/* ============================================
   FOLIO — base, components, homepage
   ============================================ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

/* Page wash + mouse glow layers */
.bg-layer {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
.bg-wash { position: absolute; top: 0; left: 0; right: 0; height: 120vh; background: var(--grad-wash); z-index: -1; pointer-events: none; }
.bg-glow {
  background: radial-gradient(560px circle at var(--glow-x, 50%) var(--glow-y, 20%),
    rgba(124, 58, 237, 0.09), rgba(56, 189, 248, 0.05) 40%, transparent 70%);
  opacity: 0; transition: opacity .6s ease;
}
body.glow-on .bg-glow { opacity: 1; }

.container { max-width: var(--page-max); margin: 0 auto; padding-left: var(--page-pad); padding-right: var(--page-pad); }

a { color: var(--color-accent); text-decoration: none; }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; display: block; }

/* ---------- Nav ---------- */
.nav {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: var(--space-lg); padding-bottom: var(--space-lg);
}
.nav-burger { display: none; }
.nav-links { display: flex; gap: var(--space-xl); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--color-text-primary); font-weight: 500; font-size: var(--text-small);
  border-bottom: 2px solid transparent; padding-bottom: 2px; transition: border-color .2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { border-color: var(--color-accent); }

/* Logo */
.logo { display: inline-block; line-height: 0; }
.logo svg { height: 42px; width: auto; }

/* Theme toggle — sliding switch */
.theme-toggle {
  position: relative; width: 54px; height: 28px; cursor: pointer; padding: 0;
  background: var(--color-bg-subtle); border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: space-between;
  transition: border-color .2s;
}
.theme-toggle:hover { border-color: var(--color-accent); }
.theme-toggle svg { width: 12px; height: 12px; position: relative; z-index: 1; transition: color .25s ease; }
.tt-sun { margin-left: 7px; color: var(--color-text-inverse); }
.tt-moon { margin-right: 7px; color: var(--color-text-secondary); }
.tt-knob {
  position: absolute; top: 2px; left: 2px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--color-bg-inverse);
  transition: transform .25s ease;
}
[data-theme="dark"] .tt-knob { transform: translateX(26px); }
[data-theme="dark"] .tt-sun { color: var(--color-text-secondary); }
[data-theme="dark"] .tt-moon { color: var(--color-text-inverse); }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--font-mono); font-size: var(--text-meta);
  letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-secondary);
  font-weight: 500;
}
h1.display {
  font-size: var(--text-display); font-weight: 700; line-height: 1.06;
  letter-spacing: -0.02em; margin: var(--space-md) 0;
}
.grad-text {
  background: var(--grad-brand); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.anim .grad-text { animation: gradRun 8s linear infinite; }
@keyframes gradRun { 0%{background-position:0% 0} 50%{background-position:100% 0} 100%{background-position:0% 0} }

.lead { font-size: var(--text-lead); color: var(--color-text-secondary); line-height: 1.5; max-width: 46ch; }

/* Rotating hero word */
.rotor {
  display: inline-block; transition: opacity .25s ease, transform .25s ease;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rotor.out { opacity: 0; transform: translateY(0.45em); }
@media (prefers-reduced-motion: reduce) { .rotor { transition: none; } }

.chip {
  font-family: var(--font-mono); font-size: var(--text-meta); font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-secondary);
}
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-md) var(--space-lg); }

.link-arrow { font-weight: 500; font-size: var(--text-small); }
.link-arrow:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
.hero .context { font-size: var(--text-small); color: var(--color-text-secondary); margin-top: var(--space-md); }
.hero .cta { display: inline-block; margin-top: var(--space-lg); }

/* ---------- Project rows ---------- */
.projects { display: flex; flex-direction: column; gap: var(--space-4xl); padding-bottom: var(--space-5xl); }
.project-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3xl); align-items: center;
  text-decoration: none; color: inherit;
}
.project-row:hover .thumb { transform: translateY(-4px); box-shadow: 0 24px 48px rgba(18,18,19,.14); }
.project-row:hover h3 { color: var(--color-accent); }
.thumb {
  border-radius: var(--radius-md); overflow: hidden; position: relative; aspect-ratio: 14/9;
  background: linear-gradient(115deg, var(--violet-600), var(--sky-400));
  transition: transform .35s ease, box-shadow .35s ease;
}
.thumb .shot {
  position: absolute; border-radius: 14px; border: 3px solid #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.28); object-fit: cover;
}
/* Pebblr collage */
.thumb-pebblr .shot-a { width: 34%; left: 14%; top: 12%; transform: rotate(-7deg); }
.thumb-pebblr .shot-b { width: 34%; left: 52%; top: 8%;  transform: rotate(7deg); }
/* HIV collage */
.thumb-hiv .shot-a { width: 33%; left: 12%; top: 10%; transform: rotate(-4deg); }
.thumb-hiv .shot-b { width: 36%; left: 55%; top: 16%; transform: rotate(5deg); }
/* Breasley collage */
.thumb-breasley .shot-a { width: 44%; left: 8%; top: 10%; height: 76%; transform: rotate(-5deg); object-position: top; }
.thumb-breasley .shot-b { width: 44%; left: 50%; top: 14%; height: 76%; transform: rotate(4deg); object-position: top; }

.project-info .chip { color: var(--color-text-secondary); }
.project-info h3 { font-size: var(--text-h3); line-height: 1.15; margin: var(--space-sm) 0; font-weight: 600; transition: color .25s; }
.project-info p { color: var(--color-text-secondary); margin: 0 0 var(--space-sm); max-width: 52ch; }
.project-info .role { font-size: 0.875rem; font-weight: 500; color: var(--color-text-primary); }

/* ---------- Credibility strip ---------- */
.cred {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl); padding-bottom: var(--space-xl);
  font-size: var(--text-small); color: var(--color-text-secondary); font-weight: 500;
}

/* ---------- About teaser ---------- */
.teaser { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); }
.teaser h2 { font-size: var(--text-h2); font-weight: 600; margin: 0 0 var(--space-md); letter-spacing: -0.01em; }
.teaser p { color: var(--color-text-secondary); max-width: 62ch; font-size: 1.125rem; line-height: 1.6; }

/* ---------- Footer ---------- */
.footer { background: var(--color-bg-subtle); margin-top: var(--space-2xl); }
.footer-inner { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
.footer h2 { font-size: var(--text-h2); font-weight: 700; margin: 0 0 var(--space-sm); }
.footer p { color: var(--color-text-secondary); font-size: var(--text-small); margin: 0; }
.footer a { color: var(--color-text-secondary); }
.footer a:hover { color: var(--color-accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .project-row { grid-template-columns: 1fr; gap: var(--space-lg); }
  .nav-links { gap: var(--space-md); }
  .projects { gap: var(--space-2xl); }
  .logo svg { height: 34px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim .grad-text { animation: none; }
  .bg-glow { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .tt-knob, .theme-toggle svg { transition: none; }
  .thumb, .project-row:hover .thumb { transition: none; transform: none; }
}

/* ---------- Collapsing nav on small screens ---------- */
@media (max-width: 700px) {
  .logo svg { height: 38px; }
  .nav-burger {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 46px; height: 46px; border-radius: 50%; cursor: pointer; padding: 0;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(18, 18, 19, 0.08);
  }
  [data-theme="dark"] .nav-burger {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }
  .nav-burger span {
    display: block; width: 20px; height: 2px; border-radius: 2px;
    background: var(--color-text-primary);
    transition: transform .25s ease, opacity .25s ease;
  }
  .nav.open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav.open .nav-burger span:nth-child(2) { opacity: 0; }
  .nav.open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-links { display: none; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-lg);
    position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
    background: var(--color-bg-card); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: var(--space-lg);
    box-shadow: 0 18px 44px rgba(0,0,0,.16);
  }
  .nav-links a { font-size: 15px; }
  .theme-toggle { width: 48px; height: 24px; }
  .theme-toggle svg { width: 11px; height: 11px; }
  .tt-sun { margin-left: 5px; }
  .tt-moon { margin-right: 5px; }
  .tt-knob { width: 17px; height: 17px; }
  [data-theme="dark"] .tt-knob { transform: translateX(24px); }
  .hero { padding-top: var(--space-lg); }
  .stats { gap: var(--space-lg); }
  .stat .num { font-size: 2.2rem; }
  .phone-row { gap: var(--space-md); }
  .phone-row img { width: min(150px, 40vw); }
  .exhibit { padding: var(--space-md); }
  .fan img { width: 30vw; }
  .tone-grid img { max-width: 100%; }
}
