/*
Theme Name: Semiotica
Theme URI: https://semiotica.agency
Description: Semiotica — immersive & interactive design agency. Custom standalone theme. No Elementor dependency. Zero JS dependencies.
Author: Adrien Oneiga / Semiotica
Author URI: https://semiotica.agency
Version: 0.1.0
Text Domain: semiotica
*/

/* ═══════════════════════════════════════════════════════════════════
   SEMIOTICA — styles
   Palette: black / off-white / indigo accent (Nila)
   Type:    Neue Haas-style sans (system fallback) + ui mono
   All visual styles live here. No @import — fonts enqueued in PHP.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --black:    #0a0a0c;
  --ink:      #111115;
  --bone:     #f2efe9;
  --mute:     rgba(242,239,233,0.55);
  --faint:    rgba(242,239,233,0.28);
  --hairline: rgba(242,239,233,0.14);
  --indigo:   #2a3b5c;
  --indigo-lt:#4a5e8a;

  --f-display: "Neue Haas Grotesk Display", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --f-ui:      "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.55, 0, 1, 0.45);
  --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);

  --gutter:    clamp(1.5rem, 4vw, 4rem);
  --rail:      clamp(1.5rem, 4vw, 4rem);
}

/* ─── RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 5.4rem;
  background: var(--black);
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
}
body {
  font-family: var(--f-display);
  font-weight: 300;
  color: var(--bone);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;      /* clip, not hidden — hidden breaks position:sticky descendants */
  width: 100%;
  max-width: 100vw;
  position: relative;
}
.page-shell { width: 100%; max-width: 100vw; overflow-x: clip; }
.hero, .services, .work, .cta, .foot { max-width: 100vw; }
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
ul { list-style: none; }

::selection { background: var(--indigo); color: var(--bone); }

/* ─── UTIL ──────────────────────────────────────────────────────── */
.rail { padding-left: var(--rail); padding-right: var(--rail); }
.eyebrow {
  font-family: var(--f-ui);
  font-weight: 400;
  font-size: 0.88rem;        /* +30% */
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mute);
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-1 { transition-delay: 0.12s; }
.reveal-2 { transition-delay: 0.24s; }
.reveal-3 { transition-delay: 0.36s; }

/* ─── NAV ───────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem var(--rail);
  mix-blend-mode: difference;
  transition: padding 0.5s var(--ease), background 0.5s var(--ease), mix-blend-mode 0s 0.5s;
}
.nav.scrolled {
  /* Padding stays identical to .nav — prevents vertical jiggle of logo/links */
  mix-blend-mode: normal;
  background: rgba(10,10,12,0.78);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  transition: background 0.5s var(--ease), mix-blend-mode 0s;
}

/* WordPress admin bar — push fixed nav below it instead of overlap */
body.admin-bar .nav { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .nav { top: 46px; }
}
.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--bone);
}
.nav__logo-svg {
  height: 46px;            /* larger — matches cap-height of the nav links */
  width: auto;
  display: block;
}
.nav__logo-svg path,
.nav__logo-svg .cls-1,
.nav__logo-svg .cls-2,
.nav__logo-svg .cls-3,
.nav__logo-svg .cls-4 { fill: var(--bone); }
.nav__toggle {
  display: none;          /* hidden on desktop, shown via media query */
  background: none;
  border: 0;
  padding: 10px;
  cursor: pointer;
  z-index: 95;
  position: relative;
}
.nav__toggle span {
  display: block;
  width: 28px;
  height: 2px;
  background: var(--bone);
  margin: 6px 0;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.nav__links {
  display: flex;
  gap: 2.5rem;
}
.nav__links a {
  font-family: var(--f-ui);
  font-size: 1.23rem;      /* +40% from 0.88rem */
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--bone);
  opacity: 0.7;
  transition: opacity 0.3s var(--ease);
}
.nav__links a:hover { opacity: 1; }

/* ─── HERO ──────────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  min-height: 720px;
  width: 100%;
  overflow: hidden;
  background: var(--black);
  margin: 0;
  z-index: 2;               /* above services — covers the fluid pinned underneath */
}

.hero__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;            /* black backdrop while video is loading — no flash of poster */
}
/* Blurred backdrop video — only renders on mobile portrait. Desktop hides it
   entirely (no extra decoder cost beyond a metadata fetch). */
.hero__bg { display: none; }

/* Swiss-cross cursor trail — particles spawn on mousemove, drift with dampened
   inertia, fade out. Each + is rendered by two orthogonal CSS gradient bars.
   Zero dependencies, GPU-accelerated transforms, no canvas. */
.hero__trail {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.hero__trail-p {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--size, 18px);
  height: var(--size, 18px);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  will-change: transform, opacity;
  /* The + shape: horizontal bar + vertical bar via two CSS gradients.
     --tint defaults to bone but can be overridden per-particle for the
     chromatic R/G/B variants. */
  --tint: var(--bone, #f2efe9);
  --tint-glow: rgba(242, 239, 233, 0.35);
  background:
    linear-gradient(var(--tint), var(--tint)) center / 100% 18% no-repeat,
    linear-gradient(var(--tint), var(--tint)) center / 18% 100% no-repeat;
  filter: drop-shadow(0 0 6px var(--tint-glow));
}
.hero__trail-p--r { --tint: #d92b33; --tint-glow: rgba(217, 43, 51, 0.55); }
.hero__trail-p--g { --tint: #6d9b1b; --tint-glow: rgba(109, 155, 27, 0.55); }
.hero__trail-p--b { --tint: #655ffc; --tint-glow: rgba(101, 95, 252, 0.55); }

/* Hiragana ゆ variant — Adrien's signifier sprinkled through the trail.
   Drops the cross gradients and renders a glyph; system Japanese fallback
   (Hiragino Sans / Yu Gothic) supplies coverage. JS sizes p.size to 1.3x
   the plus baseline so width/height + transform offsets stay centered. */
.hero__trail-p--yu {
  background: none;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-weight: 500;
  font-size: var(--size, 18px);
  line-height: var(--size, 18px);
  text-align: center;
  color: var(--tint);
}
@media (prefers-reduced-motion: reduce) {
  .hero__trail { display: none; }
}

.hero__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(10,10,12,0.5) 85%),
    linear-gradient(to bottom, rgba(10,10,12,0.3) 0%, transparent 20%, transparent 70%, rgba(10,10,12,0.85) 100%);
}

.hero__content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--rail) clamp(4rem, 10vh, 8rem);
  gap: 2rem;
  max-width: 1680px;
  margin: 0 auto;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--bone);
}
.hero__eyebrow::before {
  content: "";
  width: 42px;
  height: 1px;
  background: var(--bone);
  opacity: 0.6;
}

.hero__headline {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.92rem, 5.76vw, 6.4rem);   /* -20% */
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--bone);
  max-width: 22ch;
}
.hero__headline em {
  font-style: normal;
  color: var(--mute);
}

.hero__sub {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  line-height: 1.5;
  color: var(--mute);
  max-width: 48ch;
}

.hero__scroll {
  position: absolute;
  bottom: 1.8rem;
  right: var(--rail);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--f-ui);
  font-size: 0.78rem;        /* +30% */
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--mute);
}
.hero__scroll-line {
  width: 56px;
  height: 1px;
  background: var(--mute);
  transform-origin: right;
  animation: scrollPulse 2.4s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleX(0.2); opacity: 0.3; }
  50%      { transform: scaleX(1);   opacity: 1; }
}

/* ─── SERVICES — fluid video pinned at top, hero sits on top of it ──
   Services overlaps hero by 100vh via negative margin. Z-index layering:
     hero (z:2)  — covers fluid while in viewport
     services (z:1) — fluid pinned underneath, revealed as hero scrolls up
   Total services height: 400vh. Effective word/scrub range: scroll 100-300vh.
─────────────────────────────────────────────────────────────── */
.services {
  position: relative;
  height: 275vh;            /* projects arrive ~30% sooner */
  background: var(--black);
  margin: -100vh 0 0 0;     /* overlap the hero */
  z-index: 1;
}
.services__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.services__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;             /* JS fades in / out at the edges of active range */
  z-index: 1;
  transition: opacity 0s;
  will-change: opacity;
  background: #000;
}
/* Backdrop layer — hidden on desktop, shown only on mobile portrait */
.services__bg { display: none; }
.services__veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(10,10,12,0.45) 95%),
    linear-gradient(to bottom, transparent 0%, transparent 88%, var(--black) 100%);
  pointer-events: none;
}
.services__stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--rail);
  pointer-events: none;
}
.services__lead {
  position: relative;
  max-width: min(90vw, 1100px);
  margin: 0 auto clamp(0.5rem, 1.5vh, 1.13rem);   /* -75% gap below */
  text-align: center;
  font-family: var(--f-ui);
  font-weight: 400;
  font-size: clamp(1.1rem, 1.43vw, 1.37rem);      /* +30% */
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bone);
  line-height: 1.4;
  pointer-events: auto;
  opacity: 0;
  text-shadow: 0 2px 30px rgba(0,0,0,0.5);
  will-change: opacity;
}
.services__words {
  position: relative;
  width: 100%;
  min-height: clamp(2.2rem, 6vw, 6rem);
  display: flex;
  align-items: center;
  justify-content: center;
}
.services__word {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  width: max-content;
  max-width: 90vw;
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.92rem, 5.76vw, 6.4rem);   /* matches .hero__headline */
  letter-spacing: -0.02em;                     /* matches .hero__headline */
  line-height: 0.95;
  color: var(--bone);
  text-align: center;
  /* text-transform: uppercase removed — words now read in title case like hero */
  opacity: 0;
  pointer-events: none;
  will-change: opacity, filter;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.4);
}
.services__word.is-current {
  pointer-events: auto;          /* the active word can receive liquid hover */
}

/* ─── Liquid-glass text ─────────────────────────────────────────────
   Two modes:
     refract → canvas particle overlay (radial bulge + chromatic trail)
     curl    → DOM-driven per-char displacement
   For refract mode, DOM text becomes transparent and the visible glyphs
   are rendered as ~20 pixel-particles per character into an overlay canvas.
   The DOM text remains for screen readers / SEO. */
.liquid-char {
  display: inline-block;
  position: relative;
  will-change: transform;
  backface-visibility: hidden;
}
/* No forced position: relative — it would override .services__word's
   absolute positioning and break the stacked-words layout. JS sets
   position: relative ONLY when the computed position is static. */
.liquid-canvas-host .liquid-char {
  transition: opacity 0.18s ease-out;
  text-shadow: none !important;
}
.liquid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease-out;
}
.liquid-char::before,
.liquid-char::after {
  content: attr(data-ch);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: inherit;
  opacity: var(--shard-a, 0);
  will-change: transform, opacity;
}
.liquid-char::before {
  /* Top shard — diagonal cut */
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 42%, 0 68%);
          clip-path: polygon(0 0, 100% 0, 100% 42%, 0 68%);
  transform: translate(var(--sx-a, 0px), var(--sy-a, 0px)) rotate(var(--sr-a, 0deg));
}
.liquid-char::after {
  /* Bottom shard — complementary slice */
  -webkit-clip-path: polygon(0 68%, 100% 42%, 100% 100%, 0 100%);
          clip-path: polygon(0 68%, 100% 42%, 100% 100%, 0 100%);
  transform: translate(var(--sx-b, 0px), var(--sy-b, 0px)) rotate(var(--sr-b, 0deg));
}

/* ─── WORK ──────────────────────────────────────────────────────── */
/* Overlaps the tail of services — the "Selected Projects" header peeks
   into the viewport while the last service word is still exiting. */
.work {
  position: relative;
  padding: clamp(2.5rem, 5vh, 5rem) 0 clamp(5rem, 10vh, 10rem);
  background: var(--black);
  margin-top: -30vh;    /* work Y sits ~30vh inside services' tail — visible at ~70vh viewport when last word exits */
  z-index: 2;           /* above services (z:1) during the overlap */
}
.work__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--rail);
  margin-bottom: clamp(2.5rem, 6vh, 5rem);
}
.work__title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  letter-spacing: -0.01em;
  color: var(--bone);
}
.work__count {
  font-family: var(--f-ui);
  font-size: 0.91rem;        /* +30% */
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute);
}
.work__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
}
.work__item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--ink);
  cursor: pointer;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
}
.work__item-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(0.82);
  transform: scale(1.04);
  transition: filter 0.8s var(--ease), transform 0.8s var(--ease);
}
.work__item:hover .work__item-thumb,
.work__item:focus-visible .work__item-thumb {
  filter: grayscale(0) contrast(1) brightness(1);
  transform: scale(1.0);
}
.work__item-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,12,0.88) 0%, transparent 55%);
  pointer-events: none;
}
.work__item-meta {
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  z-index: 2;
}
.work__item-title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1rem, 1.3vw, 1.25rem);
  letter-spacing: -0.005em;
  color: var(--bone);
  line-height: 1.15;
}
.work__item-cat {
  font-family: var(--f-ui);
  font-size: 0.78rem;        /* +30% */
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: nowrap;
  align-self: flex-end;
}

/* ─── MODAL — bergerfohr-style two-phase transition ──────────────
   Phase 1 (0 → 0.7s)  : page steps back (perspective + scale + brightness)
   Phase 2 (0.4 → 1.6s): modal rises from below, slower, ease-out-expo
   On close: modal drops first, page returns after a brief delay.
─────────────────────────────────────────────────────────────── */
.page-shell {
  transform-origin: 50% 0%;
  /* Default (closing) state — page returns AFTER modal drops. */
  transition: transform 0.75s var(--ease-expo), filter 0.65s var(--ease-expo);
  transition-delay: 0.45s;
  /* No will-change here — it creates a containing block that breaks
     position:sticky descendants (the services pinned video). */
}
body.modal-open .page-shell {
  /* Opening — page steps back FIRST, no delay. */
  transform: perspective(2400px) translate3d(0, 3vh, -160px) scale(0.91);
  filter: brightness(0.42) saturate(0.72) blur(1px);
  transition-delay: 0s;
}
body.modal-open { overflow: hidden; }

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(5,5,7,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
  transition-delay: 0s;
}
body.modal-open .modal-scrim {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.3s;
}

.modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 4vh;
  z-index: 200;
  background: #000;
  transform: translateY(104%);
  /* Default (closing) — modal drops fast, no delay. */
  transition: transform 0.85s var(--ease-expo);
  transition-delay: 0s;
  overflow-y: auto;
  overscroll-behavior: contain;
  will-change: transform;
  box-shadow: 0 -40px 80px rgba(0,0,0,0.6);
}
body.modal-open .modal {
  transform: translateY(0);
  /* Opening — modal rises slower, after page has stepped back. */
  transition: transform 1.2s var(--ease-expo);
  transition-delay: 0.4s;
}

.modal__close {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem var(--rail);
  background: linear-gradient(to bottom, #000 65%, transparent);
  z-index: 10;
}

/* Prev/Next floating arrows — vertically centred, edge-anchored */
.modal__nav {
  position: fixed;
  top: 50%;
  z-index: 220;
  width: clamp(46px, 5vw, 60px);
  height: clamp(46px, 5vw, 60px);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--bone);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(-50%);
  transition: opacity 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
  opacity: 0;
}
body.modal-open .modal__nav { opacity: 1; }
body.modal-open .modal__nav.is-disabled { opacity: 0.18; pointer-events: none; }
.modal__nav:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.34);
}
.modal__nav-prev { left: clamp(0.6rem, 2vw, 2rem); }
.modal__nav-next { right: clamp(0.6rem, 2vw, 2rem); }
.modal__nav svg {
  width: 40%;
  height: 40%;
  display: block;
}
@media (min-width: 721px) {
  body.modal-open .modal__nav { display: flex; }
}

/* Mobile-only bottom nav bar — pinned, 80% black, prev/next + Swipe label */
.modal__mobnav { display: none; }
@media (max-width: 720px) {
  body.modal-open .modal__mobnav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    padding: 0 1.4rem env(safe-area-inset-bottom, 0) 1.4rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 230;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
  }
  .modal__mobnav-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--bone);
    cursor: pointer;
    padding: 0;
    transition: opacity 0.25s var(--ease);
  }
  .modal__mobnav-btn.is-disabled {
    opacity: 0.25;
    pointer-events: none;
  }
  .modal__mobnav-btn svg {
    width: 22px;
    height: 22px;
    display: block;
  }
  .modal__mobnav-label {
    font-family: var(--f-ui);
    font-size: 0.68rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--mute);
  }
}
.modal__label {
  font-family: var(--f-ui);
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mute);
}
.modal__close-btn {
  font-family: var(--f-ui);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: color 0.3s var(--ease);
}
.modal__close-btn:hover { color: var(--indigo-lt); }
.modal__close-btn::before {
  content: "";
  width: 12px;
  height: 12px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg) translate(-2px, 2px);
}
.modal__body {
  padding: 1rem var(--rail) clamp(4rem, 10vh, 10rem);
  max-width: 1440px;
  margin: 0 auto;
}
.modal__video {
  position: relative;
  width: 100%;
  background: #000;
  margin-bottom: 2.4rem;
  /* aspect-ratio + overflow:hidden removed — vertical/portrait videos were
     getting cropped because the container forced 16:9 and clipped overflow.
     Now the iframe / native video sets its own height. */
}
.modal__video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;     /* default — Vimeo/YouTube players letterbox internally */
  max-height: 80vh;
  border: 0;
  display: block;
}
.modal__video video {
  width: 100%;
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  border: 0;
  display: block;
  object-fit: contain;
  background: #000;
}
.modal__title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--bone);
  margin-bottom: 0.8rem;
}
.modal__cat {
  font-family: var(--f-ui);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--indigo-lt);
  margin-bottom: 2rem;
}
.modal__desc {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--mute);
  max-width: 60ch;
}

/* ─── MODAL — Gutenberg case-study content ───────────────────────
   Renders post_content from semiotica_project CPT. Author uses
   native Gutenberg blocks (Columns, Image, Heading, Paragraph) —
   styles below interpret them in the dark Semiotica typeface system. */
.modal__content {
  margin-top: 2.5rem;
  max-width: 1100px;
}
.modal__content > * + * { margin-top: 1.4rem; }
.modal__content p {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: 1.1rem;
  line-height: 1.75;
  color: rgba(242,239,233,0.85);
  max-width: 64ch;
}
.modal__content h2,
.modal__content h3,
.modal__content h4 {
  font-family: var(--f-display);
  font-weight: 300;
  letter-spacing: -0.005em;
  color: var(--bone);
  line-height: 1.15;
}
.modal__content h2 { font-size: clamp(1.6rem, 2.6vw, 2.4rem); margin-top: 3rem; }
.modal__content h3 { font-size: clamp(1.2rem, 1.8vw, 1.6rem); margin-top: 2.2rem; }
.modal__content h4 { font-size: 1.1rem; margin-top: 1.8rem; }

/* Gutenberg Image block — full bleed within modal width, hairline frame */
.modal__content .wp-block-image,
.modal__content figure {
  margin: 2.4rem 0;
}
.modal__content .wp-block-image img,
.modal__content figure img,
.modal__content img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--ink);
}
.modal__content figcaption,
.modal__content .wp-element-caption {
  margin-top: 0.8rem;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: center;
}

/* Gutenberg Columns block — 1-2 column layouts authored per project */
.modal__content .wp-block-columns {
  display: flex;
  gap: clamp(1.5rem, 3vw, 3rem);
  margin: 2.4rem 0;
}
.modal__content .wp-block-column {
  flex: 1;
  min-width: 0;
}
.modal__content .wp-block-column > * + * { margin-top: 1.4rem; }

/* Gutenberg Embed (Vimeo/YouTube within case study body) */
.modal__content .wp-block-embed {
  margin: 2.4rem 0;
}
.modal__content .wp-block-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* Quote block */
.modal__content blockquote,
.modal__content .wp-block-quote {
  border-left: 2px solid var(--indigo-lt);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  line-height: 1.5;
  color: var(--bone);
  max-width: 56ch;
}

/* ─── Form fields (contact / any embedded form) ──────────────────
   Rounded corners, helvetica, all-text #777, borders #333. */
.modal__content input[type="text"],
.modal__content input[type="email"],
.modal__content input[type="url"],
.modal__content input[type="tel"],
.modal__content input[type="search"],
.modal__content textarea,
.modal__content select,
.modal__content button,
.modal__content input[type="submit"] {
  border-radius: 8px;
  border: 1px solid #333;
  background: transparent;
  color: #777;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  outline: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s var(--ease);
}
.modal__content input:focus,
.modal__content textarea:focus,
.modal__content select:focus {
  border-color: #777;
}
.modal__content input::placeholder,
.modal__content textarea::placeholder {
  color: #777;
  opacity: 0.7;
}
.modal__content label {
  color: #777;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.4rem;
}
.modal__content button,
.modal__content input[type="submit"] {
  cursor: pointer;
  width: auto;
  display: inline-block;
  background: transparent;
}
.modal__content button:hover,
.modal__content input[type="submit"]:hover {
  border-color: #777;
}

/* Loading skeleton — visible briefly while modal fetches case study body */
.modal__loading {
  margin-top: 2rem;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--faint);
}

@media (max-width: 720px) {
  .modal__content .wp-block-columns { flex-direction: column; gap: 1.5rem; }
}

/* ─── CTA FOOTER ───────────────────────────────────────────────── */
.cta {
  position: relative;
  padding: clamp(6rem, 16vh, 14rem) var(--rail);
  text-align: center;
  background: var(--black);
  border-top: 1px solid var(--hairline);
}
.cta__kicker {
  display: block;
  margin-bottom: 1.5rem;
}
.cta__headline {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(2rem, 5.5vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--bone);
  margin-bottom: 2.5rem;
  max-width: 18ch;
  margin-left: auto;
  margin-right: auto;
}
.cta__mail {
  display: inline-block;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bone);
  border-bottom: 1px solid var(--faint);
  padding-bottom: 0.3rem;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.cta__mail:hover { color: var(--indigo-lt); border-color: var(--indigo-lt); }

/* ─── FOOTER ───────────────────────────────────────────────────── */
.foot {
  padding: 1.8rem var(--rail);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--hairline);
  font-family: var(--f-ui);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--black);
}
.foot a { color: var(--mute); }
.foot a:hover { color: var(--bone); }

/* ═══ ABOUT PAGE ═══════════════════════════════════════════════ */
.about {
  padding: clamp(7rem, 14vh, 12rem) var(--rail) clamp(5rem, 10vh, 10rem);
  background: var(--black);
  max-width: 1440px;
  margin: 0 auto;
}
.about__head {
  margin-bottom: clamp(3rem, 8vh, 6rem);
  max-width: 30ch;
}
.about__headline {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(2.4rem, 6vw, 6rem);
  letter-spacing: -0.015em;
  line-height: 1.02;
  color: var(--bone);
  margin-top: 1rem;
}
/* Match the hero headline exactly — used on standard pages (Contact etc) */
.about__headline--hero {
  font-size: clamp(1.92rem, 5.76vw, 6.4rem);
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin-top: 0;
  max-width: 22ch;
}
/* Full-width body when no rail (eyebrow + date removed on plain pages) */
.about__body--full {
  margin-top: clamp(2rem, 5vh, 4rem);
}

/* ─── Form fields on standard pages — same look as modal forms ────
   Rounded corners, helvetica, all-text #777, borders #333.
   !important to win against form-plugin baseline CSS. */
.about__body input[type="text"],
.about__body input[type="email"],
.about__body input[type="url"],
.about__body input[type="tel"],
.about__body input[type="search"],
.about__body input[type="number"],
.about__body input[type="password"],
.about__body textarea,
.about__body select,
.about__body button,
.about__body input[type="submit"],
.about__body input[type="button"] {
  border-radius: 8px !important;
  border: 1px solid #333 !important;
  background: transparent !important;
  color: #777 !important;
  font-family: Helvetica, Arial, sans-serif !important;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  outline: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s var(--ease);
}
.about__body input:focus,
.about__body textarea:focus,
.about__body select:focus {
  border-color: #777 !important;
}
.about__body input::placeholder,
.about__body textarea::placeholder {
  color: #777 !important;
  opacity: 0.7;
}
.about__body label,
.about__body legend {
  color: #777 !important;
  font-family: Helvetica, Arial, sans-serif !important;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.4rem;
}
.about__body button,
.about__body input[type="submit"],
.about__body input[type="button"] {
  cursor: pointer;
  width: auto;
  display: inline-block;
}
.about__body button:hover,
.about__body input[type="submit"]:hover,
.about__body input[type="button"]:hover {
  border-color: #777 !important;
}
.about__grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.about__rail {
  position: sticky;
  top: 7rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.about__body {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.1rem, 1.35vw, 1.4rem);
  line-height: 1.7;
  color: var(--bone);
}
.about__body p + p { margin-top: 1.8rem; }
.about__body p {
  color: rgba(242,239,233,0.8);
}
.about__body p:first-child {
  font-size: clamp(1.3rem, 1.9vw, 2rem);
  line-height: 1.45;
  color: var(--bone);
  margin-bottom: 2.4rem;
}
.about__services {
  margin-top: clamp(4rem, 8vh, 7rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  border-top: 1px solid var(--hairline);
  padding-top: clamp(2.5rem, 5vh, 4rem);
}
.about__service h3 {
  font-family: var(--f-ui);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--indigo-lt);
  margin-bottom: 1rem;
}
.about__service p {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--mute);
}

/* ═══ RESPONSIVE ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .work__grid { grid-template-columns: repeat(2, 1fr); }
  .about__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .about__rail { position: static; flex-direction: row; justify-content: space-between; }
  .about__services { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  :root { --rail: 1.4rem; }
  .hero__scroll { display: none; }

  /* Pin nav — keep padding constant so logo never shifts when .scrolled fires */
  .nav, .nav.scrolled {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  /* Mobile navigation — hamburger toggles a full-screen overlay menu.
     Items are top-right anchored, sitting just below the X (closed-state
     hamburger position) — first link reads as "the line below the X". */
  .nav__toggle { display: block; }
  .nav__links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 1.4rem;
    background: rgba(0, 0, 0, 0.8);     /* 80% opacity black */
    margin: 0;
    padding: 4.6rem var(--rail) 2rem;   /* top-pad clears the X; right-pad aligns with X */
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
  }
  body.nav-open .nav__links {
    opacity: 1;
    pointer-events: auto;
  }
  .nav__links a {
    font-size: 1.25rem;
    letter-spacing: 0.36em;
    text-align: right;
  }

  /* Contact / standard pages — tighten so submit fits without scroll */
  .about {
    padding-top: clamp(4rem, 10vh, 6rem);
    padding-bottom: clamp(2rem, 5vh, 4rem);
  }
  .about__head { margin-bottom: 1.2rem; }
  .about__body--full { margin-top: 0.8rem; }
  .about__body input,
  .about__body textarea,
  .about__body select,
  .about__body button { padding: 0.55rem 0.9rem; }
  .about__body label,
  .about__body legend { font-size: 0.78rem; margin-bottom: 0.2rem; }
  .hero__content { padding-bottom: 4rem; gap: 1.4rem; }
  .work__grid { grid-template-columns: 1fr; }
  .work__head { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .services { height: 160vh; }
  .about__services { grid-template-columns: 1fr; }
  .about__rail { flex-direction: column; }
  .modal { top: 2vh; }
  body.modal-open .page-shell { transform: translate3d(0, 2vh, 0) scale(0.96); }
  .foot { flex-direction: column; gap: 0.6rem; text-align: center; }

  /* Mobile container heights (apply both orientations) */
  .hero { min-height: 100dvh; }
  .services__sticky { height: 100dvh; }
  /* Slide 1 hero — full-bleed blurred backdrop + main video sized to ~40% of
     viewport height, centred. Selectors use .hero__media descendant to win
     specificity over the default `.hero__media video { object-fit: cover }`. */
  .hero__media .hero__bg {
    display: block;
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    object-fit: cover;
    opacity: 0.8;
    filter: blur(45px) saturate(1.35);
    transform: scale(1.18);     /* hides blur edge fade-out */
    z-index: 0;
    background: transparent;
    pointer-events: none;
  }
  .hero__media .hero__main {
    position: absolute;
    /* Reset inherited inset FIRST, then apply explicit centring values.
       Order matters — `inset: auto` would clobber top/left if set after them. */
    inset: auto;
    right: auto;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: 100vw;
    height: 40vh;               /* ~40% of viewport height */
    object-fit: cover;
    object-position: center center;
    z-index: 1;
    background: transparent;
  }

  /* MOBILE: lead "We create synesthetic works of art" must NEVER wrap.
     Caps absolutely at viewport width — values tuned so 36-char uppercase
     content always fits on one line down to 320px screens. */
  .services__lead {
    white-space: nowrap;
    /* Linear vw-based size: at 320px = 6.7px, at 720px = 15px */
    font-size: clamp(0.42rem, 2.1vw, 0.95rem);
    letter-spacing: 0.12em;
    max-width: 100vw;
    margin: 0 auto 0.8rem;
    padding: 0 0.5rem;
  }

  /* Hero headline tightens on small screens */
  .hero__headline {
    font-size: clamp(1.6rem, 7.2vw, 2.6rem);
    max-width: 100%;
  }
  .hero__sub {
    font-size: clamp(0.9rem, 3.4vw, 1.05rem);
  }
}

@media (max-width: 480px) {
  /* Even tighter for phones — kerning needs to relax further to keep one line */
  .services__lead {
    font-size: clamp(0.38rem, 1.95vw, 0.78rem);
    letter-spacing: 0.08em;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  /* Mobile portrait — give the slide-2 sequence more room to breathe.
     Section is taller so each word gets more scroll distance. */
  .services { height: 420vh; }

  /* Slide 2 — same blur-backdrop pattern as the hero. Backdrop fills the
     viewport with a heavy-blur copy of the video; main video centered at
     70vh (zoomed out 30% from full-bleed) so the whole frame breathes. */
  .services__sticky .services__bg {
    display: block;
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    object-fit: cover;
    opacity: 0.8;
    filter: blur(45px) saturate(1.35);
    transform: scale(1.18);     /* hides blur edge fade-out */
    z-index: 0;
    background: transparent;
    pointer-events: none;
  }
  .services__sticky .services__video {
    inset: auto;
    right: auto;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: 100vw;
    height: 70vh;               /* 30% smaller than full-bleed = 70% */
    object-fit: cover;
    background: transparent;
  }

  /* Hero media container fills the viewport */
  .hero { height: 100dvh; }
  .hero__media { width: 100vw; max-width: 100vw; height: 100dvh; }
}

/* Mobile landscape — videos behave like desktop (full-bleed cover, no
   blurred backdrop, no 40vh main constraint). Achieved by NOT having any
   landscape-specific overrides — the desktop defaults apply by default,
   and the portrait-only block above is silent in landscape. */

/* ═══ REDUCED MOTION ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.1s !important; }
  .reveal { opacity: 1; transform: none; }
  .hero__scroll-line { animation: none; }
  .services { height: auto; }
  .services__sticky { position: relative; height: 100vh; }
}
