/* ============================================================
   SHELL — persistent wavy nav, tab colors, reveal transition
   Tab colors live in :root below; edit them to retheme.
   ============================================================ */

:root {
  --c-home:    #5b1547;
  --c-work:    #95063e;
  --c-play:    #fe5627;
  --c-contact: #ffc300;

  --navy:  #1c1730;   /* nav, cursor trail, text on the light tabs */
  --cream: #fff7ec;   /* text on the dark tabs */
  --charcoal: #1d1f1c; /* work filter buttons and project cards */
  --card-hover-shadow: #0000cf; /* "true blue" backer that grows behind a hovered project card */

  /* Readable text color on each tab's color */
  --on-home:    var(--cream);
  --on-work:    var(--cream);
  --on-play:    var(--navy);
  --on-contact: var(--navy);

  --ink:      var(--on-home);  /* current page's text; shell.js switches it per tab */
  --nav-bg:   var(--navy);
  --nav-text: var(--cream);

  --nav-h:  76px;   /* straight part of the nav */
  --wv-w:   180px;  /* wavelength */
  --wv-h:   22px;   /* wave tile height (curve uses the middle 80%) */
  --wave-speed: 3.2s;
  /* One wavelength of a smooth wave, filled above the curve. Crest and trough
     sit 10% inside the tile so neither gets clipped flat by the tile edges. */
  --wave-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V10Q75 26 50 10T0 10Z'/%3E%3C/svg%3E");

  --ease-out:    cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .5, 1);
  --ease-reveal: cubic-bezier(.7, 0, .2, 1);

  --page-bg: var(--c-home);
}

html { background: var(--page-bg); transition: background-color .01s; }
body { background: transparent; color: var(--ink); min-height: 100vh; overflow-x: hidden; }
a:hover { text-decoration: none; }

/* ── Hover tint (behind content) ── */

.hover-tint {
  position: fixed; inset: 0; z-index: 0;
  background: var(--tint, transparent);
  opacity: 0;
  transition: opacity .45s var(--ease-out), background-color .2s;
  pointer-events: none;
}
body.is-tinting .hover-tint { opacity: .55; }

/* ── Nav ── */

/* Sized to the whole window (100vw includes the scrollbar), so the tabs stay
   put when a scrollbar appears; the strip under the scrollbar is just hidden. */
.nav-wrap {
  position: fixed; top: 0; left: 0; width: 100vw; z-index: 50;
  pointer-events: none;
}

.main-nav {
  pointer-events: auto;
  position: relative;
  display: flex; align-items: stretch;
  height: calc(var(--nav-h) + var(--wv-h));
  --nav-pad: clamp(.5rem, 3vw, 2rem);
  padding: 0;
  background: var(--nav-bg);
  filter: drop-shadow(0 6px 10px rgba(28, 23, 48, .18));

  /* Solid top + a wave along the bottom edge (1px overlap hides the seam).
     Children (the tab backers) are clipped by this too. The solid layer
     overhangs both sides so its anti-aliased edges never land on screen. */
  -webkit-mask:
    linear-gradient(#000 0 0) -8px 0 / calc(100% + 16px) calc(100% - var(--wv-h) + 1px) no-repeat,
    var(--wave-tile) 0 100% / var(--wv-w) var(--wv-h) repeat-x;
          mask:
    linear-gradient(#000 0 0) -8px 0 / calc(100% + 16px) calc(100% - var(--wv-h) + 1px) no-repeat,
    var(--wave-tile) 0 100% / var(--wv-w) var(--wv-h) repeat-x;
  animation: wave var(--wave-speed) linear infinite;
}

/* Right-to-left drift: shift the wave left by exactly one wavelength. */
@keyframes wave {
  from { -webkit-mask-position: -8px 0, 0 100%;                       mask-position: -8px 0, 0 100%; }
  to   { -webkit-mask-position: -8px 0, calc(var(--wv-w) * -1) 100%;  mask-position: -8px 0, calc(var(--wv-w) * -1) 100%; }
}

.nav-spacer { flex: 1; }

/* ── Tabs ── */

.tab {
  --tab: var(--c-home);
  --tab-ink: var(--on-home);
  position: relative;
  display: block;
  min-width: clamp(64px, 12vw, 132px);
  color: var(--nav-text);
  font-weight: 700;
  font-size: clamp(.85rem, 1.6vw, 1rem);
  letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
  transition: color .3s var(--ease-out);
}
.tab[data-tab="work"]    { --tab: var(--c-work);    --tab-ink: var(--on-work); }
.tab[data-tab="play"]    { --tab: var(--c-play);    --tab-ink: var(--on-play); }
.tab[data-tab="contact"] { --tab: var(--c-contact); --tab-ink: var(--on-contact); }
.tab-home { min-width: clamp(64px, 9vw, 96px); }

.tab-face {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  height: var(--nav-h);
  padding: 0 clamp(.6rem, 2vw, 1.4rem);
}

/* First and last tabs run to the screen edges; the slant would leave a dark corner, so overshoot. */
.tab:first-child .tab-face { padding-left: calc(clamp(.6rem, 2vw, 1.4rem) + var(--nav-pad)); }
.tab:first-child .tab-backer { left: -40px; }
.tab:last-child .tab-face { padding-right: calc(clamp(.6rem, 2vw, 1.4rem) + var(--nav-pad)); }
.tab:last-child .tab-backer { right: -40px; }

.tab-label { display: inline-block; transition: transform .45s var(--ease-spring); }

/* Square navy backdrop matching the nav, so it only shows on the colored Home
   fill. The SVG's square viewBox centres the icon with even margins. */
.tab-logo {
  display: block;
  width: clamp(56px, 7vw, 64px); height: auto; aspect-ratio: 1;
  background: var(--navy);
  border-radius: 14px;
}

/* Full-height slanted fill. It runs into the wave row, so the nav mask
   gives it the same moving wavy bottom. Invisible until hovered. */
.tab-backer {
  /* Same skew on every tab, so neighbours share an edge; -1px hides the AA seam */
  position: absolute; left: -1px; right: 0; top: 0; bottom: 0;
  background: var(--tab);
  opacity: 0;
  transform: skewX(-9deg) scaleX(.72);
  transition: opacity .35s var(--ease-out), transform .55s var(--ease-spring);
}
.tab:focus-visible .tab-backer,
.tab.is-active .tab-backer { opacity: 1; transform: skewX(-9deg) scaleX(1); }

/* .is-hover is set by shell.js for mouse/pen only, so taps on touch screens
   don't leave a backer stuck on (and hybrid devices still get hover). */
.tab.is-hover .tab-backer { opacity: 1; transform: skewX(-9deg) scaleX(1); }
.tab.is-hover { color: var(--tab-ink); }
.tab.is-hover .tab-label { transform: translateY(-2px) scale(1.06); }
.tab:focus-visible { outline: none; color: var(--tab-ink); }
.tab:focus-visible .tab-backer { box-shadow: inset 0 0 0 3px var(--nav-text); }

.tab.is-active { color: var(--tab-ink); }

/* ── Reveal layer ── */

.reveal-layer {
  position: fixed; inset: 0; z-index: 40;
  pointer-events: none;
  overflow: hidden;
}
.reveal-clip { position: absolute; inset: 0; }
.reveal-blob { position: absolute; will-change: transform; }
.reveal-shape {
  position: absolute; inset: 0;
  -webkit-mask: var(--blob-mask) center / 100% 100% no-repeat;
          mask: var(--blob-mask) center / 100% 100% no-repeat;
  animation: spin 16s linear infinite;
}

/* ── Cursor trail (canvas added by trail.js) ── */

.cursor-trail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* ── Panels ── */

main { position: relative; z-index: 1; padding-top: calc(var(--nav-h) + var(--wv-h) + clamp(1.5rem, 5vw, 3.5rem)); padding-bottom: 5rem; min-height: 100vh; }
.panel[hidden] { display: none; }

.panel.is-entering .reveal-item {
  animation: rise .8s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 80ms + 60ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to   { opacity: 1; transform: none;             filter: blur(0); }
}

.panel-title {
  font-size: clamp(2.4rem, 7vw, 4.75rem);
  font-weight: 800; letter-spacing: -.035em; line-height: 1;
}
.panel-sub { font-size: clamp(1rem, 2vw, 1.2rem); margin: .9rem 0 2.5rem; max-width: 46ch; opacity: .8; }

.pill-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .9rem 1.6rem; border-radius: var(--r-pill);
  background: var(--ink); color: var(--page-bg);
  font-weight: 700; border: 2px solid var(--ink);
  transition: transform .4s var(--ease-spring), background-color .25s, color .25s;
}
.pill-btn:hover { transform: translateY(-3px) rotate(-1.5deg); }
.pill-btn.ghost { background: transparent; color: var(--ink); }
.pill-btn.ghost:hover { background: var(--ink); color: var(--page-bg); }

/* ── Home ── */

#panel-home { position: relative; }
.home-inner { position: relative; min-height: calc(100vh - var(--nav-h) - 12rem); display: flex; flex-direction: column; justify-content: center; }
.home-kicker { font-weight: 700; font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.home-name {
  font-size: clamp(3rem, 13vw, 9.5rem); font-weight: 800;
  letter-spacing: -.05em; line-height: .92; margin: .4rem 0 1rem;
}
.home-name .ch { display: inline-block; transition: transform .5s var(--ease-spring); }
.home-name .ch:hover { transform: translateY(-.12em) rotate(-6deg); }
.home-role { font-size: clamp(1.15rem, 2.6vw, 1.6rem); font-weight: 700; }
.home-bio { font-size: clamp(1rem, 1.8vw, 1.15rem); max-width: 52ch; margin: 1rem 0 2rem; opacity: .82; }
.home-ctas { display: flex; flex-wrap: wrap; gap: .75rem; }

.home-blobs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; display: block;
  background: var(--ink); opacity: .07;
  -webkit-mask: var(--wave-blob-mask) center / contain no-repeat;
          mask: var(--wave-blob-mask) center / contain no-repeat;
  animation: spin 40s linear infinite;
}
.b1 { width: 46vmin; height: 46vmin; right: -8vmin; top: 2vmin; }
.b2 { width: 22vmin; height: 22vmin; right: 30vmin; bottom: 6vmin; animation-duration: 28s; animation-direction: reverse; opacity: .1; }
.b3 { width: 12vmin; height: 12vmin; left: 52%; top: 4vmin; animation-duration: 18s; opacity: .12; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Work (overrides for colored background) ── */

#panel-work .section-header { margin-bottom: 1.5rem; }
#panel-work .sort-label { color: var(--ink); opacity: .7; }
#panel-work .tag-pill { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
#panel-work .tag-pill:hover { border-color: #fff; color: #fff; }
#panel-work .tag-pill.active { background: #fff; border-color: #fff; color: var(--charcoal); }

/* Same lift + growing solid drop shadow as the Play cards, instead of the glow.
   Fill mode `backwards` so the entry animation stops holding `transform`
   once it ends, which would otherwise block the hover lift. */
#panel-work .project-card {
  border-radius: 22px; background: var(--charcoal);
  box-shadow: 0 2px 0 rgba(28, 23, 48, .9);
  animation-fill-mode: backwards;
  transition: transform .5s var(--ease-spring), box-shadow .3s;
}
#panel-work .project-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 10px 0 var(--card-hover-shadow); }
#panel-work .card-title,
#panel-work .card-link { color: #fff; }
#panel-work .card-description { color: rgba(255, 255, 255, .74); }
#panel-work .card-date { color: rgba(255, 255, 255, .6); }

/* ── Play ── */

.play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.play-card {
  position: relative; aspect-ratio: 1; border-radius: 26px; overflow: hidden;
  background: var(--card-bg, #fff); color: var(--navy);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 1.25rem;
  box-shadow: 0 2px 0 rgba(28,23,48,.9);
  border: 2px solid var(--navy);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .5s var(--ease-spring), box-shadow .3s;
}
.play-card:hover { transform: rotate(0) translateY(-6px) scale(1.03); box-shadow: 0 10px 0 rgba(28,23,48,.9); }
.play-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.play-card .play-meta { position: relative; background: #fff; border: 2px solid var(--navy); border-radius: 14px; padding: .55rem .8rem; }
.play-card h3 { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
.play-card p { font-size: .85rem; opacity: .75; }
.play-card .play-emoji { position: absolute; top: 1rem; left: 1.1rem; font-size: 2.6rem; line-height: 1; transition: transform .6s var(--ease-spring); }
.play-card:hover .play-emoji { transform: rotate(-15deg) scale(1.2); }

/* ── Contact ── */

.contact-inner { min-height: calc(100vh - var(--nav-h) - 12rem); display: flex; flex-direction: column; justify-content: center; }
.contact-head { font-size: clamp(2.6rem, 9vw, 7rem); font-weight: 800; letter-spacing: -.045em; line-height: .95; }
.contact-head em { font-style: italic; font-weight: 400; }
.contact-email-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin: 2rem 0 1.5rem; }
.copy-email { padding: .55rem 1.1rem; font-size: .9rem; }
.contact-email {
  font-size: clamp(1.2rem, 4vw, 2.4rem); font-weight: 700; color: var(--ink);
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 3px no-repeat;
  transition: background-size .45s var(--ease-out), color .3s, padding .45s var(--ease-out);
  word-break: break-all;
}
.contact-email:hover { background-size: 100% 100%; color: var(--page-bg); padding: 0 .3em; }
.contact-links { display: flex; flex-wrap: wrap; gap: .75rem; }
.contact-copy { margin-top: 3rem; font-size: .9rem; opacity: .6; }

/* ── Small screens ── */

@media (max-width: 640px) {
  :root { --nav-h: 60px; --wv-w: 110px; --wv-h: 15px; }
  .tab-logo { width: 48px; border-radius: 12px; }
  .home-inner, .contact-inner { min-height: auto; padding-top: 2rem; }
  .play-grid { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
  .play-card { padding: .65rem; border-radius: 18px; }
  .play-card .play-meta { padding: .4rem .55rem; border-radius: 10px; }
  .play-card .play-emoji { font-size: 1.9rem; top: .7rem; left: .8rem; }
  .play-card h3 { font-size: .85rem; }
  .play-card p { font-size: .72rem; }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .main-nav, .blob { animation: none; }
  .panel.is-entering .reveal-item { animation: fade .3s ease both; animation-delay: 0s; }
  @keyframes fade { from { opacity: 0; } }
  .tab-backer, .tab-label, .tab-logo, .play-card, .pill-btn { transition-duration: .01s; }
}

/* ── Project detail page ── */

/* Text follows --ink, so the page reads on both light and dark tab colors */
.page-project {
  --text:         var(--ink);
  --text-muted:   color-mix(in srgb, var(--ink) 76%, transparent);
  --accent:       var(--ink);
  --accent-dark:  var(--ink);
  --border:       color-mix(in srgb, var(--ink) 18%, transparent);
  --surface-2:    rgba(255, 255, 255, .08);
}
/* Hero starts partly behind the nav, so the title rises above the fold */
.page-project main { padding-top: calc(var(--nav-h) * .55); }

/* Wide screens: the title and article stay centered on the page, and the back
   button + tags hang in the margin to the left of the title. Needs room for
   the aside on both sides of the 760px column: 760 + 2 × (190 + 48) ≈ 1240. */
@media (min-width: 1240px) {
  .page-project {
    --aside-w: 190px;
    --aside-gap: 3rem;
  }
  .page-project .pd-lead-inner { position: relative; padding-top: 2.25rem; }
  .page-project .pd-aside {
    position: absolute;
    top: calc(2.25rem + .5rem);
    right: calc(100% - var(--gutter) + var(--aside-gap)); /* right edge = title's left edge − gap */
    width: var(--aside-w);
    display: flex; flex-direction: column; align-items: flex-end;
  }
  .page-project .pd-aside .pd-back { margin-top: 0; }
  .page-project .pd-aside .pd-tags { margin-top: 1rem; margin-bottom: 0; justify-content: flex-end; }
}

.page-project .pd-hero {
  width: min(calc(100% - 2 * var(--gutter)), calc(var(--max-w) - 2 * var(--gutter)));
  margin-inline: auto;
  border: 2px solid #fff;
  border-radius: clamp(18px, 3vw, 32px);
  box-shadow: 0 8px 0 rgba(28, 23, 48, .9);
}

.page-project .pd-back {
  margin-top: 2.25rem;
  padding: .45rem 1rem;
  border: 2px solid #fff; border-radius: var(--r-pill);
  color: var(--ink);
  transition: background-color .25s, color .25s, transform .4s var(--ease-spring);
}
.page-project .pd-back:hover { background: #fff; color: var(--page-bg); transform: translateX(-4px); }

.page-project .pd-title { font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -.045em; line-height: 1; }

.page-project .pd-meta-chip {
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: 14px;
  transition: transform .4s var(--ease-spring);
}
.page-project .pd-meta-label { color: rgba(28, 23, 48, .6); }
.page-project .pd-meta-value { color: var(--navy); }
/* Straight at rest; a playful tilt (alternating direction) on hover */
.page-project .pd-meta-chip:nth-child(odd):hover  { transform: rotate(-2deg) translateY(-3px); }
.page-project .pd-meta-chip:nth-child(even):hover { transform: rotate(2deg) translateY(-3px); }

.page-project .pd-section-heading { font-size: clamp(1.3rem, 2.4vw, 1.6rem); }

.page-project .pd-gallery-img { border-radius: 18px; border: 2px solid var(--ink); }

/* Inline media and lists inside sections (built by buildBlock in project.js) */
.page-project .pd-figure { margin: 1.5rem 0 1.75rem; }
.page-project .pd-figure img,
.page-project .pd-figure video,
.page-project .pd-figure iframe {
  display: block; width: 100%; height: auto;
  border: 2px solid var(--ink); border-radius: 18px;
  background: var(--navy);
}
.page-project .pd-figure iframe { background: #fff; }
.page-project .pd-figure figcaption {
  margin-top: .55rem; font-size: .875rem; line-height: 1.5;
  color: var(--text-muted);
}
.page-project .pd-figure-grid {
  display: grid; gap: 1rem; margin: 1.5rem 0 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: start;
}
.page-project .pd-figure-grid .pd-figure { margin: 0; }
.page-project .pd-list { margin: 0 0 1rem 1.25rem; color: var(--text-muted); line-height: 1.8; }
.page-project .pd-list li { padding-left: .25rem; margin-bottom: .35rem; }
.page-project .pd-list li::marker { color: var(--ink); font-weight: 800; }

.page-project .pd-outcomes-list li {
  background: var(--charcoal);
  color: #fff;
  border: 2px solid var(--charcoal);
  border-radius: 14px;
}
.page-project .pd-outcomes-list li::before { color: #fff; }

.page-project .pd-cta-btn {
  background: var(--ink); color: var(--page-bg);
  transition: transform .4s var(--ease-spring);
}
.page-project .pd-cta-btn:hover { transform: translateY(-3px) rotate(-1.5deg); }

.page-project .pd-nav-link {
  padding: 1rem 1.25rem;
  border: 2px solid var(--charcoal); border-radius: 18px;
  background: var(--charcoal);
  transition: background-color .25s, border-color .25s, transform .4s var(--ease-spring);
}
.page-project .pd-nav-link .pd-nav-title { color: #fff; }
.page-project .pd-nav-link .pd-nav-dir { color: rgba(255, 255, 255, .6); }
.page-project .pd-nav-link:hover { background: #fff; border-color: #fff; transform: translateY(-4px); }
.page-project .pd-nav-link:hover .pd-nav-title { color: var(--charcoal); }
.page-project .pd-nav-link:hover .pd-nav-dir { color: rgba(29, 31, 28, .6); }

@media (max-width: 640px) {
  .page-project .pd-project-nav-inner { flex-direction: column; gap: .75rem; }
  .page-project .pd-nav-link { max-width: none; width: 100%; }
  .page-project .pd-nav-next { align-items: flex-start; text-align: left; margin-left: 0; }
}
