/* =====================================================================
   Competent Democracy — public-facing explainer site
   Restrained policy/think-tank palette.
   ===================================================================== */

:root {
  /* Palette */
  --ink: #0d1b2a;            /* near-black, primary text */
  --ink-soft: #2a3a4d;       /* secondary text */
  --muted: #5a6b80;          /* tertiary text */
  --line: #d8dee7;           /* hairlines */
  --paper: #f6f4ef;          /* warm off-white background */
  --paper-2: #ffffff;        /* card surface */
  --paper-3: #ecebe4;        /* subtle band */
  --deep: #0f3a4d;           /* primary deep teal */
  --deep-2: #155a73;         /* lighter teal */
  --accent: #b07a1c;         /* muted amber for "score" */
  --accent-soft: #d9a85a;
  --good: #2f6f4b;
  --warn: #a44a2a;

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Geometry */
  --maxw: 1140px;
  --readw: 720px;
  --radius: 6px;
  --radius-lg: 14px;
}

/* ---------- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--deep-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; }

/* ---------- Base -------------------------------------------------- */
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.4em 0;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.08; font-weight: 500; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.15; }
h3 { font-size: 1.2rem; line-height: 1.3; font-weight: 600; font-family: var(--sans); letter-spacing: 0; }
h4 { font-size: 1rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }

p { margin: 0 0 1em 0; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em 0; }
li { margin-bottom: 0.4em; }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* ---------- Layout helpers --------------------------------------- */
.section {
  padding: clamp(4rem, 8vw, 7rem) 1.5rem;
}
.section--tight { padding: clamp(3rem, 5vw, 4.5rem) 1.5rem; }
.section--band { background: var(--paper-3); }
.section--ink { background: var(--ink); color: #e7ebf0; }
.section--ink h2, .section--ink h3, .section--ink h4 { color: #f5f1e6; }
.section--ink a { color: var(--accent-soft); }
.section--ink .eyebrow { color: var(--accent-soft); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
}
.container--narrow {
  max-width: var(--readw);
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--deep);
  margin-bottom: 0.9rem;
  display: block;
}

.section-lead {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.5;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 60ch;
  margin-bottom: 2.5rem;
}

/* ---------- Header / nav ----------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  background: rgba(246, 244, 239, 0.85);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}
.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  padding: 0; margin: 0;
}
.nav-links a {
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }
@media (max-width: 820px) {
  .nav-links { display: none; }
}

/* ---------- Hero -------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(5rem, 12vw, 9rem) 1.5rem clamp(4rem, 9vw, 7rem);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 10%, rgba(15,58,77,0.10), transparent 55%),
    radial-gradient(ellipse at 10% 90%, rgba(176,122,28,0.08), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, #efece5 100%);
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(13,27,42,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,27,42,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
}
.hero-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
}
.hero h1 {
  max-width: 18ch;
  margin-bottom: 1.4rem;
}
.hero h1 .accent { color: var(--deep); font-style: italic; font-weight: 400; }
.hero-tagline {
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  max-width: 56ch;
  color: var(--ink-soft);
  margin-bottom: 2.6rem;
  line-height: 1.5;
}
.epigraph {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.2rem;
  max-width: 56ch;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 2.6rem;
}
.epigraph cite {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 0.5rem;
}
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--deep);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--deep);
  border-radius: 999px;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.scroll-cue:hover {
  background: var(--deep);
  color: var(--paper);
  transform: translateY(-1px);
}
.scroll-cue svg { width: 14px; height: 14px; }

/* ---------- Problem panels --------------------------------------- */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}
@media (max-width: 880px) { .problem-grid { grid-template-columns: 1fr; } }

.problem-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem 1.6rem;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -16px rgba(13,27,42,0.18);
}
.problem-card .icon {
  width: 44px; height: 44px;
  margin-bottom: 1rem;
  color: var(--deep);
}
.problem-card h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.problem-card p {
  color: var(--ink-soft);
  font-size: 0.96rem;
  margin: 0;
}

/* ---------- Premise (one breath) --------------------------------- */
.premise {
  background:
    linear-gradient(180deg, #102a36 0%, #0a1d27 100%);
  color: #e7ebf0;
  border-radius: var(--radius-lg);
  padding: clamp(2.5rem, 4vw, 3.6rem);
  position: relative;
  overflow: hidden;
}
.premise::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(217,168,90,0.18) 0%, transparent 65%);
  pointer-events: none;
}
.premise p {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  line-height: 1.55;
  color: #f3eee2;
  max-width: 56ch;
  margin: 0;
  position: relative;
}
.premise .premise-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 1.2rem;
  display: block;
}

/* ---------- Principles ------------------------------------------- */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-top: 2.5rem;
}
.principle {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  position: relative;
  overflow: hidden;
}
.principle::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--deep);
}
.principle .num {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
  font-weight: 500;
}
.principle h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}
.principle p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Institutions diagram --------------------------------- */
.institutions-wrap {
  margin-top: 2.5rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}
.institutions-svg {
  width: 100%;
  height: auto;
  display: block;
}
.institutions-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem 1.5rem;
  margin-top: 2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.legend-item {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.legend-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  margin-top: 5px;
  flex-shrink: 0;
}
.legend-item dt {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0;
}
.legend-item dd {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* ---------- Scoring + mock app ----------------------------------- */
.scoring-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-top: 2rem;
}
@media (max-width: 880px) { .scoring-grid { grid-template-columns: 1fr; gap: 2rem; } }

.feature-list { list-style: none; padding: 0; }
.feature-list li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list .check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  color: var(--accent);
  margin-top: 2px;
}
.feature-list strong { display: block; margin-bottom: 0.15rem; }
.feature-list span.body { color: var(--ink-soft); font-size: 0.94rem; }

/* Citizen App mock-up */
.app-mock {
  background: linear-gradient(180deg, #1a3845 0%, #0d2530 100%);
  border-radius: 26px;
  padding: 22px 14px;
  box-shadow:
    0 30px 60px -20px rgba(13,27,42,0.45),
    0 8px 18px -8px rgba(13,27,42,0.25);
  max-width: 360px;
  margin: 0 auto;
  position: relative;
}
.app-mock::before {
  content: "";
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 6px;
  background: #0a1820;
  border-radius: 3px;
}
.app-screen {
  background: var(--paper-2);
  border-radius: 16px;
  padding: 1.4rem 1.2rem;
  margin-top: 18px;
}
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
}
.app-header .app-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.app-header .app-dot {
  width: 8px; height: 8px;
  background: var(--good);
  border-radius: 50%;
}
.app-goal-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 1rem 0;
}
.score-ring {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.score-ring svg { width: 86px; height: 86px; flex-shrink: 0; }
.score-meta {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.score-meta strong { color: var(--ink); display: block; font-size: 0.92rem; font-weight: 600; }
.app-spark {
  width: 100%;
  height: 50px;
  margin: 0.4rem 0 0.8rem;
}
.app-sources {
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}
.app-sources strong { color: var(--ink-soft); font-size: 0.74rem; }
.app-sources ul { list-style: none; padding: 0; margin: 0.35rem 0 0 0; }
.app-sources li {
  font-size: 0.72rem;
  padding: 0.18rem 0;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}
.app-sources li .src-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--deep-2);
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Two tracks ------------------------------------------- */
.tracks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
}
@media (max-width: 760px) { .tracks-grid { grid-template-columns: 1fr; } }

.track {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
}
.track h3 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.track-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.track--a .track-badge { background: rgba(15,58,77,0.1); color: var(--deep); }
.track--b .track-badge { background: rgba(176,122,28,0.12); color: var(--accent); }
.track p { color: var(--ink-soft); font-size: 0.95rem; }
.track ul { padding-left: 0; list-style: none; margin-top: 1rem; }
.track ul li {
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.7rem;
}
.track ul li::before {
  content: "—";
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Safeguards ------------------------------------------- */
.safeguards-list {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
}
.safeguards-list li {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  font-size: 0.95rem;
  color: #d6dbe2;
  margin: 0;
  position: relative;
  padding-left: 2.6rem;
}
.safeguards-list li::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: 1.45rem;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-soft);
}
.safeguards-list strong {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1rem;
  color: #f3eee2;
  margin-bottom: 0.2rem;
}

/* ---------- Get involved ---------------------------------------- */
.next-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: start;
  margin-top: 2rem;
}
@media (max-width: 820px) { .next-grid { grid-template-columns: 1fr; } }

.resource-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.resource-list li {
  border-top: 1px solid var(--line);
  padding: 1.1rem 0;
}
.resource-list li:last-child { border-bottom: 1px solid var(--line); }
.resource-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}
.resource-list a:hover { color: var(--accent); }
.resource-list .resource-title { font-size: 1.02rem; }
.resource-list .resource-meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.resource-list .resource-desc { font-size: 0.88rem; color: var(--muted); margin-top: 0.25rem; display: block; }

.contact-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
}
.contact-card h3 { margin-bottom: 0.5rem; }
.contact-card p { color: var(--ink-soft); font-size: 0.95rem; }
.todo-tag {
  display: inline-block;
  background: rgba(176,122,28,0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  margin-right: 0.4rem;
}

/* ---------- Review-submission form ------------------------------- */
.review-form { margin-top: 1.4rem; }
.review-form .bot-field { position: absolute; left: -9999px; }
.review-form .form-row { margin-bottom: 0.9rem; }
.review-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.review-form .optional { font-weight: 400; color: var(--muted); }
.review-form input,
.review-form textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}
.review-form input:focus,
.review-form textarea:focus {
  outline: 2px solid var(--deep);
  outline-offset: 1px;
  border-color: var(--deep);
}
.review-form textarea { resize: vertical; min-height: 14rem; }
.form-submit {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--deep);
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}
.form-submit:hover { background: var(--deep-2, #0d2530); }
.form-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.7rem;
  margin-bottom: 0;
}

/* ---------- Footer ----------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: #aeb8c5;
  padding: 3rem 1.5rem 2rem;
  font-size: 0.88rem;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-end;
}
.site-footer a { color: #d9c596; }
.footer-brand {
  font-family: var(--serif);
  color: #f3eee2;
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}
.footer-meta { color: #7f8a99; font-size: 0.8rem; line-height: 1.6; }
.footer-links {
  display: flex; gap: 1.4rem;
  list-style: none; padding: 0; margin: 0;
  flex-wrap: wrap;
}
.footer-links .footer-email { color: #7f8a99; font-size: 0.85rem; }

/* ---------- Reveal animations ------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Print ------------------------------------------------ */
@media print {
  .site-header, .scroll-cue, .hero-grid { display: none; }
  body { background: white; }
  .section { padding: 1rem 0; break-inside: avoid; }
}
