/* ═══════════════════════════════════════════
   global.css — All component styles
   Depends on theme.css being loaded first.
═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: #0a0a0a;
  color: var(--text-primary);
  overflow-x: hidden;
  max-width: 100vw;
  transition: color 0.4s var(--ease);
}

[data-theme="light"] body { background: #f2f2f5; }

/* ── Fixed constellation canvas ── */
#bokeh-global {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Isolate canvas into its own GPU layer so iOS Safari doesn't snapshot it
     as part of a backdrop-filter compositing group (causes dot-position redraws on scroll) */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  transition: opacity 0.4s ease;
}

/* Fade background elements at narrow viewports so they don't compete with text */
@media (max-width: 700px) {
  #bokeh-global { opacity: 0.35; }
}
@media (min-width: 701px) and (max-width: 900px) {
  #bokeh-global { opacity: 0.65; }
}

/* ═══════════════════════════════════════════
   SITE NAV
═══════════════════════════════════════════ */
#sitenav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.sitenav-logo {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.3s;
}

.sitenav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.sitenav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.sitenav-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.25s var(--ease);
  font-family: var(--font);
}
.sitenav-link:hover,
.sitenav-link.active { color: var(--text-primary); }

/* Theme toggle */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s, transform 0.2s;
  color: var(--text-secondary);
}
.theme-toggle:hover { background: var(--surface-hover); transform: scale(1.08); }
.theme-toggle svg { width: 15px; height: 15px; }
.icon-moon { display: block; }
.icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: block; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text-secondary);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile drawer */
.nav-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 199;
  background: var(--drawer-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  padding: 8px 0 16px;
}
.nav-drawer.open { display: flex; }

.nav-drawer-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 28px;
  transition: color 0.2s;
  font-family: var(--font);
}
.nav-drawer-link:hover,
.nav-drawer-link.active { color: var(--text-primary); }

@media (max-width: 600px) {
  .sitenav-links { display: none; }
  .nav-hamburger { display: flex; }
  #sitenav { padding: 0 18px; }
  .sitenav-right { gap: 14px; }
}

/* ═══════════════════════════════════════════
   HOME — HERO
═══════════════════════════════════════════ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh; /* iOS Safari: uses small viewport height so chrome (tab bar) doesn't push scroll cue off-screen */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--nav-h) + 60px) clamp(20px,8vw,80px) 80px;
  overflow: hidden;
}

.hero-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.8s var(--ease) 0.2s forwards;
}

.hero-name {
  font-size: clamp(52px, 9vw, 108px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.9s var(--ease) 0.35s forwards;
}

.hero-greeting {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.9s var(--ease) 0.5s forwards;
}

.hero-tagline {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.9s var(--ease) 0.5s forwards;
}
.hero-tagline strong { color: var(--text-primary); font-weight: 600; }

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.65s forwards;
}

.btn-primary {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--btn-primary-text);
  background: var(--btn-primary-bg);
  border: none;
  padding: 14px 28px;
  border-radius: 40px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--btn-ghost-text);
  background: var(--btn-ghost-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--btn-ghost-border);
  padding: 14px 28px;
  border-radius: 40px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-hover); background: var(--surface-hover); }

.hero-scroll-cue {
  position: absolute;
  bottom: 36px;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 1.1s forwards;
}
.hero-scroll-cue span {
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--scroll-cue);
}

.scroll-arrow { animation: bounce 2s ease-in-out infinite; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(5px); }
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   HOME — TIMELINE MINI-NAV
═══════════════════════════════════════════ */
#mininav {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  gap: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), background 0.4s var(--ease);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#mininav::-webkit-scrollbar { display: none; }
#mininav.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.mini-node {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  opacity: 0.35;
  transition: opacity 0.4s var(--ease);
  padding: 4px 0;
  flex-shrink: 0;
}
.mini-node.active { opacity: 1; }
.mini-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-primary); flex-shrink: 0;
  transition: transform 0.35s var(--ease);
}
.mini-node.active .mini-dot { transform: scale(1.7); }
.mini-label {
  font-size: 10px; font-weight: 500; color: var(--text-primary);
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.mini-line {
  height: 1px; width: 20px;
  background: var(--border);
  flex-shrink: 0; margin: 0 4px;
}

@media (max-width: 600px) {
  .mini-label { font-size: 9px; letter-spacing: .04em; }
  .mini-line  { width: 12px; }
  #mininav    { padding: 11px 12px; justify-content: flex-start; }
}

/* ═══════════════════════════════════════════
   HOME — TIMELINE SECTIONS
═══════════════════════════════════════════ */
.section {
  position: relative;
  /* expose layout variables so timeline pieces can compute positions consistently */
  --section-pad-inline: clamp(52px,8vw,80px);
  --tl-spine-offset: clamp(18px, 2.5vw, 30px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 80px var(--section-pad-inline);
  background: transparent;
}

.section-icon {
  position: absolute;
  right: min(-2vw, calc(158vw - 1120px));
  top: 2;
  bottom: auto;
  z-index: 1; opacity: 0;
  transition: opacity 0.7s var(--ease);
  pointer-events: none;
}
.section-icon svg {
  width: clamp(330px, 62vw, 750px);
  height: clamp(330px, 62vw, 750px);
}
@media (max-width: 900px) {
  .section-icon svg { width: clamp(260px, 45vw, 420px); height: clamp(260px, 45vw, 420px); }
}
.section-icon svg path,
.section-icon svg line,
.section-icon svg rect,
.section-icon svg circle,
.section-icon svg polygon,
.section-icon svg ellipse {
  stroke-dasharray: var(--len, 2000);
  stroke-dashoffset: var(--len, 2000);
  transition: stroke-dashoffset 1.8s var(--ease);
  stroke: var(--text-primary);
}

.section.in-view .section-icon { opacity: 0.13; }
[data-theme="light"] .section.in-view .section-icon { opacity: 0.22; }

.section.in-view .section-icon svg path,
.section.in-view .section-icon svg line,
.section.in-view .section-icon svg rect,
.section.in-view .section-icon svg circle,
.section.in-view .section-icon svg polygon,
.section.in-view .section-icon svg ellipse { stroke-dashoffset: 0; }

.section-icon svg *:nth-child(1)  { transition-delay: 0.04s; }
.section-icon svg *:nth-child(2)  { transition-delay: 0.13s; }
.section-icon svg *:nth-child(3)  { transition-delay: 0.22s; }
.section-icon svg *:nth-child(4)  { transition-delay: 0.31s; }
.section-icon svg *:nth-child(5)  { transition-delay: 0.40s; }
.section-icon svg *:nth-child(6)  { transition-delay: 0.49s; }
.section-icon svg *:nth-child(7)  { transition-delay: 0.58s; }
.section-icon svg *:nth-child(8)  { transition-delay: 0.67s; }
.section-icon svg *:nth-child(9)  { transition-delay: 0.76s; }
.section-icon svg *:nth-child(10) { transition-delay: 0.85s; }
.section-icon svg *:nth-child(11) { transition-delay: 0.94s; }
.section-icon svg *:nth-child(12) { transition-delay: 1.03s; }

.section-content {
  position: relative; z-index: 2; max-width: 560px;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease) 0.1s, transform 0.7s var(--ease) 0.1s;
}
.section.in-view .section-content { opacity: 1; transform: translateY(0); }

.eyebrow {
  font-size: 10px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--eyebrow); margin-bottom: 14px;
  padding-top: 2px;
}
.stage-title {
  font-size: clamp(38px, 7vw, 72px);
  font-weight: 500; line-height: 1.02;
  letter-spacing: -0.03em; color: var(--text-primary); margin-bottom: 8px;
}
.stage-sub {
  font-size: 12px; color: var(--text-muted);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 36px;
}
.bullets { display: flex; flex-direction: column; gap: 22px; }
.bullet {
  padding-left: 18px;
  border-left: 2px solid var(--bullet-border);
  opacity: 0; transform: translateX(-8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.section.in-view .bullet { opacity: 1; transform: translateX(0); }
.section.in-view .bullet:nth-child(1) { transition-delay: 0.35s; }
.section.in-view .bullet:nth-child(2) { transition-delay: 0.50s; }
.section.in-view .bullet:nth-child(3) { transition-delay: 0.65s; }
.bullet-head { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; line-height: 1.3; }
.bullet-body { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }

.divider {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  height: 40px;
}
.divider svg { opacity: 0.3; stroke: var(--text-primary); }

/* ═══════════════════════════════════════════
   TIMELINE SPINE — left-side anchor
═══════════════════════════════════════════ */
.tl-spine {
  position: absolute;
  left: var(--tl-spine-offset);
  top: 0; bottom: 0;
  width: 1px;
  background: var(--bullet-border);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: opacity 0.6s var(--ease) 0.05s,
              transform 0.7s var(--ease) 0.05s;
}

.section.in-view .tl-spine {
  opacity: 1;
  transform: scaleY(1);
}

/* Dot: positioned just left of the eyebrow label */
.section-content .tl-dot {
    position: absolute;
    /* compute dot left so its right edge sits an 8px gap left of the section-content's left edge
       by subtracting the section padding and the dot size + gap from the spine offset */
    left: calc(var(--tl-spine-offset) - var(--section-pad-inline) - 4px);
    top: 6px; /* vertically centered with 10px eyebrow text */
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-primary);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.35s var(--ease) 0.35s,
                transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s;
    z-index: 4;
}

.section.in-view .section-content .tl-dot {
  opacity: 0.85;
  transform: scale(1);
}

/* Line + arrowhead from dot to eyebrow label — inherits parent opacity/scale transition */
.section-content .tl-dot::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 4px;
  width: calc(var(--section-pad-inline) - var(--tl-spine-offset) - 18px);
  height: 1px;
  background: var(--text-primary);
}
.section-content .tl-dot::before {
  content: '';
  position: absolute;
  left: calc(var(--section-pad-inline) - var(--tl-spine-offset) - 12px);
  top: 2px;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--text-primary);
  border-top: 1px solid var(--text-primary);
  transform: rotate(45deg);
}

/* ═══════════════════════════════════════════
   INNER PAGES — shared
═══════════════════════════════════════════ */
.inner-page {
  position: relative; z-index: 1;
  min-height: 100vh;
  padding: calc(var(--nav-h) + 72px) clamp(20px,8vw,120px) 120px;
  max-width: 860px;
}

.page-eyebrow {
  font-size: 10px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--eyebrow); margin-bottom: 20px;
}
.page-title {
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 500; line-height: 1.0;
  letter-spacing: -0.03em; color: var(--text-primary);
  margin-bottom: 48px;
}
.page-body {
  font-size: 16px; line-height: 1.75;
  color: var(--text-secondary); max-width: 640px;
}
.page-body p { margin-bottom: 24px; }
.page-body p:last-child { margin-bottom: 0; }
.page-body strong { color: var(--text-primary); font-weight: 600; }

.page-section-head {
  font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--eyebrow); margin: 52px 0 18px;
}

/* ═══════════════════════════════════════════
   WORK PAGE
═══════════════════════════════════════════ */
.case-studies { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }

.case-study {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 30px;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
  background: var(--surface);
  margin-bottom: 20px;
}
.case-study:hover { border-color: var(--border-hover); background: var(--surface-hover); }

.cs-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}
.cs-title { font-size: 20px; font-weight: 600; color: var(--text-primary); line-height: 1.2; margin-bottom: 10px; }
.cs-desc  { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 18px; }
.cs-tags  { display: flex; flex-wrap: wrap; gap: 7px; }
.cs-tag {
  font-size: 10px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  padding: 4px 10px; border-radius: 20px;
}
.cs-coming {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 14px;
}

/* ═══════════════════════════════════════════
   THINKING PAGE
═══════════════════════════════════════════ */
.thinking-grid { display: flex; flex-direction: column; }

.thinking-item {
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: padding-left 0.2s var(--ease);
}
.thinking-item:hover { padding-left: 8px; }
.thinking-item:first-child { border-top: 1px solid var(--border); }

.ti-meta {
  font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}
.ti-title  { font-size: 18px; font-weight: 600; color: var(--text-primary); line-height: 1.3; margin-bottom: 8px; }
.ti-preview { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }

.philosophy-block {
  margin-top: 60px;
  padding: 32px 30px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.philosophy-block .page-section-head { margin-top: 0; }
.philosophy-entries { display: flex; flex-direction: column; gap: 26px; margin-top: 4px; }
.philosophy-entry { padding-left: 18px; border-left: 2px solid var(--bullet-border); }
.philosophy-entry h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.philosophy-entry p  { font-size: 13px; line-height: 1.65; color: var(--text-secondary); margin: 0; }

/* ═══════════════════════════════════════════
   CONTACT PAGE
═══════════════════════════════════════════ */
.contact-links { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; max-width: 480px; }

.contact-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.25s, background 0.25s;
  margin-bottom: 20px;
}
.contact-link:hover { border-color: var(--border-hover); background: var(--surface-hover); }

.cl-label { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.cl-value { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.cl-arrow { font-size: 20px; color: var(--text-tertiary); }

.contact-note { margin-top: 36px; max-width: 480px; font-size: 13px; line-height: 1.7; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .section-icon svg path, .section-icon svg line,
  .section-icon svg rect,  .section-icon svg circle,
  .section-icon svg polygon, .section-icon svg ellipse {
    transition: none; stroke-dashoffset: 0;
  }
  .section-content, .bullet { transition: none; opacity: 1; transform: none; }
  .hero-eyebrow, .hero-name, .hero-tagline, .hero-cta, .hero-scroll-cue {
    animation: none; opacity: 1; transform: none;
  }
}
