/* =========================================================================
   THE DIGNITY COMMISSION — in-world federal portal
   A fictional agency from the novel THE IN-LAW CALL by Thomas Avery.
   Design language: the calm, soft, pastel bureaucracy of the book —
   USWDS-style government scaffolding, warmed to lilac and made unsettlingly
   gentle. The softness is the point.
   ========================================================================= */

:root {
  /* The Commission's color is lilac. (canon) */
  --lilac-900: #3a3350;
  --lilac-700: #5e5286;
  --lilac-600: #7a6bb0;
  --lilac-500: #9184c9;
  --lilac-400: #b0a6da;
  --lilac-300: #cfc8ea;
  --lilac-200: #e6e1f4;
  --lilac-100: #f2eff9;
  --lilac-050: #f9f7fd;

  --ink: #2a2733;
  --ink-soft: #55505f;
  --ink-faint: #857f92;

  --paper: #ffffff;
  --paper-warm: #faf9fc;
  --line: #e4e0ec;
  --line-soft: #eeebf4;

  --gov-blue: #2b3a67;      /* the "official banner" navy, cooled */
  --seal-gold: #b9a24a;

  --ok: #4f8a6b;
  --watch: #c9973f;
  --concern: #b4574e;

  --shadow-sm: 0 1px 2px rgba(58, 51, 80, 0.06);
  --shadow-md: 0 4px 20px rgba(58, 51, 80, 0.08);
  --shadow-lg: 0 12px 40px rgba(58, 51, 80, 0.12);

  --radius: 10px;
  --radius-lg: 16px;
  --maxw: 1080px;

  --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Tinos", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper-warm);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--lilac-700); text-underline-offset: 2px; }
a:hover { color: var(--lilac-600); }

h1, h2, h3, h4 { font-family: var(--sans); color: var(--lilac-900); line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* ---- Skip link ---- */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 10px 16px; z-index: 200; border-radius: 8px; box-shadow: var(--shadow-md); }

/* =========================================================================
   OFFICIAL BANNER  (the .gov tell, twisted)
   ========================================================================= */
.gov-banner {
  background: var(--gov-blue);
  color: #d9dcea;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}
.gov-banner .wrap { display: flex; align-items: center; gap: 10px; min-height: 34px; flex-wrap: wrap; }
.gov-banner .flaglet { width: 15px; height: 15px; flex: none; }
.gov-banner strong { color: #fff; font-weight: 600; }
.gov-banner .partner { margin-left: auto; color: #aab0c8; font-style: italic; }

/* =========================================================================
   MASTHEAD / NAV
   ========================================================================= */
.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead .wrap { display: flex; align-items: center; gap: 18px; min-height: 84px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand .seal { width: 52px; height: 52px; flex: none; }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.brand .wordmark .agency { font-weight: 800; color: var(--lilac-900); font-size: 1.12rem; letter-spacing: -0.01em; }
.brand .wordmark .dept { font-size: 11.5px; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; }

.nav-toggle { margin-left: auto; display: none; background: var(--lilac-100); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; color: var(--lilac-800); font-size: 14px; }

nav.primary { margin-left: auto; }
nav.primary ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
nav.primary a {
  display: block; padding: 10px 14px; border-radius: 8px; text-decoration: none;
  color: var(--ink-soft); font-weight: 600; font-size: 15px; white-space: nowrap;
}
nav.primary a:hover { background: var(--lilac-100); color: var(--lilac-800); }
nav.primary a.active { background: var(--lilac-200); color: var(--lilac-900); }
nav.primary a.portal-cta { background: var(--lilac-600); color: #fff; }
nav.primary a.portal-cta:hover { background: var(--lilac-700); }

/* =========================================================================
   HERO
   ========================================================================= */
.hero { background: linear-gradient(170deg, var(--lilac-100), var(--lilac-050) 55%, var(--paper)); border-bottom: 1px solid var(--line-soft); }
.hero .wrap { padding-top: 64px; padding-bottom: 64px; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12.5px; font-weight: 700; color: var(--lilac-600); margin-bottom: 14px; }
.hero h1 { max-width: 16ch; margin: 0 0 18px; }
.hero p.lede { font-size: 1.22rem; color: var(--ink-soft); max-width: 52ch; margin: 0 0 28px; }
.hero .cta-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* two-column hero: copy left, the agency mark (hands cradling a sunset) right */
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 54px; align-items: center; }
.hero-grid .hero-copy { min-width: 0; }
.hero-mark { text-align: center; }
.hero-mark .big-mark { width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.hero-mark .mark-tagline {
  font-family: var(--serif); font-style: italic; color: var(--lilac-700);
  font-size: 1.05rem; margin: 14px 0 0; letter-spacing: 0.02em;
}

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  padding: 13px 24px; border-radius: 999px; font-weight: 700; font-size: 16px;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--lilac-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--lilac-700); color: #fff; }
.btn-ghost { background: #fff; color: var(--lilac-800); border-color: var(--lilac-300); }
.btn-ghost:hover { background: var(--lilac-100); }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =========================================================================
   GENERIC SECTIONS / CARDS
   ========================================================================= */
main { display: block; }
.section { padding: 56px 0; }
.section.tint { background: var(--lilac-050); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.section-head { text-align: center; max-width: 60ch; margin: 0 auto 40px; }
.section-head p { color: var(--ink-soft); font-size: 1.08rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.card .ico { width: 30px; height: 30px; flex: none; color: var(--lilac-500); }
.card p { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 0; }
.card a.more { display: inline-block; margin-top: 14px; font-weight: 700; font-size: 14.5px; text-decoration: none; }
.card a.more::after { content: " \203A"; }

/* callout / notice boxes */
.notice {
  background: var(--lilac-100); border: 1px solid var(--lilac-200);
  border-left: 4px solid var(--lilac-500); border-radius: 10px; padding: 18px 22px; margin: 26px 0;
}
.notice.soft { background: var(--paper-warm); }
.notice h4 { margin: 0 0 6px; color: var(--lilac-800); }
.notice p { margin: 0; color: var(--ink-soft); font-size: 15.5px; }

/* prose pages */
.prose { max-width: 720px; margin: 0 auto; }
.prose > .section { padding-top: 40px; }
.prose h2 { margin-top: 40px; }
.prose p, .prose li { color: #38343f; font-size: 17px; }
.prose .lede { font-size: 1.18rem; color: var(--ink-soft); }
.pagehead { background: linear-gradient(170deg, var(--lilac-100), var(--paper)); border-bottom: 1px solid var(--line-soft); padding: 46px 0 40px; }
.pagehead .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; font-weight: 700; color: var(--lilac-600); margin-bottom: 10px; }
.pagehead h1 { margin: 0; }
.breadcrumb { font-size: 13.5px; color: var(--ink-faint); margin-bottom: 16px; }
.breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--lilac-600); }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; text-align: center; }
.stats .stat { padding: 22px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.stats .num { font-size: 2rem; font-weight: 800; color: var(--lilac-700); line-height: 1; }
.stats .lbl { font-size: 13px; color: var(--ink-faint); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.05em; }

/* =========================================================================
   FOOTER  — the "exit ramp" that appears on every page (Ch 11)
   ========================================================================= */
.exit-ramp {
  background: linear-gradient(180deg, var(--lilac-200), var(--lilac-100));
  border-top: 1px solid var(--lilac-300);
  text-align: center; padding: 40px 24px;
}
.exit-ramp .q { font-size: 1.35rem; font-weight: 700; color: var(--lilac-900); margin: 0 0 6px; }
.exit-ramp .sub { color: var(--lilac-700); margin: 0 0 20px; font-size: 15px; }

.sitefoot { background: var(--lilac-900); color: #cfc8e4; font-size: 14px; }
.sitefoot .wrap { padding: 44px 24px 30px; }
.sitefoot .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.sitefoot h5 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; }
.sitefoot ul { list-style: none; margin: 0; padding: 0; }
.sitefoot li { margin-bottom: 9px; }
.sitefoot a { color: #cfc8e4; text-decoration: none; }
.sitefoot a:hover { color: #fff; text-decoration: underline; }
.sitefoot .footseal { display: flex; gap: 12px; align-items: flex-start; }
.sitefoot .footseal .seal { width: 46px; height: 46px; flex: none; }
.sitefoot .footseal p { margin: 0; color: #9f97bd; font-size: 13px; }
.sitefoot .slogan { font-style: italic; color: #b7aed6; margin-top: 8px; }

.colophon {
  border-top: 1px solid #4a4168; margin-top: 34px; padding-top: 22px;
  color: #9f97bd; font-size: 13px; line-height: 1.6; text-align: center;
}
.colophon strong { color: #e7e2f4; }
.colophon a { color: #d8b8e8; font-weight: 600; }

/* =========================================================================
   CLARITY ASSESSMENT ENGINE
   ========================================================================= */
.assess-shell { max-width: 720px; margin: 0 auto; }
.assess-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.assess-progress { height: 6px; background: var(--lilac-100); }
.assess-progress > span { display: block; height: 100%; background: var(--lilac-500); width: 0%; transition: width 0.4s ease; }
.assess-body { padding: 40px 40px 36px; min-height: 340px; }
.assess-body .axis-tag { display: inline-block; background: var(--lilac-100); color: var(--lilac-700); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.assess-body .prompt { font-size: 1.35rem; font-weight: 600; color: var(--lilac-900); margin: 0 0 8px; line-height: 1.35; }
.assess-body .instruction { color: var(--ink-soft); margin: 0 0 26px; }
.assess-foot { display: flex; align-items: center; justify-content: space-between; padding: 20px 40px; border-top: 1px solid var(--line-soft); background: var(--paper-warm); }
.assess-foot .step-count { font-size: 13.5px; color: var(--ink-faint); }

/* big number flash */
.flash-num { font-size: 3.6rem; font-weight: 800; letter-spacing: 0.12em; color: var(--lilac-800); text-align: center; padding: 30px 0; font-variant-numeric: tabular-nums; }
.count-ring { text-align: center; font-size: 2.4rem; font-weight: 800; color: var(--lilac-600); font-variant-numeric: tabular-nums; }

/* inputs */
.field { width: 100%; padding: 14px 16px; font-size: 17px; border: 1.5px solid var(--line); border-radius: 10px; font-family: inherit; color: var(--ink); background: #fff; }
.field:focus { outline: none; border-color: var(--lilac-400); box-shadow: 0 0 0 3px var(--lilac-200); }
textarea.field { min-height: 120px; resize: vertical; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.field-label { font-weight: 600; font-size: 14px; color: var(--ink-soft); margin: 0 0 6px; display: block; }

/* choice buttons */
.choices { display: grid; gap: 12px; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choices.cols-4 { grid-template-columns: repeat(4, 1fr); }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; font-size: 16px; font-family: inherit; color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice:hover { border-color: var(--lilac-400); background: var(--lilac-050); }
.choice.selected { border-color: var(--lilac-500); background: var(--lilac-100); box-shadow: 0 0 0 2px var(--lilac-200) inset; }
.choice .key { width: 26px; height: 26px; border-radius: 6px; background: var(--lilac-100); color: var(--lilac-700); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }

/* faces (emotion ID) */
.face-svg { width: 100%; max-width: 220px; margin: 0 auto 24px; aspect-ratio: 1; border-radius: 16px; background: var(--lilac-050); border: 1px solid var(--line); }

/* fluency word chips */
.chip-input { display: flex; gap: 10px; }
.chip-input .field { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 30px; }
.chips .chip { background: var(--lilac-100); color: var(--lilac-800); padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.timer-big { font-size: 1.5rem; font-weight: 800; color: var(--lilac-600); font-variant-numeric: tabular-nums; }
.timer-big.low { color: var(--concern); }

/* =========================================================================
   RESULTS SCREEN  (Ch 10 format, exact)
   ========================================================================= */
.report { max-width: 760px; margin: 0 auto; }
.report-doc {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.report-doc .rd-head { background: var(--lilac-800); color: #fff; padding: 26px 34px; }
.report-doc .rd-head .k { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lilac-200); }
.report-doc .rd-head h2 { color: #fff; margin: 4px 0 0; font-size: 1.5rem; }
.report-doc .rd-body { padding: 30px 34px 36px; }

.composite { display: flex; align-items: baseline; gap: 16px; padding: 8px 0 22px; border-bottom: 1px solid var(--line-soft); margin-bottom: 22px; }
.composite .big { font-size: 3.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.composite .of { font-size: 1.2rem; color: var(--ink-faint); }
.composite .delta { margin-left: auto; text-align: right; font-size: 14px; color: var(--ink-soft); }
.composite .delta b { font-size: 1.15rem; }

.axis-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.axis-table th { text-align: left; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.axis-table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); }
.axis-table td.score { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; width: 64px; }
.axis-table td.status { text-align: right; font-size: 13px; font-weight: 600; white-space: nowrap; }
.axis-table tr.below td { background: #fbeeec; }
.axis-table tr.below td.axis::before { content: "\26A0  "; color: var(--concern); }
.s-ok { color: var(--ok); }
.s-watch { color: var(--watch); }
.s-concern { color: var(--concern); }

.threshold-badge { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 12px; font-weight: 800; letter-spacing: 0.02em; margin: 24px 0 10px; }
.threshold-badge.above { background: #eaf4ee; color: var(--ok); border: 1px solid #cfe6d8; }
.threshold-badge.review { background: #fbf1e0; color: var(--watch); border: 1px solid #f0dcb8; }
.threshold-badge.below { background: #fbeae7; color: var(--concern); border: 1px solid #f0cdc6; }

.reviewer-note { background: var(--paper-warm); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; font-size: 15px; color: var(--ink-soft); margin-top: 20px; }
.reviewer-note .rn-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lilac-600); font-weight: 700; margin-bottom: 6px; }

.next-line { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-size: 15px; color: var(--ink-soft); }
.next-line .cal { width: 20px; height: 20px; color: var(--lilac-500); flex: none; }

/* the moment after: the exit ramp made personal */
.after-note { margin: 26px auto 0; max-width: 760px; }

/* =========================================================================
   PORTAL LOGIN
   ========================================================================= */
.portal-hero { min-height: 78vh; display: grid; place-items: center; background: linear-gradient(165deg, var(--lilac-200), var(--lilac-050)); padding: 50px 24px; }
.portal-box { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px 36px; }
.portal-box .seal { width: 60px; height: 60px; margin: 0 auto 18px; }
.portal-box h1 { text-align: center; font-size: 1.5rem; margin: 0 0 6px; }
.portal-box p.sub { text-align: center; color: var(--ink-soft); font-size: 15px; margin: 0 0 26px; }
.code-inputs { display: flex; gap: 6px; justify-content: center; margin: 8px 0 6px; flex-wrap: wrap; }
.code-inputs input { width: 34px; height: 44px; text-align: center; font-size: 18px; font-weight: 700; border: 1.5px solid var(--line); border-radius: 8px; font-family: inherit; color: var(--lilac-900); }
.code-inputs input:focus { outline: none; border-color: var(--lilac-400); box-shadow: 0 0 0 3px var(--lilac-200); }
.portal-msg { text-align: center; font-size: 14px; margin-top: 14px; min-height: 20px; }
.portal-msg.err { color: var(--concern); }
.portal-help { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--ink-faint); }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-mark { order: -1; }
  .hero-mark .big-mark { max-width: 190px; }
  .card-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sitefoot .cols { grid-template-columns: 1fr; gap: 24px; }
  nav.primary { display: none; position: absolute; top: 118px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md); z-index: 100; margin: 0; }
  nav.primary.open { display: block; }
  nav.primary ul { flex-direction: column; padding: 10px; }
  nav.primary a { padding: 14px; }
  .nav-toggle { display: block; }
  .masthead .wrap { position: relative; }
  .assess-body, .assess-foot { padding-left: 24px; padding-right: 24px; }
  .field-row { grid-template-columns: 1fr; }
  .choices.cols-4 { grid-template-columns: 1fr 1fr; }
  .report-doc .rd-body { padding: 22px 20px 28px; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .composite .big { font-size: 2.6rem; }
}
