:root {
  --bg: #0b0a09;
  --bg-2: #141311;
  --fg: #f2ede4;
  --muted: rgba(242, 237, 228, 0.52);
  --line: rgba(242, 237, 228, 0.14);
  --gold: #e3a10a;
  --gold-hi: #ffdc3c;
  --gold-grad: linear-gradient(180deg, #fff7c4 0%, #ffdc3c 25%, #e3a10a 55%, #ffe15a 78%, #9a6409 100%);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: 36px;
  /* side margin for the fixed HUD: grows on wide screens so content stays in a ~1760px centred column */
  --edge: max(var(--pad), calc((100vw - 1760px) / 2));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  cursor: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: none; }
a { color: inherit; text-decoration: none; cursor: none; }
img { display: block; max-width: 100%; }
em { font-style: italic; }
code { font-family: var(--mono); font-size: 0.85em; color: var(--gold-hi); }

.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Canvas + overlays ---------- */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.65) 100%);
}
.grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 40; opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.8s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-5%, 3%); }
  40% { transform: translate(4%, -6%); } 60% { transform: translate(-3%, 5%); }
  80% { transform: translate(6%, 2%); } 100% { transform: translate(0, 0); }
}

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center;
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.2s var(--ease);
}
body.loaded #loader { clip-path: inset(0 0 100% 0); pointer-events: none; }
.loader-inner { display: grid; justify-items: center; gap: 22px; }
.loader-logo { width: 84px; opacity: 0.9; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.96); } }
.loader-count { font-family: var(--serif); font-size: 64px; line-height: 1; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 10px; }
.loader-unit { font-family: var(--mono); font-size: 13px; letter-spacing: 0.16em; color: var(--gold-hi); }
.loader-bar { width: 180px; height: 1px; background: var(--line); overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 100%; background: var(--gold-grad); transform-origin: left; transform: scaleX(0); }

/* ---------- Top HUD ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px var(--edge);
  opacity: 0; transform: translateY(-12px);
  transition: opacity 1s var(--ease-out) 0.6s, transform 1s var(--ease-out) 0.6s;
}
body.loaded .hud-top { opacity: 1; transform: none; }
.brand { display: flex; align-items: center; gap: 14px; text-align: left; }
.brand img { width: 44px; height: 44px; transition: transform 0.8s var(--ease-out); }
.brand:hover img { transform: rotate(-12deg) scale(1.06); }
.brand .label { color: var(--fg); font-size: 10px; }
.nav { display: flex; gap: 6px; }
.nav button {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 10px 16px; border: 1px solid transparent; border-radius: 999px;
  color: var(--muted); transition: color 0.4s, border-color 0.4s;
}
.nav button:hover { color: var(--fg); border-color: var(--line); }
.nav button.active { color: var(--fg); border-color: rgba(227, 161, 10, 0.55); }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; position: relative; }
.menu-btn span { position: absolute; left: 13px; right: 13px; height: 1px; background: var(--fg); transition: transform 0.5s var(--ease); }
.menu-btn span:first-child { top: 18px; }
.menu-btn span:last-child { top: 25px; }
body.menu-open .menu-btn span:first-child { transform: translateY(3.5px) rotate(45deg); }
body.menu-open .menu-btn span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* ---------- Home copy ---------- */
.home-copy {
  position: fixed; left: var(--edge); bottom: 14vh; z-index: 10; max-width: 640px;
  transition: opacity 0.6s, transform 0.8s var(--ease-out);
}
body.is-work .home-copy, body.panel-open .home-copy { opacity: 0; transform: translateY(-30px); pointer-events: none; }
.home-copy h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(52px, 7.6vw, 132px); line-height: 0.92; letter-spacing: -0.015em;
  margin: 18px 0 26px;
}
.line { display: block; overflow: hidden; padding-bottom: 0.08em; }
@media (min-width: 861px) {
  .home-copy { max-width: none; }
  .home-copy h1 .line { white-space: nowrap; }
}
.line > * { display: inline-block; transform: translateY(110%); transition: transform 1.3s var(--ease-out); }
.line:nth-child(2) > * { transition-delay: 0.1s; }
.home-copy h1 em {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: 0.08em;
}
.reveal { overflow: hidden; }
.reveal > span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease-out) 0.25s; }
body.loaded .line > *, body.loaded .reveal > span { transform: none; }
.home-sub { max-width: 380px; font-size: 15px; line-height: 1.6; color: var(--muted); margin-bottom: 30px; }

.cta {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 8px 8px 8px 22px; border: 1px solid var(--line); border-radius: 999px;
  transition: border-color 0.4s, background 0.4s;
  opacity: 0; transition: opacity 1s 0.9s, border-color 0.4s, background 0.4s;
}
body.loaded .cta { opacity: 1; }
.cta:hover { border-color: var(--gold); background: rgba(227, 161, 10, 0.08); }
.cta-arrow {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-grad); color: var(--bg); font-style: normal; font-size: 14px;
  transition: transform 0.5s var(--ease-out);
}
.cta:hover .cta-arrow { transform: translateX(4px) rotate(-45deg); }

/* ---------- Work HUD ---------- */
.work-hud {
  position: fixed; left: var(--edge); bottom: var(--pad); z-index: 10;
  opacity: 0; pointer-events: none; transition: opacity 0.6s;
}
body.is-work .work-hud { opacity: 1; pointer-events: auto; }
body.panel-open .work-hud { opacity: 0; pointer-events: none; }
.work-index span { color: var(--fg); }
.work-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(46px, 6.4vw, 112px); line-height: 1; letter-spacing: -0.01em;
  margin: 10px 0 14px; overflow: hidden; padding-bottom: 0.1em; white-space: nowrap; min-height: 1.1em;
}
.split .char { display: inline-block; transform: translateY(110%); transition: transform 0.9s var(--ease-out); transition-delay: calc(var(--i) * 22ms); }
.split.in .char { transform: none; }
.split.out .char { transform: translateY(-110%); transition: transform 0.4s var(--ease); transition-delay: calc(var(--i) * 10ms); }
.work-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.work-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }

/* ---------- Rail ---------- */
.rail {
  position: fixed; right: var(--edge); top: 50%; transform: translateY(-50%); z-index: 10;
  display: grid; gap: 14px; justify-items: end;
  opacity: 0; transition: opacity 1s 1s;
}
body.loaded .rail { opacity: 1; }
body.panel-open .rail { opacity: 0; pointer-events: none; }
.rail button { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.rail .label { opacity: 0; transform: translateX(6px); transition: opacity 0.4s, transform 0.4s var(--ease-out); }
.rail button:hover .label { opacity: 1; transform: none; }
body:not(.is-work) .rail button.active .label { opacity: 1; transform: none; }
.rail button.active .label { color: var(--fg); }
.rail i { display: block; width: 14px; height: 1px; background: var(--muted); transition: width 0.6s var(--ease-out), background 0.4s; }
.rail button:hover i { width: 24px; background: var(--fg); }
.rail button.active i { width: 40px; background: var(--gold); }

.scroll-hint {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 10;
  display: grid; justify-items: center; gap: 10px;
  opacity: 0; transition: opacity 1s 1.4s;
}
body.loaded .scroll-hint { opacity: 1; }
body.is-work .scroll-hint, body.panel-open .scroll-hint { opacity: 0; transition-delay: 0s; }
.scroll-hint i { width: 1px; height: 46px; background: var(--line); position: relative; overflow: hidden; }
.scroll-hint i::after {
  content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 40%;
  background: var(--gold); animation: drip 1.8s var(--ease) infinite;
}
@keyframes drip { 0% { transform: translateY(-100%); } 100% { transform: translateY(260%); } }

/* ---------- Panels ---------- */
.panel {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(11, 10, 9, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  clip-path: inset(100% 0 0 0); visibility: hidden;
  transition: clip-path 1s var(--ease), visibility 0s 1s;
  user-select: text;
}
.panel.open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 1s var(--ease), visibility 0s; }
.panel-close {
  position: fixed; top: 30px; right: var(--pad); z-index: 2;
  display: flex; align-items: center; gap: 12px; color: var(--fg);
}
.panel-close i {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; font-style: normal; font-size: 18px;
  transition: transform 0.6s var(--ease-out), border-color 0.4s;
}
.panel-close:hover i { transform: rotate(90deg); border-color: var(--gold); }
.panel-inner {
  max-width: 1240px; margin: 0 auto; padding: 130px var(--pad) 100px;
  opacity: 0; transform: translateY(60px);
  transition: opacity 0.6s, transform 1.2s var(--ease-out);
}
.panel.open .panel-inner { opacity: 1; transform: none; transition-delay: 0.35s; }
.panel-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(54px, 8vw, 140px); line-height: 0.95; letter-spacing: -0.015em;
  margin: 14px 0 48px;
}
.panel-title em { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 0.06em; }

.pp-hero { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 2px; background: var(--bg-2); }
.pp-hero img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); transition: transform 1.8s var(--ease-out); }
.panel.open .pp-hero img { transform: scale(1); transition-delay: 0.3s; }
.pp-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 60px; margin: 64px 0; }
.pp-meta { display: grid; gap: 26px; align-content: start; }
.pp-meta dd { font-family: var(--serif); font-size: 26px; margin-top: 4px; }
.pp-body p { font-size: 18px; line-height: 1.7; color: rgba(242, 237, 228, 0.82); }
.pp-body p + p { margin-top: 1.2em; }
.pp-body p:first-child { font-family: var(--serif); font-size: 30px; line-height: 1.3; color: var(--fg); }
.pp-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pp-gallery figure { overflow: hidden; background: var(--bg-2); aspect-ratio: 4 / 3; }
.pp-gallery figure:only-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.pp-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out); }
.pp-gallery figure:hover img { transform: scale(1.04); }
.pp-next {
  display: grid; justify-items: start; gap: 12px; width: 100%;
  margin-top: 100px; padding-top: 40px; border-top: 1px solid var(--line); text-align: left;
}
.pp-next-title { font-family: var(--serif); font-size: clamp(44px, 6vw, 96px); line-height: 1; transition: color 0.4s, transform 0.8s var(--ease-out); }
.pp-next:hover .pp-next-title { color: var(--gold-hi); transform: translateX(16px); }

.about { display: grid; grid-template-columns: 5fr 7fr; gap: 72px; align-items: center; min-height: 100%; }
.about-photo { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 2px; }
.about-photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.35) contrast(1.05); }
.about-copy .panel-title { margin-bottom: 32px; }
.about-copy p { font-size: 17px; line-height: 1.7; color: var(--muted); max-width: 540px; }
.about-copy p + p { margin-top: 1em; }
.about-copy .lead { font-family: var(--serif); font-size: 28px; line-height: 1.35; color: var(--fg); }
.stats { list-style: none; display: flex; gap: 48px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.stats li { display: grid; gap: 6px; }
.stat-num { font-family: var(--serif); font-size: 40px; line-height: 1; }
.certs { margin-top: 40px; }
.certs ul { list-style: none; margin-top: 14px; border-top: 1px solid var(--line); }
.certs li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.cert-name { font-family: var(--serif); font-size: 24px; line-height: 1.2; transition: color 0.3s; }
a.cert-name:hover { color: var(--gold-hi); }
.cert-arrow { font-style: normal; font-size: 0.7em; color: var(--gold); display: inline-block; transition: transform 0.4s var(--ease-out); }
a.cert-name:hover .cert-arrow { transform: translate(3px, -3px); }
.certs li .label { color: var(--gold-hi); text-align: right; }

.contact { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.contact-mail {
  font-family: var(--serif); font-style: italic; font-size: clamp(30px, 5vw, 76px);
  border-bottom: 1px solid var(--line); padding-bottom: 12px; align-self: flex-start;
  transition: color 0.4s, border-color 0.4s; word-break: break-all;
}
.contact-mail:hover { color: var(--gold-hi); border-color: var(--gold); }
.contact .panel-title { margin-bottom: 24px; }
.contact-intro { font-family: var(--serif); font-size: 26px; line-height: 1.4; max-width: 640px; margin-bottom: 44px; color: rgba(242, 237, 228, 0.86); }
.contact-mail-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.copy-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.copy-btn:hover { color: var(--fg); border-color: var(--gold); }
.copy-btn.copied { color: var(--bg); background: var(--gold-hi); border-color: var(--gold-hi); }
.contact-loc { margin-top: 20px; }
.contact-actions { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; margin-top: 48px; }
.contact-actions .socials { margin-top: 0; }
.socials { list-style: none; display: flex; gap: 32px; margin-top: 56px; flex-wrap: wrap; }
.socials a { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); transition: color 0.3s; }
.socials a:hover { color: var(--fg); }

/* ---------- Mobile menu ---------- */
.menu-overlay {
  position: fixed; inset: 0; z-index: 25; background: var(--bg);
  display: flex; align-items: center; padding: 0 var(--pad);
  clip-path: circle(0% at calc(100% - 42px) 50px); transition: clip-path 0.9s var(--ease);
  pointer-events: none;
}
body.menu-open .menu-overlay { clip-path: circle(150% at calc(100% - 42px) 50px); pointer-events: auto; }
.menu-overlay nav { display: grid; gap: 10px; }
.menu-overlay button, .menu-overlay a {
  display: flex; align-items: baseline; gap: 16px; text-align: left;
  font-family: var(--serif); font-size: 56px; line-height: 1.1;
}
.menu-overlay .menu-garage { color: var(--gold-hi); }
/* link to the 3D garage version */
.nav .nav-garage {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 10px 16px; margin-left: 6px; border: 1px solid rgba(227, 161, 10, 0.55); border-radius: 999px;
  color: var(--gold-hi); transition: background 0.4s, color 0.4s;
}
.nav .nav-garage:hover { background: rgba(227, 161, 10, 0.12); color: var(--fg); }

/* ---------- Cursor ---------- */
.cursor { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.cursor-dot, .cursor-ring { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--gold-hi); }
.cursor-ring {
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 1px solid rgba(242, 237, 228, 0.35);
  display: grid; place-items: center;
  transition: width 0.5s var(--ease-out), height 0.5s var(--ease-out), margin 0.5s var(--ease-out), background 0.4s, border-color 0.4s;
}
.cursor-text { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bg); opacity: 0; transition: opacity 0.3s; }
.cursor.is-hover .cursor-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--gold); }
.cursor.is-view .cursor-ring, .cursor.is-drag .cursor-ring {
  width: 96px; height: 96px; margin: -48px 0 0 -48px; background: var(--gold-hi); border-color: var(--gold-hi);
}
.cursor.is-view .cursor-text, .cursor.is-drag .cursor-text { opacity: 1; }
.cursor.is-view .cursor-dot, .cursor.is-drag .cursor-dot { opacity: 0; }
@media (hover: none), (pointer: coarse) {
  body, button, a { cursor: auto; }
  .cursor { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  :root { --pad: 20px; }
  .hud-top { padding: 20px var(--pad); }
  .nav { display: none; }
  .menu-btn { display: block; }
  .home-copy { bottom: 10vh; right: var(--pad); }
  .home-sub { font-size: 14px; }
  .rail { top: auto; bottom: 40px; transform: none; }
  .rail .label { display: none; }
  .work-title { font-size: clamp(40px, 12vw, 64px); }
  .pp-grid, .about { grid-template-columns: 1fr; gap: 36px; }
  .pp-gallery { grid-template-columns: 1fr; }
  .panel-close { top: 20px; }
  .panel-inner { padding-top: 100px; }
  .about { padding-top: 100px; }
  .stats { gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .scroll-hint i::after { animation: none; }
}
