/* ==========================================================================
   JAZZ DIGITAL — Where AI meets soul
   Design System: Neo-Jazz Lounge × AI Future
   ========================================================================== */

/* --- Self-hosted fonts: latin + thai subsets of the Google Fonts builds, in src/static/fonts.
   (Fraunces roman and italic are variable fonts; JetBrains Mono serves 400 and 700 from one file.) --- */
/* Fraunces italic 400 500 (latin) */
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/fraunces-italic-latin.b58654dd.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Fraunces normal 400 500 (latin) */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/fraunces-normal-latin.48642176.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono normal 400 (latin) */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-normal-latin.4f27206c.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono normal 700 (latin) */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-normal-latin.4f27206c.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Manrope normal 300 600 (latin) */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('/fonts/manrope-normal-latin.b4295101.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Noto Sans Thai normal 300 600 (thai) */
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('/fonts/noto-sans-thai-normal-thai.4dd2ca6f.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
/* Noto Sans Thai normal 300 600 (latin) */
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('/fonts/noto-sans-thai-normal-latin.a52e5614.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Noto Serif Thai normal 400 600 (thai) */
@font-face {
  font-family: 'Noto Serif Thai';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/noto-serif-thai-normal-thai.34deb55d.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
/* Noto Serif Thai normal 400 600 (latin) */
@font-face {
  font-family: 'Noto Serif Thai';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/noto-serif-thai-normal-latin.47a6d1d8.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* --- Design Tokens --- */
:root {
  color-scheme: dark;   /* native selects, scrollbars and form controls follow the theme */
  --bg: #0a0a0f;
  --bg-deeper: #050508;
  --surface: #13131a;
  --surface-2: #1c1c26;
  --border: rgba(212, 175, 55, 0.14);
  --border-strong: rgba(212, 175, 55, 0.35);

  --gold: #d4af37;
  --gold-light: #f4d03f;
  --gold-dim: #8b7424;
  --cream: #f5efde;
  --cream-dim: #d8d0bd;

  --cyan: #00e5ff;
  --magenta: #ff2e80;

  --text: #f5efde;
  --text-mute: #a8a297;
  --text-dim: #8a8678;

  --font-display: 'Fraunces', 'Noto Serif Thai', 'Times New Roman', serif;
  --font-deco: 'Fraunces', 'Noto Serif Thai', serif;
  --font-body: 'Manrope', 'Noto Sans Thai', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Noto Sans Thai', monospace;

  --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-snap: cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Hide custom cursor on touch devices (the system pointer is never hidden) */
@media (hover: none) {
  .cursor, .cursor-trail { display: none !important; }
}

/* Background atmosphere */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(212, 175, 55, 0.08), transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(0, 229, 255, 0.05), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 46, 128, 0.03), transparent 60%);
  z-index: -2;
  pointer-events: none;
}

/* Film grain */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3CfeColorMatrix values='0 0 0 0 0.83 0 0 0 0 0.69 0 0 0 0 0.21 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: -1;
  animation: grain 8s steps(8) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  20% { transform: translate(5%, -2%); }
  30% { transform: translate(-3%, 4%); }
  40% { transform: translate(4%, 3%); }
  50% { transform: translate(-4%, -4%); }
  60% { transform: translate(3%, 5%); }
  70% { transform: translate(-5%, 2%); }
  80% { transform: translate(2%, -3%); }
  90% { transform: translate(-2%, 4%); }
}

/* --- Custom Cursor --- */
.cursor {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--gold);
  opacity: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.25s, height 0.25s, background 0.25s;
  box-shadow: 0 0 12px var(--gold);
  mix-blend-mode: screen;
}

.cursor-trail {
  position: fixed;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.18s var(--ease-smooth), width 0.3s, height 0.3s, border-color 0.3s;
  mix-blend-mode: screen;
}

.cursor.hover { width: 4px; height: 4px; background: var(--cream); box-shadow: 0 0 24px var(--cream); }
.cursor-trail.hover { width: 64px; height: 64px; border-color: var(--gold-light); }

/* Light theme: purple cursor, no blend mode (gold on cream = invisible) */
[data-theme="light"] .cursor {
  background: var(--purple);
  box-shadow: 0 0 12px rgba(94, 31, 138, 0.6);
  mix-blend-mode: normal;
}
[data-theme="light"] .cursor-trail {
  border-color: rgba(94, 31, 138, 0.45);
  mix-blend-mode: normal;
}
[data-theme="light"] .cursor.hover {
  background: var(--purple-light);
  box-shadow: 0 0 24px var(--purple);
}
[data-theme="light"] .cursor-trail.hover { border-color: var(--purple); }

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--cream);
}

.display-xl {
  font-size: clamp(2.45rem, 8.4vw, 7.7rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.display-lg {
  font-size: clamp(1.75rem, 4.9vw, 4.2rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.display-md {
  font-size: clamp(1.4rem, 3.15vw, 2.625rem);
}

.italic-accent {
  font-family: var(--font-deco);   /* Fraunces ships a real italic */
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

.gold-text {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--gold);
  font-weight: 400;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

.eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--gold);
}

p { color: var(--text-mute); font-weight: 300; }

a { color: inherit; text-decoration: none; }

/* --- Layout --- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

section { position: relative; padding: 8rem 0; }

@media (max-width: 768px) {
  section { padding: 5rem 0; }
  .container { padding: 0 1.5rem; }
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all 0.4s var(--ease-smooth);
}

.nav.scrolled { padding: 1rem 2.5rem; background: rgba(5, 5, 8, 0.9); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--cream);
}

.nav-logo img { width: 15px; height: 34px; }

.nav-menu {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}

.nav-menu a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
  position: relative;
  padding: 0.5rem 0;
  transition: color 0.3s;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: all 0.4s var(--ease-smooth);
  transform: translateX(-50%);
}

.nav-menu a:hover { color: var(--gold); }
.nav-menu a:hover::after { width: 100%; }
.nav-menu a.active { color: var(--gold); }
.nav-menu a.active::after { width: 100%; }

.nav-cta {
  padding: 1.3rem 3.8rem;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.4s;
}

.nav-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: translateY(101%);
  transition: transform 0.4s var(--ease-smooth);
  z-index: -1;
}

.nav-cta:hover { color: var(--bg); }
.nav-cta:hover::before { transform: translateY(0); }

.nav-menu .nav-cta { padding: 0.7rem 1.4rem; }
.nav-tools { display: flex; align-items: center; gap: 0.75rem; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 1px;
  background: var(--cream);
  transition: all 0.3s;
}

/* Below 1100px the five menu items, the CTA and the tools no longer fit on one row
   (the wordmark ran into HOME at 1000px), so the drawer takes over early. */
@media (max-width: 1100px) {
  .nav { padding: 1rem 1.5rem; }
  .nav-menu {
    position: fixed;
    top: 0; right: 0;
    width: min(80vw, 360px);
    height: 100vh;
    height: 100dvh;
    z-index: 101;                 /* above the language and theme pills in the bar */
    background: var(--bg-deeper);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease-smooth);
    border-left: 1px solid var(--border);
    box-shadow: -30px 0 60px rgba(0, 0, 0, 0.35);
  }
  .nav-menu.open { transform: translateX(0); }
  .nav-menu .nav-cta { margin-top: 1rem; }   /* the drawer keeps the Start-a-project CTA */
  .nav-tools { margin-left: auto; margin-right: 1.5rem; }   /* next to the hamburger, not mid-bar */
  .nav-toggle { display: flex; z-index: 102; padding: 8px 0; }
  /* the three bars fold into an × while the drawer is open */
  .nav-toggle span { transition: transform 0.3s var(--ease-smooth), opacity 0.2s; }
  .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); }
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 7rem;
}

.hero .container { width: 100%; }

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: end;
  width: 100%;
}

@media (max-width: 980px) {
  .hero-content { grid-template-columns: 1fr; }
}

.hero-text { max-width: 900px; }

.hero-title {
  font-size: clamp(2.45rem, 8.4vw, 7.7rem);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.hero-title .line {
  display: block;
  overflow: hidden;
}

.hero-title .line-inner {
  display: block;
  opacity: 0;
  transform: translateY(110%);
  animation: reveal-up 1.2s var(--ease-smooth) forwards;
}

/* Short delays: the headline is the LCP element, so it must not wait on a long cue. */
.hero-title .line:nth-child(1) .line-inner { animation-delay: 0.05s; }
.hero-title .line:nth-child(2) .line-inner { animation-delay: 0.15s; }
.hero-title .line:nth-child(3) .line-inner { animation-delay: 0.25s; }
.hero-title .line:nth-child(4) .line-inner { animation-delay: 0.35s; }

@keyframes reveal-up {
  to { opacity: 1; transform: translateY(0); }
}

.hero-sub {
  margin-top: 2rem;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  max-width: 540px;
  color: var(--cream-dim);
  font-weight: 300;
  line-height: 1.6;
  opacity: 0;
  animation: fade-in 0.6s ease forwards 0.45s;
}

@keyframes fade-in { to { opacity: 1; } }


.hero-cta-row {
  margin-top: 3rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fade-in 0.6s ease forwards 0.6s;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  overflow: hidden;
  transition: color 0.4s;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  border: 1px solid var(--gold);
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cream);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-smooth);
  z-index: -1;
}

.btn-primary:hover::before { transform: translateY(0); }

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--cream);
  background: transparent;
}

.btn-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: translateY(101%);
  transition: transform 0.4s var(--ease-smooth);
  z-index: -1;
}

.btn-ghost:hover { color: var(--bg); border-color: var(--gold); }
.btn-ghost:hover::before { transform: translateY(0); }

.btn .arrow {
  display: inline-block;
  transition: transform 0.4s var(--ease-snap);
}

.btn:hover .arrow { transform: translateX(6px); }

/* --- Equalizer --- */
.equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
}

.equalizer .bar {
  width: 3px;
  background: var(--gold);
  border-radius: 1px;
  animation: eq-bounce 1.2s ease-in-out infinite;
  animation-play-state: paused;   /* frozen until audio plays */
  transform: scaleY(0.3);         /* resting state — short bars */
}

/* Bars animate only while audio is playing */
html.audio-playing .equalizer .bar {
  animation-play-state: running;
}

.equalizer .bar:nth-child(1) { animation-delay: 0s; height: 30%; }
.equalizer .bar:nth-child(2) { animation-delay: 0.15s; height: 60%; }
.equalizer .bar:nth-child(3) { animation-delay: 0.3s; height: 90%; }
.equalizer .bar:nth-child(4) { animation-delay: 0.45s; height: 50%; }
.equalizer .bar:nth-child(5) { animation-delay: 0.6s; height: 75%; }
.equalizer .bar:nth-child(6) { animation-delay: 0.75s; height: 40%; }
.equalizer .bar:nth-child(7) { animation-delay: 0.9s; height: 65%; }

@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1.4); }
}

/* --- Saxophone: #sax-3d (below) gets this class once its intro has flown in; sax3d.js owns the
   geometry, main.js the scroll motion. Past the hero it is parked at low opacity so the content
   underneath stays readable; hovering brings it back. --- */
.hero-sax { opacity: 0.9; transition: opacity 0.6s; }
.hero-sax.parked { opacity: 0.35; }

@keyframes float-sax {
  0%, 100% { transform: translateY(-50%) rotate(-3deg); }
  50%       { transform: translateY(-57%) rotate(-1deg); }
}

.note {
  position: absolute;
  font-size: 2rem;
  color: var(--gold);
  opacity: 0;
  animation: float-note 4s ease-out infinite;
  pointer-events: none;
}

@keyframes float-note {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(0.5); }
  20% { opacity: 0.8; }
  100% { opacity: 0; transform: translate(var(--tx, 50px), -200px) rotate(20deg) scale(1.2); }
}

/* --- Sections --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 3rem;
  margin-bottom: 5rem;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 800px;
}

.section-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  line-height: 1.6;
  max-width: 280px;
}

/* --- Marquee --- */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  background: var(--bg-deeper);
  position: relative;
  /* Isolate the animated child into its own compositing context so it
     doesn't interfere with the fixed 3D saxophone's GPU layer */
  isolation: isolate;
  transform: translateZ(0);
  will-change: transform;
}

.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
  gap: 4rem;
  padding-right: 4rem;
  will-change: transform;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee-item {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  gap: 4rem;
}

.marquee-item .dot {
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  display: inline-block;
}

/* --- Services Grid --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.service-card {
  background: var(--bg);
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
  transition: background 0.5s;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(212, 175, 55, 0.15), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.service-card:hover::before { opacity: 1; }
.service-card:hover { background: var(--surface); }

.service-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.2em;
}

.service-icon {
  width: 64px;
  height: 64px;
  margin: 2rem 0;
  color: var(--gold);
  transition: transform 0.5s var(--ease-snap);
}

.service-card:hover .service-icon { transform: rotate(12deg) scale(1.1); }

.service-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--cream);
}

.service-desc {
  color: var(--text-mute);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.service-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: auto;
}

.service-link .arrow { transition: transform 0.4s; }
.service-card:hover .service-link .arrow { transform: translateX(6px); }

/* --- Process Section --- */
.process {
  position: relative;
  padding: 8rem 0;
  border-top: 1px solid var(--border);
}

.process-list {
  display: grid;
  gap: 0;
}

.process-step {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 3rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  align-items: center;
  position: relative;
  transition: background 0.4s, padding 0.4s;
}

.process-step:last-child { border-bottom: 1px solid var(--border); }

.process-step:hover {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.06), transparent);
  padding-left: 2rem;
}

.process-num {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--gold);
  font-style: italic;
}

.process-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
}

.process-desc {
  max-width: 380px;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .process-step {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 2rem 0;
  }
  .process-step:hover { padding-left: 0; }
}

/* --- Work / Portfolio --- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem;
}

.work-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.6s var(--ease-smooth), border-color 0.4s;
  display: block;
}

.work-card:hover { border-color: var(--border-strong); }

.work-card.span-7 { grid-column: span 7; }
.work-card.span-6 { grid-column: span 6; }
.work-card.span-5 { grid-column: span 5; }
.work-card.span-4 { grid-column: span 4; }
.work-card.span-12 { grid-column: span 12; }

@media (max-width: 880px) {
  .work-card { grid-column: span 12 !important; }
}

.work-visual {
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-2), var(--bg-deeper));
}

.work-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 15, 0.95));
}

.work-info {
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.work-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.work-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.work-arrow {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  transition: all 0.4s var(--ease-snap);
}

.work-card:hover .work-arrow {
  background: var(--gold);
  color: var(--bg);
  transform: rotate(-45deg);
}

/* Generative project artwork */
.work-art {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-art svg { width: 80%; height: 80%; }

/* --- Tech Stack --- */
.tech-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 3rem;
}

.tech-item {
  background: var(--bg);
  padding: 2rem 1.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--cream-dim);
  transition: all 0.4s;
}

.tech-item:hover {
  background: var(--gold);
  color: var(--bg);
}

/* --- CTA Section --- */
.cta-section {
  text-align: center;
  position: relative;
  border-top: 1px solid var(--border);
  padding: 10rem 0;
  overflow: hidden;
}

.cta-section::before {
  content: 'JAZZ';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(15rem, 35vw, 35rem);
  font-weight: 500;   /* the self-hosted Fraunces covers 400–500 only */
  color: rgba(212, 175, 55, 0.04);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: -0.05em;
}

.cta-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 7rem);
  line-height: 0.95;
  margin-bottom: 3rem;
  position: relative;
}

.cta-title .italic-accent { display: inline; }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 5rem 0 2rem;
  background: var(--bg-deeper);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

.footer-brand h3 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: 0.9rem;
  max-width: 320px;
  color: var(--text-mute);
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.75rem; }
.footer-col a {
  color: var(--cream-dim);
  font-size: 0.9rem;
  transition: color 0.3s;
  position: relative;
}
.footer-col a:hover { color: var(--gold); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  flex-wrap: wrap;
  gap: 1rem;
}

/* --- Reveal-on-scroll ---
   Content is visible by default. It is only hidden for the reveal once main.js has started
   and put .reveal-ready on <html>, so a script failure can never leave the page blank. */
html.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-smooth);
}

html.reveal-ready .reveal.in {
  opacity: 1;
  transform: translateY(0);
}

html.reveal-ready .reveal-stagger > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-smooth);
}

/* cards keep their own hover transitions next to the reveal ones */
html.reveal-ready .reveal-stagger > .service-card {
  transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-smooth), background 0.5s;
}
html.reveal-ready .reveal-stagger > .work-card {
  transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-smooth), border-color 0.4s;
}

html.reveal-ready .reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
html.reveal-ready .reveal-stagger.in > *:nth-child(1) { transition-delay: 0.05s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(2) { transition-delay: 0.15s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(3) { transition-delay: 0.25s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(4) { transition-delay: 0.35s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(5) { transition-delay: 0.45s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(6) { transition-delay: 0.55s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(7) { transition-delay: 0.65s; }
html.reveal-ready .reveal-stagger.in > *:nth-child(8) { transition-delay: 0.75s; }

/* Grids that draw their hairlines as a background behind 1px-gapped cards would show as one solid
   gold slab while the cards are still transparent: keep the lines off until the cards are coming in. */
.services-grid, .tech-rail { transition: background 0.8s ease 0.4s, border-color 0.8s ease 0.4s; }
html.reveal-ready .services-grid.reveal-stagger:not(.in),
html.reveal-ready .tech-rail.reveal-stagger:not(.in) { background: transparent; border-color: transparent; }

/* --- Page-Specific: About --- */
.about-hero {
  padding-top: 12rem;
  padding-bottom: 4rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  align-items: start;
}

@media (max-width: 880px) {
  .about-grid { grid-template-columns: 1fr; gap: 3rem; }
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 4rem;
}

.value-card {
  padding: 2.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all 0.4s;
}

.value-card:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  transform: translateY(-4px);
}

.value-symbol {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 3rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
  line-height: 1;
}

.value-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* --- Team --- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 880px) { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .team-grid { grid-template-columns: 1fr; } }

.team-card {
  position: relative;
}

.team-photo {
  aspect-ratio: 3/4;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.4s;
}

.team-card:hover .team-photo { border-color: var(--gold); }


.team-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.team-role {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

/* --- Contact --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 6rem;
}

@media (max-width: 880px) {
  .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
}

.form-group {
  margin-bottom: 2rem;
  position: relative;
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 1rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-strong);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.4s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
}

.form-group textarea { min-height: 120px; resize: vertical; font-family: var(--font-body); }

.contact-info {
  padding: 3rem;
  border: 1px solid var(--border);
  background: var(--bg-deeper);
  position: relative;
  overflow: hidden;
}

.contact-info-item {
  margin-bottom: 2.5rem;
}

.contact-info-item:last-child { margin-bottom: 0; }

.contact-info-item .contact-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
}
.contact-info-item .contact-label svg { vertical-align: -1px; margin-right: 4px; }

.contact-info-item p, .contact-info-item a {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--cream);
  line-height: 1.4;
  transition: color 0.3s;
}

.contact-info-item a:hover { color: var(--gold); }

/* --- Detailed Services Page --- */
.service-detail {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 6rem;
  align-items: center;
  padding: 6rem 0;
  border-bottom: 1px solid var(--border);
}

.service-detail:nth-child(even) {
  grid-template-columns: 1.4fr 1fr;
}

.service-detail:nth-child(even) .service-detail-visual {
  order: 2;
}

@media (max-width: 880px) {
  .service-detail,
  .service-detail:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 4rem 0;
  }
  .service-detail:nth-child(even) .service-detail-visual { order: -1; }
}

.service-detail-visual {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--surface), var(--bg-deeper));
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-detail-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 1rem;
  display: block;
}

.service-detail-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin-bottom: 1.5rem;
  line-height: 1;
}

.service-detail-desc {
  margin-bottom: 2rem;
  line-height: 1.7;
}

.service-features {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.service-features li {
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.9rem;
  color: var(--cream-dim);
}

.service-features li::before {
  content: '♪';
  position: absolute;
  left: 0;
  color: var(--gold);
}

/* --- Loader --- */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-deeper);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2rem;
  transition: opacity 0.8s, visibility 0.8s;
  /* Pure-CSS failsafe: even if no script ever runs, the loader fades out and stops
     intercepting clicks after ~4 s. main.js dismisses it much sooner (.gone). */
  animation: loader-failsafe 0.6s ease 4s forwards;
}

.loader.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes loader-failsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

.loader-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2rem;
  color: var(--gold);
  letter-spacing: -0.02em;
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* --- Selection --- */
::selection {
  background: var(--gold);
  color: var(--bg);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deeper); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ==========================================================================
   LIGHT THEME — "Jazz Club by Afternoon"
   Warm ivory + deep purple + champagne gold
   ========================================================================== */

/* Theme colour transition: only while main.js has the class on <html> during a toggle,
   so it never overrides the components' own transitions. */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, fill 0.35s ease !important;
}

/* --- Light theme token overrides --- */
[data-theme="light"] {
  --bg:           #ede6d6;
  --bg-deeper:    #e2d9c4;
  --surface:      #d8ccb8;
  --surface-2:    #cec0a8;
  --border:       rgba(94, 31, 138, 0.13);
  --border-strong:rgba(94, 31, 138, 0.32);

  --gold:         #7d5606;
  --gold-light:   #946508;
  --gold-dim:     #5e4004;
  --cream:        #1c150e;
  --cream-dim:    #5a4e3c;

  --cyan:         #006d8f;
  --magenta:      #b8105e;

  --text:         #1c150e;
  --text-mute:    #5a4e3c;
  --text-dim:     #64584a;

  /* Purple — the new accent in light mode */
  --purple:       #5e1f8a;
  --purple-light: #7d3aad;
  --purple-dim:   #3d1462;
  color-scheme: light;
}

/* --- Background atmosphere (light) --- */
[data-theme="light"] body::before {
  background:
    radial-gradient(circle at 15% 20%, rgba(94, 31, 138, 0.06), transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(158, 110, 14, 0.05), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(94, 31, 138, 0.03), transparent 60%);
}

[data-theme="light"] body::after { opacity: 0.025; }

/* --- Typography --- */
[data-theme="light"] .italic-accent { color: var(--purple); }

[data-theme="light"] .gold-text {
  background: linear-gradient(135deg, var(--purple-light) 0%, var(--purple) 50%, var(--purple-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .eyebrow { color: var(--purple); }
[data-theme="light"] .eyebrow::before { background: var(--purple); }
[data-theme="light"] .mono-label { color: var(--purple); }

[data-theme="light"] ::selection { background: var(--purple); color: #fff; }

/* --- Navigation --- */
[data-theme="light"] .nav {
  background: rgba(248, 244, 238, 0.88);
  border-bottom-color: rgba(94, 31, 138, 0.1);
}
[data-theme="light"] .nav.scrolled { background: rgba(237, 230, 214, 0.97); }

[data-theme="light"] .nav-logo { color: var(--cream); }

[data-theme="light"] .nav-menu a { color: var(--text-mute); }
[data-theme="light"] .nav-menu a::after { background: var(--purple); }
[data-theme="light"] .nav-menu a:hover { color: var(--purple); }
[data-theme="light"] .nav-menu a.active { color: var(--purple); }
[data-theme="light"] .nav-menu a.active::after { background: var(--purple); }

[data-theme="light"] .nav-cta {
  border-color: rgba(94, 31, 138, 0.35);
  color: var(--purple);
  transition: color 0.4s;
}
[data-theme="light"] .nav-cta::before { background: var(--purple); }
[data-theme="light"] .nav-cta:hover { color: #fff; }

[data-theme="light"] .nav-toggle { color: var(--purple); }
[data-theme="light"] .nav-toggle span { background: var(--cream); }

/* Mobile nav open */
[data-theme="light"] .nav-menu.open {
  background: var(--bg);
  border-left-color: var(--border);
}

/* --- Buttons --- */
[data-theme="light"] .btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
[data-theme="light"] .btn-primary::before { background: var(--purple-light); }

[data-theme="light"] .btn-ghost {
  color: var(--cream);
  border-color: rgba(94, 31, 138, 0.3);
}
[data-theme="light"] .btn-ghost::before { background: var(--purple); }
[data-theme="light"] .btn-ghost:hover { color: #fff; border-color: var(--purple); }

/* --- Marquee --- */
[data-theme="light"] .marquee-item .dot { background: var(--purple); }

/* --- Services --- */
[data-theme="light"] .service-card::before {
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(94, 31, 138, 0.1), transparent 50%);
}
[data-theme="light"] .service-num { color: var(--purple); }
[data-theme="light"] .service-icon { color: var(--purple); }
[data-theme="light"] .service-title { color: var(--cream); }
[data-theme="light"] .service-link { color: var(--purple); }

/* --- Process --- */
[data-theme="light"] .process-step:hover {
  background: linear-gradient(90deg, rgba(94, 31, 138, 0.05), transparent);
}
[data-theme="light"] .process-num { color: var(--purple); }

/* --- Work cards (the light overlay itself is set with the theme-aware artwork rules below) --- */
[data-theme="light"] .work-category { color: var(--purple); }
[data-theme="light"] .work-arrow {
  border-color: rgba(94, 31, 138, 0.3);
  color: var(--purple);
}

/* --- Tech rail --- */
[data-theme="light"] .tech-item:hover {
  background: var(--purple);
  color: #fff;
}

/* --- CTA section — dark purple band, always dramatic --- */
[data-theme="light"] .cta-section {
  /* dark purple band: use the dark-theme golds so gold text stays readable on it */
  --gold: #d4af37;
  --gold-light: #f4d03f;
  --gold-dim: #8b7424;
  background: linear-gradient(135deg, #2d0a4e 0%, #1a0832 100%);
  border-top-color: rgba(94, 31, 138, 0.3);
}
[data-theme="light"] .cta-section::before {
  color: rgba(255, 255, 255, 0.035);
}
[data-theme="light"] .cta-section h1,
[data-theme="light"] .cta-section h2,
[data-theme="light"] .cta-section h3 { color: #f0e8ff; }
[data-theme="light"] .cta-section p { color: rgba(240, 232, 255, 0.7); }
[data-theme="light"] .cta-section .eyebrow { color: #c4a4e8; }
[data-theme="light"] .cta-section .eyebrow::before { background: #c4a4e8; }
[data-theme="light"] .cta-section .italic-accent { color: var(--gold); }
[data-theme="light"] .cta-section .gold-text {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .cta-section .btn-ghost {
  color: rgba(240, 232, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}
[data-theme="light"] .cta-section .btn-ghost:hover { color: #fff; }

/* --- Footer --- */
[data-theme="light"] .footer-col h4 { color: var(--purple); }
[data-theme="light"] .footer-col a:hover { color: var(--purple); }

/* --- About / Values --- */
[data-theme="light"] .value-symbol { color: var(--purple); }
[data-theme="light"] .team-card:hover .team-photo { border-color: var(--purple); }
[data-theme="light"] .team-role { color: var(--purple); }

/* --- Contact --- */
[data-theme="light"] .contact-info-item .contact-label { color: var(--purple); }
[data-theme="light"] .contact-info-item a:hover { color: var(--purple); }
[data-theme="light"] .form-group label { color: var(--text-mute); }
[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group textarea:focus,
[data-theme="light"] .form-group select:focus {
  border-bottom-color: var(--purple);
}

/* --- Scrollbar --- */
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-deeper); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(94, 31, 138, 0.35); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* --- Theme Toggle Button --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}
.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}
[data-theme="light"] .theme-toggle:hover {
  border-color: var(--purple);
  color: var(--purple);
}
/* In dark mode: show sun (click to go light) */
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none; }
/* In light mode: show moon (click to go dark) */
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }


/* ==========================================================================
   HERO TITLE — Fraunces (jazz-soul vibe)
   ========================================================================== */
.hero-title {
  font-family: 'Fraunces', 'Noto Serif Thai', serif;
  font-weight: 400;
  font-variation-settings: "SOFT" 100, "WONK" 0, "opsz" 144;
  letter-spacing: -0.025em;
  font-style: normal;
}

.hero-title .italic-accent {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  font-weight: 400;
  color: var(--gold);
}

[data-theme="light"] .hero-title .italic-accent {
  color: var(--purple);
}

/* ==========================================================================
   INTERNATIONALIZATION (EN / TH)
   ========================================================================== */

/* Each language is its own page (English at /, Thai at /th/), so <html lang> says which one this is. */

/* Thai-only typographic refinements (line-height for legibility — fonts cascade via font stack) */
html[lang="th"] {
  letter-spacing: 0;
}
html[lang="th"] .hero-title,
html[lang="th"] .display-xl,
html[lang="th"] .display-lg,
html[lang="th"] .display-md {
  line-height: 1.15;
}
/* Thai italic-accent: page content only, never the logo/brand wordmark in the nav and footer */
html[lang="th"] #page-content .italic-accent {
  font-style: normal;
  font-weight: 600;
}

/* Language toggle (a link to the same page in the other language) */
.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--cream-dim);
  cursor: pointer;
  height: 34px;
  padding: 0 0.7rem;
  border-radius: 17px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;     /* match the former <button> rendering */
  line-height: normal;
  text-decoration: none;
  letter-spacing: 0.18em;
  transition: border-color 0.3s, color 0.3s;
}
.lang-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}
[data-theme="light"] .lang-toggle:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.lang-toggle .lang-current { font-weight: 700; color: var(--cream); }
.lang-toggle .lang-divider { opacity: 0.4; }
.lang-toggle .lang-other   { opacity: 0.75; }

/* ==========================================================================
   MUSIC NOTE CURSOR TRAIL — notes drift in direction of mouse movement
   ========================================================================== */
.music-note-trail {
  position: fixed;
  pointer-events: none;
  color: var(--gold);
  font-family: serif;
  z-index: 9998;
  opacity: 0.9;
  user-select: none;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
  will-change: transform, opacity;
  transition: transform 1.3s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 1.3s cubic-bezier(0.4, 0, 0.6, 1);
}
[data-theme="light"] .music-note-trail {
  color: var(--purple);
  text-shadow: 0 0 12px rgba(94, 31, 138, 0.3);
}
/* Hide trail on touch devices */
@media (pointer: coarse) {
  .music-note-trail { display: none; }
}

/* Saxophone click — ring pulse + glow when audio plays */
.hero-sax:hover {
  opacity: 1;
  filter: drop-shadow(0 0 18px rgba(212, 175, 55, 0.45));
}
[data-theme="light"] .hero-sax:hover {
  filter: drop-shadow(0 0 18px rgba(94, 31, 138, 0.45));
}
.hero-sax {
  cursor: pointer;
}
.hero-sax.playing {
  filter: drop-shadow(0 0 30px var(--gold)) brightness(1.35);
  transition: filter 0.15s ease-out;
}
@keyframes sax-ring {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}
.sax-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--gold);
  pointer-events: none;
  animation: sax-ring 0.7s ease-out forwards;
}
[data-theme="light"] .sax-ring { border-color: var(--purple); }

/* Saxophone playing state — gentle pulse while music plays */
.hero-sax[data-playing] {
  filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.5));
  animation: float-sax 8s ease-in-out infinite, sax-pulse 2.4s ease-in-out infinite;
}
@keyframes sax-pulse {
  0%, 100% { filter: brightness(0.95); }
  50%       { filter: brightness(1.05); }
}
[data-theme="light"] .hero-sax[data-playing] {
  filter: drop-shadow(0 0 22px rgba(94, 31, 138, 0.4));
}

/* ═══════════════════════════════════════════════════════
   SAX PLAYING NOTES — large notes floating from the bell
   ═══════════════════════════════════════════════════════ */
.sax-playing-note {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  font-family: serif;
  color: #9b4de0;    /* vivid purple — visible on both dark and light */
  text-shadow:
    0 0 18px rgba(155, 77, 224, 0.85),
    0 0 40px rgba(155, 77, 224, 0.45),
    0 0 80px rgba(155, 77, 224, 0.2);
  user-select: none;
  will-change: transform, opacity;
  animation: sax-note-rise var(--dur, 3s) cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
@keyframes sax-note-rise {
  0%   { opacity: 0;    transform: translate(0,     0)     rotate(0deg)   scale(0.6); }
  12%  { opacity: 1;                                                                    }
  100% { opacity: 0;    transform: translate(var(--tx, -60px), -180px) rotate(var(--rot, -18deg)) scale(1.3); }
}

/* ── 3D Saxophone overlay (sax3d.js) ── */
#sax-3d {
  position: fixed !important;
  right: 0 !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  top: calc(50% + 80px) !important;
  width: clamp(280px, 30vw, 520px) !important;
  height: auto !important;
  aspect-ratio: 3 / 4 !important;
  z-index: 50 !important;
  pointer-events: all !important;
  overflow: visible !important;
}
#sax-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
/* Phones and small tablets: the 280px-minimum sax covered the hero buttons and the contact
   form's fields (pointer-events: all). sax3d.js also skips loading three.js below 980px. */
@media (max-width: 979px) {
  #sax-3d { display: none !important; }
}

/* ==========================================================================
   Audit round: services anchors, work filters, theme-aware artwork
   ========================================================================== */
.service-detail[id] { scroll-margin-top: 6rem; }

/* Work page filter chips (real buttons; JS toggles aria-pressed) */
.work-filters { display: flex; gap: 1.5rem; margin-top: 3rem; flex-wrap: wrap; }
.work-filter {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--cream-dim);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.work-filter:hover { border-color: var(--border-strong); color: var(--cream); }
.work-filter[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.work-filter:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[data-theme="light"] .work-filter[aria-pressed="true"] { border-color: var(--purple); color: var(--purple); }
[data-theme="light"] .work-filter:focus-visible { outline-color: var(--purple); }

/* Filtering: hidden cards leave the grid; while filtered, visible cards share a uniform span */
.work-card[hidden] { display: none; }
.work-grid[data-filter]:not([data-filter="all"]) .work-card { grid-column: span 6; }
.work-grid[data-filter]:not([data-filter="all"]) .work-card.fill-row { grid-column: span 12; }

/* Work page cards are not links: no hover affordance */
article.work-card:hover { border-color: var(--border); }
article.work-card .work-arrow { display: none; }

/* Light theme: the artwork sits on beige, so keep the overlay faint
   (the dark dark-theme overlay would put gold line art on near-black purple). */
[data-theme="light"] .work-visual::after {
  background: linear-gradient(180deg, transparent 60%, rgba(94, 31, 138, 0.12));
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::after { animation: none; }                       /* film grain */
  .marquee-track { animation: none; }
  .note { display: none; }                               /* floating hero notes */
  .equalizer .bar { animation: none; transform: scaleY(0.6); }
  .music-note-trail { display: none; }                   /* cursor note trail */
  .cursor-trail { transition: none; }
  html.reveal-ready .reveal,
  html.reveal-ready .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-title .line-inner,
  .hero-sub,
  .hero-cta-row { animation: none; opacity: 1; transform: none; }
}

/* ── Mobile menu: when closed it leaves the tab order and the accessibility tree ── */
@media (max-width: 1100px) {
  .nav-menu {
    visibility: hidden;
    transition: transform 0.5s var(--ease-smooth), visibility 0s linear 0.5s;
  }
  .nav-menu.open {
    visibility: visible;
    transition: transform 0.5s var(--ease-smooth), visibility 0s;
  }
}

/* ── Keyboard focus is always visible ── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.form-group :is(input, textarea, select):focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
[data-theme="light"] :focus-visible,
[data-theme="light"] .form-group :is(input, textarea, select):focus-visible { outline-color: var(--purple); }
/* headings focused by the router after an in-site navigation (they are not controls) */
h1[tabindex="-1"]:focus { outline: none; }

/* ── Thai: wide tracking made for Latin capitals breaks Thai words apart ── */
html[lang="th"] :is(.eyebrow, .mono-label, .nav-menu a, .nav-cta, .btn, .service-num, .service-link,
  .work-category, .team-role, .footer-col h4, .footer-bottom, .form-group label, .contact-label,
  .section-meta, .loader-text, .work-filter, .form-note, .contact-hours, .skip-link, .work-case strong,
  .testimonial footer, .advisory-top, .advisory-fixed, .service-case, .work-links) { letter-spacing: 0.02em; }

/* ==========================================================================
   COMPONENTS (classes that replaced the inline styles; CSP style-src is 'self' only)
   ========================================================================== */
/* Wordmark: nav, footer and loader */
.wordmark { display: flex; align-items: center; gap: 0; }
.wm-mark { display: block; flex-shrink: 0; margin-right: -2px; margin-top: -5px; transform: rotate(2deg); transform-origin: center center; }
.wm-text { letter-spacing: -0.01em; }
.nav-logo .italic-accent { font-size: 1em; }
.loader-logo { font-family: var(--font-display); font-size: 2rem; font-weight: 500; letter-spacing: 0.01em; color: var(--cream); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
html.loader-seen .loader { display: none; }   /* theme.js: the loader plays once per browser session */

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 10000;
  padding: 0.75rem 1.25rem; background: var(--gold); color: var(--bg);
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.15em; text-transform: uppercase;
}
.skip-link:focus { top: 1rem; }
#page-content:focus { outline: none; }

/* Spacing and colour utilities */
.mt-2 { margin-top: 2rem; }  .mt-15 { margin-top: 1.5rem; }  .mt-25 { margin-top: 2.5rem; }  .mt-6 { margin-top: 6rem; }
.mb-1 { margin-bottom: 1rem; }  .mb-3 { margin-bottom: 3rem; }  .mb-075 { margin-bottom: 0.75rem; }  .mb-25 { margin-bottom: 2.5rem; }
.pt-4 { padding-top: 4rem; }  .p-0 { padding: 0; }
.rule-top { border-top: 1px solid var(--border); }  .rule-bottom { border-bottom: 1px solid var(--border); }
.band { background: var(--bg-deeper); }
.gold { color: var(--gold); }  .hl { color: var(--cream); }
.text-link { color: var(--gold); text-decoration: underline; text-underline-offset: 0.15em; transition: color 0.3s; }
.text-link:hover { color: var(--gold-light); }
.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }  .btn-row--center { justify-content: center; }
.center-cta { text-align: center; margin-top: 4rem; }
.marquee { padding: 0; }

/* Inline SVG artwork colours */
.f-gold { fill: var(--gold); }  .f-cream { fill: var(--cream); }  .f-magenta { fill: var(--magenta); }
.f-cyan { fill: var(--cyan); }  .f-mute { fill: var(--text-mute); }  .f-bg { fill: var(--bg); }
.s-gold { stroke: var(--gold); }  .s-magenta { stroke: var(--magenta); }
.sc-gold { stop-color: var(--gold); }  .sc-magenta { stop-color: var(--magenta); }  .sc-cyan { stop-color: var(--cyan); }

/* Page heroes and ledes */
.about-hero .display-xl { max-width: 1200px; }
.about-hero--short { min-height: 70vh; }
.hero-lede { font-size: 1.2rem; max-width: 700px; margin-top: 2.5rem; line-height: 1.7; }
.cta-lede { font-size: 1.2rem; max-width: 600px; margin: 2rem auto 3rem; line-height: 1.6; }
.manifesto-text { font-size: 1.15rem; max-width: 760px; margin-top: 2rem; line-height: 1.7; }

/* About */
.about-copy { padding-top: 2rem; }
.about-copy p { font-size: 1.1rem; line-height: 1.8; margin-bottom: 2rem; }
.about-copy > p:last-child { margin-bottom: 0; }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding-top: 2rem; margin-top: 1rem; border-top: 1px solid var(--border); }
.fact-value { font-family: var(--font-display); font-size: 1.5rem; color: var(--cream); }
.team-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* Services: engagement cards */
.plan-term { font-family: var(--font-display); font-style: italic; font-size: 3rem; color: var(--gold); margin: 2rem 0; }

/* Prose pages (privacy) */
.prose { max-width: 820px; line-height: 1.75; font-size: 1.05rem; }
.prose ul { margin-left: 1.25rem; list-style: disc; }

/* Contact */
.contact-info { position: sticky; top: 6rem; }
.contact-hours { font-size: 0.85rem; font-family: var(--font-mono); color: var(--text-dim); letter-spacing: 0.05em; margin-top: 0.4rem; }
.honey { display: none; }
.form-status { margin-top: 1rem; font-size: 0.95rem; color: var(--text-mute); }
.form-note { margin-top: 1.5rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); }
.form-note .text-link { color: var(--gold); }

/* Work: featured card and the problem / approach / outcome notes */
.work-visual--wide { aspect-ratio: 21 / 9; }
.work-visual--wide .work-art svg { width: 100%; height: 100%; }
.work-card[id] { scroll-margin-top: 6rem; }
.work-case { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding: 0 2rem 2rem; }
.work-case div { font-size: 0.9rem; line-height: 1.6; color: var(--text-mute); }
.work-case strong { display: block; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-weight: 400; margin-bottom: 0.5rem; }
@media (max-width: 880px) { .work-case { grid-template-columns: 1fr; } }

/* Testimonials */
.testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.testimonial { padding: 2.5rem; border: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 1.5rem; transition: border-color 0.4s; }
.testimonial:hover { border-color: var(--border-strong); }
.testimonial blockquote { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.4; color: var(--cream); }
.testimonial blockquote::before { content: '\201C'; color: var(--gold); margin-right: 0.05em; }
.testimonial blockquote::after { content: '\201D'; color: var(--gold); }
.testimonial footer { margin-top: auto; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.testimonial footer span { display: block; color: var(--text-dim); margin-top: 0.3rem; }

/* Security watch */
.security-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 4rem; align-items: start; }
.security-pitch { position: sticky; top: 6rem; }
.security-pitch .manifesto-text { margin-top: 0; }
.security-steps { list-style: none; margin: 2.5rem 0; display: grid; gap: 1.25rem; counter-reset: step; }
.security-steps li { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.5rem; align-items: baseline; font-size: 0.95rem; line-height: 1.6; color: var(--text-mute); }
.security-steps li::before { counter-increment: step; content: counter(step, upper-roman) '.'; font-family: var(--font-display); font-style: italic; font-size: 1.5rem; color: var(--gold); }
.security-steps strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; color: var(--cream); margin-bottom: 0.2rem; }
.security-feed { display: grid; gap: 1.5rem; }
.advisory { padding: 2rem 2.25rem; border: 1px solid var(--border); background: var(--bg); display: grid; gap: 0.9rem; transition: border-color 0.4s; }
.advisory:hover { border-color: var(--border-strong); }
.advisory-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-dim); }
.advisory-severity { border: 1px solid var(--magenta); color: var(--magenta); border-radius: 999px; padding: 0.3rem 0.75rem; white-space: nowrap; }
.advisory-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; color: var(--cream); }
.advisory-ids { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--text-mute); overflow-wrap: anywhere; }
.advisory p { font-size: 0.95rem; line-height: 1.6; }
.advisory-fixed { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--gold); }
.advisory-fixed span { color: var(--text-dim); margin-right: 0.5rem; text-transform: uppercase; }
@media (max-width: 880px) {
  .security-grid { grid-template-columns: 1fr; gap: 3rem; }
  .security-pitch { position: static; }
}

/* Cross-links: services ↔ case studies */
.service-case, .work-links { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.service-case { margin-top: 1.75rem; }
.work-links { margin-top: 0.5rem; }
.service-case a, .work-links a { color: var(--gold); transition: color 0.3s; }
.service-case a:hover, .work-links a:hover { color: var(--gold-light); }
[data-theme="light"] :is(.service-case a, .work-links a) { color: var(--purple); }
/* the "in full" link under the Security watch meta is hidden on the security page itself */
.section-meta span { display: block; margin-top: 0.5rem; }
.section-meta span.active { display: none; }

/* Saxophone close button (sax3d.js creates it inside #sax-3d) */
.sax-close {
  position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--gold);
  font-size: 1.1rem; line-height: 1; cursor: pointer; opacity: 0.55; z-index: 1; padding: 0;
  transition: opacity 0.2s, border-color 0.2s;
}
.sax-close:hover, #sax-3d:hover .sax-close { opacity: 1; border-color: var(--gold); }

/* Light theme for the new components */
[data-theme="light"] :is(.work-case strong, .testimonial footer, .advisory-fixed, .security-steps li::before, .text-link, .form-note .text-link, .gold) { color: var(--purple); }
[data-theme="light"] .text-link:hover { color: var(--purple-light); }
[data-theme="light"] .testimonial blockquote::before,
[data-theme="light"] .testimonial blockquote::after { color: var(--purple); }
[data-theme="light"] .sax-close { color: var(--purple); border-color: rgba(94, 31, 138, 0.35); }
[data-theme="light"] .sax-close:hover, [data-theme="light"] #sax-3d:hover .sax-close { border-color: var(--purple); }
