/* ==========================================================================
   Claude Web Design Lab - shared styles
   ========================================================================== */

:root {
  --bg: #0e0c0b;
  --bg-2: #151210;
  --card: #1a1714;
  --card-2: #221e1a;
  --line: rgba(243, 237, 228, 0.1);
  --line-2: rgba(243, 237, 228, 0.18);
  --ink: #f3ede4;
  --mute: #9b9188;
  --accent: #ff6a1a;
  --accent-2: #ffb36b;
  --violet: #a78bfa;
  --mint: #7ee0c3;
  --r: 22px;
  --r-sm: 12px;
  --gutter: clamp(16px, 4vw, 56px);
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4efe7;
  --bg-2: #ebe4d9;
  --card: #fbf8f3;
  --card-2: #f1ebe2;
  --line: rgba(30, 24, 20, 0.1);
  --line-2: rgba(30, 24, 20, 0.2);
  --ink: #1d1916;
  --mute: #6f655c;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

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

img, video, canvas, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: var(--accent); color: #140b05; }

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.serif { font-family: var(--serif); font-weight: 400; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 14px var(--gutter) auto; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg) 62%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.nav .logo { font-weight: 700; letter-spacing: -0.02em; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.nav .logo i { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--violet), var(--mint), var(--accent)); animation: spin 6s linear infinite; }
/* Page links scroll sideways when they do not fit; on phones they get a row of their own. */
.nav .logo { flex: none; white-space: nowrap; }
.nav-links {
  flex: 1; min-width: 0; display: flex; gap: 2px; list-style: none; margin: 0; padding: 0;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links li:first-child { margin-left: auto; }   /* right-aligned while it fits; auto margins collapse when it scrolls */
.nav-links li:last-child { margin-right: 6px; }
.nav-links a { display: block; padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--mute); font-size: 14px; white-space: nowrap; transition: color .2s, background .2s; }
.nav-links a:hover { color: var(--ink); background: var(--line); }
.nav-links a[aria-current="page"] { color: var(--bg); background: var(--ink); }
.nav-tools { flex: none; display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2);
  background: transparent; cursor: pointer; display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 60; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

@media (max-width: 760px) {
  .nav { flex-wrap: wrap; border-radius: 22px; row-gap: 6px; padding: 8px 10px 6px 16px; }
  .nav-tools { margin-left: auto; }
  .nav-links { order: 3; flex-basis: 100%; margin: 0 -4px; }
  .nav-links li:first-child { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: grid; align-items: end;
  padding: 120px var(--gutter) 56px; overflow: hidden; isolation: isolate;
}
.hero video, .hero .hero-poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(14, 12, 11, .92) 0%, rgba(14, 12, 11, .55) 45%, rgba(14, 12, 11, 0) 75%),
    linear-gradient(0deg, var(--bg) 0%, transparent 30%);
}
.hero h1 {
  font-family: var(--serif); font-weight: 400; margin: 0;
  font-size: clamp(56px, 10.5vw, 168px); line-height: .9; letter-spacing: -0.03em; max-width: 11ch;
  color: #f3ede4;
}
.hero h1 em { color: var(--accent); }
.hero h1 .w { display: inline-block; opacity: 0; transform: translateY(40%) rotate(4deg); filter: blur(8px); animation: rise 1s cubic-bezier(.2, .8, .2, 1) forwards; }
.hero .lede { max-width: 52ch; color: #cfc6bb; font-size: clamp(16px, 1.6vw, 19px); margin: 28px 0 0; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(243, 237, 228, .2); color: #f3ede4; background: rgba(14, 12, 11, .4); text-decoration: none;
  font-size: 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip b { width: 8px; height: 8px; border-radius: 50%; }
.hero .meta-row { display: flex; gap: 32px; margin-top: 48px; color: #b7aea4; flex-wrap: wrap; }
.hero .meta-row strong { display: block; color: #f3ede4; font-family: var(--serif); font-size: 44px; font-weight: 400; line-height: 1; }
.scroll-cue { position: absolute; right: var(--gutter); bottom: 56px; writing-mode: vertical-rl; color: #b7aea4; display: flex; align-items: center; gap: 12px; }
.scroll-cue::after { content: ""; width: 1px; height: 64px; background: linear-gradient(var(--accent), transparent); animation: cue 2s ease-in-out infinite; }
.credit { position: absolute; right: var(--gutter); top: 96px; color: #b7aea4; }
@media (max-width: 720px) { .credit { display: none; } }

/* ---------- Sections ---------- */
section.chapter { padding: 120px var(--gutter) 40px; }
.chapter-head { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 48px; max-width: 1400px; margin-inline: auto; }
.chapter-head .kicker { color: var(--accent); }
.chapter-head h1, .chapter-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7vw, 110px); line-height: .95; letter-spacing: -0.02em; margin: 0; }
.chapter-head h1 em, .chapter-head h2 em { color: var(--mute); }
.chapter-head p { color: var(--mute); max-width: 62ch; margin: 0; font-size: 18px; }

.grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px;
  max-width: 1400px; margin: 0 auto;
}
.w3 { grid-column: span 3; } .w4 { grid-column: span 4; } .w5 { grid-column: span 5; }
.w6 { grid-column: span 6; } .w7 { grid-column: span 7; } .w8 { grid-column: span 8; } .w12 { grid-column: span 12; }
@media (max-width: 1080px) { .w3, .w4, .w5 { grid-column: span 6; } .w7, .w8 { grid-column: span 12; } .w6 { grid-column: span 6; } }
@media (max-width: 720px) { .grid > * { grid-column: span 12 !important; } }

/* ---------- Demo card ---------- */
.demo {
  scroll-margin-top: 96px;   /* anchor links land below the fixed nav */
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  min-width: 0;
}
.demo .stage {
  position: relative; height: var(--h, 360px); overflow: hidden; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.demo .stage > canvas { width: 100% !important; height: 100% !important; display: block; }
/* The title comes first in the DOM (read before the demo); visually it sits below. */
.demo > .meta { order: 2; }
.demo .meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 18px 20px 20px; }
.demo .num { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-top: 5px; }
.demo h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.demo .meta p { grid-column: 2; margin: 0; color: var(--mute); font-size: 14px; }
.demo .tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 0; }
.demo .tags li { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--mute); }
.demo .tags li.hf { border-color: color-mix(in oklab, var(--accent) 60%, transparent); color: var(--accent); }
.demo .tags li.three { border-color: color-mix(in oklab, var(--violet) 60%, transparent); color: var(--violet); }

/* Overlay controls inside stages */
.controls {
  position: absolute; left: 12px; bottom: 12px; right: 12px; z-index: 3;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; pointer-events: none;
}
.controls > * { pointer-events: auto; }
.btn {
  border: 1px solid rgba(243, 237, 228, .22); background: rgba(14, 12, 11, .55); color: #f3ede4;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background .2s, border-color .2s, transform .2s;
}
.btn:hover { background: rgba(255, 106, 26, .25); border-color: var(--accent); }
.btn.on { background: var(--accent); color: #140b05; border-color: var(--accent); }
.hint { position: absolute; top: 12px; right: 12px; z-index: 3; color: rgba(243, 237, 228, .7); background: rgba(14, 12, 11, .45); padding: 4px 9px; border-radius: 999px; pointer-events: none; font-size: 10.5px; }
.controls label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #f3ede4; background: rgba(14, 12, 11, .55); padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(243, 237, 228, .22); }
.controls input[type="range"] { width: 110px; accent-color: var(--accent); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); pointer-events: none; }
.loading[hidden] { display: none; }

/* ---------- Off-screen demos pause ---------- */
/* A card scrolled out of view freezes every CSS animation inside it. */
.stopped *, .stopped *::before, .stopped *::after { animation-play-state: paused !important; }
/* One-time intros still finish; only looping motion stops. */
.hero.stopped h1 .w,
.stopped .flask .outline, .stopped .flask .liquid-level, .stopped .wordmark span, .stopped .tagline { animation-play-state: running !important; }

/* ---------- Table of contents ---------- */
.toc { padding: 100px var(--gutter) 0; max-width: 1400px; margin: 0 auto; }
.toc-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.toc-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 5vw, 64px); line-height: 1; }
.toc-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.toc-filter button { border: 1px solid var(--line-2); background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--mute); }
.toc-filter button.on { color: var(--ink); border-color: var(--ink); }
.toc ol { list-style: none; margin: 0; padding: 0; columns: 3 280px; column-gap: 32px; }
.toc li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.toc li a { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: baseline; padding: 10px 0; text-decoration: none; transition: color .2s, padding .25s; }
.toc li a:hover { color: var(--accent); padding-left: 6px; }
.toc li .n { font-family: var(--mono); font-size: 11px; color: var(--mute); }
.toc li .k { width: 8px; height: 8px; border-radius: 50%; }
.toc li.hide { display: none; }
.dot-claude { background: var(--mint); } .dot-three { background: var(--violet); } .dot-hf { background: var(--accent); }

/* ---------- Footer ---------- */
footer.site { padding: 120px var(--gutter) 60px; max-width: 1400px; margin: 0 auto; }
footer.site h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 88px); line-height: 1; margin: 0 0 40px; }
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.pipeline > div { border-top: 1px solid var(--line-2); padding-top: 16px; }
.pipeline h3 { margin: 8px 0 6px; font-size: 17px; }
.pipeline p { margin: 0; color: var(--mute); font-size: 14px; }
@media (max-width: 900px) { .pipeline { grid-template-columns: 1fr 1fr; } }
.fine a { display: inline-block; padding: 6px 0; }
footer.site.compact { padding: 48px var(--gutter) 40px; }
footer.site.compact .fine { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Previous / next chapter ---------- */
.pager { max-width: 1400px; margin: 80px auto 0; padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pager-link { display: flex; flex-direction: column; gap: 6px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); text-decoration: none; transition: transform .25s, border-color .25s; }
.pager-link.next { text-align: right; align-items: flex-end; }
.pager-link .mono { color: var(--mute); }
.pager-link b { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 3vw, 38px); line-height: 1.05; }
.pager-link.prev b::before { content: "\2190  "; color: var(--accent); }
.pager-link.next b::after { content: "  \2192"; color: var(--accent); }
.pager-link:hover { transform: translateY(-2px); border-color: var(--line-2); }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } }

/* ---------- Home: chapter cards ---------- */
.chapters { padding: 100px var(--gutter) 0; max-width: 1400px; margin: 0 auto; }
.toc-head p.mono { color: var(--mute); margin: 0; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 28px; }
.chapter-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px; min-height: 250px; isolation: isolate; overflow: hidden;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--card); text-decoration: none; transition: transform .3s, border-color .3s;
}
.chapter-card::before {
  content: ""; position: absolute; right: -30%; bottom: -55%; width: 80%; aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background: radial-gradient(var(--c), transparent 65%); opacity: .22; transition: opacity .4s, transform .6s;
}
.chapter-card:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--c) 55%, transparent); }
.chapter-card:hover::before { opacity: .42; transform: scale(1.25); }
.cc-num { color: var(--c); }
.chapter-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }
.chapter-card p { margin: 0; color: var(--mute); font-size: 14px; }
.cc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--mute); }
.cc-go { color: var(--c); font-size: 20px; transition: transform .3s; }
.chapter-card:hover .cc-go { transform: translateX(5px); }
.fine { margin-top: 64px; color: var(--mute); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
@keyframes cue { 0%, 100% { transform: scaleY(.3); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* View transition used by the theme toggle */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- jump.dk ad: sticky, bottom left, in jump.dk's own colours ---------- */
.jump-ad { position: fixed; left: 16px; bottom: 16px; z-index: 45; width: min(312px, calc(100vw - 32px)); }
.jump-ad[hidden] { display: none; }
.jump-ad-link {
  display: grid; gap: 10px; padding: 14px 16px 15px; border-radius: 16px; text-decoration: none;
  background: #f2ece0; color: #1e1a14;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .6), 0 0 0 1px rgba(30, 26, 20, .12);
  transition: transform .25s, box-shadow .25s;
}
.jump-ad-link:hover { transform: translateY(-2px); box-shadow: 0 24px 46px -14px rgba(0, 0, 0, .65), 0 0 0 1px rgba(200, 78, 31, .45); }
.jump-ad-logo { width: 100px; height: auto; display: block; }
.jump-ad-body { display: grid; gap: 4px; }
.jump-ad-label { font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #8a7d6c; }
.jump-ad-title { font-family: var(--serif); font-weight: 400; font-size: 21px; line-height: 1.1; letter-spacing: -0.005em; }
.jump-ad-text { font-size: 13px; line-height: 1.45; color: #4a4238; }
.jump-ad-cta { margin-top: 5px; font-weight: 600; font-size: 13.5px; color: #c84e1f; }
.jump-ad-cta span { display: inline-block; transition: transform .25s; }
.jump-ad-link:hover .jump-ad-cta span { transform: translateX(4px); }
.jump-ad-close {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(30, 26, 20, .07); color: #1e1a14; font-size: 17px; line-height: 1; cursor: pointer;
}
.jump-ad-close:hover { background: rgba(30, 26, 20, .14); }
.jump-ad-link:focus-visible, .jump-ad-close:focus-visible { outline: 2px solid #c84e1f; outline-offset: 3px; }
/* After closing: the jump.dk flower stays in the corner and opens the ad again. */
.jump-ad-pill {
  position: fixed; left: 16px; bottom: 16px; z-index: 45; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: #f2ece0;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .6), 0 0 0 1px rgba(30, 26, 20, .12);
  transition: transform .25s, box-shadow .25s;
}
.jump-ad-pill[hidden] { display: none; }
.jump-ad-pill img { width: 38px; height: 38px; display: block; }
.jump-ad-pill:hover { transform: scale(1.08) rotate(-8deg); box-shadow: 0 16px 32px -10px rgba(0, 0, 0, .65), 0 0 0 1px rgba(200, 78, 31, .45); }
.jump-ad-pill:focus-visible { outline: 2px solid #c84e1f; outline-offset: 3px; }
/* Phones: a slim bar with the logo, the question and the link; the page gets room for it. */
@media (max-width: 640px) {
  .jump-ad { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .jump-ad-link { grid-template-columns: 70px 1fr; align-items: center; gap: 12px; padding: 10px 44px 10px 12px; border-radius: 14px; }
  .jump-ad-logo { width: 70px; }
  .jump-ad-label, .jump-ad-text { display: none; }
  .jump-ad-title { font-size: 16px; }
  .jump-ad-cta { margin: 0; font-size: 12px; }
  .jump-ad-close { top: 50%; translate: 0 -50%; }
  .jump-ad-pill { left: 10px; bottom: 10px; width: 52px; height: 52px; }
  .jump-ad-pill img { width: 34px; height: 34px; }
  body:has(.jump-ad:not([hidden])) { padding-bottom: 86px; }
}
@media print { .jump-ad, .jump-ad-pill { display: none; } }
