/* =============================================================================
   Theme Preview Mock — Avancemos
   -----------------------------------------------------------------------------
   Theming model
   -------------
   Four role tokens are set at runtime on :root by app.js from the single palette
   definition in that file:

     --dominant   60%  page background
     --secondary  30%  headers & text
     --accent     10%  CTA & buttons
     --support         borders & details

   Everything below is DERIVED from those four, using only transparency or
   color-mix(). No color outside the supplied palette is ever introduced, so what
   you see is what the palette actually produces.

   Borders and details use --support at its exact supplied value, never an
   adjusted one. Where that renders indistinctly, the audit reports it as a
   finding instead of quietly papering over it.
   ========================================================================== */

:root {
  /* --- role tokens: declared here as theme 1 defaults, overwritten by app.js --- */
  --dominant: #F8F9FA;
  --secondary: #3C2A54;
  --accent: #00A896;
  --support: #4A5568;
  /* label color for accent-filled controls; chosen per theme by contrast math */
  --accent-ink: #FFFFFF;

  /* --- derived, palette-internal only --- */
  --text: var(--secondary);
  --text-muted: color-mix(in srgb, var(--secondary) 72%, transparent);
  --surface: color-mix(in srgb, var(--secondary) 4%, var(--dominant));
  --surface-2: color-mix(in srgb, var(--secondary) 7%, var(--dominant));
  --border: var(--support);
  --border-soft: color-mix(in srgb, var(--support) 45%, transparent);
  --accent-wash: color-mix(in srgb, var(--accent) 12%, var(--dominant));
  --ring: color-mix(in srgb, var(--accent) 70%, var(--secondary));

  /* --- geometry & type: identical across themes on purpose, so color is the
         only variable being compared --- */
  --wrap: 1120px;
  --radius: 10px;
  --radius-lg: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* Reserved space for the fixed dock. Overwritten at runtime with the dock's
     measured height, so content is never hidden behind it as the bar wraps or
     the audit drawer opens. */
  --dock-space: 112px;
}

*, *::before, *::after { box-sizing: border-box; }

/* Author `display` rules outrank the UA sheet's [hidden] rule, so state it here
   explicitly — otherwise .warn-count's display:inline-flex would keep it visible. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-bottom: var(--dock-space);
  background: var(--dominant);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
/* Theme swap gets a short cross-fade. Applied globally but gated twice: only
   after first paint (.theme-ready) and only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-ready *,
  html.theme-ready *::before,
  html.theme-ready *::after {
    transition: background-color .22s ease, border-color .22s ease, color .22s ease,
                box-shadow .22s ease, text-decoration-color .22s ease;
  }
}

img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .5em; color: var(--secondary); }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.16rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 32px);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================== navigation =============================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--dominant) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--secondary);
  white-space: nowrap;
}
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-name { font-size: 1.06rem; }

.nav-links {
  display: flex;
  gap: 4px;
  margin-inline-end: auto;
  font-size: .95rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 7px;
  font-weight: 550;
}
.nav-links a:hover { color: var(--secondary); background: var(--surface-2); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.theme-chip {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* ============================== buttons ================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 650;
  font-size: .95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--secondary)); border-color: currentColor; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--secondary);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 8px 15px; font-size: .88rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ================================ hero =================================== */

.hero { padding-block: clamp(56px, 9vw, 108px); }

.hero-inner > * { max-width: 46rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* the 10% accent, used as a rule rather than as text: accent-on-background
   contrast is below AA in every one of these palettes. */
.eyebrow::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.hero h1 { margin-bottom: .35em; }

.lead {
  font-size: 1.12rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  font-size: .85rem;
  color: var(--text-muted);
}
.hero-notes li { display: flex; align-items: center; gap: 8px; }
.hero-notes li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* ============================= stat band ================================= */

.stats {
  background: var(--surface);
  border-block: 1px solid var(--border);
  padding-block: clamp(28px, 4vw, 44px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 0;
}

.stat { padding-inline: 4px; }
.stat + .stat { border-left: 1px solid var(--border-soft); padding-left: 22px; }

.stat-value {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin: 2px 0 0;
  font-size: .84rem;
  color: var(--text-muted);
}

/* ============================== value cards ============================== */

.values { padding-block: clamp(56px, 8vw, 96px); }

.section-head { max-width: 44rem; margin-bottom: clamp(28px, 4vw, 44px); }
.section-lead { color: var(--text-muted); margin: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: 0 14px 30px -20px color-mix(in srgb, var(--secondary) 55%, transparent); }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  margin-bottom: 18px;
}
.card-icon svg { width: 22px; height: 22px; }

.card h3 { margin-bottom: .45em; }
.card p { color: var(--text-muted); font-size: .95rem; }

.card-link {
  margin-top: auto;
  align-self: flex-start;
  font-size: .9rem;
  font-weight: 650;
  color: var(--secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}
.card-link::after { content: " \2192"; color: var(--accent); }
.card-link:hover { border-bottom-color: var(--accent); }

/* ============================== CTA band ================================= */

.cta-band {
  background: var(--surface);
  border-block: 1px solid var(--border);
  padding-block: clamp(48px, 7vw, 84px);
}

.cta-inner {
  display: grid;
  grid-template-columns: 1.3fr auto;
  gap: 28px 40px;
  align-items: center;
}
.cta-inner h2 { margin-bottom: .3em; }
.cta-inner .lead { margin-bottom: 0; }
.cta-inner .actions { justify-content: flex-end; }

/* =============================== footer ================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--dominant);
  padding-block: clamp(36px, 5vw, 56px) 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 28px 24px;
}

.footer-brand .brand-name { font-weight: 750; font-size: 1.05rem; color: var(--secondary); }
.footer-brand p { margin: .6rem 0 0; font-size: .9rem; color: var(--text-muted); max-width: 30ch; }

.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h3 {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.footer-col a {
  font-size: .9rem;
  text-decoration: none;
  color: var(--secondary);
  align-self: flex-start;
}
.footer-col a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.footer-legal {
  margin-top: clamp(28px, 4vw, 44px);
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.footer-legal p { margin: 0; font-size: .8rem; color: var(--text-muted); }
.mock-note { font-style: italic; }

/* =========================================================================
   Theme dock — deliberately theme-INDEPENDENT.
   Hard-coded neutral values, isolated from the role tokens, so the control
   neither competes with the palette under review nor makes a theme look
   better or worse than it is. Only the swatch strips carry palette color.
   ========================================================================= */

.dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 60;
  width: min(var(--wrap), calc(100vw - 28px));
  background: rgba(15, 18, 24, .95);
  color: #E6EBF2;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  box-shadow: 0 20px 44px -16px rgba(0, 0, 0, .55);
  backdrop-filter: blur(12px);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
}

.dock-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
}

.dock-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #8E9AAC;
  flex: none;
}

.theme-list {
  display: flex;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px 0;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 5px 10px 5px 7px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  color: #D9E1EC;
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
}
.theme-btn:hover { background: rgba(255, 255, 255, .12); color: #FFFFFF; }
.theme-btn[aria-checked="true"] {
  background: #FFFFFF;
  border-color: #FFFFFF;
  color: #12161D;
  font-weight: 700;
}

.theme-swatches {
  display: inline-flex;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
.theme-swatches i { display: block; width: 9px; height: 16px; }

.theme-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #F3B32B;
  color: #2A1D00;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.dock-tools { display: flex; gap: 6px; flex: none; }

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  background: transparent;
  color: #D9E1EC;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.dock-btn:hover { background: rgba(255, 255, 255, .12); color: #FFFFFF; }
.dock-btn[aria-expanded="true"] { background: #FFFFFF; border-color: #FFFFFF; color: #12161D; }

.warn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #F3B32B;
  color: #2A1D00;
  font-size: 10.5px;
  font-weight: 800;
}

/* ---------------------------- audit drawer ------------------------------- */

.audit {
  border-top: 1px solid rgba(255, 255, 255, .16);
  padding: 16px 18px 18px;
  max-height: min(56vh, 460px);
  overflow-y: auto;
}

.audit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.audit-head h2 { font-size: 1.05rem; margin: 0; color: #FFFFFF; letter-spacing: -0.01em; }
.audit-vibe { margin: 3px 0 0; color: #97A3B5; font-size: 12px; }

.audit-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
}
.audit-status.is-clean { color: #6FD694; border-color: rgba(111, 214, 148, .45); background: rgba(111, 214, 148, .1); }
.audit-status.is-warn { color: #F3B32B; border-color: rgba(243, 179, 43, .45); background: rgba(243, 179, 43, .1); }

.audit-cols {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px 32px;
}

.audit-h3 {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8E9AAC;
  margin: 0 0 10px;
}

.role-list, .check-list, .audit-notes { list-style: none; margin: 0; padding: 0; }

.role-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.role-item + .role-item { border-top: 1px solid rgba(255, 255, 255, .09); }

.role-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}
.role-name { display: block; font-weight: 650; color: #E6EBF2; }
.role-use { display: block; font-size: 11px; color: #97A3B5; }
.role-hex { font-family: var(--mono); font-size: 11.5px; color: #C7D0DC; }

.check-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.check-item + .check-item { border-top: 1px solid rgba(255, 255, 255, .09); }

.check-label { color: #E6EBF2; font-weight: 550; }
.check-label small { display: block; font-weight: 400; color: #97A3B5; font-size: 11px; }
.check-ratio {
  font-family: var(--mono);
  font-size: 12px;
  color: #C7D0DC;
  font-variant-numeric: tabular-nums;
}
.check-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.check-item.is-pass .check-pill { color: #6FD694; border-color: rgba(111, 214, 148, .45); }
.check-item.is-fail .check-pill { color: #FF9B8A; border-color: rgba(255, 155, 138, .5); }
.check-item.is-advisory .check-pill { color: #8E9AAC; border-color: rgba(142, 154, 172, .45); }
.check-item.is-advisory .check-label { font-weight: 400; color: #B9C3D1; }

.audit-notes { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .09); }
.audit-notes li {
  position: relative;
  padding-left: 15px;
  margin-bottom: 5px;
  font-size: 11.5px;
  color: #B9C3D1;
}
.audit-notes li::before { content: "\2014"; position: absolute; left: 0; color: #6C7787; }
.audit-notes strong { color: #E6EBF2; font-weight: 650; }

.audit-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .09);
  font-size: 11px;
  color: #8E9AAC;
  max-width: 78ch;
}
.audit-foot code {
  font-family: var(--mono);
  font-size: 10.5px;
  background: rgba(255, 255, 255, .08);
  padding: 1px 4px;
  border-radius: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-space) + 4px);
  transform: translateX(-50%);
  z-index: 70;
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(15, 18, 24, .95);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #E6EBF2;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .5);
}

/* ============================== responsive =============================== */

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-actions { margin-inline-start: auto; }

  .cta-inner { grid-template-columns: 1fr; }
  .cta-inner .actions { justify-content: flex-start; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }

  .audit-cols { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 18px 0; }
  .stat + .stat { padding-left: 0; border-left: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--border-soft); padding-left: 18px; }

  .card-grid { grid-template-columns: 1fr; }

  .theme-chip { display: none; }

  .dock-bar { flex-wrap: wrap; }
  .dock-title { display: none; }
  .theme-list { order: 1; flex-basis: 100%; }
  .dock-tools { order: 2; flex-basis: 100%; justify-content: flex-end; }
}

@media print {
  .dock, .toast { display: none; }
  body { padding-bottom: 0; }
}
