/* ══════════════════════════════════════════════════════════
   Wilfred Gweth — portfolio
   Custom layer on top of Tailwind. Palette lives in the
   tailwind.config block in index.html.
   ══════════════════════════════════════════════════════════ */

:root {
  --bone:  #EFEAE1;
  --paper: #F7F4EE;
  --ink:   #12100E;
  --soot:  #1D1A17;
  --clay:  #C2521E;
  --moss:  #3C4A32;
  --teal:  #14403C;
  --sand:  #D8C9AF;
  --ochre: #D99A2B;
}

html { scroll-behavior: auto; }         /* GSAP owns scrolling, not the browser */
body { overflow-x: hidden; }

#smooth-wrapper { position: relative; }
#smooth-content { will-change: transform; }

img { -webkit-user-drag: none; user-select: none; }

/* ══════════════════════════════════════════════════════════
   GLASS PANELS
   backdrop-filter blur + saturate, inset highlights for the
   thickness of the pane, a slow specular sweep, and grain.

   NOT refraction. `backdrop-filter: url(#svgFilter)` is a no-op
   in Chrome — CSS.supports() reports true but no filter primitive
   is ever applied, verified at displacement scale 400 against an
   unfiltered reference (byte-identical). Real refraction of live
   DOM is not achievable this way; the WebGL glass in the Play
   section refracts a texture instead, which does work.
   ══════════════════════════════════════════════════════════ */

.glass {
  position: relative;
  isolation: isolate;
  border-radius: 22px;
  background:
    linear-gradient(140deg, rgb(255 255 255 / 0.20) 0%, rgb(255 255 255 / 0.05) 42%, rgb(255 255 255 / 0.12) 100%);
  border: 1px solid rgb(255 255 255 / 0.22);
  backdrop-filter: blur(18px) saturate(175%) brightness(1.06);
  -webkit-backdrop-filter: blur(18px) saturate(175%) brightness(1.06);
  box-shadow:
    inset 0 1.4px 0 rgb(255 255 255 / 0.55),      /* top light-catch edge */
    inset 0 -1.4px 0 rgb(255 255 255 / 0.16),     /* bottom bounce */
    inset 2px 0 6px -4px rgb(255 255 255 / 0.5),
    inset -2px 0 6px -4px rgb(255 255 255 / 0.5),
    0 18px 46px -14px rgb(18 16 14 / 0.42),       /* cast shadow */
    0 2px 6px -2px rgb(18 16 14 / 0.28);
  overflow: hidden;
}

/* Specular sweep — a slow band of light crossing the pane */
.glass::after {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: -1;
  background: linear-gradient(
    72deg,
    transparent 38%,
    rgb(255 255 255 / 0.13) 47%,
    rgb(255 255 255 / 0.30) 50%,
    rgb(255 255 255 / 0.13) 53%,
    transparent 62%
  );
  transform: translateX(-38%);
  pointer-events: none;
  animation: glassSweep 11s ease-in-out infinite alternate;
}
@keyframes glassSweep {
  from { transform: translateX(-42%); }
  to   { transform: translateX(42%); }
}

/* Fine grain keeps the blur from looking like flat plastic */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.16;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.glass-panel { border-radius: 26px; }
.glass-plate { border-radius: 20px; }

/* Nav pieces */
.nav-brand {
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  transition: color 0.4s ease;
}
.nav-pill {
  border-radius: 999px;
  padding: 9px 10px;
  align-items: center;
  gap: 2px;
}
.nav-link {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  transition: background 0.3s, color 0.4s ease;
}
.nav-link:hover { background: rgb(18 16 14 / 0.09); }
.nav-link-accent { color: var(--clay); }

/* Over dark sections the glass tints the other way */
#nav.is-dark .nav-brand,
#nav.is-dark .nav-link { color: var(--bone); }
#nav.is-dark .nav-link-accent { color: var(--ochre); }
#nav.is-dark .nav-link:hover { background: rgb(239 234 225 / 0.14); }
#nav.is-dark .glass {
  background:
    linear-gradient(140deg, rgb(255 255 255 / 0.14) 0%, rgb(255 255 255 / 0.03) 42%, rgb(255 255 255 / 0.08) 100%);
  border-color: rgb(255 255 255 / 0.16);
}

/* ─── Hero backdrop scrim ───────────────────────────────── */

/* Heaviest on the left, where the giant ink headline sits; opens up on the
   right so the glass square stays clearly visible. */
.hero-scrim {
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      rgb(239 234 225 / 0.93) 0%,
      rgb(239 234 225 / 0.88) 30%,
      rgb(239 234 225 / 0.58) 58%,
      rgb(239 234 225 / 0.40) 100%
    ),
    linear-gradient(
      to bottom,
      rgb(239 234 225 / 0.55) 0%,
      rgb(239 234 225 / 0.22) 38%,
      rgb(239 234 225 / 0.62) 100%
    );
}

/* ─── Typographic utilities ─────────────────────────────── */

.label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgb(18 16 14 / 0.55);
}
@media (min-width: 768px) { .label { font-size: 11px; } }
.label-light { color: rgb(239 234 225 / 0.5); }

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 10px;
  border-radius: 999px;
  background: var(--clay);
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.25 } }

.under {
  position: relative;
  color: rgb(18 16 14 / 0.75);
  transition: color 0.25s;
}
.under::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.under:hover { color: var(--clay); }
.under:hover::after { transform: scaleX(1); transform-origin: left; }

.mm-link {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.2rem, 10vw, 3.8rem);
  line-height: 1.16;
  color: var(--bone);
}
.mm-link:hover { color: var(--clay); }

.scroll-cue-line {
  display: inline-block;
  width: 46px; height: 1px;
  background: rgb(18 16 14 / 0.4);
  position: relative;
  overflow: hidden;
}
.scroll-cue-line::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--clay);
  transform: translateX(-100%);
  animation: sweep 2s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}
@keyframes sweep { 0% { transform: translateX(-100%) } 60%,100% { transform: translateX(100%) } }

/* ─── Rotating badge ────────────────────────────────────── */

.spin-badge {
  position: absolute;
  right: 6%;
  bottom: 8%;
  width: 132px; height: 132px;
  place-items: center;
  z-index: 5;
}
.spin-badge-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.spin-badge-text {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  /* Sized so the string fits once around the 276-unit arc without overlapping */
  font-size: 9.4px;
  letter-spacing: 0.115em;
  fill: rgb(18 16 14 / 0.6);
  text-transform: uppercase;
}
.spin-badge-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 999px;
  background: var(--clay);
  color: var(--bone);
  font-size: 12px;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.spin-badge:hover .spin-badge-core { transform: scale(1.16); }

/* ─── Custom cursor ─────────────────────────────────────── */

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 999px;
  background: var(--bone);
  pointer-events: none;
  z-index: 80;
  mix-blend-mode: difference;
  opacity: 0;
  display: grid;
  place-items: center;
}
.cursor-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  opacity: 0;
  white-space: nowrap;
}
/* We draw our own cursor, so the native one is suppressed everywhere —
   descendants included. Anything that set its own (the lens used to say
   `grab`) would otherwise show the OS cursor stacked on top of ours. */
/* `html body *` rather than `body *` — Tailwind preflight ships
   `button { cursor: pointer }` at the same specificity, and the CDN injects its
   stylesheet after this one, so it would otherwise win the tie. */
@media (hover: hover) and (pointer: fine) {
  html body, html body * { cursor: none; }
}
@media (hover: none) { .cursor { display: none; } }

/* ─── Marquee ───────────────────────────────────────────── */

.mq {
  font-family: "Inter Tight", sans-serif;
  font-weight: 500;
  font-size: clamp(1.6rem, 4.4vw, 3.2rem);
  letter-spacing: -0.03em;
  padding: 0 0.28em;
}
.mq-sm { font-size: clamp(0.85rem, 1.8vw, 1.15rem); letter-spacing: 0.02em; font-weight: 400; }
.mq-dot { color: var(--clay); font-size: 0.7em; padding: 0 0.3em; }

/* ─── Services list with cursor-following preview ───────── */

.srv {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px 18px;
  padding: 26px 0;
  border-bottom: 1px solid rgb(18 16 14 / 0.15);
  transition: padding-left 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (min-width: 768px) {
  .srv { grid-template-columns: 64px 1fr 260px 40px; padding: 32px 0; }
  .srv:hover { padding-left: 26px; }
}
.srv::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
}
.srv:hover::before { transform: scaleY(1); transform-origin: top; }
.srv > * { position: relative; transition: color 0.4s ease; }
.srv:hover .srv-num,
.srv:hover .srv-title,
.srv:hover .srv-meta,
.srv:hover .srv-arrow { color: var(--bone); }
.srv:hover .srv-arrow { transform: translateX(6px); }

.srv-num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: rgb(18 16 14 / 0.4);
}
.srv-title {
  font-size: clamp(1.35rem, 3.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.srv-meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgb(18 16 14 / 0.5);
  grid-column: 2 / -1;
}
@media (min-width: 768px) { .srv-meta { grid-column: auto; text-align: right; } }
.srv-arrow {
  display: none;
  font-size: 18px;
  color: rgb(18 16 14 / 0.4);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), color 0.4s;
}
@media (min-width: 768px) { .srv-arrow { display: block; text-align: right; } }

.srv-preview {
  position: fixed;
  top: 0; left: 0;
  width: 230px;
  aspect-ratio: 3 / 4;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 22px 50px -18px rgb(18 16 14 / 0.55);
  margin: -145px 0 0 -115px;
}
.srv-preview img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none) { .srv-preview { display: none; } }

/* ─── Work cards (horizontal section) ───────────────────── */

.wcard { flex-shrink: 0; width: 78vw; max-width: 440px; }
@media (min-width: 768px) { .wcard { width: 34vw; } }

.wcard-media {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #1D1A17;
}
.wcard-img {
  position: absolute;
  top: 0;
  left: -9%;
  width: 118%;                  /* the overhang is what the parallax slides through */
  max-width: none;              /* Tailwind preflight caps img at 100% — that would kill the overhang */
  height: 100%;
  object-fit: cover;
  will-change: transform;
}
.wcard-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 18px;
  position: relative;
  padding-left: 40px;
}
.wcard-num {
  position: absolute;
  left: 0; top: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--clay);
}
.wcard-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.wcard-sub {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgb(239 234 225 / 0.45);
  margin-top: 4px;
}

/* ─── Stats ─────────────────────────────────────────────── */

.stat {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgb(239 234 225 / 0.45);
  margin-top: 14px;
}

/* ─── Opposing scroll columns ───────────────────────────── */

.col-strip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  will-change: transform;
}
@media (min-width: 768px) { .col-strip { gap: 20px; } }
.col-strip img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
}

/* ─── Craft ─────────────────────────────────────────────── */

/* (DrawSVG handles .draw-line — no styles needed) */

/* ─── Process stacking cards ────────────────────────────── */

.pcard { margin-bottom: 26px; }
.pcard-inner {
  border-radius: 14px;
  padding: 40px 30px 34px;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform-origin: center top;
  will-change: transform;
}
@media (min-width: 768px) {
  .pcard-inner { padding: 56px 56px 48px; min-height: 400px; }
}
.pcard-num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.55;
}
.pcard-title {
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 22px;
}
.pcard-body {
  margin-top: 20px;
  max-width: 52ch;
  font-size: 16px;
  line-height: 1.55;
  opacity: 0.78;
}
.pcard-ghost {
  position: absolute;
  right: 4%;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(6rem, 15vw, 14rem);
  font-weight: 600;
  letter-spacing: -0.07em;
  line-height: 0.8;
  opacity: 0.13;
  pointer-events: none;
  user-select: none;
}
.pcard-tag {
  margin-top: auto;
  padding-top: 28px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.6;
}

/* ─── Trajectory timeline ───────────────────────────────── */

#railSvg { height: 100%; }
.tnode { position: relative; }
.tnode-year {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--clay);
}
.tnode-title {
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin-top: 10px;
}
.tnode-body {
  margin-top: 12px;
  max-width: 52ch;
  line-height: 1.55;
  color: rgb(18 16 14 / 0.68);
}
.tnode-ghost {
  display: none;
  position: absolute;
  right: 2%;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(4rem, 9vw, 8rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.8;
  color: var(--ink);
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
}
@media (min-width: 1024px) { .tnode-ghost { display: block; } }

/* ─── Archive filter grid (Flip) ────────────────────────── */

.filter {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 9px 16px;
  border: 1px solid rgb(18 16 14 / 0.2);
  border-radius: 999px;
  color: rgb(18 16 14 / 0.6);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.filter:hover { border-color: rgb(18 16 14 / 0.55); color: var(--ink); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--bone); }

.acard {
  position: relative;
  overflow: hidden;
  background: var(--sand);
  aspect-ratio: 4 / 5;
}
.acard img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.acard:hover img { transform: scale(1.06); }
.acard figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: linear-gradient(to top, rgb(18 16 14 / 0.85), transparent);
  color: var(--bone);
  transform: translateY(101%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.acard:hover figcaption { transform: translateY(0); }
.acard figcaption span { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.acard figcaption em {
  font-style: normal;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.65;
}
.acard.is-hidden { display: none; }

/* ─── ALIGN mini-game ───────────────────────────────────── */

/* Scrim that makes the heading readable over the poster backdrop */
.play-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 44% at 50% 24%, rgb(18 16 14 / 0.86) 0%, rgb(18 16 14 / 0.5) 48%, rgb(18 16 14 / 0.12) 80%),
    linear-gradient(to bottom, rgb(18 16 14 / 0.5), rgb(18 16 14 / 0.3) 45%, rgb(18 16 14 / 0.5));
}

.g-track {
  position: relative;
  height: 108px;
  border-radius: 14px;
  background: rgb(18 16 14 / 0.66);
  border: 1px solid rgb(255 255 255 / 0.12);
  overflow: hidden;
}
.g-zone {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.g-zone-wide { width: 26%; background: rgb(217 154 43 / 0.14); }
.g-zone-mid  { width: 9%;  background: rgb(217 154 43 / 0.26); }
.g-centre {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--ochre);
  pointer-events: none;
}
.g-marker {
  position: absolute;
  top: 8px; bottom: 8px;
  left: 0;
  width: 12px;
  border-radius: 3px;
  background: var(--clay);
  box-shadow: 0 0 22px 2px rgb(194 82 30 / 0.65);
  will-change: transform;
}
.g-feedback {
  margin-top: 18px;
  min-height: 46px;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: rgb(239 234 225 / 0.72);
}
.g-feedback b { color: var(--bone); font-weight: 600; }
.g-btn {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 14px 30px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.28);
  color: var(--bone);
  transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.2s;
}
.g-btn:hover { background: rgb(255 255 255 / 0.12); }
.g-btn:active { transform: scale(0.97); }
.g-btn-primary { background: var(--clay); border-color: var(--clay); }
.g-btn-primary:hover { background: #d35d26; border-color: #d35d26; }
.g-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ─── Draggable stickers ────────────────────────────────── */

.sticker {
  position: absolute;
  padding: 12px 20px;
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  white-space: nowrap;
  user-select: none;
  touch-action: none;
  z-index: 20;
  box-shadow: 0 8px 24px rgb(18 16 14 / 0.14);
}

/* ─── Magnetic email button ─────────────────────────────── */

.magnet {
  display: inline-block;
  padding: 22px 34px;
  border: 1px solid rgb(18 16 14 / 0.25);
  border-radius: 999px;
  font-size: clamp(0.95rem, 2vw, 1.35rem);
  letter-spacing: -0.02em;
  position: relative;
  overflow: hidden;
  will-change: transform;
}
.magnet::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--ink);
  border-radius: inherit;
  transform: scale(0);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.magnet:hover::before { transform: scale(1.02); }
.magnet-inner { position: relative; z-index: 1; transition: color 0.4s; display: block; }
.magnet:hover .magnet-inner { color: var(--bone); }

/* ─── Motion-safety ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .dot, .scroll-cue-line::after, .glass::after { animation: none; }
  .cursor, .srv-preview { display: none; }
  @media (hover: hover) { body, body * { cursor: auto; } }
}
