:root {
  --bg: #100d0b;               /* warm near-black */
  --fg: #f1ebe1;               /* cream */
  --muted: #9a9189;            /* warm grey */
  --line: rgba(241, 235, 225, .14);
  --accent: #ff5a36;           /* vermilion */
  --ink: #140e0a;              /* text on top of accent / cream fills */
  --surface: #1b1613;          /* photo frame, subtle panels */
  --pad: clamp(20px, 4vw, 56px);
  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-loading { overflow: hidden; height: 100vh; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
::selection { background: var(--accent); color: var(--ink); }

/* grain */
body::after {
  content: "";
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 90; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* Loader */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--pad);
}
.loader__top { display: flex; justify-content: space-between; color: var(--muted); }
.loader__count {
  font-size: clamp(96px, 22vw, 320px);
  font-weight: 600; line-height: .8; letter-spacing: -.05em;
}
.loader__count sup { font-size: .25em; vertical-align: top; color: var(--accent); margin-left: .1em; }
.loader__bar { height: 2px; background: var(--line); overflow: hidden; }
.loader__bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* Cursor */
.cursor { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 95; display: none; }
.cursor span {
  display: block; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--fg); mix-blend-mode: difference;
  transition: transform .35s var(--ease);
}
.cursor.is-link span { transform: scale(3); }
@media (hover: hover) and (pointer: fine) {
  .cursor { display: block; }
  html.js body, html.js a { cursor: none; }
}

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad);
  mix-blend-mode: difference; color: #fff;
}
.nav__logo { font-weight: 700; font-size: 22px; letter-spacing: -.03em; display: inline-block; }
.nav__logo span { font-size: .5em; vertical-align: super; margin-left: 2px; }
.nav__links { display: flex; gap: 28px; }
.nav__links a { position: relative; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__time { display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* Hero */
.hero {
  min-height: 100svh;
  padding: 130px var(--pad) var(--pad);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.eyebrow { color: var(--muted); }
.hero__title {
  font-size: clamp(44px, 9.4vw, 170px);
  font-weight: 600; line-height: .95; letter-spacing: -.045em;
}
.line { display: block; overflow: hidden; padding-bottom: .08em; }
.line > span { display: block; }
.hero__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; }
.hero__desc { max-width: 440px; color: var(--muted); font-size: 17px; }
.hero__scroll {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 24px; border: 1px solid var(--line); border-radius: 999px;
  transition: background .4s, color .4s;
}
.hero__scroll:hover { background: var(--fg); color: var(--bg); }
.arrow { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

/* Marquee */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 28px 0; }
.marquee__track {
  display: flex; align-items: center; width: max-content;
  font-size: clamp(40px, 7vw, 100px); font-weight: 600; letter-spacing: -.04em; white-space: nowrap;
  animation: marquee 55s linear infinite;
}
/* margin instead of gap, so -50% lands exactly on the start of the duplicated set */
.marquee__track > * { margin-right: 36px; }
.marquee__track i { font-style: normal; color: var(--accent); font-size: .5em; }
.marquee__track span:nth-child(4n+1) { font-family: var(--serif); font-style: italic; font-weight: 400; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Work */
.work { padding: clamp(80px, 14vw, 200px) var(--pad); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 56px; gap: 24px; }
.section-title { font-size: clamp(44px, 8vw, 130px); font-weight: 600; letter-spacing: -.045em; line-height: .95; }
.section-head .mono { color: var(--muted); }

.project { border-top: 1px solid var(--line); }
.project:last-child { border-bottom: 1px solid var(--line); }
.project__row {
  display: grid; grid-template-columns: 56px 1fr auto 60px;
  grid-template-areas: "num name tag year" ". desc desc desc" ". more more more";
  align-items: baseline; column-gap: 24px; row-gap: 6px;
  padding: 34px 0; position: relative; outline: none;
  transition: padding .6s var(--ease), color .4s;
}
.project__row::before {
  content: ""; position: absolute; inset: 0 calc(var(--pad) * -1); z-index: -1;
  background: var(--fg); transform: scaleY(0); transform-origin: bottom;
  transition: transform .55s var(--ease);
}
.project__num { grid-area: num; color: var(--muted); }
.project__name { grid-area: name; font-size: clamp(30px, 5vw, 78px); font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.project__tag { grid-area: tag; color: var(--muted); text-align: right; }
.project__year { grid-area: year; color: var(--muted); text-align: right; }
.project__desc { grid-area: desc; color: var(--muted); max-width: 560px; font-size: 15px; }

/* Long description: opens on hover (mouse), focus (keyboard) or tap (touch) */
.project__more {
  grid-area: more; display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .6s var(--ease);
}
.project__more-inner { overflow: hidden; min-height: 0; }
.project__long { max-width: 760px; padding-top: 22px; font-size: 17px; line-height: 1.6; color: inherit; }
.project__stack { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 6px; }
.project__stack li { border: 1px solid currentColor; border-radius: 999px; padding: 6px 12px; }

/* open state: keyboard focus and tap */
.project__row:focus-visible,
.project.is-open .project__row { color: var(--bg) !important; padding-inline: 20px; }
.project__row:focus-visible::before,
.project.is-open .project__row::before { transform: scaleY(1); }
.project__row:focus-visible .project__more,
.project.is-open .project__more { grid-template-rows: 1fr; }
.project__row:focus-visible :is(.project__num, .project__tag, .project__year, .project__desc),
.project.is-open :is(.project__num, .project__tag, .project__year, .project__desc) { color: var(--bg); }

/* open state: mouse hover */
@media (hover: hover) {
  .projects:hover .project__row { color: var(--muted); }
  .project__row:hover { color: var(--bg) !important; padding-inline: 20px; }
  .project__row:hover::before { transform: scaleY(1); }
  .project__row:hover .project__more { grid-template-rows: 1fr; }
  .project__row:hover :is(.project__num, .project__tag, .project__year, .project__desc) { color: var(--bg); }
}

/* Touch devices: no hover, so a tap opens the row (script.js toggles .is-open) */
.project__row { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: none) {
  .project__row { cursor: pointer; }
  /* small + / − so it is obvious the row can be tapped */
  .project__desc::after { content: "  +"; color: var(--accent); font-family: var(--mono); }
  .project.is-open .project__desc::after { content: "  −"; color: inherit; }
}

/* About */
.about { padding: clamp(60px, 10vw, 160px) var(--pad); }
.about__label { color: var(--muted); margin-bottom: 32px; }
.about__text {
  font-size: clamp(26px, 4.2vw, 64px); font-weight: 500; line-height: 1.12; letter-spacing: -.035em; max-width: 1200px;
}
.about__text .w { opacity: .18; transition: opacity .3s; }
.about__text .w.on { opacity: 1; }
.about__layout {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 26vw, 380px);
  gap: clamp(32px, 5vw, 80px); align-items: start;
}
.about__layout .about__text { font-size: clamp(26px, 3.4vw, 54px); }
.about__photo { margin-top: 8px; }
.about__frame {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
.about__frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 20%;
  filter: grayscale(.25) contrast(1.03);
  transition: filter .6s, transform 1.2s var(--ease);
}
.about__photo:hover .about__frame img { filter: none; transform: scale(1.04); }
.about__ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 160px; color: var(--accent);
}
.about__photo figcaption { display: flex; justify-content: space-between; margin-top: 14px; color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; margin-top: 90px; }
.fact { border-top: 1px solid var(--line); padding-top: 18px; }
.fact .mono { color: var(--muted); }
.fact p { margin-top: 12px; font-size: 19px; max-width: 32ch; }

/* Toolbox */
.toolbox { margin-top: 110px; }
.toolbox__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px 32px; }
.tool-group { border-top: 1px solid var(--line); padding-top: 18px; }
.tool-group h3 { font-weight: 400; color: var(--muted); margin-bottom: 18px; }
.tool-group ul { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-group li {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px; font-size: 15px;
  transition: background .3s, color .3s, border-color .3s;
}
.tool-group li:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }

/* Contact */
.contact { padding: clamp(80px, 12vw, 180px) var(--pad) 28px; border-top: 1px solid var(--line); }
.contact__title { font-size: clamp(48px, 10.5vw, 190px); font-weight: 600; letter-spacing: -.05em; line-height: .92; }
.contact__mail {
  display: inline-block; margin-top: 56px;
  font-size: clamp(20px, 3vw, 44px); letter-spacing: -.03em;
  border-bottom: 2px solid var(--accent); padding-bottom: 6px;
  transition: color .3s;
}
.contact__mail:hover { color: var(--accent); }
.contact__row { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 56px; color: var(--muted); }
.contact__row a:hover { color: var(--fg); }
.contact__foot { display: flex; justify-content: space-between; margin-top: 110px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }

/* Reveal fallback (when GSAP fails to load, content stays visible) */
html.js.gsap-ready .reveal { opacity: 0; }

/* Responsive */
@media (max-width: 820px) {
  .nav__links { display: none; }
  .hero__foot { flex-direction: column; align-items: flex-start; }
  .project__row {
    grid-template-columns: 36px 1fr auto;
    grid-template-areas: "num name year" ". tag tag" ". desc desc" ". more more";
  }
  .project__tag { text-align: left; }
  .project__long { font-size: 16px; }
  .about__layout { grid-template-columns: 1fr; }
  .about__photo { order: -1; max-width: 300px; }
  .facts { grid-template-columns: 1fr; gap: 24px; margin-top: 56px; }
  .toolbox { margin-top: 72px; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}