/* ============================================================
   FONTS
   ============================================================ */
/* ============================================================
   GRADIENT CANVAS
   ============================================================ */
#gradient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* ============================================================
   THEME VARIABLES
   ============================================================ */
:root {
  /* Neutral tone scale — dark → light */
  --tone-darkest: #1a1a1a;
  --tone-darker: #2d2d2d;
  --tone-dark: #3f3f3f;

  /* Split section backgrounds */
  --split-left: #202020;
  --split-left-hover: #2E2E2E;
  --split-left-click: #141414;

  --split-right: #959595;
  --split-right-hover: #A1A1A1;
  --split-right-click: #878787;

  --tone-mid: #808080;
  --tone-light: #b3b3b3;
  --tone-lighter: #d9d9d9;
  --tone-lightest: #f0f0f0;

  /* Warm near-whites — readable on all three gradient palettes */
  --text-primary: rgba(255, 248, 240, 0.95);  /* headings */
  --text-body:    rgba(255, 248, 240, 0.75);  /* body copy */
  --text-muted:   rgba(255, 248, 240, 0.45);  /* captions, small text */

  /* Typography */
  --font-family:         'neue-haas-grotesk-text',    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-display: 'neue-haas-grotesk-display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --font-12: 12px;
  --font-14: 14px;
  --font-15: 15px;
  --font-18: 18px;
  --font-21: 21px;
  --font-24: 24px;
  --font-27: 27px;
  --font-30: 30px;
  --font-36: 36px;
  --font-48: 48px;
  --font-60: 60px;
  --font-72: 72px;
  --font-90: 90px;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 700;
  --weight-black: 900;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100dvh;
  /* Safari fills overscroll / rubber-band regions using the html element's background,
     not body — without this the pull-down and pull-up areas flash white on iOS/iPadOS. */
  background-color: #1e2e07;
}

body {
  height: 100dvh;
  font-family: var(--font-family);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Matches html background so there is no mismatch between the two layers;
     also prevents any white flash on body itself before the WebGL canvas fades in. */
  background-color: #1e2e07;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--weight-medium);
  line-height: 1.2;
}

p {
  line-height: 1.5;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* ============================================================
   APP WRAPPER
   ============================================================ */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

/* ============================================================
   SECTION VISIBILITY
   ============================================================ */
.section {
  width: 100%;
  height: 100%;
}

/* !important beats the higher-specificity #section-* ID rules that set display */
.section[hidden] {
  display: none !important;
}

/* ============================================================
   HOME SECTION
   ============================================================ */
#section-home {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Logo — absolutely positioned top-left.
   env(safe-area-inset-top) pushes it below the status bar on
   iPhone notch/island when viewport-fit=cover is active. */
.logo-overlay {
  position: absolute;
  top: calc(1.5rem + env(safe-area-inset-top, 0px));
  left: 2rem;
  z-index: 20;
}

@media (min-width: 768px) {
  .logo-overlay {
    top: calc(2rem + env(safe-area-inset-top, 0px));
    left: 3rem;
  }
}

/* Split background — hidden until sections are re-enabled */
.split-bg {
  display: none;
}

@media (min-width: 768px) {
  .split-bg {
    flex-direction: row; /* desktop: left/right */
  }
}

.split-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
}

.split-btn--left {
  background-color: transparent;
}

.split-btn--left:hover {
  background-color: rgba(255, 248, 240, 0.04);
}

.split-btn--left.is-active {
  background-color: rgba(0, 0, 0, 0.08);
}

.split-btn--right {
  background-color: transparent;
}

.split-btn--right:hover {
  background-color: rgba(255, 248, 240, 0.04);
}

.split-btn--right.is-active {
  background-color: rgba(0, 0, 0, 0.08);
}

/* Centered headline + pick-a-lane, layered above split.
   pointer-events: none lets clicks pass through to the split buttons below;
   restored on child SVGs that need interaction. */
.home-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
  pointer-events: none;
}

@media (min-width: 768px) {
  .home-content {
    gap: 4rem;
  }
}

/* Interactive headline SVG — restore pointer events so hover/mouse work.
   Mobile: left margin of 1.25rem places the asterisk in the margin while
   the W optically aligns with the logo's left edge (2rem from viewport).
   Right side gets 2rem to balance. Asymmetric padding is intentional. */

/* Override SVG presentation attribute (fill="var(--tone-lighter)") so headline
   letters use the warm off-white text token, matching all other body copy. */
#headline .letter-path {
  fill: var(--text-body);
}

#headline {
  display: block;
  width: calc(100% - 3.25rem); /* 1.25rem left + 2rem right */
  height: auto;
  min-height: 8vh;
  cursor: pointer;
  pointer-events: all;
  margin-left: 1.25rem;
  align-self: flex-start;
}

@media (min-width: 600px) {
  #headline {
    width: 55vw;
    margin-left: 0;
    align-self: center;
  }
}

@media (min-width: 1024px) {
  #headline {
    width: 40vw;
  }
}

/* Contextual onboarding hint — fades in after overlay dismiss + background ready.
   Positioned just above the footer. Populated by JS. */
.home-hint {
  position: absolute;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  font-family: var(--font-family);
  font-size: var(--font-12);
  font-weight: var(--weight-light);
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.home-hint.is-visible {
  opacity: 1;
}

/* Home footer — centered contact line.
   env(safe-area-inset-bottom) clears the home indicator bar. */
.home-footer {
  position: absolute;
  bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: all;
  z-index: 10;
}

.home-footer__text {
  font-family: var(--font-family);
  font-size: var(--font-14);
  font-weight: var(--weight-light);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.home-footer__link {
  color: var(--text-body);
  text-decoration: none;
}

.home-footer__link:hover {
  color: var(--text-primary);
}

/* ============================================================
   INNER PAGES (PROJECTS & CLIENTS)
   ============================================================ */
.page {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Page header */
.page-header {
  padding: 1.5rem 2rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .page-header {
    padding: 2rem 3rem;
  }
}

.page-header .logo-btn {
  display: inline-block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.page-header .logo-btn:hover {
  opacity: 0.7;
}

/* Page main content */
.page-main {
  flex: 1;
  padding: 0 2rem 3rem;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .page-main {
    padding: 0 3rem 3rem;
  }
}

.page-inner {
  max-width: 1280px;
  margin: 0 auto;
}

/* ============================================================
   GRID SYSTEM
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 3rem;
  }
}

/* Column spans (desktop only) */
@media (min-width: 768px) {
  .col-12 { grid-column: span 12; }
  .col-8  { grid-column: span 8; }
  .col-6  { grid-column: span 6; }
  .col-4  { grid-column: span 4; }
  .col-3  { grid-column: span 3; }
}

/* ============================================================
   PAGE TYPOGRAPHY
   ============================================================ */
.page-title {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-72);
  font-weight: var(--weight-medium);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.title-rule {
  height: 4px;
  width: 6rem;
  background-color: var(--tone-dark);
}

.section-heading {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-36);
  font-weight: var(--weight-medium);
  margin-bottom: 2rem;
}

.large-heading {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-48);
  font-weight: var(--weight-medium);
  margin-bottom: 1.5rem;
}

.card-heading {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-27);
  font-weight: var(--weight-medium);
  margin-bottom: 0.75rem;
}

.sub-heading {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-21);
  font-weight: var(--weight-medium);
  margin-bottom: 0.75rem;
}

.intro-text {
  color: var(--text-body);
  font-size: var(--font-21);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.body-text {
  color: var(--text-body);
  font-size: var(--font-18);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.body-text--muted {
  color: var(--text-muted);
  font-size: var(--font-18);
  line-height: 1.6;
}

.small-text {
  color: var(--text-muted);
  font-size: var(--font-15);
  line-height: 1.5;
}

.small-heading {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-24);
  font-weight: var(--weight-medium);
  margin-bottom: 0.5rem;
}

/* ============================================================
   PLACEHOLDER IMAGES
   ============================================================ */
.placeholder-4-3 {
  aspect-ratio: 4 / 3;
  background-color: var(--tone-darker);
  margin-bottom: 1.5rem;
}

.placeholder-4-3--light {
  background-color: var(--tone-dark);
}

.placeholder-square {
  aspect-ratio: 1;
  margin-bottom: 1rem;
}

.placeholder-square--light  { background-color: var(--tone-darker); }
.placeholder-square--mid    { background-color: var(--tone-dark); }
.placeholder-square--dark   { background-color: var(--tone-mid); }

/* ============================================================
   PAGE FOOTER
   ============================================================ */
.page-footer {
  padding: 2rem;
  border-top: 1px solid var(--tone-dark);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .page-footer {
    padding: 2rem 3rem;
  }
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
}

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

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.footer-contact h2 {
  color: var(--text-primary);
  font-size: var(--font-18);
  font-weight: var(--weight-medium);
  margin-bottom: 1rem;
}

.footer-contact p {
  color: var(--text-muted);
  font-size: var(--font-15);
  margin-bottom: 0.5rem;
}

.footer-nav {
  display: flex;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .footer-nav {
    justify-content: flex-end;
  }
}

/* Nav button (dark background, text + arrow) */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  background-color: var(--tone-mid);
  border: none;
  cursor: pointer;
}

.nav-btn:hover {
  background-color: var(--tone-dark);
}

.nav-btn__label {
  font-family: var(--font-family-display);
  color: var(--text-primary);
  font-size: var(--font-24);
  font-weight: var(--weight-medium);
}

.nav-btn__arrow {
  color: var(--text-body);
  font-size: var(--font-36);
  line-height: 1;
}

.footer-copy {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--tone-dark);
}

.footer-copy p {
  color: var(--text-muted);
  font-size: var(--font-12);
}

/* ============================================================
   CONTROLS PILL — fixed top-right, theme + sound toggles
   z-index: 100 — intentionally below #welcome-overlay (200)
   ============================================================ */
.controls-pill {
  display: none; /* hidden until re-enabled */
}

.controls-pill.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.controls-pill__btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--tone-lighter);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.controls-pill__btn:hover {
  background: var(--tone-darker);
}

.controls-pill__btn + .controls-pill__btn {
  border-top: 1px solid var(--tone-mid);
}

.controls-pill__btn:focus-visible {
  outline: 2px solid var(--tone-lighter);
  outline-offset: -2px;
}

[data-theme="light"] .controls-pill {
  background: var(--tone-lightest);
  border-color: var(--tone-lighter);
}

[data-theme="light"] .controls-pill__btn {
  color: var(--tone-darkest);
}

[data-theme="light"] .controls-pill__btn:hover {
  background: var(--tone-lighter);
}

[data-theme="light"] .controls-pill__btn + .controls-pill__btn {
  border-top-color: var(--tone-lighter);
}

/* ============================================================
   LIGHT THEME OVERRIDES
   ============================================================ */
[data-theme="light"] .page {
  background: #ffffff;
}

/* Logo: SVG paths use fill="var(--tone-lighter)" as a presentation attribute;
   a CSS rule overrides it so the wordmark is legible on a white background. */
[data-theme="light"] .page .logo-svg path {
  fill: var(--tone-darkest);
}

[data-theme="light"] .page-title      { color: var(--tone-darkest); }
[data-theme="light"] .title-rule      { background-color: var(--tone-light); }
[data-theme="light"] .section-heading { color: var(--tone-darkest); }
[data-theme="light"] .large-heading   { color: var(--tone-darkest); }
[data-theme="light"] .card-heading    { color: var(--tone-darkest); }
[data-theme="light"] .sub-heading     { color: var(--tone-darkest); }
[data-theme="light"] .small-heading   { color: var(--tone-darkest); }

[data-theme="light"] .intro-text      { color: var(--tone-darker); }
[data-theme="light"] .body-text       { color: var(--tone-darker); }
[data-theme="light"] .body-text--muted { color: var(--tone-dark); }
[data-theme="light"] .small-text      { color: var(--tone-dark); }

[data-theme="light"] .placeholder-4-3        { background-color: var(--tone-lightest); }
[data-theme="light"] .placeholder-4-3--light { background-color: var(--tone-lighter); }
[data-theme="light"] .placeholder-square--light { background-color: var(--tone-lightest); }
[data-theme="light"] .placeholder-square--mid   { background-color: var(--tone-lighter); }
[data-theme="light"] .placeholder-square--dark  { background-color: var(--tone-light); }

[data-theme="light"] .page-footer   { border-top-color: var(--tone-lighter); }
[data-theme="light"] .footer-copy   { border-top-color: var(--tone-lighter); }
[data-theme="light"] .footer-copy p { color: var(--tone-mid); }

[data-theme="light"] .footer-contact h2 { color: var(--tone-darkest); }
[data-theme="light"] .footer-contact p  { color: var(--tone-dark); }

/* ============================================================
   WELCOME OVERLAY
   ============================================================ */
#welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.6s ease;
}

#welcome-overlay.is-dismissing {
  opacity: 0;
  pointer-events: none;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  text-align: center;
  user-select: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.welcome-content.is-ready {
  opacity: 1;
}

.welcome-logo-wrap {
  width: 200px;
}

@media (min-width: 768px) {
  .welcome-logo-wrap {
    width: 280px;
  }
}

.welcome-sound {
  color: var(--text-primary);
  font-size: var(--font-18);
  font-weight: var(--weight-regular);
  margin: 0;
}

.welcome-cta {
  color: var(--text-muted);
  font-size: var(--font-12);
  font-weight: var(--weight-regular);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0;
}

/* ============================================================
   LOGO SVG
   ============================================================ */
.logo-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Mobile: fluid width so right edge sits just under the horizontal midpoint */
.logo--full {
  width: calc(50vw - 2.5rem);
}

@media (min-width: 600px) {
  .logo--full {
    width: 200px;
  }
}

.logo--small {
  width: 120px;
  height: auto;
}
