/* =============================================================
 * THC Living Plant Atlas — Shared Module Design System
 * Shared visual system for all deep-lab module pages.
 * Matches the atlas-v5 design system exactly.
 * ============================================================= */

:root {
  --bg:       #07100b;
  --surface:  #0c1810;
  --surface2: #101e15;
  --surfsoft: #13251a;
  --text:     #f2f5ef;
  --text2:    #a8b5aa;
  --text3:    #748177;
  --border:   #294032;
  --borsoft:  #1b2e22;
  --accent:   #9fe870;
  --accent2:  #d9f3c8;
  --gold:     #d9bc73;
  --danger:   #e98c78;
  --r:        18px;
  --rlg:      26px;
  --shadow:   0 24px 64px rgba(0,0,0,.38);
  --serif:    ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --sans:     Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --site-header-fallback: 0px;
}

*, *::before, *::after { box-sizing: border-box }
html { scroll-behavior: smooth; background: var(--bg) }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 18% -8%, rgba(72,120,79,.18), transparent 30rem),
    linear-gradient(180deg, #07100b 0%, #09130d 38%, #07100b 100%);
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none }
button, input, select { font: inherit; cursor: pointer }
img { max-width: 100%; display: block }
[hidden] { display: none !important }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0 }

/* ── Shell ───────────────────────────────────────────────────── */
.shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 72px;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: var(--dtf-global-header-height, var(--site-header-fallback));
  z-index: 40;
  border-bottom: 1px solid var(--borsoft);
  background: rgba(7,16,11,.92);
  backdrop-filter: blur(20px) saturate(130%);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1280px, calc(100% - 40px));
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(159,232,112,.38);
  border-radius: 11px;
  background: radial-gradient(circle at 35% 28%, rgba(159,232,112,.2), transparent 44%), #0a1a12;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.brand strong { font-family: var(--serif); font-weight: 600; font-size: .95rem; letter-spacing: .01em }
.brand small  { display: block; color: var(--text3); font-size: .58rem; letter-spacing: .15em; text-transform: uppercase; margin-top: 2px }
.top-nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.top-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text2);
  font-size: .74rem;
  font-weight: 700;
  transition: background .15s, color .15s;
}
.top-nav a:hover, .top-nav a[aria-current] {
  background: rgba(159,232,112,.08);
  color: var(--text);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  padding: 20px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: var(--text3);
}
.breadcrumb a { color: var(--text3); font-weight: 700 }
.breadcrumb a:hover { color: var(--accent) }
.breadcrumb span { color: var(--border) }

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: 48px 0 36px;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(159,232,112,.4), rgba(159,232,112,.06) 60%, transparent);
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--text3);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 6.5vw, 6.5rem);
  font-weight: 500;
  line-height: .88;
  letter-spacing: -.04em;
  max-width: 1000px;
}
.hero-accent { color: var(--accent) }
.hero-lede {
  max-width: 820px;
  color: var(--text2);
  font-size: 1.04rem;
  line-height: 1.72;
  margin: 22px 0 0;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text2);
  font-size: .78rem;
  font-weight: 800;
  transition: border-color .15s, color .15s, background .15s;
}
.hero-links a:hover { border-color: rgba(159,232,112,.5); color: var(--text); background: rgba(159,232,112,.06) }
.hero-links a.primary { background: var(--accent); border-color: var(--accent); color: #07100b }
.hero-links a.primary:hover { background: #baf582; border-color: #baf582 }

/* ── Rule cards (2-col) ──────────────────────────────────────── */
.rule-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 38px 0 0;
}
.rule-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
  position: relative;
  overflow: hidden;
}
.rule-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 64px; height: 2px;
  background: linear-gradient(90deg, rgba(159,232,112,.7), transparent);
}
.rule-card.gold::before { background: linear-gradient(90deg, rgba(217,188,115,.7), transparent) }
.rule-card h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
}
.rule-card p { margin: 0; color: var(--text2); font-size: .85rem; line-height: 1.68 }
.rule-card .badge { margin-bottom: 12px }
.rule-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.rule-links a {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: .74rem;
  font-weight: 800;
}
.rule-links a:hover { border-color: var(--accent); background: rgba(159,232,112,.07) }

/* ── Section headings ────────────────────────────────────────── */
.section { margin-top: 56px }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(41,64,50,.7);
  margin-bottom: 20px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.2vw, 3.2rem);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -.03em;
}
.section-head p { margin: 0; color: var(--text2); font-size: .8rem; max-width: 600px; line-height: 1.6 }

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surfsoft);
  color: var(--text2);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.badge.green { border-color: rgba(159,232,112,.3); background: rgba(159,232,112,.07); color: var(--accent) }
.badge.gold  { border-color: rgba(217,188,115,.3); background: rgba(217,188,115,.07); color: var(--gold)   }
.badge.warn  { border-color: rgba(233,140,120,.3); background: rgba(233,140,120,.07); color: var(--danger) }

/* ── Lesson grid ─────────────────────────────────────────────── */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.lesson-card {
  position: relative;
  border: 1px solid rgba(41,64,50,.8);
  border-radius: var(--r);
  padding: 20px;
  background: linear-gradient(180deg, rgba(12,24,16,.9), rgba(7,16,11,.95));
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.lesson-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 48px; height: 2px;
  background: linear-gradient(90deg, rgba(159,232,112,.55), transparent);
}
.lesson-card:hover { border-color: rgba(159,232,112,.35); transform: translateY(-2px) }
.lesson-card h3 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}
.lesson-card p { margin: 0; color: var(--text2); font-size: .8rem; line-height: 1.62 }
.lesson-card .card-link {
  margin-top: auto;
  padding-top: 12px;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
}

/* ── Two-column content layout ───────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.content-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
}
.content-card h2 {
  margin: 8px 0 12px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.08;
}
.content-card h3 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}
.content-card p  { margin: 0 0 10px; color: var(--text2); font-size: .85rem; line-height: 1.68 }
.content-card p:last-child { margin: 0 }
.content-card ul, .content-card ol { margin: 0; padding-left: 1.25rem; color: var(--text2); font-size: .84rem; line-height: 1.65 }
.content-card li { margin: 6px 0 }
.content-card li strong { color: var(--text) }

/* ── Step sequence ───────────────────────────────────────────── */
.steps-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  counter-reset: step;
}
.step {
  counter-increment: step;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  color: var(--gold);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .12em;
  margin-bottom: 10px;
}
.step h3 { margin: 0 0 6px; font-size: .95rem; font-weight: 800; color: var(--text) }
.step p  { margin: 0; color: var(--text2); font-size: .78rem; line-height: 1.58 }

/* ── Data table ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin-top: 12px;
}
.data-table thead th {
  padding: 11px 14px;
  border: 1px solid var(--border);
  background: var(--surfsoft);
  color: var(--gold);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
}
.data-table tbody td {
  padding: 10px 14px;
  border: 1px solid var(--borsoft);
  color: var(--text2);
  vertical-align: top;
  line-height: 1.55;
}
.data-table tbody tr:nth-child(odd) td { background: rgba(12,24,16,.4) }
.data-table td strong { color: var(--text) }

/* ── Callout / principle ─────────────────────────────────────── */
.callout {
  margin: 48px 0 0;
  border: 1px solid rgba(217,188,115,.18);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  padding: 20px 24px;
  background: linear-gradient(90deg, rgba(65,49,22,.25), rgba(8,20,13,.8));
}
.callout strong { color: var(--gold) }
.callout p { margin: 6px 0 0; color: #c8b98e; font-size: .88rem; line-height: 1.68 }
.callout a { color: var(--accent); font-weight: 800 }

/* ── Link card grid ──────────────────────────────────────────── */
.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
}
.link-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s;
}
.link-card:hover { border-color: rgba(159,232,112,.35) }
.link-card .icon  { font-size: 1.4rem }
.link-card h3     { margin: 0; font-size: .95rem; font-weight: 800; color: var(--text) }
.link-card p      { margin: 0; color: var(--text2); font-size: .78rem; line-height: 1.55; flex: 1 }
.link-card a      { margin-top: 8px; color: var(--accent); font-size: .76rem; font-weight: 800 }

/* ── Stat row ────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--borsoft);
  margin-top: 28px;
  padding-top: 0;
}
.stat {
  flex: 1;
  padding: 18px 12px 0;
  border-right: 1px solid var(--borsoft);
}
.stat:last-child { border-right: 0 }
.stat b    { display: block; font-family: var(--serif); font-size: 1.65rem; font-weight: 600; color: var(--text) }
.stat span { display: block; color: var(--text3); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; margin-top: 4px }

/* ── Page footer ─────────────────────────────────────────────── */
.page-footer {
  margin-top: 56px;
  padding: 22px 0 0;
  border-top: 1px solid var(--borsoft);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  color: var(--text3);
  font-size: .74rem;
}
.page-footer a { color: var(--text3); font-weight: 700 }
.page-footer a:hover { color: var(--accent) }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .lesson-grid { grid-template-columns: repeat(2, 1fr) }
  .steps-row   { grid-template-columns: repeat(2, 1fr) }
  .link-grid   { grid-template-columns: repeat(2, 1fr) }
}
@media (max-width: 720px) {
  .shell           { width: calc(100% - 24px) }
  .topbar-inner    { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 0 }
  .top-nav         { width: 100%; overflow-x: auto; flex-wrap: nowrap; gap: 2px }
  .top-nav a       { white-space: nowrap }
  .rule-row        { grid-template-columns: 1fr }
  .two-col         { grid-template-columns: 1fr }
  .lesson-grid     { grid-template-columns: 1fr }
  .steps-row       { grid-template-columns: 1fr }
  .link-grid       { grid-template-columns: 1fr }
  .hero h1         { font-size: clamp(2.6rem,14vw,4rem); letter-spacing: -.03em }
  .section-head    { flex-direction: column; align-items: flex-start }
}
@media (prefers-reduced-motion: reduce) {
  .lesson-card { transition: none }
  html { scroll-behavior: auto }
}
