/* ============================================================
   tejas.decodes — shared design system
   Direction: "The Annotated Bare Act"
   Tokens inherited verbatim from the author's own statute manuals
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap');

:root {
  --c-bg: 248 247 244;
  --c-surface: 255 255 255;
  --c-ink: 22 24 29;
  --c-ink-2: 91 97 110;
  --c-ink-3: 95 100 109;
  --c-line: 231 231 228;
  --c-line-2: 240 240 238;
  --c-accent: 27 58 107;
  --c-accent-soft: 238 242 248;
  --c-amber: 138 90 0;
  --c-amber-soft: 253 246 233;
  --c-amber-line: 232 213 172;
  --c-red-soft: 253 241 240;
  --c-red-line: 230 201 197;
  --c-red-ink: 138 48 40;
  --c-green-soft: 240 246 241;
  --c-green-line: 201 223 205;
  --c-green-ink: 42 92 52;
  --shadow: 0 1px 2px rgba(16,20,30,.04), 0 8px 24px -12px rgba(16,20,30,.10);
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 68ch;
}

:root[data-theme="dark"] {
  --c-bg: 15 17 21;
  --c-surface: 21 24 32;
  --c-ink: 232 233 236;
  --c-ink-2: 154 160 173;
  --c-ink-3: 150 156 168;
  --c-line: 35 39 51;
  --c-line-2: 28 32 42;
  --c-accent: 143 179 232;
  --c-accent-soft: 24 34 52;
  --c-amber: 217 164 65;
  --c-amber-soft: 34 28 16;
  --c-amber-line: 58 47 24;
  --c-red-soft: 36 23 22;
  --c-red-line: 61 37 35;
  --c-red-ink: 224 147 138;
  --c-green-soft: 20 32 26;
  --c-green-line: 34 57 42;
  --c-green-ink: 143 199 155;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

/* Default theme is always light, regardless of the visitor's OS/browser
   preference — dark mode only applies once the visitor explicitly picks it
   via the toggle (persisted in localStorage as td-theme, see theme-init.js
   and :root[data-theme="dark"] above). */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: rgb(var(--c-bg));
  color: rgb(var(--c-ink));
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  transition: background-color .25s ease, color .25s ease;
}

::selection { background: rgb(var(--c-amber) / .28); color: rgb(var(--c-ink)); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: rgb(var(--c-bg)); }
::-webkit-scrollbar-thumb { background: rgb(var(--c-ink-3) / .4); border-radius: 8px; border: 3px solid rgb(var(--c-bg)); }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--c-ink-3) / .65); }
* { scrollbar-color: rgb(var(--c-ink-3) / .4) rgb(var(--c-bg)); scrollbar-width: thin; }

a { color: rgb(var(--c-accent)); text-decoration-line: underline; text-decoration-color: rgb(var(--c-amber) / .55); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: rgb(var(--c-amber)); }

:focus-visible {
  outline: 2px solid rgb(var(--c-amber));
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.36;
  margin: 0 0 0.5em;
  color: rgb(var(--c-ink));
}
h1 { font-size: clamp(2.25rem, 5vw + 1rem, 4.25rem); }
h2 { font-size: clamp(1.75rem, 2.4vw + 1rem, 2.75rem); }
h3 { font-size: 1.375rem; }

p { margin: 0 0 1em; max-width: var(--measure); color: rgb(var(--c-ink-2)); }
.lede { font-family: var(--serif); font-size: 1.25rem; color: rgb(var(--c-ink)); line-height: 1.5; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 860px; }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgb(var(--c-bg) / .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgb(var(--c-line));
}
.site-nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: 1180px; margin: 0 auto;
}
.wordmark {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: 1.25rem; color: rgb(var(--c-ink)); text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark span { color: rgb(var(--c-amber)); font-style: normal; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-family: var(--sans); font-size: 0.95rem; font-weight: 500;
  color: rgb(var(--c-ink-2)); text-decoration: none; text-underline-offset: 4px;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: rgb(var(--c-ink)); text-decoration: underline; text-decoration-color: rgb(var(--c-amber)); text-decoration-thickness: 2px; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; }

.theme-btn {
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-surface));
  color: rgb(var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-btn:hover { border-color: rgb(var(--c-amber-line)); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; font-size: 0.95rem;
  padding: 12px 22px; border-radius: 4px;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: rgb(var(--c-ink)); color: rgb(var(--c-bg));
  border-color: rgb(var(--c-ink));
}
:root[data-theme="dark"] .btn-primary { background: rgb(var(--c-amber)); color: rgb(15 17 21); border-color: rgb(var(--c-amber)); }
.btn-primary:hover { background: rgb(var(--c-amber)); border-color: rgb(var(--c-amber)); color: rgb(var(--c-ink)); }
:root[data-theme="dark"] .btn-primary:hover { background: rgb(var(--c-amber) / .85); color: rgb(15 17 21); }
.btn-secondary {
  background: transparent; color: rgb(var(--c-ink)); border-color: rgb(var(--c-ink) / .35);
}
.btn-secondary:hover { border-color: rgb(var(--c-amber)); color: rgb(var(--c-ink)); }
.btn-block { width: 100%; justify-content: center; }
.btn[aria-disabled="true"], .btn.is-placeholder { opacity: .82; }

/* ---------- Section rhythm ---------- */
section { padding: 88px 0; }
section + section { border-top: 1px solid rgb(var(--c-line)); }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 96px;
  background: rgb(var(--c-bg));
}
.hero__grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 64px; align-items: center;
}
.hero__byline { font-family: var(--sans); font-size: .95rem; color: rgb(var(--c-ink-2)); margin: 14px 0 20px; }
.hero__byline strong { color: rgb(var(--c-ink)); font-weight: 600; }
.hero h1 { margin-bottom: 22px; }
.hero__lede { font-family: var(--serif); font-size: 1.2rem; color: rgb(var(--c-ink-2)); max-width: 46ch; margin-bottom: 32px; }
.hero__ctas { display: flex; gap: 14px; flex-wrap: wrap; }

/* Statute annotation demo card */
.statute-card {
  background: rgb(var(--c-surface));
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 30px 32px;
}
.statute-card__tag {
  display: inline-block; font-family: var(--sans); font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--c-red-ink));
  background: rgb(var(--c-red-soft)); border: 1px solid rgb(var(--c-red-line));
  padding: 4px 9px; border-radius: 3px; margin-bottom: 16px;
}
.statute-card__cite { font-family: var(--sans); font-size: .82rem; color: rgb(var(--c-ink-3)); margin-bottom: 10px; }
.statute-card p.body-text {
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.75; color: rgb(var(--c-ink));
  max-width: none;
}
.strike { text-decoration: line-through; text-decoration-color: rgb(var(--c-red-ink)); text-decoration-thickness: 2px; color: rgb(var(--c-ink-3)); }
mark.amend {
  background: rgb(var(--c-amber-soft)); color: rgb(var(--c-ink));
  padding: 0 3px; box-decoration-break: clone;
  border-bottom: 2px solid rgb(var(--c-amber));
}
.statute-card__note {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed rgb(var(--c-line));
  font-family: var(--sans); font-size: .88rem; color: rgb(var(--c-ink-2));
}
.statute-card__note b { color: rgb(var(--c-green-ink)); }

/* ---------- Three facets ---------- */
.facets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgb(var(--c-line)); border: 1px solid rgb(var(--c-line)); border-radius: 6px; overflow: hidden; }
.facet { background: rgb(var(--c-surface)); padding: 32px 28px; }
.facet__label { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: rgb(var(--c-amber)); margin-bottom: 10px; }
.facet h3 { margin-bottom: 10px; }
.facet p { font-size: .95rem; margin-bottom: 0; }

/* ---------- Course cards / pricing ---------- */
.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 48px; }
.course-card {
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px;
  padding: 28px 26px; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease;
}
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.course-card__paper { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: rgb(var(--c-ink-3)); margin-bottom: 10px; }
.course-card h3 { font-size: 1.2rem; margin-bottom: 12px; }
.course-card__topics { list-style: none; margin: 0 0 20px; padding: 0; font-size: .88rem; color: rgb(var(--c-ink-2)); }
.course-card__topics li { padding: 5px 0 5px 20px; position: relative; border-top: 1px solid rgb(var(--c-line-2)); }
.course-card__topics li:first-child { border-top: none; }
.course-card__topics li::before { content: "—"; position: absolute; left: 0; color: rgb(var(--c-amber)); }
.course-card__price { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: rgb(var(--c-ink)); margin: 4px 0 18px; }
.course-card__price small { font-family: var(--sans); font-size: .78rem; font-weight: 500; color: rgb(var(--c-ink-3)); }

.bundle-table { width: 100%; border-collapse: collapse; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px; overflow: hidden; }
.bundle-table th, .bundle-table td { text-align: left; padding: 16px 20px; border-bottom: 1px solid rgb(var(--c-line)); font-size: .95rem; }
.bundle-table th { font-family: var(--sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: rgb(var(--c-ink-3)); font-weight: 700; }
.bundle-table tr:last-child td { border-bottom: none; }
.bundle-table td.price { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.bundle-table tr.is-best td { background: rgb(var(--c-amber-soft)); }
.bundle-table tr.is-best td.price { color: rgb(var(--c-amber)); }
.pill {
  display: inline-block; font-family: var(--sans); font-size: .75rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: rgb(var(--c-green-soft)); color: rgb(var(--c-green-ink)); border: 1px solid rgb(var(--c-green-line));
}

.note-box {
  background: rgb(var(--c-amber-soft)); border: 1px solid rgb(var(--c-amber-line));
  border-radius: 6px; padding: 18px 22px; font-size: .92rem; color: rgb(var(--c-ink-2));
}
.note-box strong { color: rgb(var(--c-ink)); }

/* ---------- Resource library ---------- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.filter-chip {
  font-family: var(--sans); font-size: .85rem; font-weight: 600; padding: 8px 16px;
  border-radius: 999px; border: 1.5px solid rgb(var(--c-line)); background: rgb(var(--c-surface));
  color: rgb(var(--c-ink-2)); cursor: pointer;
}
.filter-chip[aria-pressed="true"] { border-color: rgb(var(--c-amber)); color: rgb(var(--c-ink)); background: rgb(var(--c-amber-soft)); }

.resource-list { display: grid; gap: 14px; }
.resource-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px;
  padding: 18px 20px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px;
}
.resource-row__icon { width: 34px; height: 34px; flex-shrink: 0; color: rgb(var(--c-ink-3)); }
.resource-row__title { font-weight: 600; color: rgb(var(--c-ink)); margin-bottom: 2px; }
.resource-row__meta { font-size: .82rem; color: rgb(var(--c-ink-3)); }
.tag { font-family: var(--sans); font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag--free { background: rgb(var(--c-green-soft)); color: rgb(var(--c-green-ink)); border: 1px solid rgb(var(--c-green-line)); }
.tag--paid { background: rgb(var(--c-amber-soft)); color: rgb(var(--c-amber)); border: 1px solid rgb(var(--c-amber-line)); }

/* ---------- Manual index cards ---------- */
.manual-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.manual-card {
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 8px;
  padding: 34px; display: flex; flex-direction: column; gap: 14px;
}
.manual-card h2, .manual-card h3 { margin-bottom: 0; }
.manual-card__meta { font-family: var(--sans); font-size: .82rem; color: rgb(var(--c-ink-3)); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid rgb(var(--c-line)); padding: 48px 0 40px;
  font-family: var(--sans); font-size: .88rem; color: rgb(var(--c-ink-3));
}
.footer__grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.footer__brand { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: rgb(var(--c-ink)); margin-bottom: 6px; }
.footer__links { display: flex; gap: 20px; list-style: none; padding: 0; margin: 0; }
.footer__links a { color: rgb(var(--c-ink-2)); }

/* ---------- Utilities ---------- */
.stack { display: flex; flex-direction: column; }
.center-head { text-align: left; max-width: 640px; margin-bottom: 48px; }
.mt-0 { margin-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .facets { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .manual-grid { grid-template-columns: 1fr; }
  .nav-links { position: fixed; top: 60px; left: 0; right: 0; height: calc(100vh - 60px); height: calc(100dvh - 60px); background: rgb(var(--c-bg)); flex-direction: column; align-items: flex-start; padding: 24px; gap: 20px; transform: translateX(100vw); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; border-top: 1px solid rgb(var(--c-line)); z-index: 39; overflow-y: auto; }
  .nav-links.is-open { transform: translateX(0); visibility: visible; transition: transform .2s ease, visibility 0s linear 0s; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 6px; border: 1px solid rgb(var(--c-line)); background: rgb(var(--c-surface)); cursor: pointer; }
  section { padding: 56px 0; }
  .resource-row { grid-template-columns: auto 1fr; row-gap: 8px; }
  .resource-row__cta { grid-column: 1 / -1; }
}
