/* Home page only. Builds on ds.css tokens. */

/* Hero: one big idea, the smile. It draws itself, then bends toward the pointer. */
.hero { position: relative; min-height: calc(100svh - var(--header-h)); display: grid; align-items: center; overflow: hidden; }
.hero__inner { padding-block: clamp(40px, 8vw, 96px); display: grid; gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero__main { min-width: 0; }
.hero__inner { position: relative; z-index: 1; pointer-events: none; }
.hero__main { pointer-events: auto; }
/* The text column must not reach under the wheel, or it would swallow clicks meant for the cars. */
@media (min-width: 1060px) { .hero__main { max-width: 58%; } }

/* Half wheel at the right edge: cars are social links that hang from the rim and stay upright while it turns. */
@property --spin { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
.wheel { --d: 100svh;   /* the wheel is exactly one screen high */ --r: calc(var(--d) / 2); display: none; position: absolute; z-index: 0; right: calc(var(--r) * -1); top: 50%; width: var(--d); height: var(--d); margin-top: calc(var(--r) * -1); }
@media (min-width: 1060px) { .wheel { display: block; } }
@media (prefers-reduced-motion: no-preference) {
  .wheel { animation: spin 80s linear infinite; }
  .wheel:hover, .wheel:focus-within { animation-play-state: paused; }
}
@keyframes spin { to { --spin: 360deg; } }
.wheel__frame { position: absolute; inset: 0; border: 2px solid rgba(244, 241, 234, .3); border-radius: 50%; transform: rotate(var(--spin)); background:
  radial-gradient(circle, var(--accent) 0 5px, transparent 6px),
  repeating-conic-gradient(from 0deg, var(--line-ink) 0 .35deg, transparent .35deg 30deg); -webkit-mask: radial-gradient(circle, #000 0 calc(100% - 2px), transparent 0); mask: radial-gradient(circle, #000 0 calc(100% - 2px), transparent 0); }
.wheel__frame::after { content: ""; position: absolute; inset: 14%; border: 1px dashed var(--line-ink); border-radius: 50%; }
.wheel__cars { list-style: none; position: absolute; inset: 0; }
.wheel__cars li { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: rotate(calc(var(--a) + var(--spin))) translateY(calc(var(--r) * -1)); }
.wheel__car { position: absolute; left: -29px; top: 0; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-3); color: var(--paper); border: 1.5px solid var(--line-ink); box-shadow: 0 14px 30px rgba(0, 0, 0, .45); transform-origin: 29px 0; transform: rotate(calc((var(--a) + var(--spin)) * -1)) translateY(26px); transition: background-color .2s, color .2s, border-color .2s; }
.wheel__car::before { content: ""; position: absolute; left: 50%; top: -26px; height: 26px; width: 2px; background: var(--line-ink); transform: translateX(-50%); }
.wheel__car:hover, .wheel__car:focus-visible { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.wheel__car .icon { width: 26px; height: 26px; }
.hero__title { font-size: clamp(2.7rem, 8.4vw, 7rem); line-height: .96; letter-spacing: -.045em; margin: 0 0 .15em; max-width: 12ch; }
.hero__sub { font-size: clamp(1.3rem, 3.2vw, 2.2rem); font-weight: 600; color: var(--on-ink-muted); margin: 0 0 clamp(20px, 4vw, 48px); }
.smile { width: min(100%, 880px); height: auto; margin: 0 0 clamp(28px, 5vw, 64px); overflow: visible; touch-action: pan-y; }
.smile__path { fill: none; stroke: var(--accent); stroke-width: 15; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .js .smile__path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s .25s var(--ease) forwards; }
  .js .hero__title, .js .hero__sub { animation: lift .9s var(--ease) both; }   /* transform only: the headline is the LCP element and must paint at once */
  .js .hero__paths { animation: rise .9s var(--ease) both; }
  .js .hero__sub { animation-delay: .12s; }
  .js .hero__paths { animation-delay: .5s; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes lift { from { transform: translateY(18px); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.hero__paths { list-style: none; display: grid; gap: .2rem; max-width: 560px; }
.hero__paths a { display: flex; align-items: baseline; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line-ink); font-size: 1.15rem; font-weight: 700; text-decoration: none; transition: padding-left .25s var(--ease), color .2s; }
.hero__paths a:hover { padding-left: .7rem; color: var(--accent); }
.n { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 800; }
.paper .n { color: var(--ink); }

/* Chapter navigation: sticky, shows where you are, a bar fills as you read */
.chapters { position: sticky; top: var(--header-h); z-index: 40; background: rgba(11, 11, 12, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-ink); }
.chapters ol { display: flex; gap: .25rem; list-style: none; padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; max-width: 1240px; margin-inline: auto; }
.chapters ol::-webkit-scrollbar { display: none; }
.chapters a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1rem; font-size: .9rem; font-weight: 700; text-decoration: none; color: var(--on-ink-muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.chapters a:hover { color: var(--paper); }
.chapters a[aria-current="true"] { color: var(--paper); border-bottom-color: var(--accent); }
.chapters__bar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--read, 0)); }
@supports (animation-timeline: scroll()) {
  .chapters__bar { animation: fill linear both; animation-timeline: scroll(root); }
  @keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

.chapter { padding-block: clamp(64px, 10vw, 140px); }
.chapter .section-head h2 { font-size: var(--t-h1); }
.chapter .eyebrow { gap: .8rem; }

/* Project rail */
.rail-controls { display: none; gap: .5rem; }
@media (hover: hover) and (min-width: 720px) { .rail-controls { display: flex; } }
.rail-btn { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 999px; border: 1.5px solid var(--line-ink); background: transparent; color: inherit; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s; }
.rail-btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.rail { display: flex; gap: clamp(16px, 2.4vw, 28px); list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); padding: 0 var(--gutter) 1rem; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; overscroll-behavior-x: contain; }
.rail__item { flex: 0 0 min(82vw, 440px); scroll-snap-align: start; }
@media (min-width: 1240px) { .rail { padding-inline: calc((100vw - 1240px) / 2 + var(--gutter)); scroll-padding-inline: calc((100vw - 1240px) / 2 + var(--gutter)); } }
.rail .media { aspect-ratio: 16 / 10; }

/* Writing index with a cursor-following preview (hover devices only) */
.writing { position: relative; }
.peek { display: none; }
@media (hover: hover) and (min-width: 960px) and (prefers-reduced-motion: no-preference) {
  .peek { display: block; position: fixed; left: 0; top: 0; z-index: 30; width: 300px; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; box-shadow: 0 24px 60px rgba(11, 11, 12, .35); pointer-events: none; opacity: 0; transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(.92) rotate(-2deg); transition: opacity .2s, transform .25s var(--ease); background: var(--ink); }
  .peek.is-on { opacity: 1; transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(1) rotate(-2deg); }
  .peek img { width: 100%; height: 100%; object-fit: cover; }
}
.topics { margin-top: clamp(28px, 4vw, 56px); }

/* Videos */
.videos { list-style: none; }
.card__title a::after { z-index: 0; }

/* Contact + newsletter band */
.contact-band { display: grid; gap: clamp(32px, 6vw, 88px); align-items: center; }
.contact-band h2 { font-size: var(--t-h1); margin-bottom: .5rem; }
@media (min-width: 900px) { .contact-band { grid-template-columns: 1.1fr 1fr; } }
.contact-band__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.newsletter--card { padding: clamp(20px, 3vw, 36px); border: 1.5px solid var(--ink); border-radius: var(--radius); background: #fff; }
.newsletter--card h3 { margin-bottom: .4rem; }
.newsletter--card .field { margin-top: 1rem; }
.newsletter--card .btn { margin-top: 1rem; }

/* Info card shown next to a car on hover or focus (positioned by home.js) */
.wheel-card { position: fixed; z-index: 70; left: 0; top: 0; width: min(300px, calc(100vw - 32px)); padding: 1rem 1.1rem 1.1rem; border: 1px solid var(--line-ink); border-radius: var(--radius); background: var(--ink-2); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); transform: translate3d(var(--x, 0), var(--y, 0), 0); }
.wheel-card[hidden] { display: none; }
/* An invisible margin keeps the card open while the pointer travels from the car to it. */
.wheel-card::before { content: ""; position: absolute; inset: -14px -30px; }
.wheel-card__open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.wheel-card p { margin: 0; }
.wheel-card__thumb { display: grid; gap: .3rem; margin-bottom: .9rem; }
.wheel-card__thumb[hidden] { display: none; }
.wheel-card__thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-s); }
.wheel-card__thumb .eyebrow { margin: .3rem 0 0; font-size: .7rem; }
.wheel-card__thumb-title { font-size: .95rem; line-height: 1.3; }
.wheel-card__name { font-size: 1.15rem; font-weight: 800; }
.wheel-card__text { margin-top: .3rem !important; color: var(--on-ink-muted); font-size: .92rem; line-height: 1.5; }
.wheel-card__host { margin-top: .6rem !important; font-size: .78rem; color: var(--on-ink-muted); word-break: break-all; }
.wheel-card__open { margin-top: .8rem; display: inline-flex; text-decoration: none; align-items: center; gap: .4rem; font-weight: 800; color: var(--accent); }

/* The car that reaches the middle of the wheel is enlarged, ringed and named so it draws the eye and invites a click. */
.wheel__car { transition: background-color .2s, color .2s, border-color .2s, scale .35s var(--ease), box-shadow .35s; }
.wheel__car.is-focus { scale: 1.45; background: var(--accent); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 6px rgba(255, 222, 89, .18), 0 18px 40px rgba(0, 0, 0, .55); z-index: 2; }
.wheel__label { position: absolute; right: calc(100% + 14px); top: 50%; translate: 12px -50%; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: .85rem; font-weight: 800; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .3s, translate .35s var(--ease); }
.wheel__label .icon { width: 1em; height: 1em; }
.wheel__car.is-focus .wheel__label { opacity: 1; translate: 0 -50%; }
@media (prefers-reduced-motion: no-preference) {
  .wheel__car.is-focus::after { content: ""; position: absolute; inset: -9px; border: 2px solid var(--accent); border-radius: 50%; animation: ring 1.8s ease-out infinite; }
}
@keyframes ring { from { opacity: .9; transform: scale(.85); } to { opacity: 0; transform: scale(1.5); } }

/* ---------- Projects: the page scroll drives the rail ----------
   While the section is pinned, scrolling down moves the cards sideways (CSS scroll-driven animation, no JS per frame).
   Without animation-timeline support, with reduced motion, or without a project, the normal swipeable rail is used. */
.pin__foot { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-top: 1.2rem; }
.pin__bar { display: none; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .pin {
      --pinned: 1;
      --stick: calc(var(--header-h) + 49px);
      --stage-h: max(560px, calc(100svh - var(--stick)));
      --gap: clamp(16px, 2.4vw, 28px);
      --card-w: min(82vw, 440px);
      --pad: max(var(--gutter), calc((100vw - 1240px) / 2 + var(--gutter)));
      --travel: max(0px, calc(var(--n) * var(--card-w) + (var(--n) - 1) * var(--gap) + 2 * var(--pad) - 100vw));
      height: calc(var(--stage-h) + var(--travel));
      padding-block: 0;
      view-timeline: --pin block;
    }
    .pin__stage { position: sticky; top: var(--stick); height: var(--stage-h); display: flex; flex-direction: column; justify-content: center; gap: clamp(16px, 3vh, 36px); overflow: clip; }
    .pin .section-head { margin-bottom: 0; }
    .pin .rail-controls { display: none; }
    .pin .rail { overflow: visible; scroll-snap-type: none; width: max-content; padding: 0 var(--pad); gap: var(--gap); animation: pin-slide linear both; animation-timeline: --pin; animation-range: cover calc(100svh - var(--stick)) cover calc(100% - 100svh); will-change: transform; }
    .pin .rail__item { flex: 0 0 var(--card-w); }
    .pin__bar { display: block; flex: 1; max-width: 360px; height: 3px; border-radius: 3px; background: var(--line-ink); overflow: hidden; }
    .pin__bar > span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; animation: pin-fill linear both; animation-timeline: --pin; animation-range: cover calc(100svh - var(--stick)) cover calc(100% - 100svh); }
    @keyframes pin-slide { to { transform: translateX(calc(-1 * var(--travel))); } }
    @keyframes pin-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  }
}

/* ---------- Ventures band (between the projects and the writing): logos and names on white, nothing else ---------- */
.products { background: #fff; padding-block: clamp(32px, 4.5vw, 56px); border-bottom: 1px solid var(--line-paper); }
.products .eyebrow { display: flex; justify-content: center; margin-bottom: 1.2rem; }
.products__list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(24px, 6vw, 80px); }
.product { display: inline-flex; align-items: center; gap: .9rem; padding: .4rem .2rem; text-decoration: none; color: var(--ink); }
.product img { width: 56px; height: 56px; object-fit: contain; flex: none; border-radius: 14px; transition: transform .3s var(--ease); }
.product__name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: .1em; text-underline-offset: .2em; transition: text-decoration-color .2s; }
.product:hover img, .product:focus-visible img { transform: scale(1.08) rotate(-4deg); }
.product:hover .product__name, .product:focus-visible .product__name { text-decoration-color: currentColor; }

/* Site cars show the logo itself on a light disc */
.wheel__car--logo { background: var(--paper); border-color: var(--paper); padding: 7px; }
.wheel__car--logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.wheel__car--logo.is-focus { background: #fff; border-color: var(--accent); }
