/* Home: dark hero panel with the service deck, proof row, case tiles, engagements, founder strip.
   Static end-states only; entrances and reveals live in motion.css (Task 8). */

/* ---- Hero panel ---- */
/* Full-bleed like every page's top panel: no outer margin or corners; the gutter moves into the side padding. */
.hero { margin: 0; min-height: min(100svh, 980px); background: radial-gradient(120% 80% at 50% 110%, #3a3a3a 0%, #121212 45%, #050505 100%); color: #fff; overflow: clip; padding: 128px calc(2 * var(--gutter)) 52px; display: grid; justify-items: center; align-content: center; gap: 26px; }
/* Beams sit behind the copy; the copy is positioned so it paints above them, under the grain. */
.hero > :not(.hero-beams) { position: relative; }
.hero-beams { position: absolute; inset: 0; pointer-events: none; }
.hero-beams i { position: absolute; top: -10%; bottom: -10%; width: 22%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .07), transparent); filter: blur(24px); }
.hero-beams i:nth-child(1) { left: 18%; }
.hero-beams i:nth-child(2) { left: 46%; width: 14%; }
.hero-beams i:nth-child(3) { left: 70%; }
/* A soft horizon under the deck, like a table edge catching light. */
.hero::before { content: ""; position: absolute; left: 50%; bottom: -56%; width: 140%; aspect-ratio: 2.4; translate: -50% 0; border-radius: 50%; border-top: 1px solid rgb(255 255 255 / .16); background: radial-gradient(60% 40% at 50% 0%, rgb(255 255 255 / .08), transparent 70%); pointer-events: none; }

.hero-title { font-size: clamp(48px, 7.2vw, 112px); line-height: .92; letter-spacing: -0.03em; text-align: center; color: #f2f2f1; }
.hero-title .line { display: block; overflow: clip; padding-bottom: .06em; }
.hero-title .line > span { display: inline-block; }

/* Swivel word: a one-line window over a vertical stack; the 4th word repeats the 1st so the loop is seamless. */
.swivel-word { display: inline-flex; flex-direction: column; height: 1lh; overflow: clip; vertical-align: top; text-align: left; font-style: italic; }
.swivel-word > span { display: block; animation: swivel 8.4s var(--ease-in-out) infinite; }
@keyframes swivel {
  0%, 27% { transform: translateY(0); }
  33.3%, 60% { transform: translateY(-100%); }
  66.6%, 94% { transform: translateY(-200%); }
  100% { transform: translateY(-300%); }
}
@media (prefers-reduced-motion: reduce) {
  .swivel-word > span { animation: none; }
}

.hero-lede { max-width: 56ch; margin: 0; text-align: center; color: var(--muted-inv); font-size: 17px; line-height: 1.6; text-wrap: pretty; }

/* ---- Service deck ---- */
.svc-row { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 20px); width: min(1120px, 100%); padding: 0; margin: 22px 0 0; }
/* No static transform on .svc-card: the deal-in animation (Task 8) owns it. The card is a flat projection plane
   (perspective, no preserve-3d): .svc-inner's 3D turn is flattened onto it and paints above it, so a tilted or
   turned face never sinks behind the <li> in hit testing (links and text selection on the back keep working). */
.svc-card { position: relative; aspect-ratio: 5 / 7; perspective: 1200px; }
.svc-inner { position: relative; height: 100%; transform-style: preserve-3d; transition: transform 600ms var(--ease-in-out); }
/* CSS flip for touch, keyboard-only and reduced motion. With html.has-tilt (js/cards.js) springs own the inline
   transform, so this rule and the transition step aside instead of fighting it every frame. */
html:not(.has-tilt) .svc-card[data-flipped] .svc-inner { transform: rotateY(180deg); }
.has-tilt .svc-inner { transition: none; }
/* Keyboard flips (data-kbd from js/cards.js) stay inside UI-feedback time; reduced motion keeps transition: none. */
.svc-card[data-kbd] .svc-inner { transition-duration: 240ms; }
/* The reset comes first so the face styles below win over `all: unset`. */
.svc-flip { all: unset; box-sizing: border-box; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.svc-face { position: absolute; inset: 0; border-radius: 22px; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: linear-gradient(180deg, #121212, #050505 55%); color: #fff; border: 1px solid var(--line-inv); box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 30px 60px -30px rgb(0 0 0 / .8); padding: 18px 18px 24px; display: grid; grid-template-rows: auto 1fr auto; overflow: clip; }
.svc-flip:focus-visible, .svc-back:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* The back scrolls only as a safety net; the breakpoints keep cards wide enough that the copy fits. */
.svc-back { padding: 16px; transform: rotateY(180deg); grid-template-rows: auto 1fr; align-content: start; gap: 12px; background: #121212; pointer-events: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
/* .svc-inner shares the faces' plane, so at 179.99deg it can tie with the back in 3D hit testing and swallow
   clicks: only the faces take the pointer (the card's own box catches the rest, e.g. under a lifted face). */
.svc-inner { pointer-events: none; }
.svc-front { pointer-events: auto; }
.svc-card[data-flipped] .svc-back { pointer-events: auto; }
.svc-card[data-flipped] .svc-front { pointer-events: none; }
.svc-back p { margin: 0; }
.svc-back .label { color: var(--muted-inv); }
.svc-back p:not(.label) { font-size: 13px; line-height: 1.5; color: rgb(255 255 255 / .86); align-self: end; }
.svc-back a { color: #fff; }

.svc-corner { display: grid; justify-items: center; align-content: start; gap: 4px; justify-self: start; line-height: 1; color: rgb(255 255 255 / .9); }
.svc-corner b { font: 400 22px/1 var(--serif); }
.svc-corner i { font-style: normal; font-size: 14px; font-family: var(--mono); }

/* The art bleeds into the face's top and side padding (the PNGs carry ~10% transparent margin) so the drawing
   reads at roughly 80% of the card; its box ends 8px above the name row so the name keeps clear space. */
.svc-corner { position: relative; z-index: 1; }
.svc-art { grid-row: 2; align-self: stretch; justify-self: stretch; min-height: 0; width: 100%; height: 100%; object-fit: contain; }
img.svc-art { width: calc(100% + 36px); height: calc(100% + 12px); margin: -20px -18px 8px; scale: 1.08; }
/* Fallback for a service without art: a grainy pool of light holding a large, faint suit. */
.svc-art--empty { position: relative; display: grid; place-items: center; margin: -18px -18px 0; border-radius: 50%; background: radial-gradient(closest-side, rgb(255 255 255 / .13), rgb(255 255 255 / .04) 55%, transparent); }
.svc-art--empty::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: .35; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.svc-art--empty span { font: 400 clamp(64px, 7vw, 108px)/1 var(--serif); color: rgb(255 255 255 / .2); }
.svc-name { grid-row: 3; font: 400 clamp(20px, 1.7vw, 27px)/1 var(--serif); letter-spacing: -0.01em; text-align: center; text-wrap: balance; padding: 0 12px; }

/* Written every spring frame on the front button: not inherited, so the face's children skip the style recalc. */
@property --gx { syntax: "<percentage>"; inherits: false; initial-value: 50%; }
@property --gy { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@media (hover: hover) and (pointer: fine) {
  .svc-front { transition: border-color 200ms ease; }
  .svc-front:hover { border-color: rgb(255 255 255 / .28); }
  /* M3 glare: a soft highlight placed from the sprung tilt (--gx/--gy from js/cards.js); only while springs tilt. */
  .has-tilt .svc-front::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgb(255 255 255 / .16), transparent 45%); opacity: 0; transition: opacity 200ms ease; pointer-events: none; }
  .has-tilt .svc-card:hover .svc-front::before { opacity: 1; }
  /* The other cards step back while one is held. After the deal-in (intro-done) so it never overrides that transition. */
  .js.intro-done .svc-row .svc-card { transition: opacity 200ms ease; }
  .intro-done .svc-row.has-hover .svc-card:not(:hover) { opacity: .7; }
}

/* Without JS there is nothing to flip: the back renders under the front as plain copy. */
html:not(.js) .svc-card { aspect-ratio: auto; }
html:not(.js) .svc-inner { height: auto; }
/* The front is still a <button> without JS; cursor: default keeps it from promising a flip it cannot do. */
html:not(.js) .svc-front { position: relative; width: 100%; aspect-ratio: 5 / 7; cursor: default; }
html:not(.js) .svc-back { position: static; transform: none; margin-top: 10px; pointer-events: auto; box-shadow: none; }

/* Below ~1180px five columns would shrink cards under ~200px and clip the back copy: switch to a snap row. */
@media (max-width: 1180px) {
  .hero { padding-top: 120px; }
  /* Bleeds to the panel edges; side padding lets the first and last card snap to the centre. */
  .svc-row { --card-w: min(62vw, 300px); grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: var(--card-w); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; width: calc(100% + 2 * var(--gutter)); margin-inline: calc(-1 * var(--gutter)); padding: 8px calc(50% + var(--gutter) - var(--card-w) / 2) 28px; }
  .svc-row::-webkit-scrollbar { display: none; }
  .svc-card { scroll-snap-align: center; }
  .svc-name { font-size: 24px; }
}
@media (min-width: 640px) and (max-width: 1180px) {
  .svc-row { --card-w: min(34vw, 300px); }
}
/* A mouse cannot swipe the snap row, so fine pointers get two cues that it scrolls sideways: the cards fade out at the
   panel edges instead of being cut, and a thin scrollbar sits under them (macOS shows it while scrolling). */
@media (max-width: 1180px) and (hover: hover) and (pointer: fine) {
  .svc-row { scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .28) transparent; -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
  .svc-row::-webkit-scrollbar { display: block; height: 6px; }
  .svc-row::-webkit-scrollbar-thumb { border-radius: 999px; background: rgb(255 255 255 / .28); }
}

/* ---- Proof row ---- */
.proof-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: clamp(56px, 8vw, 112px) var(--gutter) 0; padding: 0 clamp(0px, 2vw, 28px); }
.proof-row > div { display: grid; align-content: start; gap: 14px; padding: 8px clamp(16px, 2vw, 32px) 8px; border-left: 1px solid var(--line); }
.proof-row > div:first-child { border-left: 0; padding-left: 0; }
.proof-row strong { font: 400 clamp(44px, 5vw, 76px)/1 var(--serif); letter-spacing: -0.03em; font-variant-numeric: lining-nums; }
.proof-row .label { color: var(--muted); }
@media (max-width: 760px) {
  .proof-row { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
  .proof-row > div:nth-child(odd) { border-left: 0; padding-left: 0; }
}

/* ---- Work ---- */
.work { margin-top: clamp(96px, 12vw, 176px); }
.work-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 24px 48px; padding: 0 calc(var(--gutter) + clamp(0px, 2vw, 28px)); margin-bottom: clamp(40px, 5vw, 64px); }
.work-head h2 { font-size: clamp(52px, 7vw, 104px); line-height: .9; letter-spacing: -0.03em; }
.work-head p { margin: 0; max-width: 42ch; color: var(--muted); font-size: 17px; line-height: 1.55; text-wrap: pretty; }
@media (max-width: 760px) {
  .work-head { grid-template-columns: minmax(0, 1fr); }
}

/* Work experience, then Advisory: each group opens with a mono label on a hairline, like More engagements. */
.work-group + .work-group { margin-top: clamp(80px, 9vw, 128px); }
.work-group-title { margin: 0 var(--gutter) clamp(28px, 3vw, 40px); padding: 0 clamp(0px, 2vw, 28px) 18px; border-bottom: 1px solid var(--line); font: 500 11px/1.3 var(--mono); letter-spacing: .06em; color: var(--muted); }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px var(--gutter); padding: 0 var(--gutter); }
.case-tile { display: grid; gap: 18px; align-content: start; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; transition: scale 140ms var(--ease-out); }
/* M18 at tile scale: the whole tile gives by a hair under a press, so a tap on touch (no hover) still answers. */
.case-tile:active { scale: .985; }
.case-tile:focus-visible { outline-offset: 6px; border-radius: var(--r-tile); }
.tile-media { aspect-ratio: 16 / 11; border-radius: var(--r-tile); overflow: clip; position: relative; }
.case-tile--dark .tile-media { background: radial-gradient(90% 70% at 50% 40%, #2a2a2a, #1d1d1d 70%); color: #fff; }
.case-tile--light .tile-media { background: radial-gradient(90% 70% at 50% 40%, #f1f1f0, var(--tile-grey) 70%); color: var(--ink); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
/* An odd last tile spans the row as a wide band instead of leaving a hole. */
.case-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.case-tile:last-child:nth-child(odd) .tile-media { aspect-ratio: 32 / 11; }

.tile-fallback { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 22px; padding: 32px; text-align: center; }
.tile-logo { width: 140px; height: 48px; background: currentColor; -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; opacity: .9; }
.tile-metric { margin: 0; display: grid; justify-items: center; gap: 12px; }
.tile-metric b { font: 400 clamp(56px, 7vw, 104px)/1 var(--serif); letter-spacing: -0.03em; display: block; text-align: center; }
.case-tile--dark .tile-metric .label { color: var(--muted-inv); }
.case-tile--light .tile-metric .label { color: var(--muted); }

.tile-arrow { position: absolute; top: 18px; right: 18px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ink); transform: rotate(-45deg); transition: transform 200ms var(--ease-out); box-shadow: 0 6px 16px -8px rgb(0 0 0 / .4); }
.tile-arrow .icon { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  .case-tile:hover .tile-arrow { transform: rotate(0deg); }
}

.tile-caption { display: grid; gap: 0; padding: 0 4px; }
.tile-caption p { margin: 0; }
.tile-caption .label { color: var(--muted); }
.tile-caption .tile-sub { text-wrap: pretty; }
.tile-caption h3 { font: 400 26px/1.1 var(--serif); letter-spacing: -0.01em; margin: 8px 0 6px; text-wrap: balance; }
@media (max-width: 760px) {
  .tile-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .case-tile:last-child:nth-child(odd) .tile-media { aspect-ratio: 16 / 11; }
  .tile-caption h3 { font-size: 24px; }
}

/* ---- More engagements ---- */
.engagements { margin: clamp(96px, 11vw, 160px) var(--gutter) 0; padding: 0 clamp(0px, 2vw, 28px); }
.engagements > h2.label { font: 500 11px/1.3 var(--mono); letter-spacing: .06em; color: var(--muted); padding-bottom: 18px; }
.engagement-list { border-top: 1px solid var(--line); }
.engagement { border-bottom: 1px solid var(--line); }
.engagement summary { list-style: none; display: grid; grid-template-columns: 120px minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .8fr) 24px; align-items: baseline; gap: 8px 24px; padding: 26px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.engagement summary::-webkit-details-marker { display: none; }
.engagement summary::after { content: "+"; justify-self: end; font: 300 24px/1 var(--sans); transition: transform 200ms var(--ease-out); }
.engagement[open] summary::after { transform: rotate(45deg); }
.engagement summary:focus-visible { outline-offset: 4px; }
.engagement summary .label { color: var(--muted); }
.engagement summary strong { font: 400 clamp(22px, 2vw, 28px)/1.1 var(--serif); letter-spacing: -0.01em; }
.engagement summary small { font: 400 13px/1.4 var(--mono); color: var(--muted); }
.engagement summary .label:last-of-type { color: var(--ink); }
.engagement-body { display: grid; gap: 14px; max-width: 60ch; margin-left: calc(120px + 24px); padding: 0 0 36px; }
.engagement-body h3 { font-size: 28px; line-height: 1.05; }
.engagement-body p { margin: 0; line-height: 1.6; }
.engagement-body .case-context { max-width: 72ch; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.engagement-body .case-context a { color: var(--ink); text-decoration-thickness: 1px; }
.engagement-body .case-context span { font: 500 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-right: 10px; color: var(--ink); }
.engagement-body .case-link { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px; transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease; }
.engagement-body .case-link:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .engagement summary:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
  .engagement-body .case-link:hover { background: var(--card); border-color: rgb(0 0 0 / .2); }
}
.source-note { margin: 28px 0 0; max-width: 72ch; color: var(--muted); font-size: 13px; line-height: 1.6; }
@media (max-width: 760px) {
  .engagement summary { grid-template-columns: minmax(0, 1fr) 24px; gap: 6px 16px; padding: 22px 0; }
  .engagement summary > * { grid-column: 1; }
  .engagement summary::after { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
  .engagement-body { margin-left: 0; }
}

/* ---- Founder strip ---- */
.founder-strip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px 28px; margin: clamp(80px, 9vw, 128px) var(--gutter) clamp(72px, 8vw, 112px); padding: 20px clamp(20px, 2.4vw, 32px) 20px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-tile); }
.founder-strip img { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; object-position: center 18%; filter: grayscale(1) contrast(1.05); }
.founder-copy p { margin: 0; max-width: 64ch; color: var(--muted); font-size: 15px; line-height: 1.5; }
.founder-copy .founder-name { font: 400 26px/1.1 var(--serif); letter-spacing: -0.01em; color: var(--ink); margin-bottom: 4px; }
.founder-link { display: inline-flex; align-items: center; gap: 8px; padding: 14px 20px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; transition: transform 140ms var(--ease-out), background-color 160ms ease; -webkit-tap-highlight-color: transparent; }
.founder-link:active { transform: scale(.97); }
.founder-link:focus-visible { border-radius: 999px; }
@media (hover: hover) and (pointer: fine) {
  .founder-link:hover { background: var(--ink-2); }
}
@media (prefers-reduced-motion: reduce) {
  .founder-link:active, .engagement-body .case-link:active { transform: none; }
  .case-tile:active { scale: none; }
  .svc-inner { transition: none; }
}
@media (max-width: 640px) {
  .founder-strip { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .founder-link { grid-column: 1 / -1; justify-content: center; }
}
