/* ════════════════════════════════════════════════════════════
   tres.studio v2 — particle field
   The page is a fixed WebGL canvas with ~25,000 particles
   forming the content. Scroll moves the camera through five
   scenes. Mouse disturbs the particles wherever it goes.
   ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper:      #F2EDE2;
  --paper-deep: #E8E1D2;
  --ink:        #0F0F0E;
  --ink-soft:   #4B4945;
  --ink-faint:  #8B8880;
  --yellow:     #F5CB5C;
  --yellow-hot: #FFD24A;

  --display:    'Bebas Neue', sans-serif;
  --body:       'DM Sans', system-ui, sans-serif;
  --mono:       'IBM Plex Mono', ui-monospace, monospace;

  --pad:        clamp(1rem, 2.4vw, 2rem);

  --ease:       cubic-bezier(.2, .8, .2, 1);
  --ease-in:    cubic-bezier(.7, 0, .84, 0);
  --ease-out:   cubic-bezier(.16, 1, .3, 1);
}

html, body { height: 100%; width: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  cursor: none;
  position: relative;
  overscroll-behavior: none;
}


/* ── Fixed WebGL stage ───────────────────────────────────── */
.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  transition: filter 700ms var(--ease-in), opacity 700ms var(--ease-in);
}
body.diving .stage { filter: blur(16px) brightness(1.18); opacity: 0; }


/* ── Paper grain ─────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.16  0 0 0 0 0.12  0 0 0 0.34 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}


/* ── Mono typography ─────────────────────────────────────── */
.mono {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.6;
}
.mono.dim    { color: var(--ink-faint); }
.mono.strong { color: var(--ink); font-weight: 500; }


/* ── Custom cursor (soft yellow glow) ────────────────────── */
.cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 9999;
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  width: 0; height: 0;
  will-change: transform;
}
.cursor-glow {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,203,92,0.55) 0%, rgba(245,203,92,0.18) 30%, transparent 70%);
  mix-blend-mode: multiply;
  transition: width 320ms var(--ease), height 320ms var(--ease), background 240ms var(--ease);
  pointer-events: none;
}
.cursor-dot {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  transition: width 260ms var(--ease), height 260ms var(--ease), background 220ms var(--ease);
}
.cursor.hot .cursor-glow {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255,210,74,0.75) 0%, rgba(255,210,74,0.28) 30%, transparent 70%);
}
.cursor.hot .cursor-dot {
  width: 11px;
  height: 11px;
  background: var(--yellow-hot);
}

.cursor-ring {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 200ms var(--ease);
  -webkit-mask: radial-gradient(circle, transparent 22px, black 23px, black 31px, transparent 32px);
          mask: radial-gradient(circle, transparent 22px, black 23px, black 31px, transparent 32px);
  background: conic-gradient(var(--ink) 0deg, transparent 0deg);
}
.cursor-ring.active { opacity: 1; }

.cursor-readout {
  position: absolute;
  left: 22px;
  top: 22px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 6px;
  border-left: 0.5px solid rgba(15, 15, 14, 0.25);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.cursor.show-readout .cursor-readout { opacity: 1; }
.cursor-readout .mono { font-size: 9px; color: var(--ink); }


/* ── Corner chrome ───────────────────────────────────────── */
.chrome {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  transition: opacity 500ms var(--ease-in);
}
body.diving .chrome { opacity: 0; pointer-events: none; }

.ch {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ch.tl { top: var(--pad); left: var(--pad);  align-items: flex-start; }
.ch.tr { top: var(--pad); right: var(--pad); align-items: flex-end;  gap: 6px; }
.ch.bl { bottom: var(--pad); left: var(--pad); align-items: flex-start; }
.ch.br { bottom: var(--pad); right: var(--pad); align-items: flex-end; gap: 8px; }

.ch.tl::before {
  content: ''; width: 28px; height: 1px;
  background: var(--ink); opacity: 0.55; margin-bottom: 6px;
}
.back-link {
  cursor: none;
  margin-top: 6px;
  transition: color 240ms var(--ease);
}
.back-link:hover { color: var(--yellow); }
.ch.bl::after {
  content: ''; width: 28px; height: 1px;
  background: var(--ink); opacity: 0.55; margin-top: 6px;
}

.nav-link {
  cursor: none;
  position: relative;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  transition: color 240ms var(--ease), padding-right 240ms var(--ease);
  padding-right: 0;
}
.nav-link::before {
  content: '+';
  position: absolute;
  left: -14px;
  top: 0;
  font-family: var(--mono);
  color: var(--ink-faint);
  font-size: 11px;
  opacity: 0;
  transition: opacity 240ms var(--ease), transform 320ms var(--ease);
}
.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  padding-right: 4px;
}
.nav-link:hover::before,
.nav-link.active::before {
  opacity: 1;
  transform: rotate(45deg);
  color: var(--yellow);
}


/* ── Bottom-right progress ──────────────────────────────── */
.progress-track {
  position: relative;
  width: 120px;
  height: 1px;
  background: rgba(15, 15, 14, 0.2);
}
.progress-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 0%;
  background: var(--yellow);
  transition: width 0s linear;
}


/* ── Hint badge ─────────────────────────────────────────── */
.hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms var(--ease) 400ms;
}
.hint.show { opacity: 0.7; }
.hint.hide { opacity: 0 !important; transition: opacity 400ms var(--ease); }
.hint .mono { letter-spacing: 0.22em; font-size: 9px; }


/* ── Scroll spacer (defines total page height = 5 viewports) */
.scroller { position: relative; width: 100%; z-index: 4; }
.sect {
  position: relative;
  width: 100%;
  height: 100vh;
  pointer-events: none;
}

/* Each section has a DOM overlay with chrome text positioned BELOW the
   particle wordmark (wordmark sits around viewport center via canvas). */
.sect-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.sect-content .mono { line-height: 1.7; }

/* HERO subtitle + hint stack */
.sect-hero {
  justify-content: flex-start;
  padding-top: 58vh;
  gap: 24px;
}
.sect-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sect-tag .mono { font-size: 12px; letter-spacing: 0.18em; }
.sect-tag .mono.strong { font-size: 13px; }

.sect-cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  margin-bottom: 14vh;
}
.sect-cta-row.center { text-align: center; }
.sect-cta-row .mono { font-size: 11px; letter-spacing: 0.20em; }

/* DISCIPLINE — top tagrow above the wordmark, then list below, then CTA */
.sect-discipline {
  justify-content: space-between;
  padding: 14vh 6vw 12vh;
}
.sect-tagrow {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 0.5px solid rgba(15, 15, 14, 0.18);
  padding-bottom: 6px;
}
.sect-tagrow .mono { font-size: 12px; letter-spacing: 0.16em; }
.sect-tagrow.center { justify-content: center; }

.sect-list {
  list-style: none;
  width: min(820px, 90%);
  margin: auto auto 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 28px;
  pointer-events: auto;
}
.sect-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 4px 6px 0;
  border-bottom: 0.5px dashed rgba(15, 15, 14, 0.14);
  transition: background 200ms var(--ease), padding-left 240ms var(--ease);
  cursor: none;
}
.sect-row:hover {
  background: rgba(245, 203, 92, 0.16);
  padding-left: 6px;
}
.sect-row .row-num  { font-family: var(--mono); font-size: 9px;  color: var(--yellow-hot); font-weight: 600; }
.sect-row .row-name { font-family: var(--mono); font-size: 12px; color: var(--ink); letter-spacing: 0.05em; }
.sect-row .row-year { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); letter-spacing: 0.08em; }

.sect-cta {
  margin-top: 14px;
  background: none;
  border: 0.7px solid var(--yellow);
  padding: 12px 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--yellow);
  pointer-events: auto;
  cursor: none;
  transition: background 220ms var(--ease), color 220ms var(--ease), letter-spacing 280ms var(--ease);
}
.sect-cta:hover {
  background: var(--yellow);
  color: var(--ink);
  letter-spacing: 0.28em;
}

/* CONTACT — wordmark in upper half (canvas), DOM info pinned below it
   via absolute positioning so it can never overlap the wordmark/rule.   */
.sect-contact {
  padding: 0;
}
.sect-contact .sect-tagrow {
  position: absolute;
  top: 14vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, 80%);
  border-bottom-color: transparent;
}
.contact-info {
  position: absolute;
  top: 62vh;          /* well below wordmark (36vh) + rule (50vh) */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}
.sect-contact .sect-cta-row {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
}
.contact-line {
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--ink);
  cursor: none;
  transition: color 220ms var(--ease);
}
.contact-line.big { font-size: 22px; letter-spacing: 0.16em; font-weight: 500; }
.contact-line.dim { color: var(--ink-faint); }
a.contact-line:hover { color: var(--yellow-hot); }


/* ── Interior view (post-dive) ───────────────────────────── */
.interior {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background-color: #0c0c0a;
  background-image:
    repeating-linear-gradient(0deg,  transparent 0 47px, rgba(255,255,255,0.025) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(255,255,255,0.025) 47px 48px),
    radial-gradient(circle at center, rgba(245, 203, 92, 0.08) 0%, transparent 55%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  color: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms var(--ease);
}
.interior.visible { opacity: 1; pointer-events: auto; }

.interior-chrome {
  position: fixed;
  top: var(--pad);
  left: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.interior-chrome .mono.strong { color: rgba(255, 255, 255, 0.7); }
.interior-chrome .mono.dim    { color: rgba(255, 255, 255, 0.4); }

.interior-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(80px, 17vw, 260px);
  letter-spacing: 0.015em;
  line-height: 0.85;
  color: #FFFFFF;
}
.interior-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.interior-hint {
  position: fixed;
  bottom: var(--pad);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.4);
}


/* ── Loader ──────────────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--paper);
  transition: opacity 600ms var(--ease);
}
.loader.done { opacity: 0; pointer-events: none; }

.loader-dots {
  display: flex;
  gap: 6px;
}
.loader-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  animation: bounce 0.95s infinite ease-in-out both;
}
.loader-dots span:nth-child(2) { animation-delay: 0.18s; background: var(--yellow); }
.loader-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-8px); opacity: 1; }
}


/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}


/* ── Touch / coarse pointer ──────────────────────────────── */
@media (pointer: coarse) {
  body { cursor: auto; }
  .cursor { display: none; }
}


/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .ch .mono { font-size: 9px; }
  .progress-track { width: 80px; }
  .ch.tr { gap: 4px; }
}


/* ── Noscript ────────────────────────────────────────────── */
.noscript {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
