/* Karatage Christmas 2026 — warm evening room, not candy-cane Christmas.
   Base is deep spruce; light comes from filament gold and postbox red. */

:root {
  --spruce:   #0B1F17;
  --pine:     #122C21;
  --pine-lit: #17392b;
  --cream:    #F5EBD8;
  --cream-dim: #c9c0b1;
  --gold:     #E0A94E;
  --red:      #C8352B;
  --frost:    #A8CBD8;

  --accent: var(--gold);
  --accent-ink: #0B1F17;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 5rem);

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Each concept lights the room a different colour. */
[data-theme="future"]   { --accent: #E8A33D; --wash: #1a1a1c; }
[data-theme="space"]    { --accent: #E8C15C; --wash: #101c31; }
[data-theme="machines"] { --accent: #E4574C; --wash: #241417; }
[data-theme="nuclear"]  { --accent: #4FB3A5; --wash: #10241f; }
[data-theme="badideas"] { --accent: #D8B03F; --wash: #12231a; }
/* The three that went too far get louder, colder accents. */
[data-theme="tree"]       { --accent: #7FD48A; --wash: #0c1d13; }
[data-theme="northpole"]  { --accent: #FF8A3D; --wash: #211610; }
[data-theme="simulation"] { --accent: #4DD9E6; --wash: #14122b; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--spruce);
  color: var(--cream);
  font-family: var(--body);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

::selection { background: var(--gold); color: var(--spruce); }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--gold); color: var(--spruce);
  padding: 0.75rem 1.25rem; font-weight: 600;
}
.skip:focus { left: 0; }

#snow {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 600ms ease;
}
#snow.on { opacity: 1; }

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

.hero {
  position: relative;
  min-height: min(88vh, 780px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid rgba(224, 169, 78, 0.22);
}

.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* the generated banner is warm already; steady it and darken for type */
  filter: saturate(1.08) contrast(1.04) brightness(1.06);
}

.hero::after {
  content: '';
  position: absolute; inset: 0;
  /* Shade only where the type sits: a soft wedge bottom-left, a light
     bottom fade to seat the rail. The centre of the photo stays untouched. */
  background:
    radial-gradient(75% 85% at 12% 88%, rgba(8,22,16,0.92) 0%, rgba(8,22,16,0.6) 42%, rgba(8,22,16,0) 78%),
    linear-gradient(to top, rgba(8,22,16,0.72) 0%, rgba(8,22,16,0.12) 32%, rgba(8,22,16,0) 60%);
}

.hero-inner {
  position: relative; z-index: 2;
  padding: var(--gutter);
  padding-bottom: clamp(2.5rem, 6vw, 5rem);
  max-width: 46rem;
}

.hero-eyebrow {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 1.1rem;
}

.hero h1 {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 70, 'WONK' 1, 'opsz' 120;
  font-weight: 800;
  font-size: clamp(3rem, 11vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(11,31,23,0.6);
  margin-bottom: 1.4rem;
}

.hero-lede {
  max-width: 40ch;
  color: #ece2d2;
  font-size: clamp(1.02rem, 1vw + 0.85rem, 1.2rem);
  line-height: 1.6;
}

/* ------------------------------------------------------------- patch rail */

.rail {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 31, 23, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(224, 169, 78, 0.2);
}

.rail {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem var(--gutter);
}

.rail ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: clamp(0.15rem, 1vw, 0.75rem);
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.rail ul::-webkit-scrollbar { display: none; }

.rail a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--cream-dim);
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 180ms ease, background 180ms ease;
}
.rail a img {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: none;
}
.rail a:hover { color: var(--cream); background: rgba(245,235,216,0.07); }
.rail a.active { color: var(--gold); background: rgba(224,169,78,0.12); }

/* Only the concept you are reading names itself. Eight labels at once do not
   fit any screen, and eight patches are recognisable on their own. */
.rail a span { display: none; }
.rail a.active span { display: inline; }

@media (max-width: 520px) {
  .rail a.active span { display: none; }
}

/* ---------------------------------------------------------------- concept */

.concept {
  padding: clamp(3.5rem, 9vw, 7.5rem) var(--gutter);
  border-bottom: 1px solid rgba(245, 235, 216, 0.08);
  background:
    radial-gradient(90% 55% at 82% 0%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 70%),
    linear-gradient(to bottom, var(--wash) 0%, var(--spruce) 60%);
}

.concept-head {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.patch {
  width: clamp(86px, 13vw, 148px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  flex: none;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45));
}

.concept-head > div { min-width: 0; }

.concept h2 {
  overflow-wrap: break-word;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 60, 'WONK' 1, 'opsz' 90;
  font-weight: 800;
  font-size: clamp(1.9rem, 5.5vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--cream);
  text-wrap: balance;
}

.tagline {
  margin-top: 0.6rem;
  color: var(--accent);
  font-size: clamp(0.98rem, 1.6vw, 1.2rem);
  font-style: italic;
}

.concept-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1.75rem, 4vw, 4rem);
  align-items: start;
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
@media (max-width: 860px) {
  .concept-body { grid-template-columns: 1fr; }
}

.prose p {
  max-width: var(--measure);
  color: #e6dccb;
}
.prose p + p { margin-top: 1rem; }
.prose em { color: var(--cream); font-style: italic; }

.details {
  list-style: none;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding-left: clamp(1rem, 2vw, 1.5rem);
  display: grid;
  gap: 1.1rem;
}
.details li {
  font-size: 0.98rem;
  color: #ded4c3;
  line-height: 1.55;
}
.details span {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.15rem;
}
.details em { color: var(--cream); }

/* On a phone the patch sits above the heading so the title gets full width. */
@media (max-width: 620px) {
  .concept-head { flex-direction: column; align-items: flex-start; gap: 0.85rem; }
  .patch { width: 78px; }
}

/* ------------------------------------------------------------------ shots */

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
@media (max-width: 700px) { .shots { grid-template-columns: 1fr; } }

.shots figure { margin: 0; }

.shot {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(245,235,216,0.12);
  border-radius: 3px;
  background: var(--pine);
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color 200ms ease;
}
.shot:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.shots figcaption {
  margin-top: 0.7rem;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 55, 'WONK' 1, 'opsz' 40;
  font-weight: 600;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.25;
  color: var(--cream);
  text-wrap: balance;
}

/* ------------------------------------------------------------------- reel */

.reel-row {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.25rem);
  align-items: center;
  margin-bottom: 0;
}

.reel {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: #000;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.reel-video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #000;
}

.reel-note { min-width: 0; }

.reel-title {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 55, 'WONK' 1, 'opsz' 50;
  font-weight: 600;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  line-height: 1.2;
  color: var(--cream);
  margin-bottom: 0.5rem;
  text-wrap: balance;
}

.reel-sub {
  font-size: 0.95rem;
  color: var(--cream-dim);
  max-width: 46ch;
  line-height: 1.55;
  margin-bottom: 1.35rem;
}

@media (max-width: 760px) {
  .reel-row {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .reel { width: min(100%, 300px); }
  .reel-sub { max-width: 42ch; margin-inline: auto; }
  .reel-note .tracks { justify-content: center; }
}

/* ----------------------------------------------------------------- tracks */

.tracks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.tracks-label {
  font-size: 0.85rem;
  color: var(--cream-dim);
  margin-right: 0.3rem;
}

.track {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--cream);
  background: color-mix(in srgb, var(--accent) 10%, var(--pine));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}
.track:hover { background: color-mix(in srgb, var(--accent) 22%, var(--pine)); }

@media (max-width: 700px) {
  .tracks { gap: 0.5rem; }
  .track { padding: 0.6rem 1rem 0.6rem 0.7rem; font-size: 0.95rem; }
  .tracks-label { width: 100%; margin-bottom: 0.1rem; }
}

.tglyph {
  width: 1.35rem; height: 1.35rem;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
}
.tglyph::after {
  content: '';
  position: absolute;
  top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-left: 7px solid var(--accent-ink);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}
.track.playing .tglyph::after {
  border: 0;
  width: 8px; height: 8px;
  background: var(--accent-ink);
  left: 50%;
}
.track.playing { background: color-mix(in srgb, var(--accent) 26%, var(--pine)); }

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

footer {
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) clamp(6rem, 10vw, 7rem);
  max-width: 60rem;
}

.foot-lead {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 60, 'WONK' 1;
  font-weight: 700;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  line-height: 1.15;
  color: var(--cream);
  max-width: 30ch;
  margin-bottom: 1.5rem;
}

.foot-note {
  font-size: 0.9rem;
  color: var(--cream-dim);
  max-width: 58ch;
  line-height: 1.6;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  color: var(--frost);
}

/* --------------------------------------------------------------- controls */

.controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
}

.ctl {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--cream-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.ctl:hover { color: var(--cream); background: rgba(245,235,216,0.07); }
.ctl[aria-pressed="true"] {
  color: var(--cream);
  border-color: rgba(224,169,78,0.35);
  background: rgba(224,169,78,0.1);
}

.ctl-glyph {
  width: 1.5rem; height: 1.5rem;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(245,235,216,0.1);
  color: var(--cream-dim);
  font-size: 0.85rem;
  transition: background 160ms ease, color 160ms ease;
}
.ctl[aria-pressed="true"] .ctl-glyph { background: var(--gold); color: var(--spruce); }

.ctl-state {
  font-size: 0.76rem;
  color: var(--cream-dim);
}
.ctl[aria-pressed="true"] .ctl-state { color: var(--gold); }

.now {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  padding-left: 0.35rem;
  border-left: 1px solid rgba(245,235,216,0.14);
  max-width: 15rem;
}
.now[hidden] { display: none; }   /* the attribute must beat the flex above */

.now-text { min-width: 0; padding: 0 0.2rem; }
.now-title, .now-sub { display: block; }
.now-title {
  font-size: 0.8rem;
  color: var(--cream);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-sub {
  font-size: 0.7rem;
  color: var(--cream-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.skipbtn {
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--cream-dim);
  background: transparent;
  border: 0;
  border-radius: 6px;
  width: 1.6rem; height: 1.6rem;
  cursor: pointer;
  flex: none;
  transition: color 160ms ease, background 160ms ease;
}
.skipbtn:hover { color: var(--gold); background: rgba(245,235,216,0.08); }

/* Below the desktop breakpoint the rail keeps patches and controls only. */
@media (max-width: 1180px) {
  .now { max-width: 9rem; }
  .now-sub { display: none; }
}
@media (max-width: 980px) {
  .ctl-label, .ctl-state { display: none; }
  .ctl { padding: 0.3rem; }
  /* Keep the skip buttons on phones — flicking between tracks is the point.
     Only the track title is dropped, since there is no room for it. */
  .now-text { display: none; }
  .now { max-width: none; padding-left: 0.2rem; }
  .skipbtn { width: 2.75rem; height: 2.75rem; font-size: 1.4rem; }  /* 44px touch target */
  .now[hidden] { display: none; }
}

/* Eight patches need to fit a phone; shrink them and let the row scroll. */
@media (max-width: 760px) {
  .rail { gap: 0.4rem; padding-inline: clamp(0.6rem, 3vw, 1.25rem); }
  .rail a { padding: 0.3rem 0.2rem; }
  .rail a img { width: 33px; height: 33px; }
}

/* -------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed; inset: 0;
  z-index: 80;
  background: rgba(6, 16, 12, 0.96);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: clamp(1rem, 4vw, 3rem);
}
.lightbox[hidden] { display: none; }

.lightbox figure { margin: 0; min-width: 0; }
.lightbox img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 3px;
}
.lightbox figcaption {
  margin-top: 0.9rem;
  text-align: center;
  color: var(--cream-dim);
  font-size: 0.92rem;
}

.lb-close {
  position: absolute;
  top: clamp(0.5rem, 2vw, 1.5rem);
  right: clamp(0.5rem, 2vw, 1.5rem);
  font: inherit; font-size: 1.9rem; line-height: 1;
  width: 2.6rem; height: 2.6rem;
  color: var(--cream); background: transparent;
  border: 0; border-radius: 50%;
  cursor: pointer;
}
.lb-close:hover { background: rgba(245,235,216,0.12); }

.lb-nav {
  font: inherit; font-size: 2.2rem; line-height: 1;
  width: 2.8rem; height: 4rem;
  color: var(--cream); background: rgba(245,235,216,0.07);
  border: 0; border-radius: 6px;
  cursor: pointer;
  flex: none;
}
.lb-nav:hover { background: rgba(245,235,216,0.16); }

@media (max-width: 620px) {
  .lightbox { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; }
  .lb-nav { height: 2.8rem; width: 100%; }
  .lightbox figure { grid-row: 1; grid-column: 1 / -1; }
  .lb-prev { grid-row: 2; grid-column: 1; }
  .lb-next { grid-row: 2; grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35rem 1rem;
}
.lightbox figcaption a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(224, 169, 78, 0.4);
  font-size: 0.85rem;
}
.lightbox figcaption a:hover { border-bottom-color: var(--gold); }
