@import url("./tokens.css");

/* SiP internal chrome — header & footer (+ site shell). :root / fonts live in tokens.css.
   Synced from SiP-3.0 src/styles/sip-chrome.css (rules only; no duplicate :root). */

/* ——— Header ——— */
.guide-header {
  position: relative;
  overflow: hidden;
  padding: clamp(4rem, 12vw, 6rem) var(--space-section-x)
    clamp(3rem, 6vw, 4.5rem);
  background: linear-gradient(165deg, #222 0%, var(--chrome-bg) 45%, #121212 100%);
  color: var(--chrome-fg);
}

.guide-header::before,
.guide-header::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-header::before {
  top: -5rem;
  right: -4rem;
  width: min(28rem, 90vw);
  height: min(28rem, 90vw);
}

.guide-header::after {
  bottom: -6rem;
  right: 18%;
  width: 14rem;
  height: 14rem;
  border-color: rgba(255, 255, 255, 0.035);
}

.guide-header-headline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 4vw, 2.75rem);
  margin-bottom: 1.5rem;
  width: 100%;
}

.guide-header-titles {
  flex: 1;
  min-width: 0;
}

.guide-header-logo-link {
  flex-shrink: 0;
  margin-left: auto;
  line-height: 0;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
}

.guide-header-logo-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 3px;
}

.guide-header-logo {
  display: block;
  width: clamp(6rem, 16vw, 9rem);
  height: auto;
  object-fit: contain;
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin-bottom: 1.35rem;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sip-red);
}

.guide-header h1 {
  position: relative;
  z-index: 1;
  max-width: min(42rem, 100%);
  margin: 0;
  font-family: var(--f-display);
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.guide-header h1 em {
  font-style: italic;
  color: rgba(255, 255, 255, 0.42);
}

.intro {
  position: relative;
  z-index: 1;
  max-width: var(--reading-max);
  margin: 0;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.58);
}

.header-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-pill {
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.meta-pill span {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.72);
}

/* ——— Footer ——— */
.guide-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.75rem var(--space-section-x);
  background: linear-gradient(180deg, #222 0%, var(--chrome-bg) 100%);
  color: rgba(255, 255, 255, 0.35);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.footer-logo {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

.footer-name {
  font-family: var(--f-body), "DM Sans", Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chrome-fg);
}

.guide-footer p {
  max-width: 36rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
}

.guide-footer em {
  font-size: 0.6875rem;
  opacity: 0.9;
}

/* ——— Site shell (nav + auth cluster, used with fetched header.html) ——— */
.guide-header-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.sip-header-nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.sip-header-nav-auth {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.sip-header-login-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--f-body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid var(--sip-red);
  background: var(--sip-red);
  color: var(--white);
}

.sip-header-login-btn:hover {
  opacity: 0.92;
}

.sip-header-logout-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--f-body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
}

.sip-header-logout-btn:hover {
  opacity: 0.92;
}

#header-user {
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.header-username {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--f-body);
  font-size: 0.875rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sip-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.85rem var(--space-section-x);
  background: var(--canvas);
  border-bottom: 1px solid var(--rule);
}

.sip-header-nav-links a {
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.sip-header-nav-links a:hover {
  text-decoration: underline;
}

.sip-header-nav-auth .header-username {
  color: var(--ink);
}

.sip-header-nav-auth .sip-header-logout-btn {
  border-color: var(--ink);
  color: var(--ink);
}

.sip-header-nav-auth .header-avatar {
  border-color: var(--rule);
}

@media (max-width: 720px) {
  .guide-header-headline {
    flex-direction: column;
    align-items: flex-start;
  }

  .guide-header-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .guide-header-logo-link {
    margin-left: 0;
    align-self: flex-end;
  }

  .guide-header-logo {
    width: min(6.5rem, 44vw);
  }

  .sip-header-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .sip-header-nav-auth {
    justify-content: flex-end;
  }

  .header-meta {
    gap: 1.5rem;
  }
}
