/* ── HERO ── */
/* Hero is intentionally tall (200svh) so we have scroll room for a two-phase
   reveal: (1) UV moves to centred, (2) frost ramps up + content slides up. */
.hero {
  position: relative;
  height: 200svh; min-height: 1400px;
}
#canvas-container {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100svh;
  z-index: 0; pointer-events: none; overflow: hidden;
  opacity: 0; transform: translateY(32px);
}
body.loaded #canvas-container {
  animation: heroCanvasFadeUp .7s 0s cubic-bezier(.23,1,.32,1) forwards;
}
@keyframes heroCanvasFadeUp {
  to { opacity: 1; transform: translateY(0); }
}
#canvas-container canvas {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  display: block;
}
#hero-frost {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100svh;
  z-index: 1; pointer-events: none;
  background: rgba(245,243,239,0);
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  will-change: backdrop-filter, background;
}
.hero-bg { position: absolute; inset: 0; background-color: var(--bg); }
.hero-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(to top, var(--bg) 0%, rgba(245,243,239,.8) 55%, transparent 100%);
  pointer-events: none; z-index: 2;
  opacity: 0;
}
.hero-content {
  position: sticky; top: 0; z-index: 3;
  width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 52px;
  height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink2); margin-bottom: 18px;
  opacity: 0; transform: translateY(14px);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
.hero-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
.hero-headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 96px;
  font-weight: 400; line-height: 1.0; letter-spacing: -.02em; color: var(--ink);
  overflow: visible;
}
.hero-word-wrap { display: inline-block; overflow: visible; vertical-align: bottom; margin-right: .18em; padding-bottom: 0.12em; }
.hero-word { display: inline-block; transform: translateY(110%); opacity: 0; }
@keyframes wordUp { from { transform: translateY(110%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.hero-headline em { font-style: italic; font-weight: 300; color: var(--ink2); }
.hero-sub {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 18px; color: #223D4A; line-height: 1.65;
  max-width: 460px; margin: 22px 0 38px; letter-spacing: -.01em;
  opacity: 0; transform: translateY(14px);
}
.hero-actions {
  display: flex; gap: 14px;
  opacity: 0; transform: translateX(-40px);
}
.scroll-cue {
  position: absolute; bottom: 32px; left: 52px; z-index: 4;
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3);
  opacity: 0;
}

/* Entrance animations, fire only after the loader is gone.
   Delays (~1.75s+) wait for the canvas fade-in (.7s) + hold (.25s) + UV move (.8s) to finish. */
body.loaded .hero-eyebrow {
  animation: fadeUp .6s 1.75s cubic-bezier(.23,1,.32,1) forwards;
}
body.loaded .hero-word {
  animation: wordUp .85s cubic-bezier(.16,1,.3,1) both;
  animation-delay: var(--d, 1.9s);
}
body.loaded .hero-sub {
  animation: fadeUp .7s 2.55s cubic-bezier(.23,1,.32,1) forwards;
}
body.loaded .hero-actions {
  animation: slideInLeft .7s 2.75s cubic-bezier(.23,1,.32,1) forwards;
}
body.loaded .scroll-cue {
  animation: fadeUp .6s 2.95s cubic-bezier(.23,1,.32,1) forwards;
}

/* Subsequent visits in the same session — skip the intro entirely */
body.intro-skipped #canvas-container,
body.intro-skipped .hero-eyebrow,
body.intro-skipped .hero-word,
body.intro-skipped .hero-sub,
body.intro-skipped .hero-actions,
body.intro-skipped .scroll-cue {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.scroll-line { width: 40px; height: 1px; background: var(--ink3); position: relative; overflow: hidden; }
.scroll-line::after {
  content: ''; position: absolute; inset: 0; background: var(--accent);
  animation: scanLine 2.2s 2.5s infinite;
}
@keyframes scanLine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ── SECTIONS ── */
section { padding: 120px 52px; }
.section-inner { max-width: 1320px; margin: 0 auto; }
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 60px; border-bottom: 1px solid var(--border); padding-bottom: 22px;
}
.section-label {
  font-size: 11px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 8px;
}
.section-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(32px, 3.6vw, 52px); font-weight: 400;
  letter-spacing: -.015em; line-height: 1.1;
}
.section-link {
  font-size: 14px; color: var(--ink2); text-decoration: none; font-weight: 400;
  border-bottom: 1px solid var(--border); padding-bottom: 1px;
  transition: color .2s, border-color .2s;
}
.section-link:hover { color: var(--accent-dark); border-color: var(--accent); }

/* ── WORK ── */
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.work-card {
  background: var(--bg2); border-radius: var(--r);
  overflow: hidden; cursor: none; text-decoration: none;
  display: flex; flex-direction: column; position: relative;
  transition: transform .4s cubic-bezier(.23,1,.32,1), box-shadow .4s cubic-bezier(.23,1,.32,1);
}
.work-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .4s cubic-bezier(.23,1,.32,1); z-index: 2;
}
.work-card:hover::before { transform: scaleX(1); }
.work-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(34,61,74,.1);
}

/* Per-card reveal — scale up with a little bounce as each card enters the viewport */
.work-card.reveal {
  opacity: 0;
  transform: scale(0.9);
  filter: blur(2px);
  transition:
    opacity .55s cubic-bezier(.23, 1, .32, 1),
    transform .9s cubic-bezier(.34, 1.56, .64, 1),
    filter .55s cubic-bezier(.23, 1, .32, 1);
}
.work-card.reveal.visible {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}
/* Preserve the lift on hover after the bounce settles. The explicit scale(1)
   keeps the post-entrance transform composed with the hover translateY. */
.work-card.reveal.visible:hover {
  transform: translateY(-6px) scale(1);
  transition: transform .4s cubic-bezier(.23, 1, .32, 1),
              box-shadow .4s cubic-bezier(.23, 1, .32, 1),
              border-color .3s;
}
.work-card.featured { grid-column: 1 / 3; flex-direction: row; min-height: 340px; }
.work-card-thumb {
  background: #e8e5e0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.work-card-thumb-inner {
  width: 100%; height: 200px;
  background: repeating-linear-gradient(-45deg,#e4e1db 0,#e4e1db 1px,#e8e5e0 1px,#e8e5e0 8px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .5s cubic-bezier(.23,1,.32,1);
  position: relative;
}
.work-card-thumb-inner::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
.work-card.featured .work-card-thumb { width: 50%; border-right: 1px solid var(--border); }
.work-card.featured .work-card-thumb-inner { height: 100%; min-height: 340px; }
.work-card:hover .work-card-thumb-inner { transform: scale(1.04); }
.thumb-label {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink3);
  font-family: 'SF Mono', monospace; text-align: center; line-height: 1.6; padding: 16px;
}
.work-card-body {
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 12px; flex: 1; justify-content: space-between;
}
.work-card.featured .work-card-body { padding: 44px 48px; gap: 20px; justify-content: center; }
.work-card-tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink); background: var(--accent); border-radius: 4px; padding: 3px 8px;
  align-self: flex-start;
}
.work-card-name { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 14px; color: var(--ink); }
.work-card.featured .work-card-name { font-size: 30px; }
.work-card-desc { font-size: 14px; color: var(--ink2); line-height: 1.65; margin-top: 8px; }
.work-card-arrow {
  font-size: 20px; color: var(--ink3); font-weight: 400;
  align-self: flex-end; margin-top: 8px;
  transition:
    transform .3s cubic-bezier(.23, 1, .32, 1),
    color .25s,
    font-weight .25s;
}
.work-card:hover .work-card-arrow {
  transform: translate(10px, -10px) scale(1.45);
  color: var(--accent);
  font-weight: 700;
}

/* ── PROCESS ── */
.process-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; position: relative; }
.process-step {
  display: flex; flex-direction: column; gap: 20px; padding: 40px 36px 40px 0;
  position: relative;
}
.process-step:not(:last-child)::after {
  content: ''; position: absolute; top: 52px; right: 0;
  width: 1px; height: calc(100% - 52px - 40px);
  background: var(--border);
}
.process-step:not(:first-child) { padding-left: 36px; }
.process-number {
  font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--accent-dark);
  background: var(--accent-light); border: 1px solid var(--accent);
  border-radius: 6px; padding: 4px 10px; align-self: flex-start;
}
.process-title { font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 6px; }
.process-desc { font-size: 14px; color: var(--ink2); line-height: 1.7; }

/* ── ABOUT ── */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; }
.about-text { display: flex; flex-direction: column; gap: 20px; }
.about-headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(28px, 3vw, 44px); font-weight: 400;
  letter-spacing: -.015em; line-height: 1.15;
}
.about-body { font-size: 17px; color: var(--ink2); line-height: 1.75; }
.about-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none;
  border-bottom: 1.5px solid var(--accent); padding-bottom: 1px;
  transition: gap .25s, color .2s;
}
.about-link:hover { gap: 12px; color: var(--accent-dark); }
.about-stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.about-stat:first-child { border-top: 1px solid var(--border); }
.about-stat-label { font-size: 12px; color: var(--ink3); letter-spacing: .02em; }
.about-stat-val { font-size: 14px; color: var(--ink); font-weight: 500; }

/* ── SKILLS ── */
.skills-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.skill-card {
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--r);
  padding: 36px 30px; display: flex; flex-direction: column; gap: 16px;
  position: relative;
}
.skill-card > * { position: relative; z-index: 1; }
.skill-number { font-size: 11px; font-weight: 600; color: var(--accent-dark); letter-spacing: .08em; }
.skill-name { font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.skill-desc { font-size: 13px; color: var(--ink2); line-height: 1.65; }

/* ── TWEAKS ── */
#tweaks-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: white; border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; width: 256px; box-shadow: 0 8px 40px rgba(0,0,0,.12);
  display: none; flex-direction: column; gap: 16px;
}
#tweaks-panel.open { display: flex; }
.tweaks-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-label { font-size: 12px; color: var(--ink2); font-weight: 500; }
.tweak-select {
  font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--ink); font-family: inherit;
  outline: none; cursor: pointer; width: 100%;
  transition: border-color .2s;
}
.tweak-select:focus { border-color: var(--accent); }

/* ─────────────────────────────────────────────
   RESPONSIVE
   Tablet: ≤ 960px — multi-col grids collapse to 2-col
   Mobile: ≤ 600px — everything stacks, scroll-lock hero disabled
   ──────────────────────────────────────────── */

@media (max-width: 960px) {
  /* Tighter section padding */
  section { padding: 96px 32px; }
  .section-header { margin-bottom: 44px; padding-bottom: 18px; }

  /* Hero text */
  .hero-content { padding: 0 32px; }

  /* Work grid: featured no longer spans 2 cols, becomes vertical card */
  .work-grid { grid-template-columns: 1fr; gap: 16px; }
  .work-card.featured { grid-column: 1 / 2; flex-direction: column; min-height: 0; }
  .work-card.featured .work-card-thumb { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .work-card.featured .work-card-thumb-inner { min-height: 220px; height: 220px; }
  .work-card.featured .work-card-body { padding: 32px; }
  .work-card.featured .work-card-name { font-size: 24px; }

  /* Process: 2x2 */
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .process-step:not(:last-child)::after { display: none; }
  .process-step:not(:first-child) { padding-left: 0; }

  /* About: stack */
  .about-grid { grid-template-columns: 1fr; gap: 40px; }

  /* Skills: 2x2 */
  .skills-grid { grid-template-columns: repeat(2, 1fr); }

  /* Contact band */
  .contact-section { padding: 96px 32px; }
}

/* Static mobile UX image — hidden on desktop (Three.js shader handles the visuals there) */
.hero-mobile-img { display: none; }

@media (max-width: 600px) {
  /* Mobile: drop the WebGL canvas, use a static image as full-viewport background.
     Keep the frost layer so we can blur the image as the user scrolls. */
  #canvas-container { display: none; }

  .hero {
    height: 100svh; min-height: 600px;
    position: relative;
  }
  /* Image covers the full hero as a background — text overlays on top */
  .hero-mobile-img {
    display: block;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100svh;
    object-fit: cover;
    object-position: center;
    z-index: 0;
    pointer-events: none;
    /* Fade up alongside the rest of the hero entrance */
    opacity: 0; transform: translateY(32px);
  }
  body.loaded .hero-mobile-img {
    animation: heroCanvasFadeUp .7s 0s cubic-bezier(.23,1,.32,1) forwards;
  }
  body.intro-skipped .hero-mobile-img {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .hero-content {
    position: relative;
    z-index: 3;
    height: 100%;
    padding: 0 24px 70px;
    justify-content: flex-end;
  }
  .hero-eyebrow { font-size: 10px; margin-bottom: 12px; }
  .hero-headline { font-size: clamp(36px, 11vw, 60px) !important; }
  .hero-sub {
    font-size: 16px; max-width: none; width: auto !important;
    margin: 14px 0 20px;
    line-height: 1.5;
  }
  .scroll-cue { left: 24px; bottom: 24px; }

  /* Nav rules now live in nav.css so they apply to every page. */

  /* Section padding */
  section { padding: 60px 20px; }
  .section-header { margin-bottom: 28px; padding-bottom: 14px; flex-direction: column; gap: 12px; align-items: flex-start; }
  .section-title { font-size: clamp(26px, 7vw, 38px); }

  /* Work, process, skills: stack */
  .work-grid,
  .process-grid,
  .skills-grid,
  .about-grid { grid-template-columns: 1fr; }
  .work-card-body { padding: 24px; }
  .work-card-name { font-size: 18px; }
  .work-card.featured .work-card-name { font-size: 22px; }
  .work-card.featured .work-card-body { padding: 24px; }
  .work-card-thumb-inner { height: 180px; }
  .work-card.featured .work-card-thumb-inner { min-height: 180px; height: 180px; }

  /* Skills, process tighter */
  .skill-card { padding: 28px 24px; }
  .process-step { padding: 28px 0; }

  /* About stat label/value spacing */
  .about-stat { padding: 14px 0; }
  .about-headline { font-size: clamp(28px, 8vw, 38px); }

  /* Contact band + footer rules now live in footer.css so they apply everywhere. */

  /* Hide tweaks panel on mobile */
  #tweaks-panel { display: none !important; }
}

/* Cursor hide on touch devices is handled in base.css */
