/* =================================================================
   TOKENS
   Change fonts/colours here — everything else references these.
================================================================= */
:root {
  --bg: #f7f5f1;
  --bg-alt: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #5b584f;
  --fg-faint: #8a867c;
  --border: #e3e0d8;
  --border-strong: #cfcbc0;
  --focus-ring: #1a1a1a;

  /* Display / headings: Cal Sans (single weight 400 — avoid faux-bold). */
  --font-display: "Cal Sans", "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  /* Body / UI / captions: Inter */
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-sans: var(--font-body);

  --max-width: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);

  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1.25rem;
  --space-md: 2rem;
  --space-lg: 3.5rem;
  --space-xl: 6rem;
  --space-2xl: 9rem;

  --transition-fast: 180ms ease;
  --transition-base: 320ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Actual measured height of .site-header, kept in sync by main.js
     — the project detail view sits below this so the header (nav,
     language toggle) stays reachable no matter what's open. */
  --header-height: 52px;

  /* Soft sitewide wash (glass-morph blues/cyans on cream). Used by
     .page-atmosphere and .project-view so every surface shares one tint. */
  --page-atmosphere:
    radial-gradient(
      ellipse 78% 62% at 8% 14%,
      rgba(160, 233, 255, 0.12) 0%,
      rgba(160, 233, 255, 0.05) 42%,
      transparent 78%
    ),
    radial-gradient(
      ellipse 72% 58% at 92% 8%,
      rgba(32, 188, 237, 0.06) 0%,
      rgba(32, 188, 237, 0.025) 45%,
      transparent 80%
    ),
    radial-gradient(
      ellipse 70% 56% at 74% 82%,
      rgba(17, 106, 248, 0.035) 0%,
      rgba(17, 106, 248, 0.012) 48%,
      transparent 82%
    ),
    radial-gradient(
      ellipse 76% 64% at 26% 90%,
      rgba(205, 245, 253, 0.14) 0%,
      rgba(205, 245, 253, 0.055) 44%,
      transparent 80%
    );
}

/* =================================================================
   RESET
================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display family: titles / brand. Cal Sans ships as 400 only.
   CV row titles (.cv-row-role) stay on body/Inter — secondary to
   section headings like Education / About Me. */
h1,
h2,
h3,
.logo,
.section-heading,
.hero-name,
.site-intro-title,
.work-card-title,
.project-title,
.cv-block-heading {
  font-family: var(--font-display);
  font-weight: 400;
}

body.no-scroll {
  overflow: hidden;
}

.page-top-anchor {
  width: 0;
  height: 0;
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
}

/* =================================================================
   ACCESSIBILITY HELPERS
================================================================= */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =================================================================
   LAYOUT HELPERS
================================================================= */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-heading {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--transition-base),
    transform 0.6s var(--transition-base);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =================================================================
   HEADER
================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 241, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition:
    background-color var(--transition-base),
    backdrop-filter var(--transition-base),
    -webkit-backdrop-filter var(--transition-base);
}

/* Chromium sticky + backdrop-filter can freeze a stale blur when the
   DOM under the header swaps (project open/close). Briefly drop the
   filter and go fully opaque so the compositor cannot keep a frozen
   sample; restored after a short timeout in JS. */
.site-header.is-backdrop-refresh {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: var(--bg) !important;
  transition: none !important;
}

/* Project detail open: solid cream header — frost freeze cannot show
   while the view is open. Frost returns when .is-project-open is removed. */
body.is-project-open .site-header,
body.is-project-open .site-header.is-solid,
body.page-home.is-project-open .site-header,
body.page-home.is-project-open .site-header.is-solid,
body.is-project-open .site-header:has(#mobile-nav:not([hidden])) {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Homepage: frosted from the start (no solid cream block). Soft top
   fade on .hero-bg still keeps the mesh from climbing into the bar.
   .is-solid nudges opacity slightly once scrolled; mobile-open is
   more opaque so the menu stays readable. */
body.page-home .site-header.is-solid {
  background: rgba(247, 245, 241, 0.8);
}

.site-header:has(#mobile-nav:not([hidden])) {
  background: rgba(247, 245, 241, 0.94);
}

body.page-home.is-theater-mode .site-header,
body.page-home.is-theater-mode .site-header.is-solid,
body.page-home.is-theater-mode .site-header:has(#mobile-nav:not([hidden])) {
  background: #050505;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.65rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  min-width: 0;
}

.logo img {
  display: block;
  height: 48px;
  width: 170px;
  max-height: 48px;
  object-fit: cover;
  object-position: center;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: var(--space-lg);
}

.header-trailing {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-utils {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-desktop a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--fg-muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--transition-fast);
}

.nav-desktop a:hover,
.nav-desktop a:focus-visible {
  color: var(--fg);
}

.nav-desktop a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--fg);
  transition: right var(--transition-base);
}

.nav-desktop a:hover::after,
.nav-desktop a:focus-visible::after {
  right: 0;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-mobile {
  border-top: 1px solid var(--border);
  padding: var(--space-sm) var(--gutter) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nav-mobile[hidden] {
  display: none;
}

.nav-mobile a {
  font-size: 1.05rem;
}

/* Language toggle — globe + EN / ES; active code is bold/dark. */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1;
}

.lang-toggle-icon {
  flex-shrink: 0;
  display: block;
}

.lang-option {
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
  padding: 0;
  transition: color var(--transition-fast);
}

.lang-option.is-active {
  font-weight: 700;
  color: var(--fg);
}

.lang-option:hover,
.lang-option:focus-visible {
  color: var(--fg);
}

.lang-toggle-sep {
  color: var(--fg-faint);
  user-select: none;
}

/* Header search — icon matches utility color/hover; panel is a
   slim cream/glass strip under the header bar. */
.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2c2a26;
  line-height: 0;
  transition: color var(--transition-fast);
}

.search-toggle:hover,
.search-toggle:focus-visible,
.search-toggle[aria-expanded="true"] {
  color: var(--fg);
}

.site-search {
  border-top: 1px solid var(--border);
  background: rgba(247, 245, 241, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}

.site-search[hidden] {
  display: none;
}

.site-search-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-sm) var(--gutter) var(--space-xs);
}

.site-search-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 0.55rem 0;
  outline: none;
  transition: border-color var(--transition-fast);
}

.site-search-input::placeholder {
  color: var(--fg-faint);
}

.site-search-input:focus {
  border-bottom-color: var(--fg);
}

.site-search-results {
  margin-top: 0.35rem;
  max-height: min(40vh, 280px);
  overflow-y: auto;
}

.site-search-hint,
.site-search-empty {
  margin: 0;
  padding: 0.65rem 0 0.35rem;
  font-size: 0.875rem;
  color: var(--fg-faint);
}

.site-search-result {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  transition: color var(--transition-fast);
}

.site-search-result:last-child {
  border-bottom: 0;
}

.site-search-result:hover,
.site-search-result:focus-visible {
  color: var(--fg);
}

.site-search-result-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.site-search-result-meta {
  font-size: 0.8rem;
  color: var(--fg-faint);
}

@media (min-width: 768px) {
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-md);
  }
  .logo {
    justify-self: start;
  }
  .logo img {
    height: 52px;
    width: 200px;
    max-height: 52px;
  }
  .nav-desktop {
    display: flex;
    justify-self: center;
  }
  .header-trailing {
    justify-self: end;
    margin-left: 0;
  }
  .nav-toggle {
    display: none;
  }
  .nav-mobile {
    display: none;
  }
}

/* =================================================================
   HERO
================================================================= */
.site-intro {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: var(--bg);
  opacity: 1;
  visibility: visible;
}

.site-intro.is-exiting {
  animation: intro-layer-exit 0.45s ease forwards;
}

.site-intro-title {
  padding: var(--gutter);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-align: center;
}

.site-intro-pop {
  display: inline-block;
  opacity: 0;
  transform: scale(0.88) translateY(10px);
  transform-origin: center bottom;
}

.site-intro-pop.is-popped {
  animation: intro-word-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.site-intro-pop.is-visible {
  opacity: 1;
  transform: none;
}

.site-intro-caret {
  display: none;
  width: 0.08em;
  height: 0.85em;
  margin-left: 0.06em;
  vertical-align: -0.05em;
  background: currentColor;
}

.site-intro.is-typing .site-intro-caret {
  display: inline-block;
  animation: intro-caret-blink 0.9s step-end infinite;
}

html.site-intro-pending body > .site-header,
html.site-intro-pending body > main,
html.site-intro-pending body > .site-footer {
  opacity: 0;
}

html.site-intro-ready body > .site-header {
  animation: site-content-enter-header 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html.site-intro-ready body > main,
html.site-intro-ready body > .site-footer {
  animation: site-content-enter 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  margin: 0;
  /* Fill the viewport below the header so copy centers in that area. */
  min-height: calc(100vh - var(--header-height, 52px));
  min-height: calc(100svh - var(--header-height, 52px));
  padding: var(--space-md) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

/* Homepage hero sits below the solid header (no negative pull). Soft
   top fade on .hero-bg matches the bottom fade into Featured. */
body.page-home .hero-copy {
  z-index: 2;
}

/* Hero shell: positions the reusable wash behind copy. Soft fades at
   both ends — transparent under the header line, opaque through the
   hero, then transparent again into Featured (no hard seam). */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.14) 4%,
    rgba(0, 0, 0, 0.42) 8%,
    rgba(0, 0, 0, 0.78) 12%,
    #000 18%,
    #000 38%,
    rgba(0, 0, 0, 0.78) 55%,
    rgba(0, 0, 0, 0.42) 70%,
    rgba(0, 0, 0, 0.14) 85%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.14) 4%,
    rgba(0, 0, 0, 0.42) 8%,
    rgba(0, 0, 0, 0.78) 12%,
    #000 18%,
    #000 38%,
    rgba(0, 0, 0, 0.78) 55%,
    rgba(0, 0, 0, 0.42) 70%,
    rgba(0, 0, 0, 0.14) 85%,
    transparent 100%
  );
}

/* No center white veil — glass orbs must stay visible under the title. */

/* =================================================================
   GLASS MORPH BG (reusable)
   Large translucent glass orbs on light off-white. Palette:
   #A0E9FF / #116AF8 / #CDF5FD / #20BCED / #020D33 (soft navy),
   frosted blur, thin light edge.
   Perfect circles only. Soft top/bottom fades stay on .hero-bg.
   JS spawns 5–7 orbs and drives smooth free drift, soft collision, + color life.
================================================================= */

/* Interpolatable tint / shine so orbs can ease between palette colors. */
@property --orb-c1 {
  syntax: "<color>";
  inherits: false;
  initial-value: rgba(160, 233, 255, 0.72);
}

@property --orb-c2 {
  syntax: "<color>";
  inherits: false;
  initial-value: rgba(17, 106, 248, 0.45);
}

@property --orb-c3 {
  syntax: "<color>";
  inherits: false;
  initial-value: rgba(205, 245, 253, 0.58);
}

@property --orb-shine-x {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 32%;
}

@property --orb-shine-y {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 28%;
}

@property --orb-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 145deg;
}

.glass-morph-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #f7fbfc;
  transform: translateZ(0);
}

.glass-morph-bg__orb {
  position: absolute;
  display: block;
  pointer-events: none;
  will-change: transform;
  transform-origin: center center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(28px) saturate(155%);
  backdrop-filter: blur(28px) saturate(155%);
  box-shadow:
    inset 0 1px 28px rgba(255, 255, 255, 0.42),
    inset 0 -10px 32px rgba(255, 255, 255, 0.1),
    0 14px 44px rgba(100, 150, 180, 0.1);
  --orb-c1: rgba(160, 233, 255, 0.72);
  --orb-c2: rgba(17, 106, 248, 0.45);
  --orb-c3: rgba(205, 245, 253, 0.58);
  --orb-shine-x: 32%;
  --orb-shine-y: 28%;
  --orb-angle: 145deg;
  background:
    radial-gradient(
      circle at var(--orb-shine-x) var(--orb-shine-y),
      rgba(255, 255, 255, 0.58) 0%,
      transparent 42%
    ),
    linear-gradient(
      var(--orb-angle),
      var(--orb-c1) 0%,
      var(--orb-c2) 48%,
      var(--orb-c3) 100%
    );
  transition:
    --orb-c1 3.6s ease-in-out,
    --orb-c2 3.6s ease-in-out,
    --orb-c3 3.6s ease-in-out,
    --orb-shine-x 3.6s ease-in-out,
    --orb-shine-y 3.6s ease-in-out,
    --orb-angle 3.6s ease-in-out;
}

/* Whisper grain inside orbs only — tasteful, not heavy. */
.glass-morph-bg__orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* JS-driven life: free position/size; no fixed CSS drift. */
.glass-morph-bg.is-alive .glass-morph-bg__orb {
  right: auto;
  bottom: auto;
  animation: none;
}

@media (max-width: 768px) {
  .glass-morph-bg__orb {
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    backdrop-filter: blur(22px) saturate(145%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .glass-morph-bg__orb {
    animation: none !important;
    transition: none;
  }
}

/* Soft palette wash behind every page (cream base + glass-morph blues).
   Shared via --page-atmosphere so project views can reuse it. Home keeps
   its glass orbs in .hero-bg; this layer stays whisper-soft underneath. */
.page-atmosphere {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--page-atmosphere);
}

/* Keep .site-intro position:fixed (do not override to relative — that
   left the invisible intro in document flow and pushed the header down).
   Keep .site-header position:sticky so it stays pinned to the true top. */
body > main,
body > .site-footer {
  position: relative;
  z-index: 1;
}

/* Welcome glass centered in the hero (subtitle is option 3, low). */
.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: var(--max-width);
  /* Keep title glyphs visible; hero overflow:hidden is for the mesh only. */
  overflow: visible;
}

/* Liquid glass panel — title only (same recipe as .work-card-sub /
   work-card liquid glass: translucent fill, blur, rim). Option 3:
   subtitle is parked low in the hero, not under this glass. */
.hero-welcome {
  position: relative;
  z-index: 2;
  display: block;
  /* Hug the single-line title; never exceed the hero column. */
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  /* Extra inset so the title breathes inside the glass. */
  padding: 1.5rem 2.15rem 1.6rem;
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(247, 245, 241, 0.48) 45%,
    rgba(255, 255, 255, 0.58) 100%
  );
  border: 1.5px solid rgba(255, 255, 255, 0.82);
  border-radius: 1.35em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 1px 3px rgba(26, 26, 26, 0.06),
    0 10px 32px rgba(110, 150, 175, 0.12);
  -webkit-backdrop-filter: blur(16px) saturate(155%);
  backdrop-filter: blur(16px) saturate(155%);
  transform-origin: center center;
}

.hero-name {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  /* Scales down on narrow viewports so the full phrase stays one line. */
  font-size: clamp(1.35rem, 4.2vw + 0.55rem, 3.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  /* Slightly roomier than 1.05 so descenders/ascenders aren't clipped. */
  line-height: 1.2;
  margin: 0;
  padding: 0;
  max-width: 100%;
  /* Honor Enter/newlines from the pencil editor */
  white-space: pre-line;
  text-align: center;
  color: rgba(12, 14, 18, 0.82);
  -webkit-text-fill-color: rgba(12, 14, 18, 0.82);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 24px rgba(255, 255, 255, 0.25);
}

/* Soft pop/fade-in for the welcome glass (once per session). */
html.hero-title-pending .hero-welcome {
  opacity: 0;
  transform: scale(0.92);
}

.hero-welcome.is-awaiting-pop {
  opacity: 0;
  transform: scale(0.92);
}

.hero-welcome.is-popping {
  animation: hero-title-pop 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-welcome.is-popped {
  opacity: 1;
  transform: none;
}

@keyframes hero-title-pop {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }

  70% {
    opacity: 1;
    transform: scale(1.035);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Return visit: glass already settled (set in <head> from sessionStorage). */
html.hero-ready .hero-welcome {
  opacity: 1;
  transform: none;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  html.hero-title-pending .hero-welcome,
  .hero-welcome.is-awaiting-pop,
  .hero-welcome.is-popping,
  .hero-welcome.is-popped {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: calc(100vh - var(--header-height, 52px));
    min-height: calc(100svh - var(--header-height, 52px));
  }

  .hero-welcome {
    padding: 1.2rem 1.4rem 1.3rem;
  }
}

.hero-role {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--fg-muted);
  margin-bottom: var(--space-md);
}

/* Option 3: subtitle parked low in the hero viewport — above the
   scroll chevron, not glued under the welcome glass. (Option 2 would
   sit under the glass again; Option 1 hid this entirely.) */
.hero-statement {
  position: absolute;
  z-index: 2;
  left: 50%;
  /* Sit above .hero-scroll: scroll bottom + button size + gap. */
  bottom: calc(clamp(1.25rem, 4.5vh, 2.75rem) + 2.75rem + 1.15rem);
  transform: translateX(-50%);
  width: min(100%, 36rem);
  max-width: calc(100% - 2 * var(--gutter));
  margin: 0;
  padding: 0 var(--gutter);
  box-sizing: border-box;
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 0.4rem + 1.1vw, 0.95rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(90, 96, 104, 0.72);
  text-align: center;
  /* Pass clicks through to the hero; pencil re-enables below in edit mode. */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease;
}

/* Pencil is a child of .hero-statement — restore hit-testing so edit works. */
html.is-edit-mode .hero-statement .editor-pencil {
  pointer-events: auto;
  position: relative;
  z-index: 4;
}

.hero-statement.is-revealed {
  opacity: 1;
}

.hero-statement.is-revealed-instant {
  transition: none;
}

/* Return visit: show subtitle immediately (set in <head> from sessionStorage). */
html.hero-ready .hero-statement {
  opacity: 1;
  transition: none;
}

@media (max-width: 640px) {
  .hero-statement {
    bottom: calc(clamp(1rem, 3.5vh, 1.75rem) + 2.5rem + 0.95rem);
    font-size: clamp(0.68rem, 0.38rem + 1.4vw, 0.88rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-statement {
    opacity: 1;
    transition: none;
  }
}

/* Scroll-down cue — sits low in the hero viewport, away from title glass. */
.hero-scroll {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(1.25rem, 4.5vh, 2.75rem);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(247, 245, 241, 0.35) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 4px 16px rgba(110, 150, 175, 0.1);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.hero-scroll:hover,
.hero-scroll:focus-visible {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.72) 0%,
    rgba(247, 245, 241, 0.5) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 6px 20px rgba(110, 150, 175, 0.14);
  outline: none;
}

.hero-scroll:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 2px rgba(255, 255, 255, 0.85),
    0 0 0 4px rgba(91, 88, 79, 0.35),
    0 6px 20px rgba(110, 150, 175, 0.14);
}

.hero-scroll-icon {
  display: block;
  animation: hero-scroll-bounce 2.4s ease-in-out infinite;
}

@keyframes hero-scroll-bounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(4px);
  }
}

@media (max-width: 640px) {
  .hero-scroll {
    bottom: clamp(1rem, 3.5vh, 1.75rem);
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-icon {
    animation: none;
  }
}

@keyframes intro-word-pop {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(10px);
  }

  70% {
    opacity: 1;
    transform: scale(1.06) translateY(0);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes intro-caret-blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes intro-layer-exit {
  from {
    opacity: 1;
    visibility: visible;
  }

  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes site-content-enter-header {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes site-content-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-intro-pop,
  .site-intro-pop.is-popped {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .site-intro.is-exiting {
    animation: intro-layer-exit 0.25s ease forwards;
  }

  .site-intro.is-typing .site-intro-caret {
    display: none;
    animation: none;
  }

  html.site-intro-ready body > .site-header,
  html.site-intro-ready body > main,
  html.site-intro-ready body > .site-footer {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

html.site-intro-skip .site-intro {
  display: none;
}

html.site-intro-skip body > .site-header,
html.site-intro-skip body > main,
html.site-intro-skip body > .site-footer {
  opacity: 1;
  animation: none;
}

/* =================================================================
   SELECTED WORK
================================================================= */
.work {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--gutter);
  border-top: 1px solid var(--border);
}

/* Homepage: no hairline after hero — wash already fades into page bg. */
.hero + .work {
  padding-top: var(--space-lg);
  border-top: none;
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg) var(--space-md);
}

@media (min-width: 700px) {
  .work-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.work-card {
  display: block;
  color: inherit;
}

/* Liquid glass shell — shared by work cards + About portraits.
   Frame sits around the photo; backdrop-filter stays on the shell only. */
.work-card-image-wrap,
.about-photo-wrap {
  --work-card-glass-inset: 9px;
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(247, 245, 241, 0.48) 45%,
    rgba(255, 255, 255, 0.58) 100%
  );
  border: 1.5px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 1px 3px rgba(26, 26, 26, 0.06);
  -webkit-backdrop-filter: blur(16px) saturate(155%);
  backdrop-filter: blur(16px) saturate(155%);
}

.work-card-image-wrap {
  aspect-ratio: 4 / 3;
}

/* Glass rim only (masked ring) — no backdrop-filter: masks often fail with it and wash the photo */
.work-card-image-wrap::after,
.about-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  padding: var(--work-card-glass-inset);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.78) 0%,
    rgba(247, 245, 241, 0.62) 50%,
    rgba(255, 255, 255, 0.7) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.work-card-image,
.about-photo {
  position: absolute;
  top: var(--work-card-glass-inset);
  left: var(--work-card-glass-inset);
  z-index: 0;
  width: calc(100% - (var(--work-card-glass-inset) * 2));
  height: calc(100% - (var(--work-card-glass-inset) * 2));
  max-width: none;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
}

.work-card-image {
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-card:hover .work-card-image,
.work-card:focus-visible .work-card-image {
  transform: scale(1.035);
}

.work-card-video-cover {
  position: relative;
}

.work-card-cover-play {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding-left: 2px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(5px);
  font-size: 0.75rem;
}

.work-card-motion {
  position: relative;
}

.motion-card-stage {
  position: absolute;
  inset: var(--work-card-glass-inset, 9px);
  display: block;
  overflow: hidden;
  border-radius: 8px;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-card:hover .motion-card-stage,
.work-card:focus-visible .motion-card-stage {
  transform: scale(1.025);
}

.work-card-motion-phone .motion-card-stage {
  background: var(--bg);
}

.motion-card-phone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 84%;
  padding: 3px;
  border: 2px solid var(--fg);
  border-radius: 23px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transform: translate(-50%, -50%);
}

.motion-card-phone8 {
  width: auto;
  height: 90%;
  aspect-ratio: 697 / 1272;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.motion-card-phone8 .motion-card-screen {
  z-index: 1;
  top: 13.21%;
  right: auto;
  bottom: auto;
  left: 13.06%;
  width: 75.61%;
  height: 72.48%;
  border: 0;
  border-radius: 0;
}

.motion-card-phone-frame {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.motion-card-screen {
  position: absolute;
  inset: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 17px;
  color: var(--fg);
  background: #fff;
  text-align: center;
}

.motion-card-cover-image {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 800ms ease;
}

.motion-card-cover-image.is-hidden {
  opacity: 0;
}

.motion-card-preview-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 800ms ease;
  pointer-events: none;
}

.motion-card-preview-video.is-visible {
  opacity: 1;
}

.motion-card-cta {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.24);
  opacity: 0;
  transition: opacity 500ms ease;
  pointer-events: none;
}

.motion-card-phone-cover.is-cta-visible .motion-card-cta {
  opacity: 1;
}

.motion-card-cta-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding-left: 2px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
  font-size: 0.75rem;
}

.motion-card-cta-text {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.motion-card-island {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 50%;
  width: 36%;
  height: 7px;
  border-radius: 999px;
  background: var(--fg);
  transform: translateX(-50%);
}

.motion-card-title {
  max-width: 82%;
  font-size: clamp(0.58rem, 1.1vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.motion-card-play {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding-left: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--fg);
  background: var(--bg);
  font-size: 0.75rem;
}

.work-card-motion-dj .motion-card-stage {
  display: grid;
  place-items: center;
  padding: 7% 5%;
  background: var(--bg);
}

.motion-booth-device {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1448 / 567;
}

.work-card-motion-dj .motion-booth-card {
  width: 100%;
  max-height: 100%;
}

.motion-booth-frame {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

/* Screen hole from DJBOOTH.png (238,221)-(1217,488) @ 1448×567.
   PNG screen cutout is transparent; video sits under the frame so the bezel
   masks edges. Slightly oversized vs the cutout to hide subpixel/AA gaps. */
.motion-booth-screen {
  position: absolute;
  z-index: 1;
  top: 38.7%;
  left: 16.15%;
  width: 68.25%;
  height: 47.85%;
  overflow: hidden;
  background: #000;
}

.motion-booth-screen-fill {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
  opacity: 1;
  transition: opacity 800ms ease;
}

.motion-booth-screen-fill.is-hidden {
  opacity: 0;
}

.motion-booth-screen .motion-card-cover-image {
  z-index: 2;
}

.motion-booth-screen .motion-card-preview-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 800ms ease;
  pointer-events: none;
}

.motion-booth-screen .motion-card-preview-video.is-visible {
  opacity: 1;
}

.motion-booth-card.is-cta-visible .motion-card-cta {
  opacity: 1;
}

.motion-booth-screen .motion-card-cta {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.motion-booth-surface {
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
  padding: clamp(0.75rem, 2vh, 1.5rem) 0;
  background: var(--bg);
}

.motion-booth-player {
  width: min(100%, 1240px);
  margin: 0 auto;
}

.motion-booth-player .motion-video {
  position: absolute;
  z-index: 1;
  top: 38.7%;
  left: 16.15%;
  width: 68.25%;
  height: 47.85%;
  display: block;
  object-fit: cover;
  object-position: center;
  border: 0;
  background: #000;
}

.motion-booth-player .motion-video-start {
  z-index: 8;
  inset: 38.7% 15.6% 13.45% 16.15%;
  border-radius: 0;
  color: #fff;
  background: rgba(8, 5, 10, 0.72);
}

.motion-booth-player .motion-video-start span {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
  background: rgba(20, 12, 24, 0.88);
}

.motion-booth-player .motion-video-controls {
  position: absolute;
  z-index: 8;
  top: 86.25%;
  right: 16.44%;
  bottom: auto;
  left: 16.44%;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    transform 220ms ease,
    opacity 140ms ease;
}

.motion-booth-player:hover .motion-video-controls,
.motion-booth-player:focus-within .motion-video-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.motion-booth-player .motion-control-btn,
.motion-booth-player .motion-volume-toggle svg,
.motion-booth-player .motion-volume-toggle .motion-volume-wave {
  color: #fff;
  fill: #fff;
  stroke: #fff;
}

.motion-booth-player .motion-theater-toggle .motion-icon-theater {
  fill: none;
  stroke: currentColor;
  color: inherit;
}

.motion-booth-player .motion-theater-toggle.is-active {
  color: #f5d76e;
}

.motion-booth-player .motion-progress::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    #fff 0 var(--progress),
    rgba(255, 255, 255, 0.45) var(--progress) 100%
  );
}

.motion-booth-player .motion-progress::-webkit-slider-thumb,
.motion-booth-player .motion-progress::-moz-range-thumb,
.motion-booth-player .motion-progress::-moz-range-progress {
  background: #fff;
}

.motion-booth-player .motion-progress::-moz-range-track {
  background: rgba(255, 255, 255, 0.45);
}

.work-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
}

.work-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.work-card-sub {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(247, 245, 241, 0.32) 50%,
    rgba(255, 255, 255, 0.4) 100%
  );
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px rgba(26, 26, 26, 0.04);
}

/* "View all work" link under the Home page's Recent Work preview */
.work-view-all {
  display: inline-block;
  margin-top: var(--space-lg);
  font-size: 0.95rem;
  color: var(--fg-muted);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-strong);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.work-view-all:hover,
.work-view-all:focus-visible {
  color: var(--fg);
  border-color: var(--fg);
}

/* Category filter buttons on the Work page */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.category-filter-btn {
  font-size: 0.95rem;
  color: var(--fg-faint);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.category-filter-btn:hover,
.category-filter-btn:focus-visible {
  color: var(--fg);
}

.category-filter-btn.is-active {
  color: var(--fg);
  font-weight: 600;
  border-color: var(--fg);
}

/* =================================================================
   ABOUT
================================================================= */
.about {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--gutter);
  border-top: 1px solid var(--border);
}

.about-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: start;
}

/* Glass shell/rim shared with .work-card-image-wrap above; layout only here */
.about-photo-wrap {
  aspect-ratio: 4 / 5;
  max-width: 300px;
}

/* Match paragraph rhythm: global .section-heading uses space-lg,
   which left a large empty band under "Sobre mí" / About. */
.about-text .section-heading {
  margin-bottom: var(--space-sm);
}

.about-text p,
.about-text .about-bio {
  font-family: var(--font-body);
  color: var(--fg-muted);
  max-width: 60ch;
  margin-bottom: var(--space-sm);
  white-space: pre-line;
}

/* Edit mode: anchor the single bio pencil at the top of the block.
   Inline-at-end placement hides it after a long pre-line bio. */
html.is-edit-mode .about-text .about-bio {
  position: relative;
  padding-right: 1.85rem;
  box-sizing: border-box;
  min-height: 2.5rem;
}

html.is-edit-mode .about-text .about-bio.is-empty-edit::before {
  content: "Edit bio…";
  display: block;
  color: var(--fg-muted);
  opacity: 0.55;
  font-style: italic;
  pointer-events: none;
}

html.is-edit-mode .about-text .about-bio .editor-pencil {
  position: absolute;
  top: 0.15rem;
  right: 0;
  margin-left: 0;
  z-index: 2;
  pointer-events: auto;
}

.about-text p:last-child,
.about-text .about-bio:last-child {
  margin-bottom: 0;
}

.about-text .about-bio + .about-learn-more {
  margin-top: var(--space-sm);
}

@media (min-width: 800px) {
  .about-inner {
    grid-template-columns: 280px 1fr;
  }
}

/* Learn-more link out of the home page's short About section,
   styled like the "View all work" link. Last paragraph already
   supplies space-sm; avoid stacking an extra margin-top. */
.about-learn-more {
  display: inline-block;
  margin-top: 0;
  font-size: 0.95rem;
  color: var(--fg);
  border-bottom: 1px solid var(--border-strong);
  transition: border-color var(--transition-fast);
}

.about-learn-more:hover,
.about-learn-more:focus-visible {
  border-color: var(--fg);
}

/* =================================================================
   ABOUT PAGE (about.html) — full bio + CV
================================================================= */
/* Intro reuses .about-inner / .about-photo from the home About
   section (photo left, bio right). Below that: Education,
   Experience, Languages/Skills, and Software as a single column.
   Spacing between every section comes from this one flex `gap`
   instead of individual margins, so it can't drift or collapse
   unevenly no matter what sits next to what. */
.about-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--gutter) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.about-page .about-photo {
  object-fit: contain;
  object-position: center;
}

@media (min-width: 800px) {
  .about-page .about-inner {
    align-items: stretch;
  }

  .about-page .about-photo-wrap {
    aspect-ratio: auto;
    max-width: none;
    min-height: 0;
  }
}

/* Each section gets the same divider line + breathing room before
   its heading — identical for Experience, Software, and (nested
   one level in) Languages/Skills. The first block after the intro
   (Education) has no top rule so nothing sits under the photo. */
.cv-block {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.about-page > .about-inner + .cv-block {
  border-top: none;
}

.cv-block-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-sm);
}

.cv-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 700px) {
  .cv-columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tabular rows: a fixed-width left block (title, then org/location,
   then dates stacked beneath) | detail, to the right — same
   left-aligned layout for both Education and Work Experience. A
   single fixed-width column (rather than one sized by each row's
   own content) keeps every row's dates and description starting at
   the same x position instead of drifting per row. */
.cv-rows {
  display: grid;
  gap: 0;
}

.cv-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  padding-bottom: var(--space-sm);
  text-align: left;
}

.cv-row + .cv-row {
  padding-top: var(--space-sm);
}

.cv-row:last-child {
  padding-bottom: 0;
}

/* Education only — item dividers between consecutive entries */
#education-list .cv-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

@media (min-width: 700px) {
  .cv-row {
    grid-template-columns: 260px 1fr;
    gap: var(--space-md);
  }

  #education-list .cv-row {
    grid-template-columns: 1fr;
  }

  #education-list .cv-row-main {
    position: relative;
    padding-right: 14rem;
  }

  #education-list .cv-row-dates {
    position: absolute;
    right: 0;
    bottom: 0;
    margin-top: 0;
    text-align: right;
  }
}

.cv-row-main {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.cv-row-role {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.cv-row-org {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.cv-row-location {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--fg-faint);
}

.cv-row-dates {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--fg-faint);
  text-align: left;
  margin-top: 0.3rem;
}

.cv-row-detail {
  font-family: var(--font-body);
  color: var(--fg-muted);
  font-size: 0.95rem;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

ul.cv-row-detail li,
#skills-list li {
  position: relative;
  padding-left: 1.1rem;
}

ul.cv-row-detail li {
  margin-bottom: 0.35rem;
}

ul.cv-row-detail li:last-child {
  margin-bottom: 0;
}

ul.cv-row-detail li::before,
#skills-list li::before {
  content: "";
  position: absolute;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--border-strong);
}

ul.cv-row-detail li::before {
  top: 0.55em;
}

/* Skills rows have .cv-simple-list vertical padding; center dot on the text line */
#skills-list li::before {
  top: 50%;
  transform: translateY(-50%);
}

.cv-simple-list {
  list-style: none;
}

.cv-simple-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0.6rem 0;
  font-family: var(--font-body);
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* Languages only — item dividers between Spanish / English / Dutch */
#languages-list li:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

#skills-list li {
  justify-content: flex-start;
}

.cv-list-label {
  color: var(--fg);
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.tool-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 72px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
  .tool-badge:hover,
  .tool-badge:focus-within {
    transform: translateY(-4px) scale(1.12);
  }

  .tool-badge:hover .tool-badge-icon,
  .tool-badge:focus-within .tool-badge-icon {
    filter: drop-shadow(0 8px 14px rgba(26, 26, 26, 0.2));
  }

  .tool-badge:hover .tool-badge-name,
  .tool-badge:focus-within .tool-badge-name {
    color: var(--fg);
  }
}

.tool-badge-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: block;
  object-fit: contain;
  transition: filter 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-badge-icon-figma {
  transform: scale(1.15);
}

.tool-badge-name {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-align: center;
  line-height: 1.3;
  transition: color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .tool-badge,
  .tool-badge-icon,
  .tool-badge-name {
    transition: none;
  }

  .tool-badge:hover,
  .tool-badge:focus-within {
    transform: none;
  }

  .tool-badge:hover .tool-badge-icon,
  .tool-badge:focus-within .tool-badge-icon {
    filter: none;
  }
}

/* =================================================================
   FOOTER
================================================================= */
.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  align-items: center;
  justify-content: space-between;
  color: var(--fg-faint);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.project-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-lg);
  /* Single hairline under Tools — no second border creating an empty band. */
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  color: var(--fg-faint);
  font-size: 0.9rem;
}

.footer-links a {
  color: var(--fg-muted);
  transition: color var(--transition-fast);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--fg);
}

/* =================================================================
   PROJECT DETAIL VIEW
================================================================= */
.project-view {
  position: fixed;
  top: var(--header-height, 52px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  /* Cream + same soft wash as .page-atmosphere (fixed layer sits under this). */
  background: var(--page-atmosphere), var(--bg);
  overflow-y: auto;
  transition: background-color 0.35s ease;
}

.project-view.is-theater {
  background: #050505;
}

.project-view.is-theater .project-header,
.project-view.is-theater .project-tools,
.project-view.is-theater .project-footer,
.project-view.is-theater .motion-player-hint {
  opacity: 0.12;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.project-view.is-theater .project-close {
  opacity: 0.45;
  color: #ddd;
  transition: opacity 0.35s ease, color 0.2s ease;
}

.project-view.is-theater .project-close:hover,
.project-view.is-theater .project-close:focus-visible {
  opacity: 1;
  color: #fff;
}

.project-view.is-theater .project-video,
.project-view.is-theater .motion-player {
  position: relative;
  z-index: 2;
}

.project-view.is-theater .motion-booth-surface,
.project-view.is-theater .motion-phone-surface {
  background: #050505;
}

body.is-theater-mode .site-header {
  background: #050505;
  color: #777;
  transition: background-color 0.35s ease, color 0.35s ease;
}

body.is-theater-mode .site-header a,
body.is-theater-mode .site-header .lang-toggle,
body.is-theater-mode .site-header .lang-option,
body.is-theater-mode .site-header .lang-toggle-sep,
body.is-theater-mode .site-header button {
  color: #777;
}

body.is-theater-mode .site-header .lang-option.is-active {
  color: #ddd;
}

body.is-theater-mode .site-header a:hover,
body.is-theater-mode .site-header a:focus-visible,
body.is-theater-mode .site-header .lang-option:hover,
body.is-theater-mode .site-header .lang-option:focus-visible,
body.is-theater-mode .site-header button:hover,
body.is-theater-mode .site-header button:focus-visible {
  color: #ddd;
}

.project-view-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  /* Modest bottom padding — avoid a tall empty band above the footer. */
  padding: var(--space-md) var(--gutter) var(--space-lg);
}

.project-view.is-pdf-project .project-view-inner {
  max-width: min(100%, 1680px);
  padding-left: clamp(0.4rem, 1.2vw, 0.85rem);
  padding-right: clamp(0.4rem, 1.2vw, 0.85rem);
}

.project-close {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  padding: 0.6rem 0;
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  padding: 0.6rem 0;
  margin-bottom: var(--space-lg);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.project-close:hover,
.project-close:focus-visible,
.page-back-link:hover,
.page-back-link:focus-visible {
  color: var(--fg);
}

.project-header {
  max-width: 70ch;
  margin-bottom: var(--space-lg);
}

/* Layout only — glass pill look comes from .work-card-sub */
.project-meta {
  display: inline-block;
  margin-bottom: var(--space-xs);
}

.project-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.project-overview {
  color: var(--fg-muted);
  font-size: 1.05rem;
}

.project-media {
  margin-bottom: var(--space-lg);
}

.project-tools {
  border-top: 1px solid var(--border);
  /* No bottom border — footer supplies the single separator below. */
  padding: var(--space-md) 0 0;
  margin-bottom: 0;
}

/* Empty video slot must never paint a bordered box when unused. */
.project-video[hidden] {
  display: none !important;
}

.project-fact h3 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-faint);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.project-fact p {
  font-family: var(--font-body);
  color: var(--fg-muted);
}

/* Carousel — always exactly 3 fixed slots (prev / active / next);
   main.js swaps which gallery image populates each one instead of
   scrolling a long strip, so no more than 3 are ever on screen.
   Since both peek slots always share the same width, centering the
   row as a whole (justify-content) centers the active slot too — no
   translate/offset math needed. The active slide is sized to its
   own image's exact aspect ratio at the carousel's fixed height —
   full resolution, no letterboxing, ever. The peek slides take up
   whatever width is left over (main.js), cropped via object-fit:
   cover since only ever a sliver of them is visible anyway, and
   fade toward their outer edge with a mask-image gradient rather
   than a hard cut. Navigate only via a peek slide, a dot, or the
   left/right arrow keys. */
.carousel {
  position: relative;
  overflow: hidden;
  height: 60vh;
  min-height: 320px;
  max-height: 640px;
}

.carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
}

.carousel.is-animating .carousel-track {
  position: absolute;
  inset: 0;
  display: block;
}

.carousel.is-animating .carousel-track .carousel-slide {
  pointer-events: none;
  will-change: left, top, width, height, opacity;
  /* Masks only make sense at rest; mid-morph they clip wrong. */
  -webkit-mask-image: none;
  mask-image: none;
}

.carousel-slide-ghost {
  flex: none;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

.carousel-slide-ghost img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

/* During the turn, cover keeps expanding/shrinking boxes continuous;
   active snaps back to contain at rest (same look when the box
   matches the image aspect). */
.carousel.is-animating .carousel-slide img {
  object-fit: cover;
  object-position: center;
}

.carousel-slide {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  backface-visibility: hidden;
}

.carousel-slide[data-role="prev"] {
  -webkit-mask-image: linear-gradient(to left, #000 99%, transparent 100%);
  mask-image: linear-gradient(to left, #000 99%, transparent 100%);
}

.carousel-slide[data-role="next"] {
  -webkit-mask-image: linear-gradient(to right, #000 99%, transparent 100%);
  mask-image: linear-gradient(to right, #000 99%, transparent 100%);
}

.carousel-slide.is-active {
  cursor: pointer;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.carousel-slide.is-active img {
  object-fit: contain;
  object-position: center;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: var(--space-sm);
}

.carousel[hidden],
.carousel-dots[hidden],
.flipbook[hidden] {
  display: none !important;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.carousel-dot:hover,
.carousel-dot:focus-visible {
  background: var(--fg-muted);
}

.carousel-dot.is-active {
  background: var(--fg);
  transform: scale(1.25);
}

@media (max-width: 600px) {
  .carousel {
    height: 42vh;
    min-height: 220px;
  }
}

/* ---------- Editorial brochure (simple catalog folder) ---------- */
.flipbook {
  position: relative;
  margin: 0;
  max-width: none;
  width: 100%;
}

.flipbook[hidden] {
  display: none;
}

.flipbook-stage {
  position: relative;
  width: 100%;
  min-height: 0;
  margin: 0;
  overflow: visible;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.flipbook-page {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(90vh, calc(100dvh - 11rem));
  object-fit: contain;
  box-shadow: none;
  background: transparent;
  image-rendering: auto;
  pointer-events: none;
}

.flipbook-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: var(--space-sm);
}

.flipbook-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
}

.flipbook-dot:hover,
.flipbook-dot:focus-visible {
  background: var(--fg-muted);
}

.flipbook-dot.is-active {
  background: var(--fg);
  transform: scale(1.25);
}

.flipbook-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  margin: 0;
  background: rgba(247, 244, 239, 0.92);
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.flipbook-status[hidden] {
  display: none !important;
}

.work-card-image.is-pdf-cover,
.work-card-image-mockup {
  object-fit: contain;
  background: var(--bg);
}

@media (max-width: 600px) {
  .flipbook-page {
    max-height: min(82vh, calc(100dvh - 9rem));
  }
}

/* ---------- Tri-fold brochure (connected accordion hinges) ---------- */
.trifold {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.trifold[hidden] {
  display: none !important;
}

.trifold-stage {
  position: relative;
  width: 100%;
  min-height: min(64vh, 580px);
  display: grid;
  place-items: center;
  overflow: visible;
  padding: 2rem 0 3.5rem;
}

.trifold-scene {
  position: relative;
  z-index: 1;
  width: min(100%, 860px);
  min-height: min(56vh, 480px);
  display: grid;
  place-items: center;
}

/*
  Nested hinges keep panels physically connected (one paper).
  Each joint uses perspective()+rotateY around its LEFT edge so the
  next panel swings from the previous panel's right edge — no gaps.
  (No preserve-3d / filter — those break inside overflow:auto.)
*/
.trifold-accordion {
  --fold: 38deg;
  display: flex;
  align-items: stretch;
  height: min(52vh, 440px);
  transform: perspective(1200px) rotateX(5deg);
  transform-origin: center bottom;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.trifold-panel {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  background: #fff;
  overflow: hidden;
  backface-visibility: hidden;
  outline: 1px solid transparent;
}

.trifold-joint {
  display: flex;
  align-items: stretch;
  height: 100%;
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  backface-visibility: hidden;
}

.trifold-joint-1 {
  transform: perspective(900px) rotateY(calc(var(--fold) * -1));
}

.trifold-joint-2 {
  transform: perspective(900px) rotateY(var(--fold));
}

/* Hover: almost flat, still one connected sheet */
@media (hover: hover) {
  .trifold:not(.is-expanded) .trifold-scene:hover .trifold-accordion {
    --fold: 6deg;
    transform: perspective(1200px) rotateX(2deg);
  }
}

.trifold-panel-a {
  box-shadow:
    6px 14px 24px rgba(0, 0, 0, 0.18),
    inset -12px 0 18px rgba(0, 0, 0, 0.18);
}

.trifold-panel-b {
  box-shadow:
    inset 10px 0 16px rgba(0, 0, 0, 0.14),
    inset -10px 0 16px rgba(0, 0, 0, 0.12);
}

.trifold-panel-c {
  box-shadow:
    -6px 14px 24px rgba(0, 0, 0, 0.18),
    inset 12px 0 18px rgba(0, 0, 0, 0.18);
}

.trifold-face {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  background: #fff;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translateZ(0) scale(1.004);
  transform-origin: center center;
}

.trifold-flat {
  display: block;
  width: min(100%, 1100px);
  height: auto;
  max-height: min(82vh, calc(100dvh - 12rem));
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.trifold-flat[hidden] {
  display: none !important;
}

.trifold.is-expanded .trifold-scene,
.trifold.is-expanded .trifold-ground {
  display: none;
}

.trifold.is-expanded .trifold-stage {
  min-height: 0;
  padding: 0.5rem 0 1.5rem;
}

.trifold-ground {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 1.2rem;
  width: min(78%, 560px);
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.1) 42%,
    transparent 72%
  );
  transform: translateX(-50%);
  pointer-events: none;
}

.trifold-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  margin: 0;
  background: rgba(247, 244, 239, 0.92);
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.trifold-status[hidden] {
  display: none !important;
}

.trifold-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.trifold-flip-btn {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.trifold-flip-btn:hover,
.trifold-flip-btn:focus-visible {
  border-color: var(--fg);
  background: #fff;
}

.trifold-hint {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.project-view.is-pdf-project:has(#trifold:not([hidden])) .project-view-inner {
  max-width: min(100%, 1180px);
}

@media (max-width: 700px) {
  .trifold-stage {
    min-height: 48vh;
    padding: 1.25rem 0 2.5rem;
  }

  .trifold-accordion {
    --fold: 30deg;
    height: min(42vh, 340px);
    transform: perspective(1000px) rotateX(4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .trifold-accordion,
  .trifold-joint {
    transition: none;
  }

  .trifold-accordion {
    --fold: 0deg;
    transform: none;
  }

  .trifold-joint-1,
  .trifold-joint-2 {
    transform: none;
  }
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border);
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.motion-project-video {
  margin-bottom: var(--space-lg);
}

.motion-player {
  width: 100%;
}

.motion-phone-surface {
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
  padding: clamp(1rem, 2.5vh, 2rem);
  border: 0;
  background: var(--bg);
}

.motion-phone-device {
  position: relative;
  z-index: 1;
  width: auto;
  height: clamp(460px, calc(100dvh - 150px), 600px);
  aspect-ratio: 697 / 1272;
}

.motion-phone-frame {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.motion-phone-device .motion-video {
  position: absolute;
  z-index: 1;
  top: 13.21%;
  left: 13.06%;
  width: 75.61%;
  height: 72.48%;
  display: block;
  object-fit: contain;
  object-position: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}

.motion-video.is-fullscreen,
.motion-video:fullscreen,
.motion-video:-webkit-full-screen {
  position: fixed;
  inset: 0;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  object-fit: contain !important;
  object-position: center;
  background: #000;
  border: 0;
  border-radius: 0;
}

.motion-video-start {
  position: absolute;
  z-index: 2;
  inset: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  border-radius: clamp(30px, 3.3vw, 43px);
  color: var(--fg);
  background: #fff;
}

.motion-phone-device .motion-video-start {
  inset: 13.21% 11.33% 14.31% 13.06%;
  border-radius: 0;
  color: var(--fg);
  background: #fff;
}

.motion-video-start[hidden] {
  display: none;
}

.motion-video-controls {
  position: absolute;
  z-index: 5;
  right: 6px;
  bottom: 6px;
  left: 6px;
  height: 38px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px 34px 34px;
  gap: 0.5rem;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast) 1000ms;
}

.motion-phone-device .motion-video-controls {
  z-index: 8;
  top: 100%;
  right: 2%;
  bottom: auto;
  left: 2%;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-46px) scale(0.96);
  transform-origin: top center;
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 140ms ease;
}

.motion-phone-device:hover .motion-video-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(12px) scale(1);
  transition-delay: 0ms;
}

.motion-phone-device .motion-video-controls::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 18px;
}

.motion-video-controls[hidden] {
  display: none;
}

.motion-control-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.motion-play-toggle svg,
.motion-fullscreen-toggle svg,
.motion-theater-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.motion-theater-toggle .motion-icon-theater {
  fill: none;
  stroke: currentColor;
}

.motion-theater-toggle.is-active {
  color: #f5d76e;
}

.motion-icon-pause,
.motion-icon-exit-fullscreen {
  display: none;
}

.motion-play-toggle.is-playing .motion-icon-play {
  display: none;
}

.motion-play-toggle.is-playing .motion-icon-pause {
  display: block;
}

.motion-fullscreen-toggle.is-fullscreen .motion-icon-enter-fullscreen {
  display: none;
}

.motion-fullscreen-toggle.is-fullscreen .motion-icon-exit-fullscreen {
  display: block;
}

.motion-progress {
  --progress: 0%;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.motion-progress::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #fff 0 var(--progress),
    rgba(255, 255, 255, 0.45) var(--progress) 100%
  );
}

.motion-progress::-moz-range-track {
  height: 2px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.motion-progress::-moz-range-progress {
  height: 2px;
  border: 0;
  border-radius: 999px;
  background: #fff;
}

.motion-progress::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  margin-top: -4px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.motion-progress::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.motion-volume-control {
  position: relative;
  display: grid;
  place-items: center;
}

.motion-volume-toggle svg {
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: #fff;
}

.motion-volume-toggle .motion-volume-wave {
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.motion-volume-toggle.is-muted .motion-volume-wave {
  display: none;
}

.motion-volume-toggle.is-muted::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 1px;
  background: #fff;
  transform: rotate(-45deg);
}

.motion-volume-slider {
  --volume: 100%;
  position: absolute;
  z-index: 2;
  right: 50%;
  bottom: 30px;
  width: 28px;
  height: 112px;
  margin: 0;
  padding: 0;
  opacity: 0;
  appearance: none;
  -webkit-appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  accent-color: #fff;
  background: rgba(16, 16, 16, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  box-sizing: border-box;
  pointer-events: none;
  cursor: pointer;
  transform: translateX(50%) translateY(5px);
  transition:
    opacity var(--transition-fast) 1000ms,
    transform var(--transition-fast) 1000ms;
}

.motion-volume-slider::-webkit-slider-runnable-track {
  width: 4px;
  height: 100%;
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to top,
    #fff 0 var(--volume),
    rgba(255, 255, 255, 0.35) var(--volume) 100%
  );
}

.motion-volume-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-left: -4px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.motion-volume-slider::-moz-range-track {
  width: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.motion-volume-slider::-moz-range-progress {
  width: 4px;
  border: 0;
  border-radius: 999px;
  background: #fff;
}

.motion-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.motion-volume-control:hover .motion-volume-slider,
.motion-volume-control:focus-within .motion-volume-slider {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(50%) translateY(0);
  transition-delay: 0ms;
}

.motion-phone-device .motion-control-btn {
  color: var(--fg);
}

.motion-phone-device .motion-theater-toggle.is-active {
  color: #b8860b;
}

.motion-phone-device .motion-progress::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--fg) 0 var(--progress),
    var(--border-strong) var(--progress) 100%
  );
}

.motion-phone-device .motion-progress::-webkit-slider-thumb,
.motion-phone-device .motion-progress::-moz-range-thumb,
.motion-phone-device .motion-progress::-moz-range-progress {
  background: var(--fg);
}

.motion-phone-device .motion-progress::-moz-range-track {
  background: var(--border-strong);
}

.motion-phone-device .motion-volume-toggle svg {
  fill: var(--fg);
}

.motion-phone-device .motion-volume-toggle .motion-volume-wave {
  stroke: var(--fg);
}

.motion-phone-device .motion-volume-toggle.is-muted::after {
  background: var(--fg);
}

.motion-phone-device .motion-volume-slider {
  accent-color: var(--fg);
  background: rgba(247, 245, 241, 0.96);
  border-color: var(--border-strong);
}

.motion-phone-device .motion-volume-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to top,
    var(--fg) 0 var(--volume),
    var(--border-strong) var(--volume) 100%
  );
}

.motion-phone-device .motion-volume-slider::-webkit-slider-thumb,
.motion-phone-device .motion-volume-slider::-moz-range-thumb {
  background: var(--fg);
  box-shadow: none;
}

.motion-phone-device .motion-volume-slider::-moz-range-track {
  background: var(--border-strong);
}

.motion-phone-device .motion-volume-slider::-moz-range-progress {
  background: var(--fg);
}

@media (hover: none) {
  .motion-video-controls {
    opacity: 1;
    pointer-events: auto;
  }
}

.motion-video-start span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding-left: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg);
  font-size: 0.9rem;
}

.motion-video-start strong {
  max-width: 70%;
  font-size: 0.85rem;
  font-weight: 600;
}

.motion-player-hint {
  margin-top: var(--space-xs);
  color: var(--fg-faint);
  font-size: 0.78rem;
  text-align: center;
}

.motion-player-phone .motion-player-hint {
  margin-top: 4.5rem;
}

@media (max-width: 700px) {
  .motion-booth-surface {
    padding: 0.75rem 0.25rem;
  }

  .motion-phone-device {
    width: auto;
    height: clamp(350px, calc(100dvh - 210px), 460px);
  }
}

/* =================================================================
   LIGHTBOX
================================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(26, 26, 26, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(100%, 1100px);
  max-height: 80vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  touch-action: none;
}

.lightbox-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--gutter);
  color: #f7f5f1;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(247, 245, 241, 0.3);
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: rgba(247, 245, 241, 0.7);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #f7f5f1;
  font-size: 1.5rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(247, 245, 241, 0.3);
  border-radius: 999px;
}

.lightbox-nav-btn:hover,
.lightbox-nav-btn:focus-visible {
  border-color: rgba(247, 245, 241, 0.7);
}

.lightbox-prev {
  left: var(--gutter);
}

.lightbox-next {
  right: var(--gutter);
}

.lightbox-counter {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(247, 245, 241, 0.7);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .lightbox-nav-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }
  .lightbox-prev {
    left: var(--space-xs);
  }
  .lightbox-next {
    right: var(--space-xs);
  }
}

/* Pencil-edit: show Enter/newlines from the admin textarea as real line breaks */
[data-i18n],
[data-edit-project] {
  white-space: pre-line;
}

/* ============================================================
   Pencil-edit admin (only when logged in)
   ============================================================ */
.editor-toolbar {
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 8px 28px rgba(26, 26, 26, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 0.8rem;
}

.editor-toolbar-label {
  font-weight: 600;
  padding: 0 0.35rem;
  color: #1a1a1a;
}

.editor-toolbar-btn,
.editor-toolbar-link {
  border: 0;
  background: #1a1a1a;
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.editor-toolbar-muted {
  background: transparent;
  color: #5b584f;
  border: 1px solid #d4d0c8;
}

.editor-toolbar-link {
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #d4d0c8;
}

html.is-edit-mode .editor-pencil-wrap {
  position: relative;
  display: inline;
}

.editor-pencil {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-left: 0.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #2c2a26;
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.1);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}

html.is-edit-mode .editor-pencil {
  display: inline-flex;
}

.editor-pencil:hover {
  background: #fff;
  color: #1a1a1a;
}

/* Edit-mode deep-link bars — Admin → About / Projects (not pencils). */
.editor-photo-hint {
  display: none;
}

html.is-edit-mode .editor-photo-hint {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(212, 208, 200, 0.95);
  box-shadow: 0 2px 10px rgba(26, 26, 26, 0.1);
  color: #2c2a26;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: auto;
  margin: 0;
  pointer-events: auto;
}

html.is-edit-mode .editor-photo-hint:hover,
html.is-edit-mode .editor-photo-hint:focus-visible {
  background: #fff;
  color: #1a1a1a;
  outline: none;
}

html.is-edit-mode #carousel > .editor-photo-hint {
  z-index: 6;
}

.editor-popover {
  position: absolute;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(300px, calc(100vw - 24px));
  min-width: 260px;
  min-height: 200px;
  padding: 0.45rem 0.85rem 0.95rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(212, 208, 200, 0.9);
  box-shadow: 0 12px 40px rgba(26, 26, 26, 0.14);
  font-family: var(--font-body, Inter, sans-serif);
  overflow: hidden;
}

.editor-popover.is-dragging,
.editor-popover.is-resizing {
  cursor: grabbing;
  user-select: none;
}

.editor-popover.is-resizing {
  cursor: nwse-resize;
}

.editor-popover-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0 0 0.2rem;
  padding: 0.2rem 0.5rem;
  color: #b0aba2;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.editor-popover-drag:hover {
  color: #6e6a62;
}

.editor-popover.is-dragging .editor-popover-drag {
  cursor: grabbing;
  color: #5b584f;
}

.editor-popover-resize {
  position: absolute;
  right: 1px;
  bottom: 1px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #b0aba2;
  cursor: nwse-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.editor-popover-resize:hover,
.editor-popover.is-resizing .editor-popover-resize {
  color: #5b584f;
}

.editor-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  margin: 0 0 0.5rem;
}

.editor-popover-key {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: #5b584f;
}

.editor-popover-header .editor-popover-key {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-popover-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.editor-popover-lang-switch,
.editor-popover-translate,
.editor-popover-live {
  flex-shrink: 0;
  margin: 0;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d4d0c8;
  border-radius: 999px;
  background: transparent;
  color: #2c2a26;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}

.editor-popover-lang-switch:hover,
.editor-popover-translate:hover,
.editor-popover-live:hover {
  background: #fff;
  border-color: #b8b3a8;
}

.editor-popover-live.is-active,
.editor-popover-live[aria-pressed="true"] {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.editor-popover-live.is-active:hover,
.editor-popover-live[aria-pressed="true"]:hover {
  background: #2c2a26;
  border-color: #2c2a26;
  color: #fff;
}

.editor-popover-translate:disabled,
.editor-popover-lang-switch:disabled,
.editor-popover-live:disabled {
  opacity: 0.55;
  cursor: wait;
}

.editor-popover-input {
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 4.5rem;
  min-width: 0;
  height: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d4d0c8;
  border-radius: 0.5rem;
  font: inherit;
  resize: none;
}

.editor-popover-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.editor-popover-save,
.editor-popover-cancel {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.editor-popover-save {
  background: #1a1a1a;
  color: #fff;
}

.editor-popover-cancel {
  background: transparent;
  border: 1px solid #d4d0c8;
  color: #2c2a26;
}

.editor-popover-status {
  flex-shrink: 0;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #5b584f;
}

@media (max-width: 600px) {
  .editor-toolbar {
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
  }
}
