
/* ── Typography ── */
h1, h2, h3, h4 { line-height: 1.1; }

h2 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  letter-spacing: -0.02em;
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

p {
  font-size: clamp(0.9375rem, 1.4vw, 1.05rem);
  line-height: 1.65;
  font-weight: 300;
}

b { font-weight: 700; }

ul { margin-bottom: 3rem; }
li { margin-top: 0.5rem; }

/* ── Video ── */
video {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ── Animations ── */
@keyframes charReveal {
  from { opacity: 0; transform: translateY(110%); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* ── Project title ──
   The glow behind it is the sitewide backdrop (js/backdrop.js), tinted by the
   two colours this page declares on <main data-g1 data-g2>. */
.project-title {
  /* Top room was sized for the old fixed top nav; the nav is a sidebar now. */
  padding: 11rem 6rem 8rem;
  border-bottom: 1px solid var(--rule);
}

.project-name-clip {
  margin-bottom: 1.25rem;
}

.project-name {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(3rem, 7vw, 7.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 400;
  margin-bottom: 0;
}

/* Where JS is available, hide the title until reveal.js has split it,
   so the plain text never flashes before the animation. reveal.js sets
   inline opacity:1 once built (and immediately for reduced-motion). */
@media (scripting: enabled) {
  .project-name { opacity: 0; }
}

/* Per-character reveal (populated by js/reveal.js) */
.project-name .word {
  display: inline-block;
  white-space: nowrap;
}

.project-name .char-mask {
  display: inline-block;
  vertical-align: bottom;
}

.project-name .char {
  display: inline-block;
  /* Pad the box over descenders/overhangs so Safari's filter clip can't
     crop them mid-animation; the negative margin cancels it out in layout. */
  padding: 0.1em 0.05em 0.3em;
  margin: -0.1em -0.05em -0.3em;
  animation: charReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.project-role {
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  animation: fadeUp 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) 0.65s both;
}

/* ── Details / Toggle ── */
.resume {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4rem 6rem 5rem;
  gap: 2rem;
  border-bottom: 1px solid var(--rule);
}

.toggle {
  display: flex;
  gap: 2rem;
  padding: 0.75rem 2rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  animation: fadeUp 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) 0.82s both;
}

.toggle button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Oxygen', sans-serif;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.2s;
}

.toggle button[aria-selected="true"] {
  color: var(--text);
}

.toggle button:hover { color: var(--text); }

/* ── Toggle panels ── */
.toggle-panels {
  position: relative;
  width: 100%;
  max-width: 700px;
  min-height: 6rem;
  overflow: hidden;
  animation: fadeUp 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) 0.96s both;
  /* Height is animated by tabs.js so switching panels of different lengths
     eases instead of snapping. */
  transition: height 0.42s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.toggle-panel {
  position: absolute;
  opacity: 0;
  transform: translateX(40px);
  pointer-events: none;
  transition:
    opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.toggle-panel.active {
  position: relative;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.toggle-panel.exit-left {
  opacity: 0;
  transform: translateX(-40px);
}

.toggle-panel p {
  line-height: 1.65;
  margin: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.toggle-panel .note {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 1.25rem;
}

.toggle-panel a {
  display: inline;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.1rem;
  transition: color 0.2s, border-color 0.2s;
}

.toggle-panel a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.toggle-panel img {
  object-fit: cover;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: block;
}

/* ── Gallery ── */
.gallery {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background-color: var(--rule);
  border-bottom: 1px solid var(--rule);
}

.gallery img,
.gallery video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--bg);
}

/* ── Next project (bookend of the header) ──
   Carries the palette of the page it leads to (data-g1/data-g2): the backdrop
   drifts towards it as this scrolls up, so the colour arrives before you do. */
.next-project {
  display: block;
  padding: 8rem 6rem;
  border-top: 1px solid var(--rule);
  color: var(--text);
}

.next-eyebrow {
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.next-name {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(3rem, 7vw, 7.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 400;
  margin: 0 0 2.5rem;
}

.next-cta {
  display: inline-block;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.2rem;
  transition: color 0.2s, border-color 0.2s;
}

.next-project:hover .next-cta {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Desktop: header + next-project bookend run the full width of the window
   under the glass sidebar (their text still starts clear of it). ── */
@media (min-width: 769px) {
  .project-title,
  .next-project {
    margin-left: calc(-1 * var(--nav-inset));
    padding-left: calc(6rem + var(--nav-inset));
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .project-title {
    /* Clears the status bar in the home-screen app (inset is 0 in Safari). */
    padding: calc(5.5rem + env(safe-area-inset-top, 0px)) 1.5rem 5rem;
  }

  .next-project {
    padding: 5rem 1.5rem;
  }

  .resume {
    padding: 2.5rem 1.5rem 3rem;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
}
