:root {
  color-scheme: light;
  --earth: #8b4513;
  --earth-deep: #4b2b1a;
  --olive: #6b8e23;
  --olive-deep: #3f5d16;
  --orange: #cc5500;
  --sand: #f5deb3;
  --sand-pale: #fff8e9;
  --sky: #87ceeb;
  --coral: #ff6f61;
  --ochre: #cc7722;
  --white: #ffffff;
  --ink: #35271f;
  --muted: #6c594d;
  --line: rgba(75, 43, 26, 0.24);
  --shadow: 0 2px 12px rgba(75, 43, 26, 0.12);
  --display: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--sand-pale);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  animation: page-arrive 260ms ease-out both;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(circle at 12% 12%, rgba(135, 206, 235, 0.22) 0 9rem, transparent 9.1rem),
    radial-gradient(circle at 92% 48%, rgba(107, 142, 35, 0.13) 0 12rem, transparent 12.1rem);
  content: "";
  pointer-events: none;
}

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

a {
  color: var(--earth-deep);
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--olive-deep);
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

p,
dd {
  max-width: 72ch;
}

h1,
h2,
h3 {
  color: var(--earth-deep);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

h3 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.top-note {
  width: min(100% - 3rem, var(--max));
  margin: 0 auto;
  padding: 1rem 0 0;
}

.guide-stamp {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--earth);
  border-radius: 999px;
  background: var(--white);
  color: var(--earth-deep);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::after {
  position: absolute;
  right: -3rem;
  bottom: -4.5rem;
  width: 15rem;
  height: 9rem;
  border: 1rem solid rgba(204, 119, 34, 0.16);
  border-radius: 50%;
  content: "";
  transform: rotate(-10deg);
}

.hero-grid {
  display: grid;
  width: min(100% - 3rem, var(--max));
  min-height: 36rem;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6.5rem) 0;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  grid-template-columns: minmax(0, 1.02fr) minmax(18rem, 0.98fr);
}

.hero-copy,
.hero-art,
.zig-copy,
.zig-art,
.comparison-panel,
.question-panel,
.source-card {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--olive-deep);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-lede {
  margin: 0 0 1rem;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.hero-note {
  margin: 0;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.primary-action,
.secondary-action,
.footer-link,
.source-link,
.path-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}

.primary-action {
  border: 2px solid var(--orange);
  background: var(--earth-deep);
  color: var(--white);
  text-decoration: none;
  transition: box-shadow 200ms ease-out, transform 200ms ease-out;
}

.primary-action:hover {
  box-shadow: 0 6px 16px rgba(75, 43, 26, 0.2);
  color: var(--white);
  transform: translateY(-2px);
}

.secondary-action {
  border: 1px solid var(--earth);
  background: var(--white);
  color: var(--earth-deep);
  text-decoration: none;
}

.craft-frame {
  margin: 0;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px 32px 8px 32px;
  background: var(--white);
  box-shadow: var(--shadow);
  transform: rotate(0.7deg);
  transition: box-shadow 220ms ease-out, transform 220ms ease-out;
}

.craft-frame:hover {
  box-shadow: 0 10px 24px rgba(75, 43, 26, 0.18);
  transform: rotate(0deg) translateY(-3px);
}

.craft-frame img {
  width: 100%;
  border-radius: 5px 26px 5px 26px;
  background: var(--sand);
}

.craft-frame figcaption {
  padding: 0.75rem 0.35rem 0.2rem;
  color: var(--muted);
  font-size: 1rem;
}

.page-main {
  overflow: hidden;
}

.section-shell {
  width: min(100% - 3rem, var(--max));
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 8rem) 0;
}

.section-shell + .section-shell {
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 48rem;
  margin-bottom: 2.25rem;
}

.section-heading p {
  margin-bottom: 0;
}

.signal-strip {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.signal-label,
.signal-answer {
  padding: clamp(1.5rem, 4vw, 3rem);
}

.signal-label {
  background: var(--earth);
  color: var(--white);
}

.signal-label h2 {
  color: var(--white);
}

.signal-label .eyebrow {
  color: var(--sand-pale);
}

.signal-answer {
  background: var(--white);
}

.signal-answer p:first-child {
  margin-top: 0;
}

.signal-answer p:last-child {
  margin-bottom: 0;
}

.zig-row {
  display: grid;
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.zig-row + .zig-row {
  margin-top: clamp(3rem, 7vw, 7rem);
}

.zig-row:nth-child(even) .zig-copy {
  order: 2;
}

.zig-row:nth-child(even) .zig-art {
  order: 1;
}

.tile-card {
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.tile-card::after {
  position: absolute;
  right: -2.5rem;
  bottom: -2.5rem;
  width: 6rem;
  height: 6rem;
  border: 0.65rem double rgba(107, 142, 35, 0.22);
  content: "";
  transform: rotate(45deg);
}

.tile-card p:last-child {
  margin-bottom: 0;
}

.evidence-pair {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.comparison-panel,
.question-panel,
.source-card {
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.comparison-panel:nth-child(odd),
.question-panel:nth-child(even) {
  background: #eef4dc;
}

.comparison-panel p:last-child,
.question-panel p:last-child,
.source-card p:last-child {
  margin-bottom: 0;
}

.route-stack,
.question-stack,
.source-stack {
  display: grid;
  gap: 1rem;
}

.route-stack {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.route-stack .comparison-panel:nth-child(4n + 2),
.route-stack .comparison-panel:nth-child(4n + 3) {
  transform: translateY(1.5rem);
}

.source-drawer {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.source-drawer summary {
  min-height: 52px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  color: var(--earth-deep);
  font-size: 1rem;
  font-weight: 800;
}

.source-drawer[open] summary {
  border-bottom: 1px solid var(--line);
  background: rgba(135, 206, 235, 0.16);
}

.drawer-body {
  padding: 1rem;
}

.drawer-body p {
  margin-top: 0;
}

.source-link {
  width: 100%;
  justify-content: flex-start;
  padding-left: 0;
  padding-right: 0;
}

.status-card {
  border-left: 0.65rem solid var(--coral);
}

.attention-card {
  border-left: 0.65rem solid var(--ochre);
}

.definition-card {
  border-left: 0.65rem solid var(--sky);
}

.fact-value {
  color: var(--earth-deep);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
}

.notes-workbench {
  display: grid;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-top: 0.4rem solid var(--ochre);
  border-radius: 8px 38px 8px 38px;
  background: var(--sand);
  box-shadow: var(--shadow);
  gap: 1.5rem;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
}

.notes-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--earth-deep);
  font-size: 1rem;
  font-weight: 800;
}

.notes-area {
  width: 100%;
  min-height: 15rem;
  padding: 1rem;
  resize: vertical;
  border: 1px solid var(--earth);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}

.notes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.save-button,
.clear-button {
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font: 700 1rem/1 var(--body);
  cursor: pointer;
}

.save-button {
  border: 2px solid var(--orange);
  background: var(--earth-deep);
  color: var(--white);
}

.clear-button {
  border: 2px solid #ae382f;
  background: var(--coral);
  color: var(--earth-deep);
}

.notes-status {
  min-height: 1.75rem;
  margin: 0.5rem 0 0;
  color: var(--olive-deep);
  font-weight: 700;
}

.quote-anatomy {
  display: grid;
  gap: 1rem;
}

.quote-row {
  display: grid;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
  gap: 0.75rem;
  grid-template-columns: minmax(9rem, 0.35fr) minmax(0, 0.65fr);
}

.quote-row h3,
.quote-row p {
  margin: 0;
}

.path-band {
  background: var(--earth-deep);
  color: var(--white);
}

.path-band h2,
.path-band h3 {
  color: var(--white);
}

.path-band .eyebrow {
  color: var(--sand);
}

.path-grid {
  display: grid;
  width: min(100% - 3rem, var(--max));
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) 0;
  align-items: start;
  gap: 2rem;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
}

.path-links {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.path-link {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  text-align: center;
  text-decoration: none;
}

.path-link:hover {
  border-color: var(--sky);
  background: rgba(135, 206, 235, 0.18);
  color: var(--white);
}

.site-footer {
  background: var(--sand);
  color: var(--earth-deep);
}

.footer-grid {
  display: grid;
  width: min(100% - 3rem, var(--max));
  margin: 0 auto;
  padding: 2rem 0 2.5rem;
  align-items: end;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.footer-line {
  margin: 0;
  font-size: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.footer-link {
  padding: 0.55rem 0.75rem;
}

.reveal {
  animation: rise-in 420ms ease-out both;
}

.reveal:nth-child(2) {
  animation-delay: 80ms;
}

.reveal:nth-child(3) {
  animation-delay: 160ms;
}

.reveal:nth-child(4) {
  animation-delay: 240ms;
}

@keyframes page-arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px) {
  .top-note,
  .hero-grid,
  .section-shell,
  .path-grid,
  .footer-grid {
    width: min(100% - 2rem, var(--max));
  }

  .hero-grid,
  .signal-strip,
  .zig-row,
  .evidence-pair,
  .route-stack,
  .notes-workbench,
  .quote-row,
  .path-grid,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-grid {
    min-height: auto;
    padding-top: 3.5rem;
  }

  .hero-art {
    max-width: 34rem;
  }

  .zig-row:nth-child(even) .zig-copy,
  .zig-row:nth-child(even) .zig-art {
    order: initial;
  }

  .route-stack .comparison-panel:nth-child(4n + 2),
  .route-stack .comparison-panel:nth-child(4n + 3) {
    transform: none;
  }

  .path-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
