/* =====================================================================
   Story layer: hero with travelling video, grain write-on statement,
   full-screen website reel, dark-reveal skills story.
   ===================================================================== */

/* overflow-x:hidden on html/body turns body into a scroll container and
   breaks position:sticky; clip hides the overflow without that */
html, body { overflow-x: clip !important; }

:root {
  --display: "Clash Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --cols-10: calc((100vw - var(--gutter) * 2) * 10 / 12);
}

/* ---------- Hero ---------- */
.jhero {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--header-h) + clamp(24px, 6vh, 72px)) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: var(--paper);
}
.jhero-inner { flex: 1; display: flex; flex-direction: column; }
.jhero-title {
  font-family: var(--display);
  font-size: clamp(40px, 5.4vw, 108px);
  line-height: 1;
  letter-spacing: -0.02em;
  width: min(100%, 80%);
  padding-bottom: 2.5svh;
}
.jhero-title > span { display: block; }
.jhero-l1 { font-weight: 600; }
.jhero-l2 { font-weight: 400; }

.jhero-row { position: relative; flex: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.jhero-lead { width: min(420px, 34%); display: flex; flex-direction: column; align-items: flex-start; gap: 26px; }
@media (max-width: 760px) { .jhero-lead { width: 100% !important; } .jhero-lead .hero-actions { width: 100%; } }
.jhero-lead p { font-size: clamp(15px, 1.15vw, 19px); line-height: 1.45; font-weight: 500; color: #2c2c2c; }
.jhero-lead .hero-actions { margin-top: 0; }

.jhero-video {
  position: absolute;
  right: 0;
  top: 0;
  width: 22%;
  z-index: 30;
  border: 4px solid var(--paper);
  border-radius: 14px;
  background: var(--paper);
  transform-origin: top right;
  will-change: transform;
  box-shadow: 0 30px 80px rgba(0,0,0,.12);
}
.jhero-video video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #d9d4cf; }

.jhero-word {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16.4vw;
  line-height: .76;
  white-space: nowrap;
  flex-wrap: nowrap;
  letter-spacing: -0.04em;
  margin-inline: calc(var(--gutter) * -0.2);
  padding-top: 2vh;
  overflow: hidden;
  user-select: none;
  color: var(--ink);
}
.jhero-word span { display: inline-block; }
.jw-star { font-size: .55em; line-height: 1; align-self: flex-start; margin-top: .05em; }
.jhero-word .ch { display: inline-block; }

@media (max-width: 760px) {
  .jhero { padding-top: calc(var(--header-h) + 28px); }
  .jhero-title { width: 100%; font-size: clamp(34px, 10vw, 52px); }
  .jhero-row { flex-direction: column; gap: 22px; }
  .jhero-lead { width: 100%; }
  .jhero-video { position: relative; width: 100%; border-width: 5px; }
  .jhero-word { font-size: 15.6vw; margin-top: 28px; }
}

/* ---------- Statement with grain write-on ---------- */
.jstatement {
  position: relative;
  padding: 0 var(--gutter) clamp(80px, 10vw, 160px);
  background: var(--paper);
}
.jstatement-landing {
  width: var(--cols-10);
  margin: clamp(60px, 8vw, 140px) auto 0;
  aspect-ratio: 16 / 9;
}
.write-on {
  position: relative;
  width: var(--cols-10);
  margin: clamp(60px, 9vw, 150px) auto 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.write-on p { margin: 0; }
.write-on__ghost { position: absolute; inset: 0; opacity: .22; pointer-events: none; }
.write-on__text .w { display: inline-block; opacity: 0; will-change: opacity, filter; }
.write-on__text .w.on { opacity: 1; }
@media (max-width: 760px) {
  .jstatement-landing { display: none; }
  .write-on, .jstatement-landing { width: 100%; }
}

/* ---------- Website reel: one full-screen site per scroll ---------- */
#work > .wrap:first-child .sec-head { margin-bottom: clamp(28px, 4vw, 56px); }
.reel { position: relative; height: calc(var(--count, 8) * 100svh); }
.reel-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--ink); }
.reel-slide { position: absolute; inset: 0; overflow: hidden; }
.reel-anim { position: absolute; inset: 0; will-change: transform; }
.reel-slide:first-child .reel-anim { transform: none; }
.reel-media { position: absolute; inset: 0; display: block; cursor: pointer; }
.reel-media video { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; background: #111; }
.reel-shade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.reel-caption {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(16px, 3vh, 32px);
  display: flex; align-items: center; gap: 14px 22px; flex-wrap: wrap;
  padding: 12px 16px; width: max-content; max-width: calc(100% - var(--gutter) * 2);
  background: rgba(255,255,255,.92); color: var(--ink); border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
.reel-name { font-family: var(--display); font-size: clamp(15px, 1.3vw, 20px); font-weight: 600; letter-spacing: -0.01em; text-transform: none; }
.reel-count, .reel-cat { color: var(--gray); }
.reel-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding: 8px 12px; background: var(--ink); color: var(--white); border-radius: 6px; }
.reel-live .icon { width: 13px; height: 13px; }
@media (max-width: 760px) {
  .reel-caption { left: 10px; right: 10px; bottom: 10px; gap: 6px 12px; padding: 10px 12px; font-size: 10px; }
  .reel-cat { display: none; }
}

/* ---------- Skills: dark reveal + process story ---------- */
.dark-reveal { position: relative; isolation: isolate; color: var(--white); height: calc(7 * 80svh); }
.dark-bg {
  position: absolute; inset: 0; z-index: -1; background: var(--ink);
  clip-path: inset(0 var(--side, 30%) var(--bottom, 0px) var(--side, 30%) round var(--r, 24px));
}
.dark-inner {
  position: sticky; top: 0; height: 100svh;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 5vw, 90px);
  align-items: center;
  padding-top: var(--header-h);
}
.dark-head { display: grid; gap: 18px; align-content: center; }
.dark-head .kicker { color: var(--gray-2); }
.dark-head .h-display { font-family: var(--display); text-transform: none; font-weight: 600; letter-spacing: -0.03em; font-size: clamp(36px, 4.6vw, 84px); line-height: .98; }
.dark-head p { color: var(--gray-2); max-width: 380px; }
.dark-reveal .dark-head, .dark-reveal .process { opacity: var(--content, 1); transform: translateY(calc((1 - var(--content, 1)) * 30px)); }

.process { list-style: none; display: grid; }
.process-step { --open: 0; border-top: 1px solid var(--line-dark); padding: clamp(10px, 1.6vh, 18px) 0; }
.process-step:last-child { border-bottom: 1px solid var(--line-dark); }
.process-head { display: flex; align-items: baseline; gap: 18px; }
.process-num { font-size: 12px; letter-spacing: .16em; color: var(--gray-2); min-width: 28px; }
.process-title {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1;
  font-size: calc(clamp(26px, 2.6vw, 44px) + var(--open) * clamp(8px, 1.6vw, 30px));
  opacity: calc(.35 + var(--open) * .65);
}
.process-body { overflow: hidden; max-height: calc(var(--open) * 180px); padding-left: 46px; }
.process-body p { padding-top: 12px; color: #cfcfcf; max-width: 520px; font-size: 15px; line-height: 1.55; }
.process-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.process-tags li { border: 1px solid var(--line-dark); border-radius: 99px; padding: 5px 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #e6e6e6; }

@media (max-width: 860px) {
  .dark-reveal { height: calc(7 * 75svh); }
  .dark-inner { grid-template-columns: 1fr; align-content: center; gap: 22px; }
  .dark-head p { display: none; }
  .process-title { font-size: calc(22px + var(--open) * 8px); }
  .process-body { padding-left: 0; }
  .process-body p { font-size: 13px; }
}

/* ---------- Grain titles ---------- */
[data-grain-title] { will-change: filter; }

@media (prefers-reduced-motion: reduce) {
  .reel { height: auto; }
  .reel-stage { position: relative; height: auto; }
  .reel-slide { position: relative; height: 100svh; }
  .reel-anim { transform: none !important; }
  .dark-reveal { height: auto; }
  .dark-inner { position: relative; height: auto; padding-block: 120px; }
  .process-step { --open: 1 !important; }
  .dark-bg { clip-path: none; }
  .write-on__text .w { opacity: 1; }
  .write-on__ghost { display: none; }
}

/* ---------- Gray instead of black: dashboards + AI ---------- */
#work .grid-desk .proj { background: #c4c4c4; color: var(--ink); box-shadow: 0 -20px 60px rgba(0,0,0,.10); }
#work .grid-desk .proj-num, #work .grid-desk .proj-name { color: var(--ink); }
#work .grid-desk .proj-cat, #work .grid-desk .proj-desc { color: #3d3d3d; }
#work .grid-desk .proj-info { border-top-color: rgba(0,0,0,.18); }
#work .grid-desk .proj-media { background: #b3b3b3; }
#ai.sec.dark { background: #c4c4c4; color: var(--ink); }
#ai .kicker, #ai .sec-head p, #ai .proj-cat, #ai .proj-desc, #ai .proj-num { color: #3d3d3d; }
#ai .proj-info { border-top-color: rgba(0,0,0,.18); }
#ai .proj-media { background: #b3b3b3; }

/* ---------- About: grain storytelling ---------- */
.fog-story { position: relative; height: calc(5 * 100svh); margin-inline: calc(var(--gutter) * -1); }
.fog-stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center;
  padding: var(--header-h) var(--gutter) 0; column-gap: clamp(24px, 5vw, 90px);
  background: var(--paper-3);
}
.fog-layer { display: none; }
.fog-kicker { position: absolute; top: calc(var(--header-h) + 24px); left: var(--gutter); }
.fog-chapters { position: relative; grid-column: 1; grid-row: 1; height: 60svh; }
.fog-chapter { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 22px; visibility: hidden; }
.fog-chapter.is-on { visibility: visible; }
.fog-num { font-size: 12px; letter-spacing: .2em; color: var(--gray); }
.fog-line {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.035em; line-height: .95;
  font-size: clamp(42px, 6.4vw, 120px);
}
.fog-chapter p { max-width: 460px; font-size: clamp(15px, 1.2vw, 19px); color: #3a3a3a; line-height: 1.5; }
.fog-chapter .about-actions { margin-top: 6px; }
.fog-portrait {
  grid-column: 2; grid-row: 1; justify-self: center; width: min(100%, 460px); aspect-ratio: 1;
  border-radius: 16px; overflow: hidden; background: var(--paper-2);
  transform: scale(var(--ps, .9)); will-change: transform, filter;
}
.fog-portrait img { width: 100%; height: 100%; object-fit: cover; }
.fog-progress { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 28px; height: 1px; background: var(--line); }
.fog-progress i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(var(--fp, 0)); }

@media (max-width: 860px) {
  .fog-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-content: start; row-gap: 16px; padding-top: calc(var(--header-h) + 56px); }
  .fog-portrait { grid-column: 1; grid-row: 1; width: min(62vw, 260px); }
  .fog-chapters { grid-row: 2; height: 46svh; }
  .fog-chapter { justify-content: flex-start; gap: 14px; }
  .fog-line { font-size: clamp(32px, 9vw, 48px); }
}
@media (prefers-reduced-motion: reduce) {
  .fog-story { height: auto; }
  .fog-stage { position: relative; height: auto; display: block; padding-block: 100px; }
  .fog-chapters { height: auto; }
  .fog-chapter { position: relative; visibility: visible; margin-bottom: 48px; }
}

/* ---------- Hero polish ---------- */
.jhero-grain {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 998;
  pointer-events: none; opacity: .075; mix-blend-mode: multiply;
}
.jhero-inner, .jhero-word { position: relative; z-index: 2; }

.jhero-meta {
  display: flex; align-items: center; gap: 12px 32px; flex-wrap: wrap;
  padding: 14px 0; margin-bottom: clamp(18px, 3vh, 34px);
  border-block: 1px solid var(--line);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #3a3a3a;
}
.jm-status { display: inline-flex; align-items: center; gap: 10px; }
.jm-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #1fb85a; }
.jm-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid #1fb85a; animation: jm-ping 1.8s var(--ease) infinite; }
@keyframes jm-ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.jm-time b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.jm-scroll { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.jm-scroll i { position: relative; width: 44px; height: 1px; background: var(--line); overflow: hidden; }
.jm-scroll i::after { content: ""; position: absolute; inset: 0; background: var(--ink); animation: jm-line 1.8s var(--ease-io) infinite; }
@keyframes jm-line { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

.jv-label {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 10px 16px; border-radius: 99px; background: var(--white); color: var(--ink);
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  transform: translate(-50%, -50%) scale(.6); opacity: 0;
  transition: transform .45s var(--ease), opacity .3s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.jv-label .icon { width: 12px; height: 12px; }
@media (hover: hover) {
  .jhero-video:hover .jv-label { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .jhero-video video { transition: filter .5s ease; }
  .jhero-video:hover video { filter: brightness(.8); }
}

.jhero-word .ch { transition: translate .4s var(--ease); }
.jw-star { display: inline-block; rotate: var(--spin, 0deg); }
.btn.is-magnet { transition: transform .35s var(--ease); }

@media (max-width: 760px) {
  .jhero-meta { gap: 8px 18px; font-size: 10px; }
  .jm-scroll { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .jhero-grain { display: none; }
  .jm-dot::after, .jm-scroll i::after { animation: none; }
}
.jw-star svg { display: block; width: 1.3em; height: 1.08em; margin-inline: .12em; }
.jw-star { rotate: 0deg !important; }

/* ---------- Phone: same travelling hero video as desktop ---------- */
@media (max-width: 760px) {
  .jhero-video { position: relative; width: 58%; align-self: flex-end; border-width: 3px; border-radius: 10px; }
  .jstatement-landing { display: block; width: 100%; margin-top: 56px; }
}

/* Film grain on buttons (same noise as the page) */
.btn::after {
  content: "";
  position: absolute;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.6 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 110px 110px;
  mix-blend-mode: overlay;
  opacity: .55;
}
.btn:hover::after { animation: btnGrain .5s steps(4) infinite; }
@keyframes btnGrain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-7%, 5%); }
  50% { transform: translate(6%, -6%); }
  75% { transform: translate(-4%, -3%); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) { .btn:hover::after { animation: none; } }
