:root {
  color-scheme: dark;
  --bg: #090b0a;
  --surface: rgb(13 17 15 / 0.78);
  --line: #1e2722;
  --text: #dbe3de;
  --muted: #8d9c93;
  --green: #86b496;
  --green-dim: #4f735c;
  --danger: #e09a8f;
  --sans: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font: 400 1rem/1.6 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* Ambient background: decorative, never interactive. */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg) url("./ambient.jpg") center / cover no-repeat; }
.ambient video { width: 100%; height: 100%; object-fit: cover; display: block; opacity: var(--ambient-opacity, 0.5); }
.ambient::after { content: ""; position: absolute; inset: 0; background: var(--ambient-veil); }
@media (prefers-reduced-motion: reduce) {
  .ambient video { display: none; }
  .ambient { background-image: none; }
}

/* Layout */
.bar, main, footer { width: 100%; max-width: 68rem; margin: 0 auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; }
main { flex: 1; }
footer { padding-block: 2rem 4.5rem; color: var(--muted); font-size: 0.8125rem; max-width: 68rem; }
footer p { max-width: 38rem; margin: 0; border-top: 1px solid var(--line); padding-top: 1rem; }

/* Type */
.mark, .eyebrow, dt, summary, .motion { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }
.mark { color: var(--text); text-decoration: none; }
.mark span { color: var(--green); }
.eyebrow { color: var(--green); margin: 0 0 1.25rem; }
h1 { font-weight: 300; font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 1.04; letter-spacing: -0.035em; margin: 0 0 1.25rem; text-wrap: balance; }
h2 { font-weight: 400; font-size: 1.375rem; letter-spacing: -0.01em; line-height: 1.3; margin: 0 0 0.75rem; }
.lede { color: var(--muted); font-size: 1.125rem; max-width: 34rem; margin: 0 0 2rem; text-wrap: pretty; }
p { margin: 0 0 1rem; }

/* Subtle shimmer: a slow highlight passing through muted green text. */
.shimmer {
  color: var(--green);
  background: linear-gradient(100deg, var(--green) 40%, #c6dccd 50%, var(--green) 60%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.motion-paused .shimmer { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .shimmer { animation: none; background: none; -webkit-text-fill-color: currentColor; } }

/* Controls */
a { color: var(--green); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0 0 2.5rem; }
button { font: 500 0.9375rem/1 var(--sans); padding: 0.875rem 1.25rem; border-radius: 0.25rem; cursor: pointer; border: 1px solid var(--green-dim); background: var(--green); color: #07110b; transition: background-color 0.15s, color 0.15s; }
button:hover { background: #a3c9b0; }
button.quiet { background: transparent; color: var(--text); border-color: var(--line); }
button.quiet:hover { border-color: var(--green-dim); }
button:disabled { opacity: 0.6; cursor: wait; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.motion { position: fixed; right: 1rem; bottom: 1rem; padding: 0.5rem 0.75rem; letter-spacing: 0.1em; background: var(--surface); color: var(--muted); border-color: var(--line); }
.motion:hover { background: var(--surface); color: var(--text); }

/* Session panel */
.session { max-width: 34rem; border-top: 1px solid var(--line); padding-top: 1rem; }
dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; align-items: baseline; }
dt { color: var(--muted); letter-spacing: 0.1em; }
dd { margin: 0; font-family: var(--mono); font-size: 0.875rem; overflow-wrap: anywhere; }
#status { color: var(--green); }
details { margin-top: 1rem; }
summary { cursor: pointer; color: var(--muted); letter-spacing: 0.1em; width: fit-content; }
summary:hover { color: var(--text); }
details dl { margin-top: 0.75rem; }
#error { color: var(--danger); overflow-wrap: anywhere; max-width: 34rem; }
noscript { color: var(--muted); }

/* Landing: centred, airy. */
.landing { --ambient-opacity: 0.55; --ambient-veil: radial-gradient(ellipse 70% 60% at 50% 45%, rgb(9 11 10 / 0.88), rgb(9 11 10 / 0.35)); }
.landing main { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-block: 4rem 2rem; }
.landing .lede, .landing .session { margin-inline: auto; }
.landing .actions { justify-content: center; }
.landing .session { width: 100%; text-align: left; }
.landing footer p { margin-inline: auto; text-align: center; }

/* Course: reading layout with the lesson as the anchor. */
.course { --ambient-opacity: 0.35; --ambient-veil: linear-gradient(90deg, rgb(9 11 10 / 0.96) 35%, rgb(9 11 10 / 0.55)); }
.course main { display: grid; gap: 3rem; padding-block: 3rem 2rem; align-content: start; }
.lesson { background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--green-dim); border-radius: 0.25rem; padding: clamp(1.25rem, 3vw, 2rem); max-width: 40rem; }
.lesson .eyebrow { margin-bottom: 0.75rem; }
.lesson p { color: var(--muted); }
.lesson p:last-child { margin-bottom: 0; }
@media (min-width: 60rem) {
  .course main { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); align-items: start; }
}
@media (max-width: 30rem) {
  dl { grid-template-columns: 1fr; gap: 0.125rem; }
  dd + dt { margin-top: 0.5rem; }
}
