/* GRNCH: near-black, one accent, a live Julia set. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/Archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0b0b0c;
  --bg-2: #111113;
  --bg-3: #18181b;
  --line: #26262b;
  --line-2: #3a3a41;

  --ink: #edebe6;
  --ink-2: #a9a7a1;
  --ink-3: #8a8883;

  /* accent: GRNCH's incumbent red (#BD5248), hue adjustable from the home controls */
  --accent-h: 5;
  --accent: hsl(var(--accent-h) 62% 56%);
  --accent-ink: hsl(var(--accent-h) 78% 74%);
  --accent-dim: hsl(var(--accent-h) 45% 32%);
  --accent-wash: hsl(var(--accent-h) 62% 56% / 0.12);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1rem, 3.2vw, 2.75rem);
  --bar-h: 4rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { background: var(--bg); scrollbar-color: var(--line-2) var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 2px solid var(--bg); border-radius: 6px; }

img, video, iframe { max-width: 100%; }
img { height: auto; }

a { color: var(--accent-ink); text-decoration-color: hsl(var(--accent-h) 78% 74% / 0.4); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 50; padding: 0.6rem 1rem; background: var(--accent); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: 1rem; }

/* ---------- top bar ---------- */

.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.75rem);
  min-height: var(--bar-h);
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  color: var(--ink); text-decoration: none;
  font-weight: 800; font-stretch: 125%; font-size: 1.05rem; letter-spacing: 0.1em;
}
.wordmark:hover { color: var(--accent-ink); }

.bar-rule { flex: 1; }

.nav { display: flex; align-items: center; gap: clamp(0.9rem, 1.8vw, 1.6rem); }
.nav > a, .works > summary {
  color: var(--ink-2); text-decoration: none; cursor: pointer;
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.5rem 0; white-space: nowrap;
  transition: color 0.2s;
}
.nav > a:hover, .works > summary:hover { color: var(--ink); }
.nav > a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.ext { width: 0.55rem; height: 0.55rem; margin-left: 0.3rem; fill: none; stroke: currentColor; stroke-width: 1.3; vertical-align: 0.05em; }

.works { position: relative; }
.works > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.45rem; }
.works > summary::-webkit-details-marker { display: none; }
.works > summary::after {
  content: ""; width: 0.36rem; height: 0.36rem; margin-top: -0.2rem;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg);
  transition: transform 0.3s var(--ease-out);
}
.works[open] > summary { color: var(--ink); }
.works[open] > summary::after { transform: rotate(225deg); margin-top: 0.2rem; }
.works-list {
  position: absolute; top: calc(100% + 0.8rem); left: -0.9rem;
  margin: 0; padding: 0.4rem; list-style: none; width: 15rem;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8);
}
.works-list a { display: block; padding: 0.5rem 0.7rem; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.works-list a:hover { background: var(--bg-3); color: var(--accent-ink); }

.readouts { display: flex; align-items: center; gap: 1.1rem; }

.sound {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.8rem; border-radius: 999px;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line-2);
  font: 500 0.75rem/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.sound b { font-weight: 700; color: var(--ink); }
.sound:hover { border-color: var(--ink-3); color: var(--ink); }
.sound[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }
.sound[aria-pressed="true"] b { color: var(--accent-ink); }
.sound-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.8rem; }
.sound-meter i { width: 2px; height: 100%; background: currentColor; border-radius: 1px; transform: scaleY(0.3); transform-origin: bottom; transition: transform 0.2s; }
.sound[aria-pressed="true"] .sound-meter i { background: var(--accent); animation: meter 1.1s var(--ease-out) infinite alternate; }
.sound[aria-pressed="true"] .sound-meter i:nth-child(2) { animation-delay: -0.3s; }
.sound[aria-pressed="true"] .sound-meter i:nth-child(3) { animation-delay: -0.6s; }
.sound[aria-pressed="true"] .sound-meter i:nth-child(4) { animation-delay: -0.9s; }
@keyframes meter { from { transform: scaleY(0.25); } to { transform: scaleY(1); } }

.clock { color: var(--ink-3); font-size: 0.75rem; letter-spacing: 0.08em; white-space: nowrap; }
.clock time { color: var(--ink-2); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: calc(100svh - var(--bar-h));
  display: flex; align-items: center;
  padding: clamp(2rem, 6vh, 4rem) var(--gutter);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.julia { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--bg); }
.no-webgl .julia { background: radial-gradient(60% 70% at 70% 50%, var(--accent-wash), transparent 70%), var(--bg); }

.hero-copy { position: relative; z-index: 1; max-width: 34rem; }
.wordmark-xl {
  margin: 0 0 1.3rem;
  font-weight: 800; font-stretch: 125%;
  font-size: clamp(3.4rem, 9vw, 6rem); line-height: 0.92; letter-spacing: 0.01em;
  color: var(--ink);
}
.lede { margin: 0 0 2rem; max-width: 32ch; color: var(--ink); font-size: clamp(1.1rem, 1.4vw, 1.3rem); line-height: 1.5; }
.hero-note { margin: 2.4rem 0 0; max-width: 36ch; color: var(--ink-3); font-size: 0.85rem; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }

.act {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.9rem; padding: 0 1.2rem;
  border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--ink); text-decoration: none; background: rgba(11, 11, 12, 0.5);
  font: 600 0.85rem/1 var(--font); letter-spacing: 0.04em;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.3s var(--ease-out);
}
.act:hover { border-color: var(--ink-3); background: var(--bg-3); }
.act-primary { background: var(--accent); border-color: var(--accent); color: #120807; }
.act-primary:hover { background: hsl(var(--accent-h) 62% 62%); border-color: hsl(var(--accent-h) 62% 62%); transform: translateY(-1px); }
.act-quiet { border-color: transparent; background: none; padding: 0 0.4rem; color: var(--ink-2); }
.act-quiet:hover { background: none; border-color: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* control panel */

.panel {
  position: absolute; z-index: 2;
  right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: 17.5rem;
  background: rgba(14, 14, 16, 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}
.panel-tab {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 0.75rem 0.95rem; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--ink-2); cursor: pointer;
  font: 600 0.75rem/1 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
}
.panel-tab::after { content: ""; width: 0.36rem; height: 0.36rem; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(225deg); transition: transform 0.3s var(--ease-out); }
.panel.is-closed .panel-tab { border-bottom-color: transparent; }
.panel.is-closed .panel-tab::after { transform: rotate(45deg); }
.panel-tab:hover { color: var(--ink); }
.panel-body { padding: 0.85rem 0.95rem 1rem; display: grid; gap: 0.55rem; }
.panel.is-closed .panel-body { display: none; }

.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.35rem; }
.presets button {
  height: 2.1rem; border: 1px solid var(--line-2); border-radius: 4px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  font: 600 0.85rem/1 var(--font);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.presets button:hover { color: var(--ink); border-color: var(--ink-3); }
.presets button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }

.ctl { display: grid; grid-template-columns: 3.6rem 1fr 3.6rem; align-items: center; gap: 0.6rem; font-size: 0.78rem; color: var(--ink-2); }
.ctl output { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.4rem; background: transparent; margin: 0; cursor: pointer; }
.ctl input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); border-radius: 1px; }
.ctl input[type="range"]::-moz-range-track { height: 2px; background: var(--line-2); border-radius: 1px; }
.ctl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.ctl input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.ctl input[type="range"]:focus-visible { outline-offset: 0; }

/* ---------- work ---------- */

.work, .listen { padding: clamp(4rem, 10vh, 6.5rem) var(--gutter) 0; max-width: 92rem; margin: 0 auto; }
.section-title {
  margin: 0 0 2rem;
  font-weight: 800; font-stretch: 115%;
  font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: 0.01em;
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.section-head .section-title { margin: 0; }
.readout { color: var(--ink-3); font-size: 0.8rem; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap; }

.work-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 2.6vw, 2.5rem) clamp(1rem, 2vw, 1.75rem); }
.work-item { display: grid; gap: 0.35rem; color: var(--ink); text-decoration: none; }
.work-item img {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 2;
  border-radius: 3px; margin-bottom: 0.55rem;
  outline: 1px solid var(--line); outline-offset: -1px;
  transition: outline-color 0.2s, transform 0.4s var(--ease-out);
}
.work-line { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--line); }
.work-name { font-weight: 700; font-stretch: 110%; font-size: 1.12rem; line-height: 1.25; transition: color 0.2s; }
.work-blurb { color: var(--ink-2); font-size: 0.92rem; line-height: 1.5; max-width: 46ch; }
.work-item:hover img { outline-color: var(--accent); transform: translateY(-2px); }
.work-item:hover .work-name { color: var(--accent-ink); }
.work-item:hover .work-line { border-bottom-color: var(--accent-dim); }

.listen p { max-width: 52ch; color: var(--ink-2); margin: 0 0 1.6rem; }
.listen-body { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 2rem 3rem; align-items: start; }
.player { width: 100%; aspect-ratio: 350 / 470; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; }
.player-poster { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 0; background: var(--bg-2); color: var(--ink); cursor: pointer; text-align: left; }
.player-poster img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.player-cta { flex: 1; display: flex; align-items: center; gap: 0.75rem; padding: 0 1.1rem; font: 600 0.9rem/1 var(--font); letter-spacing: 0.03em; border-top: 1px solid var(--line); transition: color 0.2s, background 0.2s; }
.player-tri { width: 0; height: 0; border-left: 0.7rem solid var(--accent); border-top: 0.45rem solid transparent; border-bottom: 0.45rem solid transparent; }
.player-poster:hover .player-cta { color: var(--accent-ink); background: var(--bg-3); }
.listen-links { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: center; }

/* ---------- footer ---------- */

.foot {
  margin-top: clamp(5rem, 12vh, 8rem);
  padding: clamp(3rem, 7vh, 4.5rem) var(--gutter) 2rem;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  display: grid; grid-template-columns: 1fr auto; gap: 2.5rem 3rem; align-items: end;
}
.foot-title { margin: 0 0 0.8rem; font-weight: 800; font-stretch: 115%; font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.15; }
.foot-book p { margin: 0 0 1.6rem; max-width: 46ch; color: var(--ink-2); }
.foot-links { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; }
.foot-links a { color: var(--ink-2); text-decoration: none; font-size: 0.85rem; letter-spacing: 0.04em; }
.foot-links a:hover { color: var(--ink); }
.foot-small { grid-column: 1 / -1; margin: 0; color: var(--ink-3); font-size: 0.78rem; }

/* ---------- inner pages ---------- */

.sheet {
  margin: clamp(2rem, 6vh, 3.5rem) auto 0;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
main > .sheet { width: min(62rem, 100% - 2 * var(--gutter)); }
main > .sheet-wide { width: min(90rem, 100% - 2 * var(--gutter)); }

.sheet-head { padding-bottom: 1.4rem; margin-bottom: 2.2rem; border-bottom: 1px solid var(--line); }
.sheet-title { margin: 0; font-weight: 800; font-stretch: 115%; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.1; letter-spacing: 0.01em; }

.prose { color: var(--ink); }
.prose > * { max-width: 68ch; }
.prose > .photo-gallery, .prose > div, .prose > iframe, .prose > p:has(> img), .prose > p:has(> iframe) { max-width: none; }
.prose p { margin: 0 0 1.2em; }
.prose h1, .prose h2 { margin: 2.4em 0 0.7em; font-weight: 800; font-stretch: 110%; font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.2; }
.prose h3, .prose h4 { margin: 2.2em 0 0.6em; font-weight: 700; font-size: 1.2rem; line-height: 1.3; }
.prose > :first-child { margin-top: 0; }
.prose strong { font-weight: 700; }
.prose em { color: var(--ink-2); }
.prose img { display: block; border-radius: 3px; margin: 1.2rem 0; }
.prose iframe { border: 0; border-radius: 4px; background: var(--bg-3); }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li::marker { color: var(--accent); }
.prose code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; background: var(--bg-3); padding: 0.1em 0.35em; border-radius: 3px; }
.prose pre { overflow-x: auto; padding: 1rem 1.2rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose blockquote { margin: 1.5rem 0; padding-left: 1.2rem; border-left: 1px solid var(--accent); color: var(--ink-2); }

.ledger { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ledger-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: baseline; padding: 1rem 0.25rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.ledger-name { font-weight: 700; font-size: 1.1rem; }
.ledger-blurb { color: var(--ink-3); font-size: 0.88rem; }
.ledger-row:hover .ledger-name { color: var(--accent-ink); }

.photo-gallery { columns: 3 16rem; column-gap: 1rem; margin: 1.2rem 0 2.6rem; }
.gallery-sizer { display: none; }
.gallery-item { display: block; break-inside: avoid; margin-bottom: 1rem; border-radius: 3px; overflow: hidden; background: var(--bg-3); }
.gallery-item img { display: block; width: 100%; margin: 0; border-radius: 0; transition: transform 0.6s var(--ease-out); }
.gallery-item:hover img { transform: scale(1.02); }

/* lightbox: near-black ground, photos untouched */
.glightbox-container .goverlay { background: rgba(11, 11, 12, 0.97); }
.glightbox-clean .gslide-description { background: var(--bg-2); }
.glightbox-clean .gclose, .glightbox-clean .gnext, .glightbox-clean .gprev { background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 4px; }
.glightbox-clean .gclose:hover, .glightbox-clean .gnext:hover, .glightbox-clean .gprev:hover { background: var(--line-2); }
.glightbox-container .gslide-image img { filter: none; box-shadow: none; }

/* ---------- responsive ---------- */

@media (max-width: 70rem) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listen-body { grid-template-columns: minmax(0, 1fr) 18rem; }
}

@media (max-width: 52rem) {
  .bar { flex-wrap: wrap; padding-top: 0.6rem; padding-bottom: 0.4rem; row-gap: 0.2rem; }
  .bar-rule { display: none; }
  .readouts { margin-left: auto; }
  .clock { font-size: 0.7rem; }
  .readouts { gap: 0.7rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; gap: 1.2rem; padding-bottom: 0.2rem; padding-right: 2rem; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .nav > a[href$="/contact"] { order: -1; color: var(--ink); padding: 0.35rem 0.6rem; border: 1px solid var(--line-2); border-radius: 3px; }
  .works { position: static; }
  .works-list { position: fixed; left: var(--gutter); right: var(--gutter); top: 6.2rem; width: auto; max-height: 70vh; overflow-y: auto; }

  .hero { flex-direction: column; align-items: stretch; justify-content: flex-end; min-height: calc(100svh - 6rem); padding-bottom: 1rem; }
  .hero-copy { max-width: none; padding: 1.2rem; margin-top: 38svh; background: rgba(11, 11, 12, 0.62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 6px; }
  .wordmark-xl { font-size: clamp(2.6rem, 14vw, 3.6rem); margin-bottom: 0.8rem; }
  .lede { margin-bottom: 1.2rem; }
  .hero-note { margin-top: 1rem; font-size: 0.8rem; }
  .panel { position: relative; right: auto; top: auto; transform: none; width: auto; margin-top: 0.8rem; }

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

@media (max-width: 40rem) {
  .work-grid { grid-template-columns: 1fr; }
  .listen-body { grid-template-columns: 1fr; }
  main > .sheet, main > .sheet-wide { width: 100%; margin-top: 1.25rem; padding: 1.25rem var(--gutter) 0; border: 0; border-radius: 0; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
