/* ==========================================================
   Home page
   ========================================================== */

/* ---------- Loader: counter (A) + project images flicking in a framed
   window that finally opens into the first hero slide ---------- */
.loader { position: fixed; inset: 0; z-index: 100; color: var(--paper);
  animation: loader-failsafe 0s 12s forwards; /* if a script ever fails, never trap the page behind the loader */ }
@keyframes loader-failsafe { to { visibility: hidden; } }
.loader__bg { position: absolute; inset: 0; background: var(--ink); }
/* same box as the hero slides, so the final image hands over seamlessly */
.loader__frame { position: absolute; inset: 0 0 auto var(--slides-left); height: max(560px, 100svh); overflow: hidden; clip-path: inset(50% 50% 50% 50%); }
.loader__frame img { position: absolute; inset: 0; opacity: 0; transform: scale(1.15); filter: grayscale(0.15) contrast(1.05); }
.loader__frame img.is-on { opacity: 1; }
.loader__win { position: absolute; left: 50%; top: 50%; width: min(24vw, 300px); aspect-ratio: 4 / 5; translate: -50% -50%; pointer-events: none; }
.loader__win::before, .loader__win::after { content: ""; position: absolute; width: 18px; height: 18px; border: 0 solid var(--accent); }
.loader__win::before { left: -10px; top: -10px; border-width: 1px 0 0 1px; }
.loader__win::after { right: -10px; bottom: -10px; border-width: 0 1px 1px 0; }
.loader__cap { position: absolute; left: -10px; top: calc(100% + 16px); display: flex; gap: 1rem; font: 400 0.68rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute-d); white-space: nowrap; }
.loader__cap b { font-weight: 500; color: var(--paper); }
/* same place and size as the nav logo (.brand), so it hands over without a jump */
.loader__mark { position: absolute; left: var(--gut); top: var(--gut); width: var(--logo-w); }
.loader__mark svg { width: 100%; height: auto; display: block; overflow: visible; }
.loader__mark path { fill: transparent; stroke: var(--accent); stroke-width: 20; stroke-linejoin: round; transition: fill 0.45s var(--ease); }
.loader__mark.is-drawn path { fill: var(--accent); }
.loader__count { position: absolute; left: var(--gut); bottom: var(--gut); font-size: clamp(5rem, 18vw, 16rem); font-weight: 500; line-height: 0.8; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.loader__meta { position: absolute; right: var(--gut); bottom: var(--gut); font: 400 0.75rem/1.5 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute-d); text-align: right; }
@media (max-width: 700px) { .loader__win { width: 52vw; } .loader__meta { display: none; } }

/* ---------- Hero carousel (direction A) ---------- */
.stage { position: relative; height: 100svh; min-height: 560px; background: var(--ink); color: var(--paper); overflow: hidden; cursor: grab; user-select: none; touch-action: pan-y; }
.stage.is-dragging { cursor: grabbing; }
.stage__slides { position: absolute; inset: 0 0 0 var(--slides-left); }
.slide { position: absolute; inset: 0; clip-path: inset(0% 0% 0% 100%); overflow: hidden; }
.slide.is-active { clip-path: inset(0% 0% 0% 0%); z-index: 2; }
.slide img, .slide video { transform: scale(1.15); filter: grayscale(0.15) contrast(1.05); pointer-events: none; user-select: none; -webkit-user-drag: none; }
.slide video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* framing per project (home.js heroImg): --pos for the landscape hero, --pos-m on portrait
   screens, where projects with an upright heroM swap to it through <picture> */
.slide picture, .loader__frame picture { display: contents; }
.slide img, .loader__frame img { object-position: var(--pos, 50% 50%); }
@media (max-aspect-ratio: 4/5) { .slide img, .loader__frame img { object-position: var(--pos-m, var(--pos, 50% 50%)); } }
.stage__shade { position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, var(--ink) 0%, rgb(20 20 19 / 0.55) 28%, transparent 60%), linear-gradient(0deg, rgb(20 20 19 / 0.7), transparent 35%); }

.stage__info { position: absolute; z-index: 4; left: var(--gut); top: 38%; }
.stage__title { font-size: clamp(3.5rem, 11vw, 11rem); font-weight: 500; line-height: 0.9; letter-spacing: -0.045em; white-space: nowrap; }
.stage__meta { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.9rem; opacity: 0.85; }
.stage__meta em { font-size: 1.15em; }
.stage__view { display: inline-flex; gap: 0.6rem; align-items: center; margin-top: 1.5rem; padding: 0.6rem 1rem; border: 1px solid var(--line-d); border-radius: 100px; font-size: 0.85rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgb(255 255 255 / 0.04); transition: background 0.35s var(--ease), color 0.35s var(--ease); }
.stage__view:hover { background: var(--paper); color: var(--ink); }

.stage__index { position: absolute; z-index: 4; left: var(--gut); right: var(--gut); bottom: 5.5rem; display: flex; gap: clamp(1.5rem, 6vw, 7rem); }
.stage__index button { font-size: clamp(1.4rem, 2.6vw, 2.4rem); font-weight: 500; letter-spacing: -0.03em; opacity: 0.22; transition: opacity 0.4s var(--ease); }
.stage__index button.is-active { opacity: 1; }
.stage__index button:hover { opacity: 0.6; }

.stage__bar { position: absolute; z-index: 4; inset: auto var(--gut) 1.5rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; font-size: 0.8rem; }
/* the line is the autoplay timer: it fills, then the next slide comes in */
.stage__progress { position: absolute; left: 0; width: min(28vw, 360px); top: -1rem; height: 1px; background: var(--line-d); }
.stage__progress i { position: absolute; inset: 0; background: var(--paper); transform-origin: left; transform: scaleX(0); }
.stage__arrows { display: flex; gap: 1.5rem; align-items: center; }
.stage__arrows button { font-size: 1rem; padding: 0.25rem 0.5rem; transition: transform 0.3s var(--ease); }
.js-prev:hover { transform: translateX(-4px); }
.js-next:hover { transform: translateX(4px); }
.stage__auto { justify-self: end; display: inline-flex; align-items: center; gap: 0.55rem; font-size: 0.8rem; }
.stage__auto i { width: 9px; height: 10px; display: block; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.stage__auto[aria-pressed="false"] i { border: 0; width: 0; height: 0; border-left: 9px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
@media (max-width: 700px) {
  .stage__info { top: auto; bottom: 9.5rem; }
  .stage__meta { flex-direction: row; gap: 0.75rem; margin-top: 0.75rem; }
  .stage__view { margin-top: 1rem; }
  .stage__bar { grid-template-columns: auto 1fr; }
  .stage__hint { display: none; }
}

/* ---------- Statement (A) ---------- */
.statement { padding: clamp(6rem, 14vw, 12rem) var(--gut) clamp(5rem, 10vw, 9rem); display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem var(--gut); }
.statement .eyebrow { grid-column: 1 / -1; margin-bottom: 2rem; }
.statement__text { grid-column: 1 / 11; font-size: clamp(2.2rem, 5.6vw, 5.4rem); font-weight: 500; line-height: 0.98; letter-spacing: -0.04em; }
.has-motion .statement__text .w { opacity: 0.12; } /* words light up as you scroll */
.statement__text em { letter-spacing: -0.02em; }
.statement__side { grid-column: 8 / 13; margin-top: clamp(2rem, 5vw, 4rem); display: grid; gap: 1.5rem; justify-items: start; color: var(--ink-3); }
.statement__ctas { display: flex; flex-wrap: wrap; gap: 0.6rem; }
@media (max-width: 800px) { .statement__text, .statement__side { grid-column: 1 / -1; } }

/* ---------- Work grid (A) ---------- */
.work { padding: 0 var(--gut) clamp(6rem, 12vw, 10rem); }
.work__head { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 1rem; }
.work__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(3rem, 7vw, 7rem) var(--gut); margin-top: 3rem; }
.card { display: block; }
.card:nth-child(4n+1) { grid-column: 1 / 7; }
.card:nth-child(4n+2) { grid-column: 8 / 13; margin-top: 30%; }
.card:nth-child(4n+3) { grid-column: 2 / 7; }
.card:nth-child(4n+4) { grid-column: 7 / 13; margin-top: 12%; }
.card__num { display: block; text-align: right; font-size: 0.8rem; margin-bottom: 0.6rem; }
.card__img { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--paper-2); border-radius: 2px; }
.card:nth-child(4n+4) .card__img, .card:nth-child(4n+1) .card__img { aspect-ratio: 5 / 4; }
.card__img img { transform: scale(1.08); transition: transform 1.2s var(--ease); }
.card:hover .card__img img { transform: scale(1); }
.card__meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.9rem; font-size: 0.9rem; }
.card__name { font-weight: 500; }
.card__cat { color: var(--mute); }
.card__line { margin-top: 0.3rem; color: var(--ink-3); font-size: 0.9rem; max-width: 36ch; opacity: 0; transform: translateY(6px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.card:hover .card__line, .card:focus-visible .card__line { opacity: 1; transform: none; }
/* Other projects: a compact list under the grid (the cursor previews each image) */
.others { margin-top: clamp(5rem, 10vw, 8rem); }
.others__list { margin-top: 1rem; border-top: 1px solid var(--line); }
.others__list a { display: grid; grid-template-columns: minmax(8rem, 3fr) 6fr 3fr auto; align-items: baseline; gap: 1rem var(--gut); padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.others__name { font-size: clamp(1.6rem, 3.2vw, 2.8rem); font-weight: 500; line-height: 1; letter-spacing: -0.04em; transition: transform 0.6s var(--ease), color 0.3s; }
.others__line { color: var(--ink-3); font-size: 0.95rem; }
.others__meta { font: 400 0.72rem/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.others__arrow { font-size: 1.1rem; transition: transform 0.4s var(--ease); }
.others__list a:hover .others__name { transform: translateX(0.6rem); color: var(--accent); }
.others__list a:hover .others__arrow { transform: translate(0.2rem, -0.2rem); }
.about__ctas { display: flex; flex-wrap: wrap; gap: 0.6rem; }
@media (max-width: 800px) {
  .card:nth-child(n) { grid-column: 1 / -1; margin-top: 0; }
  .card__line { opacity: 1; transform: none; }
  .others__list a { grid-template-columns: 1fr auto; }
  .others__line, .others__meta { grid-column: 1; }
  .others__arrow { grid-column: 2; grid-row: 1; }
}

/* ---------- About (C quote + A portrait/experience) ---------- */
.about { padding: clamp(5rem, 10vw, 9rem) var(--gut); }
.about__quote { font-size: clamp(2.4rem, 6.4vw, 6.8rem); font-weight: 500; line-height: 0.95; letter-spacing: -0.05em; text-align: center; }
.about__quote em { color: var(--accent); }
.about__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gut); align-items: start; margin-top: clamp(4rem, 9vw, 8rem); }
.about__img { grid-column: 1 / 6; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 3px; margin: 0; background: var(--ink-2); }
.about__img img { filter: grayscale(1) contrast(1.05); transform: scale(1.2); }
.about__body { grid-column: 7 / 13; }
.about__body .eyebrow { margin-bottom: 1.5rem; }
.about__title { font-size: clamp(2.4rem, 5vw, 4.6rem); font-weight: 500; line-height: 0.95; letter-spacing: -0.04em; margin-bottom: 2rem; }
.about__bio { color: var(--soft-d); margin-bottom: 2.5rem; max-width: 52ch; }
.about__list { border-top: 1px solid var(--line-d); }
.about__list li { display: grid; grid-template-columns: 7.5rem minmax(0, 1.15fr) minmax(0, 1fr); align-items: baseline; gap: 1rem; padding: 1.05rem 0; border-bottom: 1px solid var(--line-d); font-size: 0.95rem; }
.about__list li > span:first-child { font-family: var(--f-mono); font-size: 0.8rem; color: var(--mute-d); }
/* the company leads, the role follows */
.about__org { display: flex; align-items: center; gap: 0.6rem; font-size: clamp(1.15rem, 1.6vw, 1.4rem); font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; }
.about__org img { width: auto; height: 1.5em; max-width: 4em; object-fit: contain; }
.about__list li > span:last-child { font-family: var(--f-serif); font-style: italic; font-size: 1.05rem; color: var(--mute-d); text-align: right; }
.about__skills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2.5rem 0; }
.about__skills li { border: 1px solid var(--line-d); border-radius: 100px; padding: 0.35rem 0.85rem; font-size: 0.8rem; }
@media (max-width: 800px) {
  .about__img, .about__body { grid-column: 1 / -1; }
  .about__img { max-width: 420px; }
  .about__list li { grid-template-columns: 5.5rem 1fr; }
  .about__list li > span:last-child { grid-column: 2; text-align: left; }
}

/* ---------- Throwable project cards (C) ---------- */
.toss { position: relative; height: 110svh; overflow: hidden; display: grid; place-items: center; background: radial-gradient(60% 50% at 50% 55%, var(--ink-2), var(--ink)); }
.toss__stage { position: absolute; inset: 0; }
.tcard { display: block; color: inherit; position: absolute; width: clamp(130px, 17vw, 250px); aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; cursor: grab;
  touch-action: none; user-select: none; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.6); background: var(--ink-2); will-change: transform; }
.tcard:active { cursor: grabbing; }
.tcard img { pointer-events: none; }
.tcard span { position: absolute; left: 0.7rem; bottom: 0.6rem; font-size: 0.75rem; background: rgb(0 0 0 / 0.55); padding: 0.2rem 0.45rem; border-radius: 2px; }
.toss__text { position: relative; z-index: 0; max-width: 24ch; text-align: center; font-size: clamp(1.3rem, 2.4vw, 2.1rem); line-height: 1.2; letter-spacing: -0.025em; pointer-events: none; }
.toss__hint { position: absolute; bottom: 2rem; left: 50%; translate: -50% 0; font-size: 0.8rem; color: var(--mute-d); white-space: nowrap; }

/* ---------- Tools strip (C) ---------- */
.tools { padding: 3rem 0 5rem; overflow: hidden; }
.tools .eyebrow { padding: 0 var(--gut); margin-bottom: 1.25rem; }
.tools__row { display: flex; gap: 0.75rem; width: max-content; }
.tool { width: clamp(140px, 14vw, 190px); aspect-ratio: 1; border: 1px solid var(--line-d); border-radius: 6px; display: grid; place-items: center; font-weight: 500; letter-spacing: -0.02em; color: var(--soft-d); }
