/* ==========================================================================
   texasmanufacturedhome.com — The Texas Manufactured Home Handbook
   Editorial reference design: paper + ink, pine green brand, HUD-label red
   signature tags. Serif system stack for reading, sans for labels/UI.
   All WCAG pairs pre-computed >= 4.5:1 (see session notes).
   ========================================================================== */

:root {
  --paper: #FBFAF6;
  --card: #FFFFFF;
  --ink: #23262B;
  --ink-soft: #59606A;
  --pine: #1D4B3E;
  --pine-deep: #12352B;
  --red: #A8322B;
  --rule: #E4E0D5;
  --tint: #EFF2EC;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --measure: 46rem;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
}

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

h1, h2, h3 { font-family: var(--serif); line-height: 1.18; color: var(--ink); }
a { color: var(--pine); }
a:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.measure { max-width: var(--measure); margin-left: auto; margin-right: auto; }

/* ---------- Signature: HUD-label tag chip ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 3px;
  padding: 4px 11px 3px;
}
.tag--quiet { color: var(--ink-soft); border-color: var(--ink-soft); }

/* Masthead double rule */
.double-rule { border: 0; border-top: 3px solid var(--ink); position: relative; margin: 0; }
.double-rule::after { content: ""; display: block; border-top: 1px solid var(--ink); margin-top: 3px; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: 26px;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn--pine { background: var(--pine); color: #fff; }
.btn--pine:hover { background: var(--pine-deep); }
.btn--ghost { background: transparent; color: var(--pine); border-color: var(--pine); }
.btn--ghost:hover { background: var(--tint); }
.btn--paper { background: var(--paper); color: var(--pine-deep); }
.btn--paper:hover { background: #fff; }

/* ---------- Hero / masthead ---------- */
.hero { padding: 64px 0 56px; }
.hero .double-rule { margin-bottom: 34px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 26px; }
.hero h1 {
  font-size: clamp(2.3rem, 5.6vw, 3.7rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 22px;
  max-width: 21ch;
}
.hero .lede {
  font-size: 1.22rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 30px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Fact strip ---------- */
.facts { padding: 8px 0 52px; }
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 800px) { .facts-grid { grid-template-columns: 1fr; } }
.factcard {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--red);
  border-radius: 6px;
  padding: 20px 22px;
}
.factcard .tag { margin-bottom: 12px; }
.factcard p { margin: 0; font-size: 0.99rem; line-height: 1.6; }

/* ---------- Section scaffolding ---------- */
.section { padding: 52px 0; }
.section--tint { background: var(--tint); }
.section-head { margin-bottom: 26px; }
.section-head .eyebrow { display: block; margin-bottom: 10px; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin: 0; letter-spacing: -0.01em; }

/* ---------- Contents (handbook TOC) ---------- */
.contents { border-top: 1px solid var(--rule); }
.contents-item {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 26px 4px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.contents-item:hover .contents-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.contents-part {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
}
.contents-title {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 700;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}
.contents-desc { font-size: 0.97rem; color: var(--ink-soft); display: block; line-height: 1.6; }
.contents-min {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .contents-item { grid-template-columns: 1fr; gap: 6px; }
  .contents-min { display: none; }
}

/* ---------- Prose (guide bodies + text pages) ---------- */
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.15em; }
.prose h2 {
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  margin: 2em 0 0.6em;
  padding-top: 0.9em;
  border-top: 1px solid var(--rule);
}
.prose h3 { font-size: 1.18rem; margin: 1.6em 0 0.5em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.45em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 0 0 1.4em;
}
.prose th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
  padding: 8px 10px 8px 0;
}
.prose td { border-bottom: 1px solid var(--rule); padding: 10px 10px 10px 0; vertical-align: top; }
.table-scroll { overflow-x: auto; }

/* Fact box inside guides */
.factbox {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--red);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 1.8em 0;
}
.factbox .tag { margin-bottom: 10px; }
.factbox p { margin: 0; font-size: 0.99rem; }
.factbox p + p { margin-top: 0.6em; }

/* Sources box */
.sources {
  background: var(--tint);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 2.2em 0 0;
  font-size: 0.95rem;
}
.sources h2 { border-top: 0; padding-top: 0; margin: 0 0 0.5em; font-size: 1.1rem; }
.sources ul { margin: 0; padding-left: 1.3em; }

/* ---------- Guide page header ---------- */
.guide-head { padding: 48px 0 8px; }
.guide-head .crumbs {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.guide-head .crumbs a { color: var(--ink-soft); }
.guide-head .tag { margin-bottom: 18px; }
.guide-head h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  max-width: 24ch;
}
.guide-head .lede { font-size: 1.15rem; line-height: 1.65; color: var(--ink-soft); max-width: 58ch; margin: 0 0 22px; }
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding-bottom: 26px;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 8px;
}
.byline strong { color: var(--ink); font-weight: 600; }

/* ---------- FAQ ---------- */
.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 4px 0;
}
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary {
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.08rem;
  padding: 14px 4px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); color: var(--red); font-size: 1.2rem; flex-shrink: 0; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.faq .faq-a { padding: 0 4px 18px; color: var(--ink-soft); }
.faq .faq-a p { margin: 0 0 0.8em; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* ---------- Next-guide footer nav ---------- */
.next-guide {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 26px;
  margin: 2.4em 0 0;
  text-decoration: none;
}
.next-guide:hover { border-color: var(--pine); }
.next-guide .contents-part { display: block; margin-bottom: 4px; }
.next-guide .contents-title { font-size: 1.3rem; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--pine-deep); color: #CBD6CE; padding: 60px 0; }
.cta-band h2 {
  color: #FBFAF6;
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  max-width: 26ch;
}
.cta-band p { max-width: 58ch; margin: 0 0 26px; font-size: 1.05rem; }
.cta-band .hero-actions { margin: 0; }

/* ---------- Simple page (about / contact / legal / 404) ---------- */
.page-head { padding: 56px 0 12px; }
.page-head .tag { margin-bottom: 18px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -0.015em; margin: 0 0 16px; max-width: 24ch; }
.page-head .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 58ch; margin: 0; line-height: 1.65; }
.page-body { padding: 26px 0 64px; }

/* Contact cards */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 1.6em 0; max-width: var(--measure); }
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 24px;
  font-family: var(--sans);
}
.contact-card h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
  border: 0;
  padding: 0;
}
.contact-card p, .contact-card address { margin: 0 0 6px; font-style: normal; font-size: 0.98rem; }
.contact-card a { color: var(--pine); font-weight: 600; }
.hours-table { width: 100%; font-size: 0.95rem; border-collapse: collapse; }
.hours-table td { padding: 5px 0; border-bottom: 1px solid var(--rule); }
.hours-table td:last-child { text-align: right; color: var(--ink-soft); }
.hours-table tr:last-child td { border-bottom: 0; }

/* Legal pages */
.legal .prose h2 { font-size: 1.25rem; }
.legal .updated { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); }

/* 404 */
.err-list { list-style: none; padding: 0; max-width: var(--measure); }
.err-list li { border-bottom: 1px solid var(--rule); }
.err-list a { display: block; padding: 14px 4px; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.err-list a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .hero { padding: 44px 0 40px; }
  .section { padding: 40px 0; }
}
