:root {
  --bg: #ddcad8;
  --card: #ff14c1;          /* must match CARD_COLOR / PAPER_COLOR in main.js (the 3D sheet hands over to this) */
  --ink: #2c0c35;
  --radius: 24px;           /* main.js reads the card radius from the DOM */
  font-family: "Anonymous Pro", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); overscroll-behavior-y: none; }   /* no rubber-band at the page end (it swallowed the first swipe back up on phones) */

#tunnel { position: fixed; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); filter: blur(28px); z-index: 0; pointer-events: none; }

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;               /* above the card while it lands, invisible afterwards */
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* The card from Figma (Example 3): 417 × 659, fluid on small screens. */
.card {
  position: relative;
  width: min(417px, 100%);
  height: min(659px, calc(100svh - 64px));
  min-height: 420px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;     /* not clickable until it has landed */
}
.card.is-landed { pointer-events: auto; }

/* brush effects (hovercard.js): one WebGL canvas that moves into the hovered card */
.card > .card__fx {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; z-index: 5;
  opacity: 1 !important; transform: none !important; transition: none !important;
}
.card__head, .card__intro, .card__links { position: relative; z-index: 1; }
.card__pills span, .card__character { z-index: 1; }

.scroll-track { height: 300vh; }   /* main.js makes it longer for the carousel */

/* Carousel cards sit in the middle of the screen like the hero card; main.js slides them. */
.carousel { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.carousel .card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translateX(100vw);
  justify-content: flex-start;
}
.carousel .card.is-landed { pointer-events: auto; }
.card--skills { background: #fff url("./public/textures/card-skills.jpg") center / cover no-repeat; }
/* the gradient keeps drifting (loop): a slightly larger copy of the background that slowly moves and breathes */
/* the gradient keeps drifting (loop). Animated with background-size/position on the card itself, not a
   transformed layer: Safari can't blend the holo foil (color-dodge) with a separately composited layer
   and paints it black. */
.card--skills { background-size: auto 130%; background-position: 50% 10%; }   /* drifts via driftBackgrounds() in hovercard.js */
@keyframes gradient-drift {
  0%   { background-size: auto 130%; background-position: 50% 10%; }
  35%  { background-size: auto 150%; background-position: 35% 70%; }
  70%  { background-size: auto 140%; background-position: 65% 30%; }
  100% { background-size: auto 155%; background-position: 50% 95%; }
}

/* typing: the not-yet-typed part keeps its place but is invisible */
.typing-ghost { color: transparent; }
.card--skills > .card__intro { position: relative; }   /* text above the moving background */

/* tags fall once with real physics (main.js, matter.js) and pile up without overlapping */
.card__pills span { visibility: hidden; }   /* no will-change: a composited layer breaks the foil blend in Safari */
.card__pills span.is-dropped { visibility: visible; }


/* the character turns over and winks once (sprite rendered in Blender: 48 frames, 340 px) */
.card__character {
  position: absolute; left: 50%; bottom: -58px; width: 300px; height: 300px; max-width: none;
  transform: translateX(-38%);
  background: url("./public/textures/character-wink.webp") 0 0 / 4800% 100% no-repeat;
  pointer-events: none;
}
.card.is-shown .card__character { animation: wink 2s steps(47) both; }
@keyframes wink { from { background-position: 0 0; } to { background-position: 100% 0; } }
.card--intro { background: #c7ff00; }
/* Impact: yellow pills of different sizes drifting along a curve, left to right, forever (main.js) — Figma 18:1344 */
.card > .card__flow { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none; display: flex; flex-direction: column; }
.card__flow-row { overflow: hidden; }
.card__flow-track { display: flex; width: max-content; animation: flowL 46s linear infinite; }
.card__flow-row:nth-child(2) .card__flow-track { animation-name: flowR; animation-duration: 38s; }
.card__flow-row:nth-child(3) .card__flow-track { animation-duration: 54s; animation-delay: -20s; }
.card__flow span { background: #2c0c35; color: #fff; border-radius: 48px; padding: 6px 10px; font-size: 24px; line-height: 1.2;
  text-transform: uppercase; white-space: nowrap; flex: none; }
@keyframes flowL { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes flowR { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .card__flow-track { animation: none; } }
.card__list.card__list--bullets { list-style: disc outside; padding-left: 25.5px; }
.card--education { background: #c4602a url("./public/textures/card-education.jpg?v=45") center / cover no-repeat; }
.card--work { background: #7e4d26; }
.card--contact { background: #ff3fc0 url("./public/textures/card-contact.jpg?v=50") center / cover no-repeat; }
.carousel .card--contact { justify-content: space-between; color: #2c0c35; }
.card--contact .card__entry { color: inherit; text-decoration: none; display: block; }
.card--contact .card__entry:hover .card__name { text-decoration: underline; text-underline-offset: 4px; }
.card--workcta { background: rgb(255 240 109 / calc(1 - var(--glass, 0))); }   /* the yellow melts into the glass while it docks */
/* 3D stone coin (three.js), centred, 212 px like the circle in Figma — drawn a bit larger so it can turn */
.card > .card__coin {
  position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px;
  pointer-events: none; z-index: 0;
}
/* animated background (Seedance clip, played forwards then backwards so it loops seamlessly) */
.card > .card__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  border-radius: inherit; pointer-events: none; opacity: 1 !important; transform: none !important; transition: none !important;
}
.card--light .card__entries, .card--light .card__title { z-index: 1; }
.carousel .card--light { justify-content: space-between; color: #f4f4f4; }
.card__entries { position: relative; display: flex; flex-direction: column; gap: 32px; }
.card__meta { margin: 0; font-size: 13px; line-height: 1.2; }
.card__name { margin: 0; font-size: 30px; line-height: 1; }
.card--light .card__title { position: relative; }
/* the fluffy heart: frames rendered in Blender (slow turn, swaying fur), played on a canvas */
.card > .card__heart {
  position: absolute; z-index: 0; width: 478px; height: 478px; max-width: none;
  left: calc(50% + 81.5px); bottom: -108px; margin-left: -239px; pointer-events: none;
}
.card__list { margin: 0; padding: 0; list-style: none; font-size: 17px; }
.card__pills span {
  position: absolute;
  padding: 6px 10px;
  border: 1px solid var(--ink);
  border-radius: 48px;
  font-size: 24px;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(var(--r));
  transform-origin: center;
}

.card__head { display: flex; flex-direction: column; gap: 24px; }
.card__intro { display: flex; flex-direction: column; gap: 8px; }

.card__tags {
  margin: 0; padding: 0; list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 17px; text-transform: uppercase; white-space: nowrap;
}
.card__title { margin: 0; font-size: 48px; font-weight: 400; line-height: 1.2; overflow-wrap: break-word; }
.card__text { margin: 0; font-size: 17px; }

.card__links { display: flex; justify-content: space-between; gap: 12px; }
.card__links a {
  padding: 6px 10px;
  border: 1px solid var(--ink);
  border-radius: 48px;
  color: var(--ink);
  font-size: 16px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease;
}
.card__links a:hover,
.card__links a:focus-visible { background: var(--ink); color: var(--card); outline: none; }

/* Content appears after the sheet has landed. */
.card > * { opacity: 0; transform: translateY(8px); transition: opacity .45s ease, transform .45s ease; }
.card.is-landed > * { opacity: 1; transform: none; }
.card.is-landed > *:nth-child(2) { transition-delay: .12s; }

@media (max-width: 380px) {
  .card { padding: 24px; }
  .card__title { font-size: 40px; }
}

/* "Work" card docked as the menu (Figma Example 8) */
.card > .card__nav {
  position: absolute; left: 32px; right: 32px; top: 0; bottom: 0; z-index: 6;   /* centred in the card at every height while it docks */
  display: flex; align-items: center; gap: 32px; opacity: 0; pointer-events: none; transform: none !important; transition: none !important;
}
.card.is-nav > .card__nav { pointer-events: auto; }
.card__nav a { color: #2c0c35; text-decoration: none; font-size: 24px; line-height: 1.2; white-space: nowrap; }
.card.is-nav > .card__fx { z-index: 20; }   /* on the menu the water covers the links too (it redraws them bent) */
.card__nav-home { flex: none; display: block; width: 56px; height: 56px; margin: 0 -8px 0 -12px; }
.card__nav-plane { display: block; width: 56px; height: 56px; }
.card__nav a.card__nav-home:hover { text-decoration: none; }
.card.is-nav { z-index: 10; }   /* above the menu ball (9): inside the glass the ball is drawn refracted */

/* narrow screens: the links don't fit in one row → plane + two lines; the lines turn into a cross and the glass
   panel slides down with the links in a column (Figma Example 18/19) */
.card__nav-burger { display: none; }
.card.is-compact > .card__nav { display: flex; flex-direction: column; align-items: center; gap: 18px; left: 0; right: 0; top: 0; bottom: 0; padding-top: 86px; }
.card.is-compact .card__nav-home { position: absolute; left: 26px; top: 14.5px; margin: 0; }
.card.is-compact .card__nav a:not(.card__nav-home) { opacity: var(--open, 0); transform: translateY(calc((1 - var(--open, 0)) * -10px)) !important; pointer-events: none; }
.card.is-compact.is-open .card__nav a:not(.card__nav-home) { pointer-events: auto; }
.card.is-compact .card__nav-burger { display: block; position: absolute; right: 22px; top: 22.5px; width: 40px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
.card__nav-burger i { position: absolute; left: 3px; right: 3px; top: calc(50% - 1px); height: 2px; background: #ff14c1; border-radius: 1px;
  transition: transform .45s cubic-bezier(.65, 0, .25, 1); }
.card__nav-burger i:first-child { transform: translateY(-4px); }
.card__nav-burger i:last-child { transform: translateY(4px); }
.card.is-open .card__nav-burger i:first-child { transform: translateY(0) rotate(45deg); }
.card.is-open .card__nav-burger i:last-child { transform: translateY(0) rotate(-45deg); }
.card.is-nav.is-compact > .card__fx { z-index: 5; }   /* the water stays under the links here (they are real text) */

/* fade used by the menu logo to jump back to the start */
.veil { position: fixed; inset: 0; z-index: 100; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .38s ease; }
.veil.is-on { opacity: 1; pointer-events: auto; }
.card--workcta:not(.is-nav) { cursor: pointer; }

/* Work: video collage under the docked menu (workgrid.js) */
.workgrid { position: fixed; inset: 0; z-index: 1; pointer-events: none; will-change: transform; opacity: 0; visibility: hidden; }
.workgrid__card {
  position: absolute; margin: 0; border-radius: 10px; overflow: hidden; background: transparent;   /* videos with alpha (.mov) stay see-through */
  transform-origin: 50% 50%; will-change: transform; transition: filter .35s ease, opacity .35s ease;
}
.flight { position: absolute; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 1; pointer-events: none; display: none; }
.workgrid__planes { position: absolute; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 2; pointer-events: none; }
.workgrid__card video { display: block; width: 100%; height: 100%; object-fit: cover; }
.workgrid.is-active ~ .carousel, .workgrid.is-active { cursor: default; }

/* docked menu over the work grid: liquid glass, drawn in WebGL by glass.js (the yellow comes from its tint) */
.card > .card__glass {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; z-index: 0;
  opacity: 0 !important; transform: none !important; transition: none !important;
}
.card > .card__glass.is-on { opacity: var(--glass, 1) !important; }
.card--workcta.is-nav { box-shadow: none; }

/* "The end" over the bowl (flight.js) */
.workgrid__card.is-src { position: fixed !important; left: 0 !important; top: 0 !important; width: 2px !important; height: 2px !important;
  transform: none !important; opacity: 0.01 !important; overflow: hidden; pointer-events: none; z-index: 0; margin: 0 !important;
  transition: none !important; animation: none !important; box-shadow: none !important; border: 0 !important; }   /* no shrinking animation into the corner */
.workgrid__card.is-src video { width: 2px !important; height: 2px !important; }
/* loading ring: a conic gradient (pink at the start corner → lime → nothing) on a border-only mask, blurred */
.ring { position: absolute; pointer-events: none; --A: 0deg; --a0: 300deg; }
.ring > i { position: absolute; inset: 0; border-radius: inherit;
  background: conic-gradient(from var(--a0), #ff14c1 0deg, #c7ff00 calc(var(--A) * 0.6), rgb(199 255 0 / 0) var(--A),
    rgb(199 255 0 / 0) calc(360deg - var(--A)), #c7ff00 calc(360deg - var(--A) * 0.6), #ff14c1 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.ring--page { inset: 0; border-radius: 8px; filter: blur(18px); }
.ring--page > i { padding: 17px; }
.ring--video { border-radius: 16px; filter: blur(2.5px); opacity: 0; transition: opacity .15s; z-index: 0;   /* under the canvas (z 1): only the outside shows */
  animation: ringPulse 1.6s ease-in-out infinite; }
.ring--video > i { padding: 6px; animation: ringGlow 1.6s ease-in-out infinite;
  /* the whole ring is pink; lime fills it from the top-left corner as the video loads */
  background: conic-gradient(from var(--a0), #c7ff00 0deg, #c7ff00 calc(var(--A) * 0.75), #ff14c1 var(--A),
    #ff14c1 calc(360deg - var(--A)), #c7ff00 calc(360deg - var(--A) * 0.75), #c7ff00 360deg); }
@keyframes ringPulse { 0%, 100% { filter: blur(2.5px); } 50% { filter: blur(6px); } }
@keyframes ringGlow { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.ring--video.is-on { opacity: 1; }
.loader { position: fixed; inset: 0; z-index: 1000; background: var(--bg); transition: opacity .7s ease; }
.loader.is-done { opacity: 0; pointer-events: none; }
.loader__num { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 40px/1.2 "Anonymous Pro", monospace; color: #2c0c35; }
.work-caption { position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap; opacity: 0; }
.work-caption__text { display: inline-block; font-size: 17px; font-weight: 400; line-height: 1.2; color: #2c0c35; }
.work-nav { position: absolute; z-index: 3; transform: translateX(-50%); display: flex; gap: 16px; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.work-nav.is-on { opacity: 1; pointer-events: auto; }
.work-nav__btn { border: 0; padding: 4px; margin: 0; background: none; color: #fff06d; cursor: pointer; line-height: 0; transition: transform .25s ease, color .25s ease; -webkit-tap-highlight-color: transparent; }
.work-nav__btn[hidden] { display: none; }
.work-nav__btn:first-child:hover { transform: translateX(-6px); }
.work-nav__btn:last-child:hover { transform: translateX(6px); }
.work-nav__btn:active { color: #ffe600; }
.work-caption__plane { position: absolute; left: 0; top: 50%; width: 44px; height: 44px; }
.flight-end { position: absolute; transform: translate(-50%, -50%); padding: 10px 33px; border: 0; border-radius: 999px; background: #2c0c35; color: #fff; cursor: pointer;
  font: 21px/1.2 "Anonymous Pro", monospace; pointer-events: none; opacity: 0; z-index: 4; white-space: nowrap; }
