/* tokens and base come from the website's app.css, keep them in sync */
@font-face {
  font-family: 'Josefin Sans';
  src: url('/font/josefin-sans-300.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/font/figtree-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/font/figtree-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Paper Mono';
  src: url('/font/paper-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --graphite: #656b73;
  --ash: #878c94;
  --silver: #bec3c9;
  --mist: #e6e9ed;
  --snow: #f3f5f9;
  --slate: #92a1ad;
  --frost: #9cb0ca;

  --surface: light-dark(#f3f5f9, #161a1e);
  --surface-raised: light-dark(#fff, #1f2329);
  --surface-sunken: light-dark(#e6e9ed, #0f1215);
  --line: light-dark(#bec3c9, #33373e);
  --line-strong: light-dark(#878c94, #70767e);
  --ink: light-dark(#1e2228, #e6e9ed);
  --ink-muted: light-dark(#5e646b, #a3a8af);
  --accent-ink: light-dark(#4f5c78, #9cb0ca);
  --accent: #9cb0ca;
  --button: light-dark(#7f94b0, #9cb0ca);
  --on-accent: light-dark(#1e2228, #15191d);
  --blush: light-dark(#cad1dc, #3b4250);
  --collar: light-dark(#1b1f24, #434950);
  --stud: light-dark(#bec3c9, #e6e9ed);
  --focus-ring: light-dark(#4f5c78, #9cb0ca);
  --shadow-soft: 0 2px 10px rgb(101 107 115 / 0.16);
  --scrim: light-dark(rgb(27 31 36 / 0.6), rgb(8 10 12 / 0.7));
  --warn: light-dark(#6e4d75, #d2b0da);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 48px;
  --radius-sm: 4px;
  --radius-md: 14px;
  --radius-round: 9999px;

  --font-display: 'Josefin Sans', 'Futura', system-ui, sans-serif;
  --font-sans: 'Figtree', system-ui, sans-serif;
  --font-mono: 'Paper Mono', ui-monospace, monospace;

  --text-display: 300 4.5rem/0.95 var(--font-display);
  --text-title: 300 2rem/1.25 var(--font-display);
  --text-heading: 600 1.25rem/1.4 var(--font-sans);
  --text-body: 400 1rem/1.625 var(--font-sans);
  --text-small: 400 0.8125rem/1.54 var(--font-sans);
  --text-label: 600 0.75rem/1.34 var(--font-sans);
  --text-code: 400 0.875rem/1.58 var(--font-mono);

  @media (prefers-color-scheme: dark) {
    --shadow-soft: 0 2px 12px rgb(0 0 0 / 0.5);
  }
}

html {
  scrollbar-color: var(--line-strong) var(--surface);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: var(--text-body);
  font-size-adjust: from-font;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

a {
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  &:hover {
    text-decoration: underline;
  }
}

:is(h1, h2, p, figure, pre) {
  margin: 0;
}
:is(h1, h2) {
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}

@view-transition {
  navigation: auto;
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
::view-transition-group(*) {
  animation-duration: 0.3s;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
summary {
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.skip {
  position: absolute;
  z-index: 1;
  inset: var(--space-2) auto auto var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  &:not(:focus) {
    clip-path: inset(50%);
  }
}

/* stud, since the focus ring is too dark on the collar */
:is(.collar, .strip) :focus-visible {
  outline-color: var(--stud);
}

.collar {
  --edge: max(var(--space-4), (100% - 1344px) / 2);
  box-sizing: border-box;
  min-height: 104px;
  padding: var(--space-3) var(--edge) 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  view-transition-name: collar;
  background: var(--collar) url('/motifs/spike.svg') repeat-x center bottom 8px / var(--space-4) 16px;
  & a {
    color: var(--stud);
  }
  & nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-inline-start: auto;
    @media (width < 600px) {
      margin-inline-start: calc(-1 * var(--space-3));
    }
  }
}
.mark {
  font: var(--text-title);
  letter-spacing: 0.01em;
}
.tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-md);
  font: var(--text-label);
  letter-spacing: 0.08em;
  &.tab[aria-current] {
    background: var(--accent);
    color: var(--on-accent);
  }
}

.shelf,
.wide {
  box-sizing: border-box;
  width: 100%;
  max-width: 1392px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.shelf {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-5);
  padding-block: var(--space-5);
  @media (width >= 900px) {
    grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
    padding-block: 72px;
  }
}
.about {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  & h1 {
    margin-bottom: var(--space-3);
    font: var(--text-display);
    letter-spacing: 0.02em;
    overflow-wrap: anywhere;
    @media (width >= 900px) {
      font-size: 6rem;
    }
  }
}
.facts:has(> .btn) {
  margin-top: var(--space-2);
}
/* pages without builds */
.shelf:has(+ .bare) {
  flex: none;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.lead {
  font: var(--text-heading);
  font-size: 1.625rem;
}
.heading {
  font: var(--text-heading);
}
.small {
  font: var(--text-small);
  color: var(--ink-muted);
}
.mono {
  font: var(--text-code);
}
.tap {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: var(--text-label);
  letter-spacing: 0.08em;
}

.tag {
  --h: 255;
  padding: var(--space-1) var(--space-2);
  background: light-dark(oklch(0.86 0.045 var(--h)), oklch(0.36 0.05 var(--h)));
  color: light-dark(oklch(0.34 0.06 var(--h)), oklch(0.92 0.035 var(--h)));
  border-radius: var(--radius-round);
  font: var(--text-label);
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}
/* classes, the csp has no inline styles */
.h195 { --h: 195; }
.h230 { --h: 230; }
.h255 { --h: 255; }
.h285 { --h: 285; }
.h320 { --h: 320; }
.h350 { --h: 350; }

.files {
  align-self: start;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  & li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
    padding-block: var(--space-4);
    border-top: 1px solid var(--line);
  }
  & h2 {
    overflow-wrap: anywhere;
  }
  & summary {
    width: fit-content;
    min-height: 24px;
    align-content: center;
  }
  & code {
    overflow-wrap: anywhere;
  }
}
.file {
  flex: 1 1 260px;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding-inline: var(--space-4);
  box-sizing: border-box;
  background: var(--button);
  color: var(--on-accent);
  border-radius: var(--radius-md);
  font: var(--text-label);
  letter-spacing: 0.08em;
  &:hover {
    background: var(--blush);
    color: var(--ink);
    text-decoration: none;
  }
  &.quiet {
    background: var(--blush);
    color: var(--ink);
    &:hover {
      background: var(--button);
      color: var(--on-accent);
    }
  }
  @media (width < 600px) {
    flex: 1 1 100%;
  }
  @media (prefers-reduced-motion: no-preference) {
    transition:
      background-color 0.12s ease,
      translate 0.08s ease;
    &:active {
      translate: 0 1px;
    }
  }
}

.builds {
  padding-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 var(--space-4);
}
.strip {
  --edge: max(var(--space-4), (100% - 1344px) / 2);
  list-style: none;
  margin: 0;
  padding: var(--space-3) calc(var(--edge) - var(--space-2)) var(--space-2);
  scroll-padding-inline: calc(var(--edge) - var(--space-2));
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  /* what the spikes stand on */
  background: linear-gradient(var(--graphite) 0 0) 0 72px / 100% 2px no-repeat var(--collar);
  color: var(--stud);
  scrollbar-color: var(--stud) var(--collar);
  /* the extra .4 leaves a cut-off build at the edge, so it looks scrollable */
  & li {
    flex: 0 0 calc(100% / var(--fit));
    min-width: 0;
  }
  --fit: 2.4;
  @media (width >= 600px) {
    --fit: 4.4;
  }
  @media (width >= 900px) {
    --fit: 6.4;
  }
  @media (width >= 1400px) {
    --fit: 7.4;
  }
}
.bare {
  min-height: 96px;
  & .spike {
    margin-inline-start: var(--space-2);
  }
}
.stud {
  box-sizing: border-box;
  position: relative;
  height: 100%;
  padding: 0 var(--space-3) var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  color: var(--stud);
  font: var(--text-small);
  white-space: nowrap;
  &:hover .spike {
    @media (prefers-reduced-motion: no-preference) {
      scale: 1 1.12;
    }
  }
  &[aria-current] {
    scroll-initial-target: nearest;
    & .spike {
      fill: var(--accent);
      stroke: var(--accent);
      view-transition-name: lit;
    }
    & .stud-name {
      text-decoration: underline 2px var(--accent);
    }
  }
}
.stud-gap {
  height: 56px;
  margin-bottom: var(--space-3);
}
.stud-name {
  font: var(--text-title);
  font-size: 1.625rem;
}
:is(.stud-name, .stud-ref) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.stud-meta {
  display: flex;
}
.stud-ref {
  min-width: 0;
}
/* hollow unless it's the one shown */
.spike {
  width: 24px;
  height: 24px;
  margin-block: 32px var(--space-3);
  overflow: visible;
  transform-origin: bottom;
  fill: none;
  stroke: var(--stud);
  stroke-width: 2px;
  transition: scale 0.12s ease-out;
  & path {
    vector-effect: non-scaling-stroke;
  }
  &.tall {
    height: 56px;
    margin-top: 0;
  }
}

.more {
  display: flex;
  flex-direction: column;
  & > details > :not(summary) {
    margin-block-end: var(--space-3);
  }
  & summary {
    width: fit-content;
    min-height: 44px;
    align-content: center;
    font: var(--text-label);
    letter-spacing: 0.08em;
    color: var(--accent-ink);
  }
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  & li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-3);
    min-height: 44px;
    border-top: 1px solid var(--line);
  }
  & a {
    flex: 1 1 128px;
    &[aria-current] {
      font-weight: 600;
    }
  }
}
.well {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.foot {
  margin-top: auto;
  background: var(--surface-sunken);
  & div {
    box-sizing: border-box;
    max-width: 1392px;
    margin: 0 auto;
    padding: var(--space-4);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    font: var(--text-small);
    color: var(--ink-muted);
  }
}
