/*
 * terraformed.dev — the public site. Same visual language as the course (src/web/styles/tokens.css):
 * a survey plan of hairlines, left rails and measured bands, one accent, colour only for state.
 */
:root {
  color-scheme: light;
  --paper: #f1f3f2;
  --surface: #ffffff;
  --sunken: #e7ebe9;
  --ink: #16222b;
  --ink-2: #44555f;
  --ink-3: #6c7d86;
  --line: #ccd6d4;
  --hair: #dde4e2;
  --iris: #4a41a8;
  --iris-strong: #3a3290;
  --iris-wash: #ecebf7;
  --moss: #2c6a52;
  --moss-wash: #e4efe9;
  --amber: #8a5a12;
  --amber-wash: #f6eedd;
  --rust: #a1352c;
  --rust-wash: #f8e8e5;
  --code-bg: #f7f8f7;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --prose: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", Consolas, monospace;
  --shell: 72rem;
  --narrow: 44rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0e1317;
    --surface: #151c21;
    --sunken: #0b1013;
    --ink: #e5eae9;
    --ink-2: #b3c0c2;
    --ink-3: #8595a0;
    --line: #2c3a41;
    --hair: #212c32;
    --iris: #a79ff2;
    --iris-strong: #c3bdf7;
    --iris-wash: #24223f;
    --moss: #6fc39b;
    --moss-wash: #16291f;
    --amber: #e1b065;
    --amber-wash: #2e2414;
    --rust: #f08d80;
    --rust-wash: #33191a;
    --code-bg: #10171c;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.6 var(--ui);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
a { color: var(--iris); text-underline-offset: 0.18em; }
a:hover { color: var(--iris-strong); }
:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 650; }
h2 { font-size: 1.6rem; font-weight: 640; }
h3 { font-size: 1.12rem; font-weight: 640; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg); border: 1px solid var(--hair); border-radius: 3px; padding: 0.05em 0.3em; }
pre { font-family: var(--mono); font-size: 0.875rem; background: var(--code-bg); border: 1px solid var(--hair); border-left: 3px solid var(--line); padding: 0.8rem 1rem; overflow-x: auto; border-radius: 3px; }
pre code { background: none; border: 0; padding: 0; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: var(--narrow); }
.skip { position: absolute; left: -9999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 10; }
.skip:focus { left: 0.5rem; }

/* ---- header and footer */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-weight: 640; }
.brand em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.mark { width: 1.6rem; height: 1.6rem; }
.top nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-size: 0.92rem; }
.top nav a:not(.btn) { color: var(--ink-2); text-decoration: none; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.top nav a:not(.btn):hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--iris); }
.foot { border-top: 1px solid var(--line); margin-top: 4rem; font-size: 0.875rem; color: var(--ink-3); }
.foot-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.5rem; }
.foot-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.foot a { color: var(--ink-2); }

/* ---- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--iris); color: #fff; border: 1px solid var(--iris); border-radius: 4px;
  padding: 0.6rem 1.1rem; font: 600 0.95rem/1.2 var(--ui); text-decoration: none; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .btn { color: #0e1317; } }
.btn:hover { background: var(--iris-strong); border-color: var(--iris-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn:hover { color: #0e1317; } }
.btn-quiet { background: transparent; color: var(--iris); }
.btn-quiet:hover { background: var(--iris-wash); color: var(--iris-strong); }
@media (prefers-color-scheme: dark) { .btn-quiet, .btn-quiet:hover { color: var(--iris-strong); } }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.875rem; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---- hero */
.eyebrow { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 0.75rem; }
.eyebrow a { color: inherit; }
.lede { font-family: var(--prose); font-size: 1.18rem; line-height: 1.55; color: var(--ink-2); max-width: 38rem; }
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4.5rem); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: end; }
.hero h1 { max-width: 15ch; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--hair); font-size: 0.9rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-family: var(--mono); font-weight: 600; }

/* ---- bands */
.band { padding: clamp(2.5rem, 6vw, 4.5rem) 0; border-bottom: 1px solid var(--line); }
.band-sunken { background: var(--sunken); }
.section-lede { color: var(--ink-2); max-width: 40rem; margin-bottom: 2rem; }
.tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.track { padding: 1.5rem 1.5rem 1.5rem 0; border-right: 1px solid var(--hair); }
.track + .track { padding-left: 1.5rem; }
.track:last-child { border-right: 0; padding-right: 0; }
.track p { color: var(--ink-2); }
.track ul { margin: 0 0 1rem; padding: 0; list-style: none; }
.track li { padding: 0.35rem 0 0.35rem 0.9rem; border-left: 2px solid var(--line); font-size: 0.93rem; margin-bottom: 0.2rem; }
.more { font-weight: 600; text-decoration: none; }
.status { display: inline-block; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 3px; margin-bottom: 0.9rem; }
.status-live { background: var(--moss-wash); color: var(--moss); }
.status-soon { background: var(--amber-wash); color: var(--amber); }
.status-planned { background: var(--iris-wash); color: var(--iris); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.steps li { counter-increment: step; border-left: 2px solid var(--iris); padding-left: 1rem; }
.steps li::before { content: "0" counter(step); display: block; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3); margin-bottom: 0.4rem; }
.steps p { color: var(--ink-2); margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.split p { color: var(--ink-2); max-width: 36rem; }
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--iris); padding: 1.5rem; border-radius: 3px; }

/* ---- inner pages */
.page { padding: clamp(2rem, 6vw, 3.5rem) 0 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head .lede { margin-bottom: 0; }
.prose { font-family: var(--prose); font-size: 1.08rem; }
.prose h1, .prose h2 { font-family: var(--ui); }
.prose h2 { font-size: 1.2rem; margin-top: 1.8em; }

/* ---- notices */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--ink-3); background: var(--surface); padding: 0.85rem 1rem; margin: 1rem 0 1.5rem; border-radius: 3px; }
.notice-ok { border-left-color: var(--moss); background: var(--moss-wash); }
.notice-error { border-left-color: var(--rust); background: var(--rust-wash); }
.notice-iris { border-left-color: var(--iris); background: var(--iris-wash); }

/* ---- forms */
.form { display: grid; gap: 1.1rem; margin-top: 1.5rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.92rem; }
.form small { font-weight: 400; color: var(--ink-3); font-size: 0.82rem; }
input, select, textarea {
  font: 400 1rem/1.4 var(--ui); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.7rem; width: 100%;
}
textarea { resize: vertical; min-height: 8rem; font-family: var(--ui); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--iris); outline-offset: 0; border-color: var(--iris); }
.form .btn { justify-self: start; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- forum */
.tabs { display: flex; gap: 0.25rem 1.2rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 1.5rem 0 0; font-size: 0.92rem; }
.tabs a { color: var(--ink-2); text-decoration: none; padding: 0.55rem 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--iris); font-weight: 600; }
.threads { list-style: none; margin: 0; padding: 0; }
.thread { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--hair); }
.thread-title { font-weight: 620; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.thread-title:hover { color: var(--iris); }
.thread .meta { margin: 0.3rem 0 0; }
.thread-stats { text-align: right; font-size: 0.9rem; white-space: nowrap; }
.meta { font-size: 0.84rem; color: var(--ink-3); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 0.05rem 0.4rem; border-radius: 3px; background: var(--sunken); color: var(--ink-2); margin-right: 0.35rem; text-transform: uppercase; letter-spacing: 0.03em; }
.tag-terraform { background: var(--iris-wash); color: var(--iris); }
.tag-cloudflare { background: var(--amber-wash); color: var(--amber); }
.tag-iam { background: var(--moss-wash); color: var(--moss); }
.empty { padding: 2rem 0; color: var(--ink-2); }
.pager { display: flex; gap: 1.5rem; padding: 1.2rem 0; }
.posts { border-top: 1px solid var(--line); margin-bottom: 2rem; }
.post { padding: 1.1rem 0 0.4rem 1rem; border-left: 2px solid var(--hair); margin: 1rem 0; }
.post-first { border-left-color: var(--iris); }
.post-body { font-family: var(--prose); font-size: 1.05rem; overflow-wrap: anywhere; }
.post-body p:last-child { margin-bottom: 0.6rem; }

@media (max-width: 52rem) {
  .hero-grid, .split, .steps { grid-template-columns: 1fr; }
  .tracks { grid-template-columns: 1fr; }
  .track, .track + .track { padding: 1.25rem 0; border-right: 0; border-bottom: 1px solid var(--hair); }
  .form .row { grid-template-columns: 1fr; }
  .thread { flex-direction: column; gap: 0.3rem; }
  .thread-stats { text-align: left; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
