/* =========================================================
   TX Benefits Guide — Design System v2
   Grounded in the Texas county courthouse / land-ledger
   tradition: paper, brick, ruled lines, stamped type.
   Deliberately NOT blue/navy — distinct from coastal themes.
   ========================================================= */

:root {
  /* Color */
  --paper: #FAF6EE;
  --paper-deep: #F0E8D8;
  --ink: #1C1C1A;
  --ink-soft: #5B5650;
  --brick: #6B1F1F;
  --brick-dark: #4A1414;
  --brick-light: #F4E1DD;
  --gold: #B8860B;
  --gold-light: #FBF1DC;
  --slate: #4B5563;
  --slate-light: #E8EAED;
  --line: #D8CDB4;
  --white: #FFFFFF;

  /* Type */
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Source Sans 3', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Scale */
  --step--1: clamp(0.83rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.95rem + 0.2vw, 1.05rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.4vw, 1.3rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.9rem, 1.6rem + 1.2vw, 2.4rem);
  --step-4: clamp(2.3rem, 1.8rem + 2vw, 3.2rem);

  --radius: 2px;
  --container: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.1;
  margin: 0 0 0.5em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); text-transform: none; }
h4 { font-size: var(--step-1); text-transform: none; }

p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--brick); text-decoration: underline; text-decoration-color: rgba(107,31,31,0.35); text-decoration-thickness: 1.5px; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.4em; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header: light paper, NOT a dark bar ---------- */
.site-header {
  background: var(--paper);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px double var(--brick);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand .mark {
  width: 38px; height: 38px;
  border: 2px solid var(--brick);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--brick);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: 0;
}
.main-nav { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}
.main-nav a:hover { opacity: 1; color: var(--brick); }

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font-family: var(--font-display);
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 760px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 3px double var(--brick);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem 1.4rem;
    gap: 0.9rem;
  }
  .main-nav.is-open { display: flex; }
  .nav-toggle { display: inline-block; }
}

/* ---------- County search ---------- */
.county-finder {
  background: var(--brick-dark);
  padding: 2.6rem 0 3rem;
  color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(250,246,238,0.04) 0, rgba(250,246,238,0.04) 1px, transparent 1px, transparent 28px);
}
.county-finder h1, .county-finder h2 { color: var(--white); }
.finder-box {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 0.4rem;
  display: flex;
  gap: 0.4rem;
  max-width: 560px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.finder-box input {
  flex: 1;
  border: none;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
}
.finder-box input:focus { outline: none; }
.finder-box button {
  background: var(--brick);
  color: var(--white);
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-display);
}
.finder-box button:hover { background: var(--brick-dark); }
.finder-results {
  background: var(--paper);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  max-width: 560px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  display: none;
}
.finder-results.is-open { display: block; }
.finder-results a {
  display: block;
  padding: 0.7rem 1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-size: var(--step--1);
}
.finder-results a:last-child { border-bottom: none; }
.finder-results a:hover { background: var(--paper-deep); }

/* ---------- Hero ---------- */
.hero { padding: 3.5rem 0 3rem; }
.hero .eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brick);
  margin-bottom: 0.8rem;
}
.hero p.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 56ch; }

/* ---------- Program grid ---------- */
.program-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin: 2rem 0; }
@media (max-width: 900px) { .program-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .program-grid { grid-template-columns: 1fr; } }

.program-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.program-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: var(--gold);
}
.program-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(28,28,26,0.14); }
.program-card .tag {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: var(--slate-light);
}
.program-card h3 { font-size: var(--step-1); margin-bottom: 0.2rem; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; }
.program-card p { font-size: var(--step--1); color: var(--ink-soft); margin: 0; }

/* ---------- Ledger ticket (signature element) ---------- */
.ledger-ticket {
  background: var(--white);
  border: 1px solid var(--ink);
  position: relative;
  padding: 0;
  margin: 0;
}
.ledger-ticket .ledger-head {
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1.5rem;
  font-family: var(--font-display);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  justify-content: space-between;
}
.ledger-ticket .ledger-rows { display: grid; grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .ledger-ticket .ledger-rows { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ledger-ticket .ledger-rows { grid-template-columns: 1fr; } }
.ledger-ticket .ledger-cell { padding: 1.1rem 1.4rem; border-right: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.ledger-ticket .ledger-cell:last-child { border-right: none; }
.ledger-ticket .ledger-cell .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.ledger-ticket .ledger-cell .value { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--brick); font-weight: 600; }

/* ---------- County header ---------- */
.county-hero { padding: 2.2rem 0 1.4rem; background: var(--paper-deep); border-bottom: 1px solid var(--line); }
.county-hero .breadcrumb { font-size: var(--step--1); color: var(--ink-soft); margin-bottom: 0.6rem; }
.county-hero .breadcrumb a { color: var(--ink-soft); }
.county-hero h1 { margin-bottom: 0.3rem; }
.county-hero .subtitle { font-size: var(--step-1); color: var(--ink-soft); font-family: var(--font-body); font-style: italic; text-transform: none; }

/* ---------- Sections ---------- */
.section { padding: 2.6rem 0; }
.section.alt { background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 1.4rem; }
.section-head .kicker {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brick);
}

/* ---------- Program panel ---------- */
.program-panel { background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--slate); border-radius: var(--radius); padding: 1.6rem 1.8rem; margin-bottom: 1.4rem; }
.program-panel.snap { border-left-color: var(--slate); }
.program-panel.medicaid { border-left-color: var(--brick); }
.program-panel.housing { border-left-color: var(--gold); }
.program-panel.cash { border-left-color: var(--ink); }
.program-panel h3 { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; font-family: var(--font-display); text-transform: uppercase; font-size: var(--step-1); letter-spacing: 0.02em; }
.program-panel .meta-line { font-size: var(--step--1); color: var(--ink-soft); border-top: 1px dashed var(--line); margin-top: 0.8rem; padding-top: 0.8rem; }

/* ---------- Info cards ---------- */
.info-card { background: var(--paper-deep); border-radius: var(--radius); padding: 1.2rem 1.4rem; font-size: var(--step--1); border-left: 3px solid var(--gold); }
.info-card strong { color: var(--brick); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .info-grid { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: var(--radius); font-weight: 600; font-size: var(--step--1); text-decoration: none; border: 2px solid transparent; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; }
.btn-primary { background: var(--brick); color: var(--white); }
.btn-primary:hover { background: var(--brick-dark); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--white); }

/* ---------- Steps list ---------- */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1.1rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -0.1rem;
  width: 1.9rem; height: 1.9rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

/* ---------- County link list ---------- */
.county-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem 1.2rem; }
@media (max-width: 900px) { .county-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .county-list { grid-template-columns: repeat(2, 1fr); } }
.county-list a { display: block; padding: 0.5rem 0; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); font-size: var(--step--1); }
.county-list a:hover { color: var(--brick); }

.region-block { margin-bottom: 2.2rem; }
.region-block h3 { font-size: var(--step-1); border-bottom: 2px solid var(--gold); padding-bottom: 0.4rem; margin-bottom: 0.4rem; font-family: var(--font-display); text-transform: uppercase; }
.region-block .region-meta { font-size: var(--step--1); color: var(--ink-soft); margin-bottom: 0.8rem; }

/* ---------- Disclaimer banner ---------- */
.disclaimer-note { background: var(--gold-light); border: 1px solid var(--gold); border-radius: var(--radius); padding: 1rem 1.3rem; font-size: var(--step--1); color: #6B4E08; }
.disclaimer-note strong { color: var(--gold); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(250,246,238,0.75); padding: 2.6rem 0 1.6rem; margin-top: 2rem; font-size: var(--step--1); }
.site-footer h4 { color: var(--white); font-size: var(--step-0); font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1.6rem; margin-bottom: 1.6rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid a { color: rgba(250,246,238,0.75); display: block; margin-bottom: 0.4rem; text-decoration: none; }
.footer-grid a:hover { color: var(--white); text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(250,246,238,0.15); padding-top: 1.2rem; font-size: 0.78rem; color: rgba(250,246,238,0.55); }

/* ---------- Utility ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
