/* filndgap portfolio — inverted: black hero, white door, light inside */
:root {
  --ink: #0f1110;
  --paper: #f2f2f0;
  --tile: #e6e6e3;
  --tile-2: #dfdfdb;
  --tile-3: #e9e9e6;
  --label-bg: #ececea;
  --line: #d4d4d0;
  --muted: #4f514f;
  --muted-2: #5f615f;
  --accent: #3b5bfd;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- pinned intro ---------- */
.track { position: relative; height: 395vh; }
.anchor { position: absolute; top: 292vh; left: 0; width: 1px; height: 1px; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  perspective: 1000px;
}

.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  padding: 24px 5%; display: flex; justify-content: space-between; gap: 16px; font-size: 14px;
}
.nav-name { font-weight: 600; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { opacity: .85; }
.nav-links a:hover { opacity: 1; }

.world {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transform-style: preserve-3d;
  /* no permanent will-change: lets the browser redraw the logo sharp at each zoom level.
     main.js adds it only while a step is animating. */
}
.floor {
  position: absolute; left: -150vw; width: 400vw; height: 3200px;
  transform-origin: center top; transform: rotateX(90deg);
  background:
    radial-gradient(ellipse 18vw 900px at var(--floor-x, 200vw) 0, rgba(242,242,240,var(--spill, .22)), rgba(242,242,240,0)),
    repeating-linear-gradient(to bottom, rgba(242,242,240,.07) 0 2px, transparent 2px 140px),
    repeating-linear-gradient(to right, rgba(242,242,240,.05) 0 2px, transparent 2px 140px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
  pointer-events: none;
}

.word {
  position: relative; margin: 0;
  display: inline-flex; align-items: baseline;
  font-size: clamp(80px, 16vw, 260px); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1;
}
.letters { will-change: opacity; }
.door {
  position: relative; display: inline-block; flex: 0 0 auto;
  width: var(--door-w, .56em); height: var(--door-h, .73em);
  margin-left: var(--door-ml, .04em); margin-right: var(--door-mr, .01em);
  border-radius: var(--door-r, .28em .28em 0 0);
  background: radial-gradient(ellipse at 50% 70%, #ffffff 0%, #ffffff 55%, #ecebe6 100%); /* light behind the door */
}
.door-glow {
  position: absolute; left: -120%; top: -60%; width: 340%; height: 220%; z-index: -1;
  background: radial-gradient(ellipse at 50% 55%, rgba(255,255,255,.55), rgba(255,255,255,.12) 38%, rgba(255,255,255,0) 68%);
  opacity: .35; pointer-events: none;
}

.tagline {
  position: absolute; bottom: 14%; left: 0; right: 0; margin: 0;
  text-align: center; font-size: 17px; color: #a3a5a3; padding: 0 6%;
}
.hint {
  position: absolute; bottom: 5%; left: 0; right: 0;
  text-align: center; font-size: 13px; color: #8a8c8a;
}

/* inside the door */
.gap {
  position: absolute; inset: 0; background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  padding: 0 8%; opacity: 0; pointer-events: none;
}
.gap-lead, .gap-answer {
  font-size: clamp(40px, 6vw, 96px); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.05;
}
.gap-lead { color: #8a8c8a; }
.gap-answer { will-change: opacity, transform; }
.gap-line {
  display: block; height: 6px; width: 20%; max-width: 900px;
  background: var(--accent); border-radius: 3px; margin-top: 12px;
}
.gap-foot {
  position: absolute; bottom: 6%; left: 8%; right: 8%;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 14px; color: var(--muted-2);
}

/* ---------- design rule: doors open ----------
   Every door has a leaf (the door itself) hinged on the left.
   Scroll 1: the leaf swings open toward you and light shows through.
   Scroll 2: you walk through.  main.js drives --leaf-rot and --leaf-shade. */
.leaf {
  position: absolute; inset: 0; border-radius: inherit;
  background: var(--paper);
  transform-origin: left center;
  transform: perspective(2.2em) rotateY(var(--leaf-rot, 0deg));
  will-change: transform;
}
.leaf::after {                       /* the leaf darkens as it turns away from the light */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: #000; opacity: var(--leaf-shade, 0);
}
.leaf::before {                      /* door knob */
  content: ""; position: absolute; right: 14%; top: 56%;
  width: 0.065em; height: 0.065em; border-radius: 50%;
  background: rgba(15,17,16,.35);
}

/* ---------- design rule: the door letter ----------
   One letter in a word becomes an arched door (the "n" in filndgap,
   the "A" in AI and in kthrAnz). It always:
   - sits on the baseline and matches cap height (0.73em)
   - has a half-circle top and a flat bottom
   - takes the text colour of the word it lives in            */
.dletter, .adoor {
  display: inline-block; vertical-align: baseline;
  width: 0.62em; height: 0.73em; margin: 0 0.02em;
  border-radius: 0.31em 0.31em 0 0; background: currentColor;
}
/* the A-door opens: light behind, dark leaf in front */
.adoor { position: relative; background: #ffffff; }
.adoor .leaf { background: currentColor; }
.adoor .leaf::before { background: rgba(242,242,240,.55); }
.brand { font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.nav-name.brand { font-size: 26px; line-height: 1; }
.byline {
  position: absolute; left: 0; right: 0; bottom: calc(14% + 40px); margin: 0;
  text-align: center; font-size: 15px; color: #a3a5a3;
}
.byline .brand { font-size: 24px; color: var(--paper); margin-left: 4px; }
@media (max-width: 600px) {
  .nav-name.brand { font-size: 22px; }
  .byline .brand { font-size: 20px; }
  .byline { bottom: calc(14% + 58px); }
}
.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;
}
.gap { will-change: auto; }

/* featured projects
   Balanced two-column layout on one centred content width:
   [ door — 62% ]  gap 7%  [ caption column — the rest ]
   The door keeps a 16:10 picture ratio. The caption column is exactly as
   tall as the door: counter at the top, project in the middle, "next" at
   the bottom. Projects rise through the door; the next one peeks in below. */
.featured {
  --W: min(88vw, 1400px);                                   /* content width */
  --mx: calc((100vw - var(--W)) / 2);                       /* side margin   */
  --cw: min(calc(var(--W) * 0.62), calc(62vh * 1.6));       /* door width    */
  --dh: calc(var(--cw) / 1.6);                              /* door height (16:10) */
  --colgap: calc(var(--W) * 0.07);
  --dleft: var(--mx);
  --dtop: calc(50% - var(--dh) / 2 - 3vh);
  --colx: calc(var(--dleft) + var(--cw) + var(--colgap));
  --colw: min(calc(var(--W) - var(--cw) - var(--colgap)), 420px);
  --fgap: 4vh;
  position: absolute; inset: 0; background: var(--paper); color: var(--ink);
  opacity: 0; pointer-events: none; overflow: hidden;
}

/* top of the caption column: counter + progress */
.featured-head {
  position: absolute; z-index: 3; left: var(--colx); top: var(--dtop); width: var(--colw);
  display: flex; align-items: center; gap: 16px;
}
.featured-count { font-size: 14px; color: var(--muted-2); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.fprogress { flex: 1 1 auto; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.fprogress span { display: block; height: 100%; width: calc(20% + 80% * var(--fp, 0)); background: var(--ink); }

/* ↑ ↓ buttons next to the counter */
.farrows { display: flex; gap: 6px; }
.farrow {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer;
  display: grid; place-items: center; transition: background .2s, color .2s, border-color .2s;
}
.farrow:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.farrow:disabled { opacity: .35; cursor: default; background: #fff; color: var(--ink); border-color: var(--line); }

/* bottom of the caption column: every project, pick any */
.flist {
  position: absolute; z-index: 3; left: var(--colx); width: var(--colw);
  top: calc(var(--dtop) + var(--dh)); transform: translateY(-100%);
  list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line);
}
.fpick {
  width: 100%; display: flex; gap: 14px; align-items: baseline; text-align: left;
  padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: none;
  font: inherit; font-size: 14px; color: var(--muted-2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s, padding-left .25s;
}
.fpick span { font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.fpick:hover { color: var(--ink); padding-left: 6px; }
.fpick.is-active { color: var(--ink); font-weight: 600; }
.fpick.is-active span { color: var(--accent); }

.fghost-wrap {                                     /* faint neighbours above / below */
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 82%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 82%, transparent 100%);
}
.fghost {
  position: absolute; left: var(--dleft); top: var(--dtop); width: var(--cw);
  display: flex; flex-direction: column; gap: var(--fgap); opacity: .2; will-change: transform;
}
.fghost-slide, .fslide {
  flex: 0 0 var(--dh); width: 100%;
  background-color: var(--tile); background-size: cover; background-position: center;
}
.fghost-slide { border-radius: 10px; }

.fdoor {                                           /* the door */
  position: absolute; left: var(--dleft); top: var(--dtop); z-index: 2;
  width: var(--cw); height: var(--dh); overflow: hidden;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line), 0 50px 90px -50px rgba(15,17,16,.55);
  isolation: isolate;
}
.fdoor-track { display: flex; flex-direction: column; gap: var(--fgap); height: 100%; will-change: transform; }
.fslide { display: block; }

.fmeta-stack {                                     /* the project, centred on the door */
  position: absolute; z-index: 2;
  left: var(--colx); width: var(--colw);
  top: calc(var(--dtop) + var(--dh) * 0.38); height: 0;   /* sits between the counter and the list */
}
.fmeta {
  position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transform: translateY(-50%); translate: 0 10px; pointer-events: none;
  transition: opacity .45s ease, translate .45s ease;
}
.fmeta.is-active { opacity: 1; translate: 0 0; pointer-events: auto; transition-delay: .12s; }
.fdoor-track, .fghost { transition: transform .75s cubic-bezier(.65,0,.2,1); }
.featured.no-anim .fdoor-track, .featured.no-anim .fghost { transition: none; }
.fmeta i { font-style: normal; font-size: 13px; color: var(--muted-2); letter-spacing: .04em; text-transform: uppercase; }
.fmeta b { font-size: clamp(22px, 2vw, 32px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; }
.fmeta span { font-size: 16px; color: var(--muted); line-height: 1.55; }
.fmeta::after { content: "Open project →"; font-size: 15px; font-weight: 600; color: var(--accent); margin-top: 8px; }

/* project canvas */
.grid-layer {
  position: absolute; inset: 0; background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
}
.grid {
  width: 92vw; display: grid; gap: 2vw;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  transform-origin: 50% 50%; will-change: transform;
}
.tile {
  display: flex; flex-direction: column; height: 28vh;
  border-radius: 12px; overflow: hidden;
  background: var(--tile); border: 1px solid var(--line);
}
.tile:nth-child(3n+2) .tile-media { background: var(--tile-2); }
.tile:nth-child(3n) .tile-media { background: var(--tile-3); }
.tile-media {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
  background: var(--tile); color: var(--muted-2); font-size: 13px;
  background-size: cover; background-position: center;
}
.tile-label {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 14px; font-size: 13px; background: var(--label-bg);
}
.tile-label b { font-weight: 600; color: var(--ink); }
.tile-label i { font-style: normal; color: var(--muted-2); }
.grid-cta {
  position: absolute; bottom: 5%; left: 0; right: 0;
  display: flex; justify-content: center; opacity: 0;
}
.btn {
  background: var(--ink); color: var(--paper); border-radius: 999px;
  padding: 12px 22px; font-size: 14px; font-weight: 600;
}

/* ---------- regular sections ---------- */
.wrap { max-width: 1280px; margin: 0 auto; }
.label {
  margin: 0; font-size: 15px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.about { border-top: 1px solid var(--line); padding: 120px 5%; }
.about-row { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.portrait {
  flex: 0 1 260px; min-width: 0; height: 320px; border-radius: 16px;
  background: var(--tile); border: 1.5px dashed #a3a5a3;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted-2);
}
.about-text { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.about-lead { margin: 0; font-size: 28px; line-height: 1.35; font-weight: 500; }

.contact { border-top: 1px solid var(--line); padding: 120px 5% 64px; }
.contact-col { display: flex; flex-direction: column; gap: 28px; }
.contact-big {
  font-size: clamp(44px, 7vw, 88px); line-height: 1.05;
  font-weight: 700; letter-spacing: -0.02em;
}
.links { display: flex; flex-wrap: wrap; gap: 24px; font-size: 15px; color: var(--muted); }
.links a:hover { color: var(--ink); }
.copy { font-size: 13px; color: var(--muted-2); padding-top: 48px; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .featured { --cw: calc(var(--W) * 0.58); --colgap: calc(var(--W) * 0.05); }
  .fmeta span { font-size: 14px; }
  .fpick { padding: 7px 0; font-size: 13px; }
}
@media (max-width: 600px) {
  .featured { --W: 88vw; --cw: 88vw; --dh: calc(88vw / 1.25); --dtop: calc(50% - var(--dh) / 2 - 8vh); --colw: 88vw; }
  .featured-head { left: var(--mx); top: calc(var(--dtop) - 34px); }
  .fmeta-stack { left: var(--mx); top: calc(var(--dtop) + var(--dh) + 22px); height: auto; min-height: 60px; }
  .fmeta { transform: none; gap: 4px; }
  .featured-head { gap: 10px; }
  .flist { top: auto; bottom: 5vh; transform: none; left: var(--mx); width: 88vw; display: flex; gap: 8px; border: 0; }
  .flist li { flex: 1 1 0; }
  .fpick { justify-content: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 0; font-size: 0; }
  .fpick span { font-size: 13px; }
  .fpick.is-active { background: var(--ink); border-color: var(--ink); }
  .fpick.is-active span { color: var(--paper); }
  .fmeta b { font-size: 18px; }
  .fmeta span { display: none; }
  .fmeta::after { display: none; }
  .nav-links { gap: 16px; }
  .tile { height: 15vh; }
  .tile-label { display: none; }
  .about-lead { font-size: 22px; }
}

/* keyboard focus */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* click-to-enter door transition (featured projects → project page) */
.door-transition { position: fixed; inset: 0; z-index: 100; pointer-events: all; }
.dt-door {
  position: absolute; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, #1c1e1d, var(--ink) 70%);   /* dark inside: the project page starts dark */
  will-change: transform;
}
.dt-leaf {
  position: absolute; inset: 0; border-radius: inherit;
  background-size: cover; background-position: center;
  transform-origin: left center; will-change: transform;
}

/* the doorway that grows when you walk through the A in "AI" */
.adoor-zoom {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  background: #ffffff; opacity: 0; pointer-events: none; will-change: transform;
}
