/* ==========================================================
   Felix — Portfolio
   Design tokens
   ========================================================== */
:root {
  --bg: #ededea;
  --bg-2: #e2e2de;
  --ink: #0e0e0e;
  --muted: #7d7d78;
  --line: rgba(14, 14, 14, 0.14);
  --accent: #ff4b1f;

  --font: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 2.2vw, 32px);
  --gap: clamp(12px, 1.4vw, 20px);
  --header-h: 64px;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: clamp(18px, 1.5vw, 22px);
  --fs-lg: clamp(28px, 3.4vw, 52px);
  --fs-xl: clamp(44px, 7.6vw, 132px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-sm);
  line-height: 1.4;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
ul { list-style: none; margin: 0; padding: 0; }
::selection { background: var(--ink); color: var(--bg); }

.label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  z-index: 50;
  mix-blend-mode: difference;
  color: #fff;
}
.header__mark { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.header__mark sup { font-size: 9px; font-weight: 500; margin-left: 1px; }
.header__tag { font-size: var(--fs-sm); opacity: 0.7; text-align: center; }
.header__nav { display: flex; gap: 22px; justify-content: flex-end; }
.header__nav a { position: relative; }
.header__nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.header__nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  padding: calc(var(--header-h) + 8vh) var(--gutter) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}
.hero__title {
  font-size: var(--fs-xl);
  line-height: 0.92;
  letter-spacing: -0.045em;
  font-weight: 500;
  max-width: 14ch;
}
.hero__foot {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.hero__foot p { max-width: 34ch; }
.hero__scroll { justify-self: end; grid-column: 4; }

/* split-word animation targets */
.word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.06em; }
.word > span { display: inline-block; will-change: transform; }

/* ---------- Section heads ---------- */
.section { padding: 0 var(--gutter); }
.section__head {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  padding: 120px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--gap);
}
.section__head h2 { font-size: var(--fs-sm); font-weight: 500; }
.section__head .count { color: var(--muted); }

/* ---------- Work grid ---------- */
.work {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--gap) * 3) var(--gap);
}
.tile { display: block; cursor: none; }
.work .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.work .tile:last-child:nth-child(odd) .tile__media { aspect-ratio: 21 / 9; }
.tile__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--media-bg, var(--bg-2));
}
.tile__media > .cover,
.tile__media > img,
.tile__media > video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transition: transform 1.1s var(--ease);
}
.tile:hover .tile__media > * { transform: scale(1.035); }
.tile__meta {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: var(--gap);
  padding-top: 12px;
}
.tile__title { font-weight: 500; }
.tile__cat, .tile__year { color: var(--muted); }

/* ---------- Generated covers (placeholder art until real media) ---------- */
.cover {
  --c1: #1f3bff; --c2: #9fb4ff;
  background:
    radial-gradient(120% 90% at 20% 15%, var(--c2) 0%, transparent 55%),
    radial-gradient(90% 90% at 85% 90%, var(--c1) 0%, transparent 60%),
    linear-gradient(160deg, var(--c1), var(--c2));
  display: grid; place-items: center;
}
.cover__shape {
  width: 30%; aspect-ratio: 9 / 19;
  border-radius: 14% / 6.5%;
  background: linear-gradient(140deg, rgba(255,255,255,0.55), rgba(255,255,255,0.08));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45), 0 40px 80px -30px rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  animation: float 7s ease-in-out infinite;
}
.cover__num {
  position: absolute; left: 4%; bottom: 2%;
  font-size: clamp(40px, 9vw, 150px); font-weight: 600; letter-spacing: -0.06em;
  line-height: 0.85; color: rgba(255,255,255,0.85); mix-blend-mode: overlay;
}
.cover--pixel-11 { --c1: #1f3bff; --c2: #a9bcff; }
.cover--pixel-watch-5 { --c1: #ff5a2a; --c2: #ffd6c2; }
.cover--pixel-watch-5 .cover__shape { width: 34%; aspect-ratio: 1; border-radius: 50%; }
.cover--impact-100 { --c1: #141414; --c2: #6e6e6a; }
.cover--impact-100 .cover__shape { width: 42%; aspect-ratio: 1.3; border-radius: 50% 50% 18% 18% / 60% 60% 22% 22%; }
.cover--fitbit-air-pokemon-sleep { --c1: #ff3d6e; --c2: #ffe066; }
.cover--fitbit-air-pokemon-sleep .cover__shape { width: 18%; aspect-ratio: 1 / 2.4; border-radius: 999px; }
.cover--impact-5000-go { --c1: #34452a; --c2: #cfdca6; }
.cover--impact-5000-go .cover__shape { width: 46%; aspect-ratio: 1.6; border-radius: 999px; }
@keyframes float { 0%,100% { transform: translateY(-2%) rotate(-2deg); } 50% { transform: translateY(2%) rotate(2deg); } }

/* ---------- Info ---------- */
.info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.info__lead {
  grid-column: 1 / span 3;
  font-size: var(--fs-lg);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.info__cols {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-top: 80px;
}
.info__cols li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.info__cols .label { margin-bottom: 12px; display: block; }

/* ---------- Contact / footer ---------- */
.contact { padding: 160px var(--gutter) var(--gutter); }
.contact__mail {
  display: inline-block;
  font-size: var(--fs-xl);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 500;
  position: relative;
}
.contact__mail::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0.04em; height: 0.05em;
  background: var(--accent); transform: scaleX(0); transform-origin: right;
  transition: transform 0.8s var(--ease);
}
.contact__mail:hover::after { transform: scaleX(1); transform-origin: left; }
.footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-top: 120px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.footer a:hover { color: var(--ink); }
.footer__top { justify-self: end; }

/* ---------- Project page ---------- */
.p-hero { padding: calc(var(--header-h) + 14vh) var(--gutter) 40px; }
.p-hero__back { display: inline-flex; gap: 8px; margin-bottom: 40px; color: var(--muted); }
.p-hero__back:hover { color: var(--ink); }
.p-hero__title { font-size: var(--fs-xl); line-height: 0.92; letter-spacing: -0.045em; }
.p-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-top: 56px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.p-meta dt { margin-bottom: 6px; }
.p-meta dd { margin: 0; }
.p-feature { padding: 0 var(--gutter); }
.p-feature__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--media-bg, var(--bg-2)); }
.p-feature__media > * { position: absolute; inset: -8% 0; width: 100%; height: 116%; object-fit: contain; }
.p-feature__media > .cover { object-fit: cover; }
.p-intro {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  padding: 120px var(--gutter);
}
.p-intro__lead {
  grid-column: 2 / span 3;
  font-size: var(--fs-lg);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.p-intro__body { grid-column: 2 / span 2; margin-top: 40px; display: grid; gap: 1em; font-size: var(--fs-md); line-height: 1.4; max-width: 46ch; }
.p-gallery {
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}
.p-gallery { align-items: start; }
.p-gallery figure { margin: 0; position: relative; overflow: hidden; background: var(--bg-2); }
.p-gallery figure.wide { grid-column: 1 / -1; }
.p-gallery figure > img, .p-gallery figure > video { width: 100%; height: auto; }
.p-gallery figure.video { width: min(100%, 960px); justify-self: center; aspect-ratio: 16 / 9; background: #000; margin: calc(var(--gap) * 2) 0; }
.p-gallery figure.video > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.p-gallery figure.ph { aspect-ratio: 4 / 5; }
.p-gallery figure.ph.wide { aspect-ratio: 16 / 9; }
.p-gallery figure.ph > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.p-gallery figcaption { position: absolute; left: 12px; bottom: 10px; z-index: 2; color: rgba(255,255,255,0.9); font-size: var(--fs-xs); }
.placeholder {
  display: grid; place-items: center; color: var(--muted);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  background: repeating-linear-gradient(-45deg, var(--bg-2) 0 14px, #dadad5 14px 15px);
}
.p-next {
  display: block;
  margin: 160px var(--gutter) 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.p-next__title {
  display: block;
  margin-top: 20px;
  font-size: var(--fs-xl);
  line-height: 0.92;
  letter-spacing: -0.045em;
  font-weight: 500;
  transition: color 0.5s var(--ease);
}
.p-next:hover .p-next__title { color: var(--accent); }

/* ---------- Cursor ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 500;
  transform: scale(0); opacity: 0;
}

/* ---------- Page transition ---------- */
.curtain {
  position: fixed; inset: 0; z-index: 80; background: var(--ink);
  transform: translateY(100%); pointer-events: none; visibility: hidden;
}
html.is-loading .curtain { transform: translateY(0); visibility: visible; }

/* reveal: hidden only when JS animation is available */
html.anim [data-reveal] { opacity: 0; transform: translateY(40px); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .header { grid-template-columns: 1fr auto; }
  .header__tag { display: none; }
  .hero__foot, .section__head, .p-meta, .footer { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .hero__scroll, .footer__top { grid-column: auto; justify-self: start; }
  .work, .p-gallery { grid-template-columns: 1fr; }
  .p-gallery figure.ph.wide { aspect-ratio: 4 / 3; }
  .info__lead, .p-intro__lead, .p-intro__body { grid-column: 1 / -1; }
  .info__cols { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .tile { cursor: pointer; }
  .cursor { display: none; }
  .section__head { padding-top: 88px; }
  .p-intro { padding: 80px var(--gutter); }
  .contact { padding-top: 110px; }
  .contact__mail { font-size: clamp(30px, 9.4vw, 60px); word-break: break-all; }
}
@media (prefers-reduced-motion: reduce) {
  .cover__shape { animation: none; }
  html.anim [data-reveal] { opacity: 1; transform: none; }
}
