/*
 * css/site-header.css - the shared SPARKS-SIX sticky header + footer chrome,
 * ported pixel-faithfully from docs/design/SiteHeader.dc.html (header) and
 * the footer block shared by docs/design/Result.dc.html / Teams.dc.html.
 *
 * Themes entirely through frontend/css/tokens.css custom properties (never
 * redeclared here). The one local addition is the header-only dark
 * accent-ink override: the DC source hard-codes color:#fff on the
 * accent-filled buttons, which fails AA against the dark theme's silver
 * accent; the fix uses a dedicated dark ink (#06262C), distinct from the
 * general --accent-ink (#161C24) that Landing and other surfaces use for
 * their own accent CTAs.
 */

/* Compensate for the sticky .site-header so in-page anchor jumps (e.g. #register)
   land below the header instead of hidden underneath it. Site-wide: this stylesheet
   loads on every surface. */
html { scroll-padding-top: 5rem; }

.site-header {
  --sh-accent-ink: var(--accent-ink); /* light: #FFFFFF, matches the general token */

  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
}
[data-theme="dark"] .site-header {
  /* Header-only dark CTA ink (deep teal), distinct from the general dark
     --accent-ink (#161C24) tokens.css defines for e.g. Landing's CTAs.
     Both clear WCAG AA 4.5:1 against the dark silver accent (#C9D2DB):
     #161C24 is ~11.2:1, #06262C is ~10.4:1 -- this is a brand choice on
     the header specifically, not an AA fallback. */
  --sh-accent-ink: #06262C;
}

.site-header__inner {
  position: relative;
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-header__inner--compact { padding: 5px 10px; gap: 8px; }
.site-header__inner--compact .site-header__nav { gap: 5px; }

/* Left: wordmark + six-dot mark. */
.site-header__logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.site-header__logo-text {
  font-family: var(--brand-sans); font-weight: 800; font-size: 1.02rem;
  letter-spacing: -0.025em; line-height: 1; color: var(--ink);
}
.site-header__logo-mark { display: inline-flex; flex: 0 0 auto; }
.site-header__inner--compact .site-header__logo { gap: 7px; }
.site-header__inner--compact .site-header__logo-text { font-size: 0.88rem; }
.site-header__inner--compact .site-header__logo-mark svg { width: 19px; height: 19px; }

/* Optional centered title / subtitle (funnel / playback surfaces). */
.site-header__titlewrap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; max-width: 48%;
}
.site-header__title {
  font-family: var(--brand-sans); font-weight: 700; font-size: 0.92rem;
  letter-spacing: -0.01em; line-height: 1.15; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-header__subtitle {
  font-family: var(--brand-sans); font-weight: 500; font-size: 0.72rem;
  line-height: 1.25; color: var(--ink60); white-space: nowrap;
}

/* Right: controls. */
.site-header__nav { display: flex; align-items: center; gap: 8px; }

.site-header__restart {
  font-family: var(--brand-sans); font-size: 0.82rem; font-weight: 600; color: var(--ink60);
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.site-header__restart:hover { border-color: var(--accent); color: var(--ink); }
.site-header__inner--compact .site-header__restart { padding: 7px 9px; font-size: 0.78rem; }

/* Segmented EN | RO. */
.site-header__lang {
  display: inline-flex; align-items: center; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden;
}
.site-header__lang-btn {
  font-family: var(--brand-sans); font-size: 0.78rem; font-weight: 600;
  border: none; padding: 8px 11px; cursor: pointer; background: transparent;
  color: var(--ink40); transition: color 0.15s ease, background 0.15s ease;
}
.site-header__lang-btn--active { background: var(--tint); color: var(--ink); }
.site-header__inner--compact .site-header__lang-btn { padding: 7px 8px; font-size: 0.7rem; }

/* Theme toggle: raised bordered box, sun/moon glyph. */
.site-header__theme {
  font-family: var(--brand-sans); font-size: 0.95rem; line-height: 1; color: var(--ink);
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
  width: 40px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.site-header__theme:hover { transform: translateY(-1px); border-color: var(--accent); }
.site-header__inner--compact .site-header__theme { width: 34px; height: 33px; font-size: 0.85rem; }

/* Account button (circular). */
.site-header__acct { position: relative; flex: 0 0 auto; }
.site-header__acct-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; cursor: pointer; padding: 0;
  color: var(--ink); background: var(--raised); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s ease, transform 0.15s ease;
}
.site-header__acct-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.site-header__acct-btn--signed-in { background: var(--accent); border-color: transparent; color: var(--sh-accent-ink); }
.site-header__acct-initials { font-family: var(--brand-sans); font-weight: 700; font-size: 0.82rem; line-height: 1; color: var(--sh-accent-ink); }
.site-header__acct-icon { display: inline-flex; align-items: center; justify-content: center; }
.site-header__inner--compact .site-header__acct-btn { width: 33px; height: 33px; }

/* Account dropdown. The button anchors a relative wrapper; the popover is an
   absolute panel with a full-viewport scrim catching outside clicks. */
.site-header__acct-scrim { position: fixed; inset: 0; z-index: 60; }
.site-header__acct-menu {
  position: absolute; top: 100%; right: 0; margin-top: 10px; z-index: 61;
  width: 264px; max-width: calc(100vw - 20px);
  background: var(--raised); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 18px 48px -14px rgba(20, 26, 32, 0.5), 0 2px 8px rgba(20, 26, 32, 0.14);
}
[data-theme="dark"] .site-header__acct-menu {
  box-shadow: 0 18px 48px -14px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.45);
}
.site-header__acct-welcome { display: flex; flex-direction: column; gap: 9px; }

.site-header__acct-eyebrow {
  font-family: var(--brand-sans); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.site-header__acct-note { margin: 0; font-family: var(--brand-sans); font-size: 0.82rem; line-height: 1.45; color: var(--ink60); }
.site-header__acct-note--ink { color: var(--ink); }

/* Accent-filled buttons: Log in (menu), Submit (form), Take the Snapshot (welcome). */
.site-header__acct-cta {
  display: block; text-align: center; text-decoration: none;
  font-family: var(--brand-sans); font-size: 0.88rem; font-weight: 600;
  color: var(--sh-accent-ink); background: var(--accent); border: none; border-radius: 10px;
  padding: 11px 14px; cursor: pointer; transition: filter 0.15s ease, transform 0.15s ease;
}
.site-header__acct-cta:hover { filter: brightness(1.07); transform: translateY(-1px); }

/* Outlined: Create account (menu view). */
.site-header__acct-outline {
  font-family: var(--brand-sans); font-size: 0.88rem; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; cursor: pointer; transition: border-color 0.15s ease;
}
.site-header__acct-outline:hover { border-color: var(--accent); }

/* Text-only: Done (welcome) / Back (form). */
.site-header__acct-done, .site-header__acct-back {
  font-family: var(--brand-sans); font-size: 0.82rem; font-weight: 600; color: var(--ink60);
  background: transparent; border: none; padding: 4px; cursor: pointer; align-self: center;
  transition: color 0.15s ease;
}
.site-header__acct-done:hover, .site-header__acct-back:hover { color: var(--ink); }

/* Profile view: identity row + menu items. */
.site-header__acct-id { display: flex; align-items: center; gap: 11px; padding: 2px 2px 11px; border-bottom: 1px solid var(--line-soft); }
.site-header__acct-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: var(--accent);
  color: var(--sh-accent-ink); font-family: var(--brand-sans); font-weight: 700; font-size: 0.92rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.site-header__acct-idtext { min-width: 0; }
.site-header__acct-name {
  font-family: var(--brand-sans); font-weight: 700; font-size: 0.92rem; color: var(--ink);
  line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-header__acct-email {
  font-family: var(--brand-sans); font-size: 0.78rem; color: var(--ink60);
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-header__acct-link {
  font-family: var(--brand-sans); font-size: 0.88rem; font-weight: 600; color: var(--ink);
  text-decoration: none; padding: 9px 10px; border-radius: 9px; transition: background 0.14s ease;
}
.site-header__acct-link:hover { background: var(--tint); }
.site-header__acct-signout {
  text-align: left; font-family: var(--brand-sans); font-size: 0.88rem; font-weight: 600; color: var(--ink60);
  background: transparent; border: none; padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.site-header__acct-signout:hover { background: var(--tint); color: var(--ink); }

/* Form fields (login / register). */
.site-header__acct-input {
  font-family: var(--brand-sans); font-size: 0.88rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; box-shadow: var(--inset); transition: border-color 0.15s ease;
}
.site-header__acct-input:focus { border-color: var(--accent); }

.site-header__logo:focus-visible, .site-header__lang-btn:focus-visible,
.site-header__theme:focus-visible, .site-header__acct-btn:focus-visible,
.site-header__restart:focus-visible, .site-header__acct-cta:focus-visible,
.site-header__acct-outline:focus-visible, .site-header__acct-link:focus-visible,
.site-header__acct-signout:focus-visible, .site-header__acct-input:focus-visible,
.site-header__acct-done:focus-visible, .site-header__acct-back:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

@media (max-width: 600px) {
  .site-header__inner { padding: 10px 14px; gap: 9px; }
  .site-header__titlewrap { display: none; }
  .site-header__restart-label { display: none; }
  .site-header__restart { padding: 9px 11px; }
  /* Right-anchoring a 264px popover off a button inset from the viewport
     edge can overflow on narrow screens; pin it to the viewport instead. */
  .site-header__acct-menu { position: fixed; top: 60px; right: 10px; left: 10px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header__theme, .site-header__acct-btn, .site-header__restart,
  .site-header__lang-btn, .site-header__acct-cta, .site-header__acct-outline {
    transition: none;
  }
  .site-header__theme:hover, .site-header__acct-btn:hover, .site-header__acct-cta:hover {
    transform: none;
  }
}

/* ===================================================================== */
/* The shared site footer (every surface): logo + Take the Snapshot /     */
/* For teams / Legal, matching Result.dc.html / Teams.dc.html.            */
/* ===================================================================== */

.site-footer { border-top: 1px solid var(--line-soft); }
.site-footer__inner {
  max-width: 1180px; margin: 0 auto; padding: 28px 24px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
}
.site-footer__logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.site-footer__logo-text {
  font-family: var(--brand-sans); font-weight: 800; font-size: 0.86rem;
  letter-spacing: -0.025em; line-height: 1; color: var(--ink60);
}
.site-footer__logo-mark { display: inline-flex; flex: 0 0 auto; opacity: 0.92; }
.site-footer__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-footer__link {
  font-family: var(--brand-sans); color: var(--ink60); font-size: 0.85rem;
  text-decoration: none; padding: 6px 10px; border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-footer__link:hover { color: var(--ink); background: var(--tint); }
.site-footer__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-footer__sep { font-family: var(--brand-sans); color: var(--ink40); }
.site-footer__logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .site-footer__link { transition: none; }
}
