/* Project Joey — projectjoey.app */

:root {
  --bg: #f8fbfd;
  --bg-alt: #eef4f8;
  --surface: #ffffff;
  --ink: #0b1722;
  --ink-2: #3e5162;
  --ink-3: #6b7d8c;
  --line: rgba(11, 23, 34, 0.1);
  --line-strong: rgba(11, 23, 34, 0.19);
  --accent: #b4521d;
  --accent-soft: rgba(180, 82, 29, 0.1);
  --on-accent: #ffffff;
  --warn: #a8670f;
  --fail: #b0283a;
  --fail-soft: rgba(176, 40, 58, 0.09);
  --pass: #2f7552;
  --pass-soft: rgba(47, 117, 82, 0.1);
  --veil: 248, 251, 253;
  /* Particle colours as "r, g, b" so the canvas can add alpha. */
  --particle: 36, 56, 74;
  --particle-accent: 196, 98, 45;
  --particle-alpha: 0.55;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1017;
    --bg-alt: #0e161f;
    --surface: #121c26;
    --ink: #f4f8fb;
    --ink-2: #b1c0cc;
    --ink-3: #7a8c9b;
    --line: rgba(244, 248, 251, 0.1);
    --line-strong: rgba(244, 248, 251, 0.2);
    --accent: #f0975c;
    --accent-soft: rgba(240, 151, 92, 0.13);
    --on-accent: #1c0e05;
    --warn: #f0c060;
    --fail: #ff8d93;
    --fail-soft: rgba(255, 141, 147, 0.12);
    --pass: #8fd3ab;
    --pass-soft: rgba(143, 211, 171, 0.12);
    --veil: 10, 16, 23;
    --particle: 232, 242, 248;
    --particle-accent: 240, 151, 92;
    --particle-alpha: 0.5;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a1017;
  --bg-alt: #0e161f;
  --surface: #121c26;
  --ink: #f4f8fb;
  --ink-2: #b1c0cc;
  --ink-3: #7a8c9b;
  --line: rgba(244, 248, 251, 0.1);
  --line-strong: rgba(244, 248, 251, 0.2);
  --accent: #f0975c;
  --accent-soft: rgba(240, 151, 92, 0.13);
  --on-accent: #1c0e05;
  --warn: #f0c060;
  --fail: #ff8d93;
  --fail-soft: rgba(255, 141, 147, 0.12);
  --pass: #8fd3ab;
  --pass-soft: rgba(143, 211, 171, 0.12);
  --veil: 10, 16, 23;
  --particle: 232, 242, 248;
  --particle-accent: 240, 151, 92;
  --particle-alpha: 0.5;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ol,
ul,
figure,
blockquote {
  margin: 0;
}

a {
  color: inherit;
}

q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* Header */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(var(--veil), 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.top.is-scrolled {
  border-bottom-color: var(--line);
}
.top-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  -webkit-mask: url("/kangaroo.png") center / contain no-repeat;
  mask: url("/kangaroo.png") center / contain no-repeat;
  transform: translateY(-2px);
}
.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.nav a:hover {
  color: var(--ink);
  background: var(--accent-soft);
}
.theme {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.theme:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.theme svg {
  width: 18px;
  height: 18px;
}

/* Hero */

.hero {
  position: relative;
  isolation: isolate;
  min-height: min(92vh, 860px);
  min-height: min(92svh, 860px);
  display: flex;
  align-items: center;
  margin-top: -60px;
  padding: 120px 0 72px;
  overflow: hidden;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(var(--veil), 0.8) 0%, rgba(var(--veil), 0.45) 36%, rgba(var(--veil), 0) 60%),
    linear-gradient(180deg, rgba(var(--veil), 0) 70%, rgba(var(--veil), 1) 100%);
}
.hero-inner {
  position: relative;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(var(--veil), 0.6);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent);
}
.hero h1 {
  max-width: 11ch;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 28px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.lede {
  max-width: 34rem;
  font-size: clamp(17px, 1.6vw, 19px);
  color: var(--ink-2);
}
.lede + .lede {
  margin-top: 12px;
}
.lede-strong {
  color: var(--ink);
}
.lede-strong strong {
  font-weight: 600;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(var(--veil), 0.5);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.btn:hover {
  border-color: var(--ink-3);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Facts band */

.facts {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.fact {
  padding: 32px 28px 30px;
  border-left: 1px solid var(--line);
}
.fact:first-child {
  border-left: 0;
  padding-left: 0;
}
.fact-num {
  font-family: var(--serif);
  font-size: clamp(44px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.fact-num span {
  color: var(--ink-3);
}
.fact-date {
  font-size: clamp(30px, 3.4vw, 40px);
  padding-top: 14px;
}
.fact-label {
  max-width: 26ch;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* Sections */

.section {
  padding: clamp(72px, 10vw, 128px) 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section-head {
  max-width: 48rem;
  margin-bottom: clamp(36px, 5vw, 56px);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.section h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-sub {
  margin-top: 18px;
  color: var(--ink-2);
  max-width: 38rem;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.prose p {
  color: var(--ink-2);
}
.prose p + p,
.prose .bet + p {
  margin-top: 20px;
}
.why {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--ink-2);
}
.why strong {
  color: var(--ink);
  font-weight: 600;
}
.prose .why + p {
  margin-top: 20px;
}
.bet {
  margin: 32px 0;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--accent);
}
.bet p {
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.2;
  color: var(--ink);
}
.bet footer {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.loop {
  list-style: none;
  padding: 0;
  counter-reset: step;
  border-top: 1px solid var(--line);
}
.loop li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16.5px;
}
.loop li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}

/* Design */

.parts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.part {
  padding: 28px 26px 30px;
  background: var(--surface);
}
.part-crate {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.part h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.part p:last-child {
  font-size: 15.5px;
  color: var(--ink-2);
}
.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.rules span {
  padding: 6px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}

/* Results */

.stages {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--line);
}
.stage {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.stage-id {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  padding-top: 5px;
}
.stage h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  margin-bottom: 8px;
}
.stage p {
  max-width: 44rem;
  color: var(--ink-2);
  font-size: 16px;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.tag-pass {
  color: var(--pass);
  background: var(--pass-soft);
}
.tag-fail {
  color: var(--fail);
  background: var(--fail-soft);
}
.tag-infra {
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
}

.probe-block {
  margin-top: clamp(48px, 7vw, 80px);
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.probe-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  margin-bottom: 20px;
}
.probe-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
}
.probe-head p {
  font-size: 14px;
  color: var(--ink-3);
}
.probes {
  list-style: none;
  padding: 0;
}
.probes li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 15.5px;
}
.mark {
  font-family: var(--mono);
  font-size: 14px;
  text-align: center;
}
.mark-fail {
  color: var(--fail);
}
.mark-pass {
  color: var(--pass);
}
.probe-q {
  color: var(--ink);
}
.probe-k {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.sample {
  margin-top: 24px;
}
.sample figcaption {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.sample pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--bg-alt);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sample code {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* Lessons */

.lessons {
  list-style: none;
  padding: 0;
  counter-reset: lesson;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(32px, 5vw, 72px);
}
.lessons li {
  counter-increment: lesson;
  padding: 28px 0 30px;
  border-top: 1px solid var(--line-strong);
}
.lessons li::before {
  content: counter(lesson, decimal-leading-zero);
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  margin-bottom: 12px;
}
.lessons h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.lessons p {
  color: var(--ink-2);
  font-size: 16px;
}

/* Closing */

.closing-inner {
  max-width: 46rem;
}
.closing-inner p:last-child {
  margin-top: 22px;
  font-size: 18px;
  color: var(--ink-2);
}

.foot {
  border-top: 1px solid var(--line);
  padding: 32px 0 calc(40px + env(safe-area-inset-bottom));
  font-size: 14.5px;
  color: var(--ink-2);
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
}
.foot a {
  color: var(--ink);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.foot a:hover {
  text-decoration-color: var(--accent);
}
.foot-meta {
  color: var(--ink-3);
}

/* Reveal on scroll (only when JS runs and motion is welcome) */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .js .reveal.is-in {
    opacity: 1;
    transform: none;
  }
  .hero-canvas {
    opacity: 0;
    transition: opacity 1.6s ease;
  }
  .hero-canvas.is-ready {
    opacity: 1;
  }
}

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

/* Responsive */

@media (max-width: 900px) {
  .cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .parts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .stage-id {
    padding-top: 0;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }
  .nav {
    display: none;
  }
  .theme {
    margin-left: auto;
  }
  .hero {
    align-items: flex-end;
    min-height: 100vh;
    min-height: 100svh;
    padding: 300px 0 48px;
  }
  .hero-veil {
    background:
      linear-gradient(180deg, rgba(var(--veil), 0) 0%, rgba(var(--veil), 0) 32%, rgba(var(--veil), 0.6) 44%, rgba(var(--veil), 0.82) 64%, rgba(var(--veil), 1) 100%);
  }
  .facts-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .fact,
  .fact:first-child {
    padding: 22px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .fact:first-child {
    border-top: 0;
  }
  .fact-label {
    max-width: none;
  }
  .parts {
    grid-template-columns: minmax(0, 1fr);
  }
  .lessons {
    grid-template-columns: minmax(0, 1fr);
  }
  .probes li {
    grid-template-columns: 22px minmax(0, 1fr);
  }
  .probe-k {
    grid-column: 2;
    margin-top: -6px;
  }
}
