/* project harmonique
   Palette: iTerm2 "Laser" (mbadolato/iTerm2-Color-Schemes).
   Type: Source Code Pro, subset to ASCII, Latin-1 and Latin Extended-A (session
   titles and guest names arrive from the feed, so the page's own text is not
   the whole charset) plus the few symbols the page draws. Rebuilt from Adobe's
   SourceCodeVF-Upright.ttf with:
     pyftsubset SourceCodeVF-Upright.ttf --layout-features='' --flavor=woff2 \
       --unicodes="U+0020-007E,U+00A0-017F,U+2013-2014,U+2018-201D,U+2026,U+2192,U+258C,U+25B8,U+25BE,U+266A-266B" \
       --output-file=SourceCodePro-subset.woff2 */

@font-face {
  font-family: "Source Code Pro";
  src: url("/fonts/SourceCodePro-subset.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #030d18;
  --pink: #f106e3;
  --green: #00ff9c;
  --text: #ffe5fe;
  --dim: #8f8f8f;
  --sel: #2e1f47;
  --error: #ff7333;

  --mono: "Source Code Pro", ui-monospace, "SF Mono", SFMono-Regular, Menlo,
    Consolas, monospace;

  --step: 1.9rem; /* vertical rhythm between terminal lines */
}

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

html {
  /* Prevent iOS Safari from inflating type in landscape. */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  /* Cross axis is horizontal in a column, so this centers both the terminal and
     the footer. `safe` falls back to start-alignment rather than pushing content
     off the left edge, should it ever exceed the viewport width. */
  align-items: center;
  align-items: safe center;

  background-color: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(0.95rem, 0.85rem + 0.5vw, 1.0625rem);
  line-height: 1.75;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A faint bloom behind the text — a phosphor glow, not a gradient. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    70ch 60ch at 22% 42%,
    rgb(241 6 227 / 7%),
    transparent 70%
  );
}

::selection {
  background: var(--sel);
  color: #f5f5f5;
}

.terminal {
  position: relative;
  /* content-box so the measure below is 68 real characters. Under the global
     border-box, the horizontal padding would eat into it and wrap the copy
     early. */
  box-sizing: content-box;
  /* A fixed measure, not shrink-to-fit, and anchored to the top rather than
     centered: every page then puts the title in the same spot, however long or
     short its copy, so moving between pages does not make the header jump.
     The calc keeps the column inside a narrow viewport, less the padding. */
  width: min(68ch, calc(100% - 2 * clamp(1.25rem, 5vw, 3rem)));
  margin: 0 auto;
  padding: clamp(2.5rem, 10vh, 6rem) clamp(1.25rem, 5vw, 3rem)
    clamp(1.75rem, 5vw, 4rem);
}

.line {
  margin: 0 0 var(--step);
  /* Keep a line's glyphs from being orphaned onto their own row. */
  text-wrap: pretty;
}

.line--title {
  font-size: 1em;
  font-weight: 600;
  color: var(--pink);
  letter-spacing: 0.01em;
}

/* The title hangs its mark in the left margin so that wrapped text lands in the
   same column as every other line rather than sliding back under the note.
   2.75ch = the mark's box (2ch, see .prompt--logo) + its margin (0.75ch). */
.line--title {
  padding-left: 2.75ch;
  text-indent: -2.75ch;
}

/* The mark and title lead home. Same pink, no underline, until pointed at. */
.home {
  color: inherit;
  text-decoration: none;
  border-radius: 2px;
}

.home:hover .text,
.home:focus-visible .text {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.home:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--green);
}

/* A mark is boxed into a fixed number of cells and centered, so that a glyph
   whose natural advance is not a whole cell still holds the monospace grid. The
   box stays in Source Code Pro so `ch` still measures against the text font. */
.prompt {
  display: inline-block;
  width: 1ch;
  text-align: center;
  /* The mark is allowed to overhang this box (the note plus its underscore run
     ~2.2ch inside a 2ch column). Unlike a text glyph, the inline SVG offers a
     line-break opportunity, so without this the two halves of the logo wrap
     onto separate lines. */
  white-space: nowrap;
  margin-right: 0.75ch;
  color: var(--pink);
  user-select: none;
  /* Some platforms would otherwise give the note an emoji presentation that
     ignores `color`. */
  font-variant-emoji: text;
  /* text-indent is inherited, so as an inline-block this box would otherwise
     re-apply the -2.75ch hanging indent of .line--title to its own contents and
     drag the glyph out of the column. */
  text-indent: 0;
}

/* Two cells for the note-plus-underscore logo mark — declared after the rule
   above so it wins on source order. The markup closes up the whitespace this
   line would otherwise carry, so the column still totals the same 2.75ch
   (2ch box + 0.75ch margin) and the title stays aligned with every other row.
   Centered in 2ch, the note lands at the same offset a lone glyph does in 1ch. */
.prompt--logo {
  width: 2ch;
}

/* `line-height: 0` keeps a tall glyph from opening up the line box. */
.mark {
  font-family: "Source Code Pro", monospace;
  font-style: normal;
  line-height: 0;
}

/* The logo note, vectorised from the brand icon itself rather than derived from
   a typeface: no font character has this shape (an open notehead with a flag is
   not a real note value), and approximating it from Source Code Pro's eighth
   note gave the wrong silhouette. The favicon carries the same traced path, so
   the mark on the page and the mark in the tab cannot drift apart. */
.mark--note {
  /* An inline-block replaced element takes its bottom margin edge as its
     baseline, which puts the note on the text baseline like the glyph was.
     .mark's `line-height: 0` guards text glyphs from opening the line box and
     would collapse this element's inline box instead, so it is reset here.
     Width follows the traced artwork's own 271:389 aspect at the height the
     glyph used to occupy. */
  display: inline-block;
  line-height: normal;
  width: 0.582em;
  height: 0.835em;
  vertical-align: -0.003em;
}

/* Every other line simply starts in the text column. Only the title carries a
   mark, so only the title needs the hanging indent. */
.line:not(.line--title) {
  padding-left: 2.75ch;
}

/* ---- cursor ---------------------------------------------------------- */

.cursor {
  display: none;
  color: var(--green);
  user-select: none;
}

.cursor::after {
  content: "\258C"; /* ▌ */
  /* Leads the write head by half a cell so the block sits in the next cell
     rather than crowding the last character typed. */
  padding-left: 0.55ch;
}

/* Only shown while JS is driving the typing.
   Zero-width, with the block painted outside the box: the cursor rides between
   the typed head and the hidden tail, so if it occupied a cell it would add
   ~1.25ch to whichever line it happened to be on and could tip a full line
   into wrapping each time it moved. */
.js .cursor--active {
  display: inline-block;
  width: 0;
  overflow: visible;
  /* Same trap as .prompt: as an inline-block this box would re-apply the
     -2.75ch hanging indent it inherits from .line--title to its own contents,
     painting the block back over the last word. */
  text-indent: 0;
  animation: blink 1.06s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* ---- labels -------------------------------------------------------- */

/* Section headings, e.g. "sessions": dim, and closer to what they introduce
   than a full line step. */
.line--label {
  margin-bottom: 0.85rem;
  color: var(--dim);
}

.line--label .text {
  color: var(--dim);
}

/* An aside under a list, e.g. "follow on spotify or apple". */
.line--note {
  color: var(--dim);
}

/* ---- nav ------------------------------------------------------------- */

/* The pages, under the title. Shown from the first frame rather than typed:
   a way around should never wait on the animation. Separators are drawn here,
   trailing each link, as in the "where to listen" row. */
.nav {
  color: var(--dim);
}

.nav__link {
  color: var(--dim);
  text-decoration: none;
  border-radius: 2px;
  white-space: nowrap;
}

.nav__link:has(+ .nav__link)::after {
  content: "\00B7"; /* · */
  display: inline-block;
  margin: 0 0.9ch;
  color: var(--dim);
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.nav__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--green);
}

/* You are here: the cursor's green. */
.nav__link[aria-current="page"] {
  color: var(--green);
}

/* ---- links in the copy ----------------------------------------------- */

/* In the cursor's green, so it reads as something to act on. */
.link {
  color: var(--green);
  text-decoration: none;
  border-radius: 2px;
}

.link .text {
  color: inherit;
}

.link:hover,
.link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--green);
}

/* ---- prose ----------------------------------------------------------- */

/* The about and play pages' sections: a dim numbered label, a lead line in full
   weight, then the copy. Paragraphs sit closer than terminal lines so the
   page reads as prose; the sections keep the full step between them. */
.prose__section {
  margin-bottom: calc(var(--step) * 2);
}

.prose__section .line {
  margin-bottom: calc(var(--step) * 0.6);
  text-wrap: pretty;
}

.prose__label {
  font-size: 1em;
  font-weight: 400;
}

.prose .prose__label,
.terminal > .prose__label {
  margin-bottom: calc(var(--step) * 0.3);
}

/* The opening's lead is the typed line, outside the revealed sections, so it
   takes the sections' paragraph spacing here. */
.terminal > .prose__lead {
  margin-bottom: calc(var(--step) * 0.6);
}

.prose__lead {
  font-weight: 600;
}

.prose__signoff {
  color: var(--pink);
}

/* A section's way in, e.g. "Ask about a workshop". */
.prose__action {
  margin-top: calc(var(--step) * -0.3);
}

/* ---- social ---------------------------------------------------------- */

/* Sits at the foot of the page, centered: the auto top margin takes up whatever
   height the terminal leaves. `flex-shrink: 0` so a short viewport scrolls
   rather than squeezing the icons. */
.social {
  display: flex;
  flex-shrink: 0;
  margin-top: auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  padding: 0 1rem clamp(1rem, 3.5vw, 2.25rem);
}

.social__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--dim);
  border-radius: 2px;
  transition: color 140ms ease;
}

.social__link:hover,
.social__link:focus-visible {
  color: var(--pink);
}

/* Green ring, matching every other focusable control on the page. */
.social__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--green);
}

/* Stroked rather than filled, to sit at the weight of the monospace text. */
.social__icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The two solid details: Instagram's corner dot and YouTube's play triangle. */
.social__dot,
.social__solid {
  fill: currentColor;
  stroke: none;
}

/* ---- small screens --------------------------------------------------- */

@media (max-width: 30rem) {
  :root {
    --step: 1.45rem;
  }

  /* Tighter separators keep the nav on one line at 320px. */
  .nav__link:has(+ .nav__link)::after {
    margin: 0 0.5ch;
  }

  /* The indent stays at 2.75ch here on purpose — narrowing it would buy a
     little width at the cost of knocking the body copy out of the same
     column as the prompted lines. Session-specific small-screen rules live
     in sessions.css. */
}

/* ---- JS-driven states ------------------------------------------------ */

/* Before typing begins, hide what is about to be typed. Scoped to .js so the
   no-JS page keeps everything visible. */
.js .text[data-type] {
  visibility: hidden;
}

.js .text[data-type].is-typing,
.js .text[data-type].is-done {
  visibility: visible;
}

/* The not-yet-typed remainder of the line being written. Hidden rather than
   removed, so it still holds the line's final width and wrap points and
   nothing reflows as the characters arrive. */
.js .untyped {
  visibility: hidden;
}

/* The sessions list and footer wait for the type-on above them to finish. */
.js [data-reveal] {
  opacity: 0;
}

/* The attribute selector is repeated so this outranks the rule above — without
   it the reveal never wins and the list stays invisible. */
.js [data-reveal].is-shown {
  opacity: 1;
  transition: opacity 420ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .js .cursor--active {
    animation: none;
  }

  .js [data-reveal].is-shown {
    transition: none;
  }
}
