/* Stray Frequency site. All colour, space and type come from design-system/tokens.css.
   Surfaces borrow from the brand ephemera: a dusty charcoal ground, paper labels
   in light-ash with ink type, and raised charcoal tiles. */

:root {
  --radius-small: calc(var(--radius-tile) / 2);
  --ground: var(--charcoal) url("../media/brand/ground.webp") 0 0 / 840px;
  --speckle: url("../media/speckle.png") 0 0 / 96px;
  --rim: var(--ash-grey);
  /* A band of speckled texture with a clean edge: set as background on a box with a transparent border. */
  --band: var(--speckle) border-box, var(--rim) border-box;
  --paper: url("../media/scuff.png") 0 0 / 360px, var(--light-ash);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--light-ash);
  font: var(--text-body);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: var(--radius-none); }
:focus-visible { outline: 1px solid var(--light-ash); outline-offset: 3px; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }

.masthead, .hero, .graph, .footer {
  width: min(1320px, 100% - 2 * var(--space-6));
  margin-inline: auto;
}

/* Small paper tag, like a strip of label tape. */
.tag, .horizon .label, .panel__head .label {
  display: inline-block;
  background: var(--paper);
  color: var(--ink);
  padding: 3px 10px;
  border-radius: 3px;
  font-weight: 500;
}

/* Masthead */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-12);
  align-items: end;
  padding-block: var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--iron);
}
.masthead__logo img { width: 190px; height: auto; }
.masthead .tagline { color: var(--oxidized-copper); }
.masthead__intro { max-width: 60ch; margin-top: 2px; }
.masthead__nav { display: flex; gap: var(--space-2); }
.masthead__nav a { text-decoration: none; padding: 6px 14px; border: 1px solid var(--iron); border-radius: var(--radius-small); background: var(--charcoal-raised); }
.masthead__nav a:hover { border-color: var(--light-ash); }

/* Hero: an always-open paper-label card with featured work and news. */
.hero { position: relative; margin-top: var(--space-6); }
.hero__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--radius-tile);
  background: var(--ash-grey);
}
/* Speckled frame drawn over the card. */
.hero::after { content: ""; position: absolute; inset: -4px; border: 7px solid transparent; border-radius: calc(var(--radius-tile) + 4px); background: var(--band); -webkit-mask: linear-gradient(black 0 0) padding-box, linear-gradient(black 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.hero__track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  height: 430px;
}
.slide__label {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-12);
  background: var(--paper);
  color: var(--ink);
}
.slide__kicker { font-weight: 500; }
.slide__title { font: 600 56px/0.95 var(--font-display); text-transform: uppercase; text-wrap: balance; }
.slide__text { font: 400 18px/26px var(--font-body); max-width: 44ch; }
.slide__cta { text-decoration: none; background: var(--ink); color: var(--light-ash); padding: 10px 18px; border-radius: var(--radius-small); font-weight: 500; }
.slide__cta:hover { background: var(--charcoal); }
.slide__art { position: relative; overflow: hidden; background: var(--charcoal); }
.slide__art img { width: 100%; height: 100%; object-fit: cover; }
.slide__art::after { content: ""; position: absolute; inset: 0; background: url("../media/grunge.png") 0 0 / 380px; pointer-events: none; }
.hero__controls { position: absolute; right: var(--space-6); bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-4); padding: 6px 10px; background: var(--charcoal); border: 1px solid var(--iron); border-radius: var(--radius-small); }
.hero__nav { padding: 2px 6px; }
.hero__nav:hover { color: var(--oxidized-copper); }
.hero__dots { display: flex; gap: 6px; }
.hero__dots button { width: 22px; height: 8px; border-radius: 2px; background: var(--ash-grey); border: 1px solid var(--iron); }
.hero__dots button[aria-current="true"] { background: var(--light-ash); border-color: var(--light-ash); }

/* Graph */
.graph { position: relative; padding-block: var(--space-12); }
.graph__links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.graph__links path { fill: none; stroke: var(--iron); stroke-width: 1.25; stroke-linecap: round; opacity: 0.6; transition: opacity 0.25s, stroke 0.25s, stroke-width 0.25s; }
.graph__links path[data-kind="collaborator"] { stroke-dasharray: 2 6; }
.graph__links path[data-kind="lineage"] { opacity: 0.95; stroke-width: 1.75; }
.graph.is-focused .graph__links path { opacity: 0.14; }
.graph.is-focused .graph__links path.is-on { opacity: 1; stroke: var(--light-ash); stroke-width: 2; }

.tier { position: relative; z-index: 1; }
.tier__nodes {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  column-gap: 0;
  row-gap: var(--space-12);
}

.horizon { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-4); }
.horizon:not(.horizon--lower) { margin-top: var(--space-12); }
.horizon--lower { margin-bottom: var(--space-12); }
.horizon__rule { flex: 1; height: 2px; background: var(--iron); }
/* Closed: the two labels sit either side of one line. */
.graph:not(.is-open) .horizon--lower .horizon__rule { visibility: hidden; }
.graph:not(.is-open) .horizon--lower { margin-top: var(--space-2); }

/* Nodes: raised rounded tiles with a speckled border. They drift, and can be dragged to a new place. */
.node {
  grid-column: var(--c) / span 2;
  grid-row: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding-inline: 6px;
  text-align: center;
  text-decoration: none;
  will-change: transform;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.25s;
}
.node.is-dragging { cursor: grabbing; z-index: 3; }
/* A lifted node: the hold has armed and the node follows the finger. */
.node.is-dragging .node__disc { scale: 1.12; --rim: var(--light-ash); }
.node.is-held .node__disc { scale: 0.96; transition: scale 0.3s ease-out; }
.node__disc {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-tile);
  background: linear-gradient(var(--charcoal-raised) 0 0) padding-box, var(--band);
  border: 7px solid transparent;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: scale 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.node__disc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.7) contrast(1.08); transition: filter 0.3s; pointer-events: none; }
.node__disc img.is-contain { object-fit: contain; padding: 7px; }
.node__disc.is-light { background: linear-gradient(var(--light-ash) 0 0) padding-box, var(--band); }
.node__disc--blank { font: var(--text-headline); text-transform: uppercase; color: var(--iron); }

/* Companies are paper labels with ink type. */
.node__disc--badge { width: 148px; aspect-ratio: 3 / 2; color: var(--ink); background: url("../media/scuff.png") 0 0 / 360px padding-box, linear-gradient(var(--light-ash) 0 0) padding-box, var(--band); }
.node__disc--badge::after { content: ""; position: absolute; inset: 5px; border: 1px solid var(--ink); border-radius: var(--radius-small); opacity: 0.45; pointer-events: none; }
.node__disc .node__logo { width: 100%; height: 100%; object-fit: contain; padding: 10px; filter: none; }
.node__disc--badge:has(.node__logo) { width: 196px; aspect-ratio: 5 / 2; }
.node__disc--badge:has(.node__logo)::after { display: none; }
.node__badge { padding: 14px; font: 600 16px/17px var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; }

.node__text { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 6px; background: var(--charcoal); border-radius: var(--radius-small); }
.node__title { font: var(--text-label); text-transform: uppercase; letter-spacing: 0.06em; line-height: 17px; }
.node__meta { font: var(--text-caption); color: var(--iron); line-height: 15px; }

.node:hover .node__disc, .node:focus-visible .node__disc { --rim: var(--light-ash); scale: 1.08; }
.node:hover .node__disc img, .node.is-selected .node__disc img, .node.is-on .node__disc img { filter: none; }
.node.is-selected .node__disc { --rim: var(--light-ash); outline: 2px solid var(--light-ash); outline-offset: 5px; scale: 1.08; }
.node:focus-visible { outline: none; }

.node--company { grid-column: var(--c) / span 4; align-self: center; }

.graph.is-focused .node:not(.is-on) { opacity: 0.3; }

/* Panel: opens in the gap between the tiers. */
.panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.6s cubic-bezier(0.3, 1.2, 0.4, 1);
  background: var(--ground);
}
.panel[hidden] { display: none; }
.graph.is-open .panel { grid-template-rows: 1fr; }
.panel__inner { overflow: hidden; min-height: 0; outline: none; }
.panel__body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-12);
  padding-block: var(--space-12);
  animation: panel-in 0.5s ease both;
}
@keyframes panel-in { from { opacity: 0; translate: 0 12px; } }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--iron); margin-bottom: var(--space-6); }
.panel__close { font: var(--text-label); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 14px; border: 1px solid var(--iron); border-radius: var(--radius-small); background: var(--charcoal-raised); }
.panel__close:hover { border-color: var(--light-ash); }
.panel__text > * + * { margin-top: var(--space-6); }
.panel__text .headline { font: 600 48px/0.98 var(--font-display); text-wrap: balance; }
.panel__lead { font: 400 20px/28px var(--font-body); max-width: 46ch; }
.panel__copy p { max-width: 60ch; }
.panel__copy p + p { margin-top: var(--space-4); }
.panel h3.label { color: var(--light-ash); padding-bottom: var(--space-2); border-bottom: 1px solid var(--ash-grey); margin-bottom: var(--space-4); }

.facts { display: grid; grid-template-columns: 9.5em 1fr; gap: var(--space-2) var(--space-4); padding: var(--space-4); background: var(--charcoal-raised); border-radius: var(--radius-small); }
.facts dt { font: var(--text-label); text-transform: uppercase; letter-spacing: 0.08em; color: var(--iron); }
.list li { padding-block: 6px; border-bottom: 1px solid var(--ash-grey); max-width: 60ch; }
.list li:last-child { border-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.stats div { background: var(--paper); color: var(--ink); padding: var(--space-4); border-radius: var(--radius-small); }
.stats b { display: block; font: var(--text-headline); text-transform: uppercase; }
.stats span { font: var(--text-caption); }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { font: var(--text-label); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 14px; border: 1px solid var(--iron); border-radius: var(--radius-small); background: var(--charcoal-raised); text-decoration: none; }
.chip:hover { border-color: var(--light-ash); }
.chip--plain { border-color: var(--ash-grey); cursor: default; }

/* Gallery */
/* The frame takes each image's own shape. Very tall images stop at a height limit and sit between dark bars. */
.gallery__main { position: relative; box-sizing: content-box; width: calc(100% - 14px); aspect-ratio: 16 / 9; max-height: min(720px, 80vh); background: linear-gradient(var(--charcoal) 0 0) padding-box, var(--band); border: 7px solid transparent; border-radius: var(--radius-tile); display: grid; place-items: center; overflow: hidden; }
.gallery__main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gallery__main.is-light { background: linear-gradient(var(--light-ash) 0 0) padding-box, var(--band); }
.gallery__tag { position: absolute; left: 12px; bottom: 12px; font: var(--text-label); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; background: var(--paper); color: var(--ink); padding: 4px 12px; border-radius: 3px; }
.gallery__caption { margin-top: var(--space-2); color: var(--iron); min-height: 18px; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--space-2); margin-top: var(--space-4); }
.gallery__thumbs button { aspect-ratio: 1; border: 2px solid var(--ash-grey); border-radius: var(--radius-small); background: var(--charcoal-raised); overflow: hidden; transition: scale 0.3s cubic-bezier(0.3, 1.6, 0.5, 1), border-color 0.2s; }
.gallery__thumbs button:hover { scale: 1.1; border-color: var(--iron); }
.gallery__thumbs button.is-light { background: var(--light-ash); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs button[aria-current="true"] { border-color: var(--light-ash); }
.gallery__note { margin-top: var(--space-4); color: var(--iron); }

/* About */
.about__photo { width: 220px; height: 220px; object-fit: cover; object-position: 50% 42%; border: 7px solid transparent; border-radius: var(--radius-tile); background: var(--band); }
.about__groups > * + * { margin-top: var(--space-12); }

/* Footer */
.footer { display: flex; align-items: center; gap: var(--space-6); padding-block: var(--space-6) var(--space-12); border-top: 1px solid var(--iron); }
.footer__badge { width: 120px; height: 120px; border-radius: var(--radius-round); }
.footer .caption { color: var(--iron); margin-left: auto; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 10; background: var(--ground); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-4); padding: var(--space-12) var(--space-6) var(--space-6); }
.lightbox[hidden] { display: none; }
.lightbox figure { display: grid; justify-items: center; gap: var(--space-2); min-width: 0; }
.lightbox img { max-height: calc(100vh - 140px); max-width: 100%; object-fit: contain; border-radius: var(--radius-small); }
.lightbox figcaption { color: var(--iron); }
.lightbox__close { position: absolute; top: var(--space-4); right: var(--space-6); }
.lightbox button { padding: 6px 14px; border: 1px solid var(--iron); border-radius: var(--radius-small); background: var(--charcoal-raised); }
.lightbox button:hover { border-color: var(--light-ash); }

/* Narrow: clusters stack, three tiles a row. */
@media (max-width: 860px) {
  .masthead { grid-template-columns: 1fr; gap: var(--space-4); align-items: start; }
  .masthead__logo img { width: 170px; }
  .slide { grid-template-columns: 1fr; grid-template-rows: 180px 1fr; height: 580px; }
  .slide__art { order: -1; }
  .slide__label { padding: var(--space-6) var(--space-6) calc(var(--space-12) + 12px); gap: var(--space-2); justify-content: flex-start; }
  .slide__title { font-size: 36px; }
  .slide__text { font: var(--text-body); }
  .hero__controls { right: var(--space-4); bottom: var(--space-4); }
  .tier__nodes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--space-2); }
  .node { grid-column: auto; grid-row: auto; padding-inline: 4px; }
  .node.is-cluster-start { grid-column-start: 1; }
  .node--company { grid-column: 1 / -1; justify-self: start; margin-top: var(--space-4); }
  .node__disc--badge { width: 132px; }
  .panel__body { grid-template-columns: 1fr; gap: var(--space-6); padding-block: var(--space-6); }
  .panel__media { order: -1; }
  .panel__text .headline { font-size: 36px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: var(--space-2); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer { flex-wrap: wrap; }
  .footer .caption { margin-left: 0; }
  .lightbox { grid-template-columns: 1fr 1fr; padding-inline: var(--space-4); }
  .lightbox figure { grid-column: 1 / -1; grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .panel, .node, .node__disc, .graph__links path { transition: none; }
  .panel__body { animation: none; }
}

/* Reset for nodes the viewer has moved. */
.graph__reset { position: absolute; top: var(--space-4); right: 0; z-index: 2; padding: 6px 14px; border: 1px solid var(--iron); border-radius: var(--radius-small); background: var(--charcoal-raised); }
.graph__reset:hover { border-color: var(--light-ash); }
.graph__reset[hidden] { display: none; }
.node { cursor: grab; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.node img { -webkit-touch-callout: none; }

/* Video: a poster with a play tag until pressed, then the YouTube player. */
.video { margin-bottom: var(--space-6); }
.video__frame { position: relative; aspect-ratio: 16 / 9; border: 7px solid transparent; border-radius: var(--radius-tile); background: linear-gradient(var(--charcoal) 0 0) padding-box, var(--band); overflow: hidden; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__play { position: absolute; inset: 0; width: 100%; height: 100%; display: grid; place-items: center; }
.video__play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; transition: opacity 0.25s; }
.video__play:hover img { opacity: 0.8; }
.video__play .tag { position: relative; font: 600 20px/24px var(--font-display); letter-spacing: 0.08em; padding: 10px 22px; border-radius: var(--radius-small); }
.video__picks { margin-top: var(--space-4); }
.video__picks .chip[aria-current="true"] { border-color: var(--light-ash); }
.video__caption { margin-top: var(--space-2); color: var(--iron); }
