/* Novelty Engine — a tribute to Terence McKenna.
   Dark by default; the light theme is genuinely light and survives Chrome's forced dark mode
   (color-scheme: only light). Type: Verdana for the H1, EB Garamond (OFL, self-hosted) for reading. */

@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-italic.woff2") format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; }

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0a11;
  --bg-2: #120f19;
  --surface: #17141f;
  --surface-2: #201c2b;
  --text: #f1ebde;
  --muted: #bdb4a2;
  --faint: #8d8576;
  --accent: #e8b86a;
  --accent-strong: #f3cd8c;
  --accent-ink: #1a1208;
  --teal: #8fd3c7;
  --border: #2e2a3b;
  --border-strong: #463f58;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --hero-veil: linear-gradient(180deg, rgba(12, 10, 17, .62) 0%, rgba(12, 10, 17, .78) 55%, #0c0a11 100%);
  --hero-filter: none;
  --switch-track: #2a2536;
  --switch-track-on: #f2e6cf;
  --knob: #f1ebde;
  --btn-bg: #e8b86a;
  --btn-text: #1a1208;
  --btn-border: #e8b86a;
  --btn-hover: #f3cd8c;
  --ghost-bg: rgba(241, 235, 222, .06);
  --focus: #8fd3c7;
  --ok: #8fd3c7;
  --bad: #ff9a8a;
}

[data-theme="light"] {
  color-scheme: only light;
  --bg: #fbf7ef;
  --bg-2: #f5efe2;
  --surface: #ffffff;
  --surface-2: #f6f0e4;
  --text: #1f1a14;
  --muted: #554c40;
  --faint: #6f6556;
  --accent: #8a5a12;
  --accent-strong: #6e470b;
  --accent-ink: #3d2706;
  --teal: #1f6b60;
  --border: #e4dac8;
  --border-strong: #cdbfa6;
  --shadow: 0 14px 40px rgba(60, 45, 20, .10);
  --hero-veil: linear-gradient(180deg, rgba(251, 247, 239, .86) 0%, rgba(251, 247, 239, .90) 60%, #fbf7ef 100%);
  --hero-filter: grayscale(30%) brightness(1.35) contrast(.75);
  --switch-track: #e9e0cf;
  --switch-track-on: #fde9c2;
  --knob: #ffffff;
  --btn-bg: #fdebc8;
  --btn-text: #3d2706;
  --btn-border: #d9b06a;
  --btn-hover: #fbdfa6;
  --ghost-bg: #ffffff;
  --focus: #1f6b60;
  --ok: #1f6b60;
  --bad: #a1271a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  font-size: 1.2rem; line-height: 1.6; text-rendering: optimizeLegibility;
  font-variant-numeric: oldstyle-nums proportional-nums;
}
img, video, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); }
.skip:focus { top: 12px; }
.ui { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 40px); margin-inline: auto; }

/* ---------- navbar (the header) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.25rem; letter-spacing: .01em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand .logo-bg { fill: #120f19; }
[data-theme="light"] .brand .logo-bg { fill: #fdf3df; }
.brand .logo-line { stroke: #e8b86a; }
[data-theme="light"] .brand .logo-line { stroke: #8a5a12; }
.brand .logo-dot { fill: #8fd3c7; }
[data-theme="light"] .brand .logo-dot { fill: #1f6b60; }
.nav-links { display: flex; gap: 4px; margin-left: auto; list-style: none; padding: 0; margin-block: 0; }
.nav-links a { display: block; padding: 8px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--text); background: var(--ghost-bg); }
.nav-tools { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--ghost-bg); color: var(--text); cursor: pointer; align-items: center; justify-content: center; }
.menu-btn svg { width: 22px; height: 22px; }

/* iPhone-style theme switch: moon while dark, sun once light is on, no text label. */
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--switch-track); cursor: pointer; padding: 0; flex: none; transition: background .2s; }
.switch[aria-checked="true"] { background: var(--switch-track-on); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .22s ease; display: flex; align-items: center; justify-content: center; }
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); }
.switch-knob svg { width: 16px; height: 16px; }
.switch .icon-sun, .switch[aria-checked="true"] .icon-moon { display: none; }
.switch[aria-checked="true"] .icon-sun { display: block; }

@media (max-width: 920px) {
  .menu-btn { display: inline-flex; }
  .nav-links { position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0; padding: 8px 14px 16px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); display: none; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 10px; font-size: 1rem; }
  .nav-tools { margin-left: auto; }
}

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(84px, 14vw, 170px) 0 clamp(70px, 10vw, 120px); }
.hero-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; filter: var(--hero-filter); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--hero-veil); }
.eyebrow { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; color: var(--accent); margin: 0 0 18px; }
h1 { font-family: Verdana, Geneva, sans-serif; font-weight: 700; font-size: clamp(2.5rem, 6.4vw, 4.6rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 26px; color: var(--text); }
.hero-quote { font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.45; max-width: 820px; margin: 0 0 10px; font-style: italic; color: var(--text); }
.hero-quote::before { content: "\201C"; color: var(--accent); }
.hero-quote::after { content: "\201D"; color: var(--accent); }
.cite { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .85rem; color: var(--muted); }
.cite a { color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 26px; }
.hero-note { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .85rem; color: var(--muted); max-width: 640px; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 11px 20px; border-radius: 999px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .98rem; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-text); transition: background .15s, transform .15s; }
.btn:hover { background: var(--btn-hover); color: var(--btn-text); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--ghost-bg); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--accent); color: var(--text); }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .88rem; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- sections ---------- */
section { padding: clamp(64px, 9vw, 110px) 0; border-top: 1px solid var(--border); }
section:nth-of-type(even) { background: var(--bg-2); }
h2 { font-weight: 500; font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-weight: 600; font-size: 1.45rem; line-height: 1.25; margin: 0 0 8px; }
.lede { color: var(--muted); font-size: 1.28rem; max-width: 760px; margin: 0 0 40px; }
.grid { display: grid; gap: 22px; }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }

/* who */
.who { display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: start; }
.who p { margin: 0 0 18px; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.facts li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; color: var(--muted); }
.facts li strong { color: var(--text); font-weight: 600; }
.facts svg { width: 22px; height: 22px; margin-top: 4px; color: var(--accent); }
@media (max-width: 860px) { .who { grid-template-columns: 1fr; gap: 28px; } }

/* listen */
.player { position: sticky; top: 76px; z-index: 5; display: grid; grid-template-columns: auto 1fr; gap: 18px 22px; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 30px; }
.play-big { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-text); display: grid; place-items: center; cursor: pointer; }
.play-big:hover { background: var(--btn-hover); }
.play-big svg { width: 26px; height: 26px; }
.player-title { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.now { font-size: 1.22rem; line-height: 1.4; margin: 0; min-height: 3.4em; font-style: italic; }
.now-src { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .82rem; color: var(--muted); margin: 4px 0 0; min-height: 1.3em; }
.bar { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar input[type="range"] { width: 100%; accent-color: var(--accent); }
.sets { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.set { position: relative; text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.set img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
/* Light theme: the black-ground plates become dark ink on pale paper, like the printed engravings. */
[data-theme="light"] .set img, [data-theme="light"] .idea img { filter: invert(.92) hue-rotate(180deg) sepia(.18) contrast(.95); }
.set-body { padding: 12px 16px 16px; }
.set-num { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.set-name { display: block; font-size: 1.25rem; font-weight: 600; line-height: 1.25; margin: 2px 0; }
.set-meta { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .82rem; color: var(--muted); }
.set[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.set-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 600px) { .player { top: 70px; grid-template-columns: 1fr; padding: 16px; } .play-big { width: 54px; height: 54px; } .now { min-height: 4.2em; font-size: 1.1rem; } }

/* watch */
.films { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.film { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.film video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.film-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.film-body p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.film-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
@media (max-width: 400px) { .films { grid-template-columns: 1fr; } }

/* ideas */
.ideas { display: grid; gap: 22px; }
.idea { display: grid; grid-template-columns: 300px 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.idea img { width: 100%; height: 100%; object-fit: cover; min-height: 220px; }
.idea-body { padding: 26px 30px; }
.idea-body > p { margin: 0 0 14px; }
.deeper-btn { margin-top: 6px; }
.deeper-btn svg { transition: transform .2s; }
.deeper-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.deeper { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 18px; }
.deeper[hidden] { display: none; }
.deeper p { margin: 0 0 14px; }
.qlist { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 16px; }
.qlist blockquote { margin: 0; padding-left: 16px; border-left: 2px solid var(--accent); font-style: italic; }
.qlist .cite { display: block; margin-top: 4px; font-style: normal; }
@media (max-width: 760px) { .idea { grid-template-columns: 1fr; } .idea img { aspect-ratio: 16 / 7; min-height: 0; } .idea-body { padding: 20px; } }

/* timewave */
.wave-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.wave-svg { width: 100%; height: auto; overflow: visible; }
.wave-svg .axis { stroke: var(--border-strong); stroke-width: 1; }
.wave-svg .curve { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.wave-svg .area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.wave-svg .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.wave-svg .dot.on { fill: var(--teal); stroke: var(--teal); }
.wave-svg .tick { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: 12px; fill: var(--faint); }
.wave-svg .cursor { stroke: var(--teal); stroke-width: 1.5; stroke-dasharray: 4 4; }
.wave-controls { display: grid; gap: 10px; margin-top: 18px; }
.wave-controls label { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .9rem; color: var(--muted); }
.wave-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.wave-readout { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; margin-top: 12px; align-items: baseline; }
.wave-readout h3 { margin: 0; }
.wave-readout .when { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; color: var(--accent); font-size: .95rem; text-align: right; }
.wave-readout p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.honest { margin-top: 22px; padding: 16px 18px; border-radius: 14px; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 1.05rem; }

/* life */
.life { list-style: none; padding: 0; margin: 0; position: relative; }
.life::before { content: ""; position: absolute; left: 86px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); }
.life li { display: grid; grid-template-columns: 70px 1fr; gap: 34px; padding: 0 0 26px; position: relative; }
.life li::before { content: ""; position: absolute; left: 81px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg-2); }
.life .yr { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-weight: 700; color: var(--accent); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.life p { margin: 0; }
.life p strong { font-weight: 600; }

/* further */
.further { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 760px) { .further { grid-template-columns: 1fr; } }
.further ul { padding-left: 20px; margin: 0; }
.further li { margin-bottom: 8px; }
.further h3 { display: flex; align-items: center; gap: 10px; }
.further h3 svg { width: 22px; height: 22px; color: var(--accent); }
.care { border-color: color-mix(in srgb, var(--teal) 55%, var(--border)); }

/* contact */
form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .92rem; font-weight: 600; }
.field input, .field textarea { font: inherit; font-size: 1.08rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; width: 100%; }
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--bad); }
.err { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .85rem; color: var(--bad); min-height: 1.1em; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-result { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; min-height: 1.4em; margin: 0; }
.form-result.ok { color: var(--ok); }
.form-result.bad { color: var(--bad); }
.fallback { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .88rem; color: var(--muted); }

/* footer */
footer { border-top: 1px solid var(--border); padding: 44px 0 54px; background: var(--bg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif; font-size: .88rem; color: var(--muted); }
.foot { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; }
.foot p { margin: 0 0 10px; }
.foot nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: flex-end; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }
.copy { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
@media (max-width: 760px) { .foot { grid-template-columns: 1fr; } .foot nav ul { justify-content: flex-start; } }

/* 404 */
.lost { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 60px 20px; }
