/* ==========================================================================
   Pro Bono Inmate Appeal Program — design system
   Navy + gold. Serif display for gravitas, Inter for interface.
   ========================================================================== */

:root {
  --ink:        #0A1F38;
  --ink-deep:   #06152A;
  --ink-soft:   #1B3557;
  --gold:       #C08A2E;
  --gold-soft:  #D9B46A;
  --gold-wash:  #FBF6EC;

  --paper:      #FFFFFF;
  --paper-warm: #F7F5F1;
  --line:       #E4E0D9;
  --text:       #16212F;
  --muted:      #5C6B7E;

  --ok:   #1E7A4D;
  --warn: #A8641B;
  --stop: #A62828;

  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Helvetica, Arial, sans-serif;

  --wrap: 1180px;
  --radius: 4px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(10,31,56,.06), 0 2px 8px rgba(10,31,56,.05);
  --shadow-md: 0 4px 12px rgba(10,31,56,.08), 0 12px 32px rgba(10,31,56,.07);

  /* Divider heights — referenced by the hero padding guard. */
  --swoop-h: clamp(48px, 7vw, 110px);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important;
    transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); }
p  { margin: 0 0 1.1em; }

a { color: var(--ink-soft); text-decoration-thickness: 1px;
    text-underline-offset: 3px; }
a:hover { color: var(--gold); }

img { max-width: 100%; height: auto; display: block; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }

.section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.section--warm { background: var(--paper-warm); }
.section--ink  { background: var(--ink); color: #DCE5EF; }
.section--ink h2, .section--ink h3 { color: #fff; }

.eyebrow {
  font-family: var(--font-body);
  font-size: .78rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 .9rem;
}
.section--ink .eyebrow { color: var(--gold-soft); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.section--ink .lede { color: #AFC0D4; }

/* ---------- Skip link -------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: .8rem 1.2rem;
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  padding: .82rem 1.5rem; border-radius: var(--radius);
  border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; transition: background .16s, color .16s,
    border-color .16s, transform .16s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--gold); color: #22160A; border-color: var(--gold); }
.btn--primary:hover { background: var(--gold-soft); color: #22160A; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff;
  border-color: #fff; }
.btn--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--dark:hover { background: var(--ink-soft); color: #fff; }
.btn--sm { padding: .55rem 1rem; font-size: .86rem; }

/* ---------- Header ----------------------------------------------------- */
.topbar {
  background: var(--ink-deep); color: #9FB3CB;
  font-size: .82rem; letter-spacing: .01em;
}
.topbar__inner { display: flex; flex-wrap: wrap; gap: 1.25rem;
  justify-content: flex-end; padding: .55rem 0; }
.topbar a { color: #C3D3E5; text-decoration: none; }
.topbar a:hover { color: var(--gold-soft); }

.masthead { background: var(--ink); position: sticky; top: 0; z-index: 60; }
.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: .9rem 0;
}
.brand { display: flex; align-items: center; gap: .85rem;
  text-decoration: none; color: #fff; }
.brand__mark {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: linear-gradient(145deg, var(--gold), #96671C);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: #1A1206; letter-spacing: .02em;
}
.brand__name { font-family: var(--font-display); font-size: 1.06rem;
  font-weight: 600; line-height: 1.2; color: #fff; }
.brand__sub { font-size: .74rem; letter-spacing: .11em;
  text-transform: uppercase; color: var(--gold-soft); }

.nav { display: flex; align-items: center; gap: .35rem; }
.nav a {
  color: #D6E1EE; text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: .55rem .85rem; border-radius: var(--radius);
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.is-active { color: #fff; border-bottom-color: var(--gold); }

.nav-toggle {
  display: none; background: none; border: 1.5px solid rgba(255,255,255,.35);
  border-radius: var(--radius); color: #fff; padding: .5rem .7rem;
  cursor: pointer; font-size: 1rem;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; inset: 100% 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink-deep); padding: .5rem 1.25rem 1.25rem;
    box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .85rem .25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .masthead__inner { position: relative; }
}

/* ---------- Hero + wave divider ---------------------------------------- */
.hero {
  position: relative;
  background: linear-gradient(160deg, var(--ink-deep) 0%, var(--ink) 55%,
                              #123055 100%);
  color: #fff;
  overflow: hidden;
  /* Bottom padding guard: content must clear the deepest point of the wave. */
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 calc(var(--swoop-h) + 2.5rem);
}
/* Subtle radial texture so the navy is not a flat slab. */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(58% 78% at 78% 12%, rgba(192,138,46,.20), transparent 62%),
    radial-gradient(46% 60% at 8% 92%, rgba(52,110,180,.22), transparent 68%);
}
.hero > * { position: relative; z-index: 1; }

.hero__grid { display: grid; gap: clamp(2rem, 4vw, 3.5rem);
  grid-template-columns: 1.15fr .85fr; align-items: center; }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }

.hero h1 { color: #fff; max-width: 16ch; }
.hero__lede { font-size: clamp(1.05rem, 1.7vw, 1.22rem); color: #C4D4E6;
  max-width: 52ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .85rem;
  margin-top: 1.9rem; }

.hero__card {
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.7rem;
  backdrop-filter: blur(6px);
}
.hero__card h2 { font-size: 1.15rem; color: #fff; margin-bottom: .8rem; }
.hero__card p { color: #B9CADC; font-size: .95rem; }
.hero__card .btn { margin-top: .4rem; }

/* The wave. fill MUST equal the background of the section below (--paper). */
.swoop {
  position: absolute; left: 0; bottom: -1px; width: 100%;
  height: var(--swoop-h); display: block; z-index: 1;
}
.swoop__fill { fill: var(--paper); }
/* Gentler echo of the same motif at one later boundary — never mixed with an
   angled divider on the same page. */
.swoop--echo { height: clamp(34px, 4.5vw, 68px); }
.swoop--echo .swoop__fill { fill: var(--paper-warm); }

@media (max-width: 640px) {
  /* Flatten so the curve can never cross a headline on a narrow screen. */
  :root { --swoop-h: 38px; }
  .swoop--echo { height: 26px; }
}

.section--relative { position: relative; }

/* ---------- Stats ------------------------------------------------------ */
.stats { display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow-sm); }
.stat__n { font-family: var(--font-display); font-size: 2.5rem;
  font-weight: 700; color: var(--ink); line-height: 1; }
.stat__l { font-size: .84rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin-top: .5rem; }

/* ---------- Cards / grids ---------------------------------------------- */
.grid { display: grid; gap: 1.4rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px);
  border-color: #CFC7B8; }
.card h3 { margin-bottom: .45rem; }
.card p { color: var(--muted); font-size: .95rem; margin-bottom: 0; }
.card__num { font-family: var(--font-display); font-size: 1.6rem;
  color: var(--gold); font-weight: 700; margin-bottom: .5rem; }

/* ---------- Counsel ---------------------------------------------------- */
.counsel-grid { display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.counsel {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s;
}
.counsel:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.counsel__avatar {
  width: 58px; height: 58px; flex: none; border-radius: 50%;
  object-fit: cover; object-position: center 30%;
  background: var(--gold-wash); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--gold); letter-spacing: .02em;
}
.counsel__name { font-family: var(--font-display); font-weight: 600;
  font-size: 1.05rem; color: var(--ink); margin: 0 0 .15rem; }
.counsel__firm { font-size: .88rem; color: var(--muted); margin: 0 0 .5rem; }
.counsel__link { font-size: .84rem; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; }
.counsel__link:hover { color: var(--gold); }
.counsel__link::after { content: " →"; }

/* ---------- Cases ------------------------------------------------------ */
.year-block { margin-bottom: 2.5rem; }
.year-head {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;
  padding-bottom: .6rem; border-bottom: 2px solid var(--line);
}
.year-head h2 { margin: 0; font-size: 1.6rem; }
.year-head .count { font-size: .82rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }

.case-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem;
  padding: .85rem 1rem; border-radius: var(--radius);
  border-left: 3px solid transparent;
}
.case-row:nth-child(odd) { background: var(--paper-warm); }
.case-row:hover { border-left-color: var(--gold); background: var(--gold-wash); }
.case-row__cite { font-family: var(--font-display); font-size: 1.02rem;
  font-weight: 600; color: var(--ink); text-decoration: none; }
.case-row__cite:hover { color: var(--gold); }
.case-row__meta { margin-left: auto; display: flex; gap: .6rem;
  align-items: center; }

.tag {
  display: inline-block; font-size: .72rem; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  padding: .22rem .6rem; border-radius: 999px;
  background: var(--gold-wash); color: var(--warn);
  border: 1px solid #EADCC0;
}
.tag--ink { background: #EDF1F6; color: var(--ink-soft); border-color: #D8E1EB; }

/* ---------- Filters / forms -------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  margin-bottom: 2rem; padding: 1.15rem 1.25rem;
  background: var(--paper-warm); border: 1px solid var(--line);
  border-radius: var(--radius-lg); }

.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: .88rem; font-weight: 600;
  color: var(--ink); margin-bottom: .35rem; }
.field__input, .field input, .field select, .field textarea,
.filters input, .filters select {
  width: 100%; font: inherit; font-size: .95rem;
  padding: .7rem .85rem; color: var(--text);
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--radius);
}
.filters input, .filters select { width: auto; min-width: 170px; }
.field__input:focus, .field input:focus, .field select:focus,
.field textarea:focus { border-color: var(--gold); outline: none;
  box-shadow: 0 0 0 3px rgba(192,138,46,.15); }
.field .helptext { display: block; font-size: .82rem; color: var(--muted);
  margin-top: .3rem; }
.field--check { display: flex; gap: .65rem; align-items: flex-start; }
.field--check input { width: auto; margin-top: .35rem; }
.field--check label { font-weight: 400; font-size: .92rem; }
.errorlist { list-style: none; margin: .4rem 0 0; padding: 0;
  color: var(--stop); font-size: .86rem; }

.alert { padding: .95rem 1.2rem; border-radius: var(--radius);
  border-left: 4px solid; margin-bottom: 1.2rem; font-size: .95rem; }
.alert--success { background: #EAF6F0; border-color: var(--ok); color: #14563a; }
.alert--warning { background: #FDF4E7; border-color: var(--warn); color: #7A4A13; }
.alert--error   { background: #FBEDED; border-color: var(--stop); color: #7E1D1D; }
.alert--info    { background: #EDF3FA; border-color: var(--ink-soft); color: #1B3557; }

/* ---------- Footer ----------------------------------------------------- */
.footer { background: var(--ink-deep); color: #9FB3CB; padding: 4rem 0 0;
  font-size: .93rem; }
.footer h3 { color: #fff; font-size: 1rem; font-family: var(--font-body);
  font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 1rem; }
.footer a { color: #C3D3E5; text-decoration: none; }
.footer a:hover { color: var(--gold-soft); text-decoration: underline; }
.footer__grid { display: grid; gap: 2.5rem;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr; padding-bottom: 3rem; }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; } }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .55rem; }
.footer__bar { border-top: 1px solid rgba(255,255,255,.1);
  padding: 1.4rem 0; display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; font-size: .85rem; color: #7D91A9; }
.footer__staff { color: #9FB3CB; border: 1px solid rgba(255,255,255,.18);
  padding: .35rem .85rem; border-radius: var(--radius); }
.footer__staff:hover { border-color: var(--gold-soft); text-decoration: none; }
.funder { margin-top: 1.25rem; font-size: .82rem; color: #7D91A9; }

/* ---------- Staff dashboard -------------------------------------------- */
.dash { background: var(--paper-warm); min-height: 100vh; padding: 2.5rem 0; }
.dash__head { display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.dash__nav { display: flex; gap: .5rem; flex-wrap: wrap; }
.dash__nav a { font-size: .9rem; font-weight: 600; text-decoration: none;
  padding: .5rem .95rem; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.dash__nav a:hover, .dash__nav a.is-active { background: var(--ink);
  color: #fff; border-color: var(--ink); }

.board { display: grid; gap: 1rem; grid-template-columns: repeat(6, minmax(220px, 1fr));
  overflow-x: auto; padding-bottom: 1rem; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(6, 250px); } }
.board__col { background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: .9rem; min-height: 180px; }
.board__col h3 { font-family: var(--font-body); font-size: .8rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; margin-bottom: .8rem; }
.board__card { display: block; background: var(--paper-warm);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem .85rem; margin-bottom: .6rem; text-decoration: none;
  border-left: 3px solid var(--gold); }
.board__card:hover { background: var(--gold-wash); }
.board__card strong { display: block; color: var(--ink); font-size: .93rem; }
.board__card span { font-size: .8rem; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; }
.table th, .table td { text-align: left; padding: .8rem 1rem;
  border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: var(--paper-warm); font-size: .78rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }

.panel { background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-sm);
  margin-bottom: 1.4rem; }
.panel h2 { font-size: 1.25rem; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: .55rem 1rem;
  font-size: .94rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; color: var(--text); }
@media (max-width: 620px) { .dl { grid-template-columns: 1fr; gap: .15rem 0; }
  .dl dd { margin-bottom: .6rem; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0 .6rem 1.1rem; border-left: 2px solid var(--line);
  font-size: .9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 1rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.timeline time { color: var(--muted); font-size: .82rem; }

/* ---------- Auth ------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--ink-deep), var(--ink) 60%, #123055);
  padding: 2rem 1.25rem; }
.auth__card { width: min(100%, 430px); background: var(--paper);
  border-radius: var(--radius-lg); padding: 2.4rem; box-shadow: var(--shadow-md); }
.auth__card h1 { font-size: 1.6rem; }

.prose > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Drag & drop upload ----------------------------------------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-warm);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  display: flex; flex-direction: column; gap: .35rem;
  transition: border-color .16s, background .16s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--gold);
  background: var(--gold-wash); }
.dropzone.is-over { border-color: var(--gold); background: var(--gold-wash);
  border-style: solid; }
.dropzone strong { color: var(--ink); font-family: var(--font-display);
  font-size: 1.05rem; }

/* ---------- Public document list --------------------------------------- */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { margin-bottom: .6rem; }
.doc-link {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.1rem; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); border-left: 3px solid var(--gold);
  transition: background .16s, box-shadow .16s;
}
.doc-link:hover { background: var(--gold-wash); box-shadow: var(--shadow-sm); }
.doc-link__name { font-weight: 600; color: var(--ink); }
.doc-link__meta { margin-left: auto; font-size: .82rem; color: var(--muted);
  white-space: nowrap; }
