/* Shared by index.html and music.html. The background characters are drawn by sky.js. */

@font-face {
  font-family: "Montserrat";
  /* The .woff2 is the same typeface with only the letters the site can use (Latin, punctuation,
     arrows), a fraction of the size; the full .ttf is the fallback. */
  src: url("../fonts/Montserrat.woff2") format("woff2"), url("../fonts/Montserrat.ttf") format("truetype");
  font-weight: 100 900;
  /* The pages preload this file, and text waits for it rather than showing in another font first. */
  font-display: block;
}

:root {
  --bg: #0a0a0a; /* sky.js keeps this in step with the field */
  --text: #ffffff;
  --dim: rgba(255, 255, 255, 0.66);
  --line: rgba(255, 255, 255, 0.14);
  --hi: #f2e94e; /* the highlight colour */
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font: 500 15px/1.5 "Montserrat", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* A soft dark edge on the letters themselves, so they read over the characters without a panel. */
  text-shadow: 0 0 2px var(--bg), 0 0 7px var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- What a selection takes ----
   Dragging across the page, or Select All, picks up the writing only. Pictures, clips, the cat,
   the background and the players (with the song names printed on their covers) are left out:
   they neither turn blue nor end up in what is copied. */
img,
svg,
video,
canvas,
button,
.noki,
.logo,
.media,
.cover {
  -webkit-user-select: none;
  user-select: none;
}

/* A picture is also not dragged off the page as a ghost of itself. */
img,
svg {
  -webkit-user-drag: none;
}

/* The two pages (sky.js). Once one is open the other is brought into the same document and
   parked one screen to the side, so that going between them is a slide. --side is -1 (parked on
   the left) or 1 (on the right). While they move, both are kept on their own layers and the page
   does not widen. */
main.parked {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translate3d(calc(var(--side, 1) * 100vw), 0, 0);
}

/* Painted once ahead of time, where it will be shown, too faint to see. */
main.parked.warming {
  transform: none;
  opacity: 0.01;
  pointer-events: none;
}

main.parked,
html.sliding main {
  will-change: transform;
}

html.sliding,
html.sliding body {
  overflow-x: clip;
}

/* Loaded with a mark for the other page: this file's own page stays unseen until the swap. */
html.switching main:not(.parked) {
  visibility: hidden;
}

/* The drag-to-reorder bar (temporary) belongs to the music page. */
body[data-page="home"] .arrange-bar,
body[data-page="home"] .arrange-box {
  display: none;
}

#sky {
  position: fixed;
  inset: 0 0 auto 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  display: block;
}

/* Without WebGL2 the page keeps the plain background. */
.flat-sky #sky {
  visibility: hidden;
}

/* The transform changes nothing visually. It stops Safari from stretching a text selection's
   highlight past the end of each line to the edge of the page. */
main {
  position: relative;
  z-index: 1;
  transform: translate(0);
  max-width: 1080px;
  margin: 0 auto;
  padding: 132px 28px 96px;
}

/* ---- The background's switch, top left: soft or full strength (sky.js adds and runs it) ---- */

.soften {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}

.soften:hover,
.soften:focus-visible {
  color: var(--text);
}

.soften svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* The filled half: the left one while the field is soft, the right one at full strength. */
.soften path {
  fill: currentColor;
  stroke: none;
  transform-origin: 12px 12px;
  transition: transform 0.25s ease;
}

.soften[aria-pressed="false"] path {
  transform: rotate(180deg);
}

/* Beside it, on the home page: which way the cat is drawn (noki.js adds and runs it). */
.catstyle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: calc(max(12px, env(safe-area-inset-left)) + 36px);
  z-index: 3;
  height: 30px;
  padding: 0 6px;
  border: 0;
  background: none;
  font: 500 11px/30px Montserrat, system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}

.catstyle:hover,
.catstyle:focus-visible {
  color: var(--text);
}

body[data-page="music"] .catstyle {
  display: none;
}

/* Where the back arrow sits in the same corner, the switch is smaller and stays above it. */
@media (max-width: 1180px) {
  .soften {
    top: max(4px, env(safe-area-inset-top));
    left: max(6px, env(safe-area-inset-left));
    width: 24px;
    height: 24px;
  }
  .catstyle {
    top: max(4px, env(safe-area-inset-top));
    left: calc(max(6px, env(safe-area-inset-left)) + 28px);
    height: 24px;
    line-height: 24px;
  }
}

/* ---- Section links in the top corner ---- */

.top {
  position: absolute;
  top: 30px;
  right: 28px;
  display: flex;
  gap: 26px;
  color: var(--dim);
}

.top a:hover,
.top a[aria-current] {
  color: var(--text);
}

/* ---- Intro: the text on the left, Noki sitting on a line to its right ---- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 20px;
  align-items: end;
}

/* Room for the cat. noki.js sets its size to a whole number of grid cells and puts its canvas inside. */
.noki {
  position: relative;
  width: 233px;
  height: 270px;
  margin: 0 51px 6px 0;
  cursor: pointer;
}

.who {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sub {
  margin: 3px 0 0;
  color: var(--dim);
}

.bio {
  max-width: 640px;
  margin: 20px 0 0;
  font-size: 16px;
  line-height: 1.6;
}

.bio p {
  margin: 0 0 10px;
}

/* A highlighted name in the bio: coloured and underlined. */
.hi {
  color: var(--hi);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.hi:hover {
  text-decoration-thickness: 2px;
}

/* The way through to the music page: bold, with an arrow that nudges out on hover. */
.music {
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.music .arr {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-left: 0.22em;
  vertical-align: 0.02em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.music:hover {
  color: var(--hi);
}

.music:hover .arr {
  transform: translate(2.5px, -2.5px);
}

.links {
  width: fit-content;
  display: flex;
  gap: 20px;
  margin-top: 12px;
  color: var(--dim);
}

.links a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Each of these goes somewhere else, so each carries the same arrow as "compose music": three
   lines, drawn a little lighter to match these words. It nudges out on hover. */
.links a {
  white-space: nowrap;
}

.links .arr {
  display: inline-block;
  width: 0.68em;
  height: 0.68em;
  margin-left: 0.2em;
  vertical-align: 0.03em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.links a:hover .arr {
  transform: translate(2px, -2px);
}

/* ---- Sections ---- */

section {
  margin-top: 52px;
  scroll-margin-top: 28px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
}

/* ---- Experience: one row each, filling the left column first ---- */

.rows {
  display: grid;
  /* The left column is a little wider so its longest description stays on one line. */
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 0 56px;
}

.row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px 0;
}

.logo {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #17171a;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Artwork that should sit inside its tile instead of filling it. */
.logo.fit img {
  object-fit: contain;
  padding: 4px;
}

.logo.light {
  background: #f7f7f7;
}

/* A logo drawn in white, shown black on a light tile. */
.logo.invert img {
  filter: invert(1);
  padding: 3px;
}

/* ShapeUp's mark is a comb on a round badge. The tile takes the badge's colour and the badge is
   enlarged until it covers the tile's corners, so the colour fills the whole square. */
.logo.shapeup {
  background: #b8584d;
}

.logo.shapeup img {
  transform: scale(1.24);
}

/* In a row only the logo and the name are links, not its whole width. Pointing at either lifts
   the logo. (Two rules: a browser without :has() would otherwise drop the first one too.) */
a.logo:hover {
  transform: scale(1.06);
  border-color: rgba(255, 255, 255, 0.4);
}

.row:has(a.name:hover) .logo,
.row:has(a.name:focus-visible) .logo {
  transform: scale(1.06);
  border-color: rgba(255, 255, 255, 0.4);
}

.head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.name {
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
}

.role {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.when {
  flex: 0 0 auto;
  font-size: 13.5px;
  color: var(--dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.desc {
  display: block;
  margin-top: 1px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--dim);
}

/* An award, on its own line under the description with a gap between. */
.desc.award {
  margin-top: 8px;
}

/* ---- Projects: a clip or picture, then two lines ---- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 22px;
  margin-top: 6px;
}

.card {
  display: block;
}

.media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #111113;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.media video,
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A logo centred on its tile. */
.media.mark img {
  object-fit: contain;
  object-position: center;
  padding: 5%;
}

/* Pointing at one project: its text brightens, the others' dims (sky.js also stops their clips). */
.card .head,
.card .desc,
.card .media {
  transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

/* Projects wait their turn. --seen is how far the reader has come to a card, 0 to 1 (sky.js
   sets it from the scroll). Until then the whole card is faint and sits a little low, and its clip
   is still, so the first screen is quiet; it fades up into place as the card is reached, one card
   after another along its row. Pointing at a card, or tabbing into it, brings it up at once. */
.card {
  --seen: 0;
  opacity: calc(0.1 + 0.9 * var(--seen));
  translate: 0 calc((1 - var(--seen)) * 28px);
  transition: opacity 0.7s ease, translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card .media {
  transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease, border-color 0.25s ease, filter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* The other ways a tile can wait and come up, for comparing while the page is tuned (sky.js sets
   html[data-reveal]; "rise", above, is the one visitors get). Each is drawn from the same --seen. */
html[data-reveal]:not([data-reveal="rise"]) .card {
  opacity: 1;
  translate: none;
}

/* grey to colour: the tile is dim and nearly grey, then comes up to full colour */
html[data-reveal="grey"] .card .media {
  filter: saturate(calc(0.22 + 0.78 * var(--seen))) brightness(calc(0.5 + 0.5 * var(--seen)));
}

/* blur to sharp: the tile is out of focus and dim, then pulls sharp */
html[data-reveal="blur"] .card .media {
  filter: blur(calc((1 - var(--seen)) * 10px)) brightness(calc(0.6 + 0.4 * var(--seen)));
}

/* scale in: the tile is smaller and dark, then grows to its size from its bottom edge */
html[data-reveal="zoom"] .card .media {
  filter: brightness(calc(0.4 + 0.6 * var(--seen)));
  scale: calc(0.88 + 0.12 * var(--seen));
  transform-origin: 50% 100%;
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease, filter 0.7s ease, scale 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* wipe in: the tile is covered, then uncovered from its bottom edge up */
html[data-reveal="wipe"] .card .media {
  clip-path: inset(calc((1 - var(--seen)) * 100%) 0 0 0 round 12px);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease, clip-path 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cards.focus .card:not(.on) .head,
.cards.focus .card:not(.on) .desc {
  opacity: 0.38;
}

.cards.focus .card:not(.on) .media {
  opacity: 0.7;
}

.cards.focus .card.on .desc,
.cards.focus .card.on .role {
  color: #fff;
}

.card:hover .media {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
}

.card .head {
  margin-top: 11px;
}

.card .role {
  font-size: 13.5px;
}

/* ---- A card whose tile is a small audio player: the logo, then one song at a time with
   previous / play / next, its name and a progress line. player.js runs it. Sizes follow the tile
   (cqw / cqh are 1% of its width / height), so the stack fits at every card width. ---- */

.media.player {
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card:hover .media.player {
  transform: none;
  border-color: var(--line);
}

.media.player .art {
  width: auto;
  height: 41cqh;
  object-fit: contain;
}

/* The logo is a link to the project. Pointing at it eases it a little larger. */
.art-link {
  display: block;
  line-height: 0;
}

.art-link .art {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.art-link:hover .art,
.art-link:focus-visible .art {
  transform: scale(1.1);
}

.cue {
  margin-top: 2cqh;
  font-size: clamp(11px, 4.1cqw, 15px);
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

.ctl {
  display: flex;
  align-items: center;
  gap: clamp(8px, 3.4cqw, 14px);
  margin-top: 3cqh;
}

.play {
  width: clamp(26px, 9.6cqw, 36px);
  height: clamp(26px, 9.6cqw, 36px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0a0a0a;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.play:hover {
  transform: scale(1.1);
}

.play svg {
  width: 62%;
  height: 62%;
  fill: currentColor;
}

.play .i-pause,
.player.on .play .i-play {
  display: none;
}

.player.on .play .i-pause {
  display: block;
}

/* Previous and next: a triangle against a bar, no disc behind them. */
.skip {
  width: clamp(24px, 8.6cqw, 32px);
  height: clamp(24px, 8.6cqw, 32px);
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.78);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}

.skip:hover {
  color: #fff;
  transform: scale(1.12);
}

.skip svg {
  width: 74%;
  height: 74%;
  fill: currentColor;
}

.tname {
  margin-top: 2.4cqh;
  font-size: clamp(10.5px, 3.5cqw, 13px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--dim);
  white-space: nowrap;
}

.player .bar {
  width: 54cqw;
  max-width: none;
  margin-top: 0.6cqh;
}

.player.off .ctl,
.player.off .tname,
.player.off .bar {
  opacity: 0.45;
}

/* The line: a thin gray track with the played part drawn thicker in white. */
.bar {
  position: relative;
  display: block;
  width: 100%;
  max-width: 132px;
  height: 10px;
  cursor: pointer;
}

.bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.bar i {
  position: absolute;
  left: 0;
  top: 50%;
  width: calc(var(--p, 0) * 100%);
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  background: #fff;
}

/* ---- The music page ---- */

.back {
  position: absolute;
  top: 30px;
  left: -36px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 40px;
  color: var(--dim);
  transition: color 0.15s ease, transform 0.15s ease;
}

/* A two-line arrow, a little narrower than it is tall. */
.back svg {
  width: 17px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back:hover {
  color: var(--text);
  transform: translateX(-3px);
}

/* Where the page has no side margin to spare, the arrow stays inside it. */
@media (max-width: 1180px) {
  .back {
    left: 2px;
  }
}

/* Songs come in groups. An album is a square cover with rounded corners and everything inside it:
   the showing song's name (and which of how many) in the top corner; at the bottom, play between two
   hand-drawn arrows, and a short thick progress line under them. albums.js runs them. */

.albums {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 32px;
  margin-top: 36px;
}

.album {
  width: 210px;
  max-width: 100%;
}

.cover {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background: #000;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.cover:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
}

.cover img,
.cover video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Noki's head bop: seven drawings side by side in one picture. albums.js sets --pose (0 to 6) to the
   drawing that fits the beat. */
.cover .bop {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: 700% 100%;
  background-position: calc(var(--pose, 0) * 100% / 6) 0;
}

/* The picture is darkened a little behind the name and behind the controls. */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 32%, rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.62));
  pointer-events: none;
}

/* A click anywhere on the picture plays or pauses, like the button does. */
.hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.tag {
  position: absolute;
  top: 12px;
  right: 15px;
  z-index: 2;
  max-width: 72%;
  text-align: right;
  pointer-events: none;
}

.song {
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
}

.deck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 5px;
  pointer-events: none;
}

/* A song with its own video: while it plays and the pointer is somewhere else, the play button
   and the progress line fade back so the picture shows through. They return when the pointer
   comes back over the cover (or the keyboard lands on one of its controls). Only where there is a
   pointer that can hover: on a touch screen they stay as they are. */
.deck {
  transition: opacity 0.3s ease;
}

@media (hover: hover) {
  .album.on:has(.cover video):not(:hover):not(:has(:focus-visible)) .deck {
    opacity: 0.25;
    transition: opacity 0.6s ease 0.3s;
  }
}

.keys {
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
}

.toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0a0a0a;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.toggle:hover {
  transform: scale(1.08);
}

.toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.toggle .i-pause,
.album.on .toggle .i-play {
  display: none;
}

.album.on .toggle .i-pause {
  display: block;
}

/* The arrows: two thick, round-ended lines each, drawn by hand the way Noki is. */
.step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.step svg {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.55));
}

.step[data-step="-1"]:hover {
  transform: translateX(-3px);
}

.step[data-step="1"]:hover {
  transform: translateX(3px);
}

/* Shorter and thicker than the card's line. */
.album .bar {
  width: 46%;
  max-width: none;
  height: 13px;
  pointer-events: auto;
}

.album .bar::before {
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.34);
}

.album .bar i {
  height: 5px;
  margin-top: -2.5px;
}

.album.off {
  opacity: 0.45;
}

/* Singles: the same thing, smaller, one song each. */
.singles-wrap {
  margin-top: 28px;
}

.singles-wrap h2 {
  font-size: 13px;
}

.singles {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 20px;
  margin-top: 10px;
}

.album.single {
  width: 172px;
}

/* A song's own video keeps its shape: as tall as the squares beside it, and wider. */
.album.wide {
  width: 229px;
}

.wide .cover {
  aspect-ratio: 4 / 3;
}

/* The same for a 16:9 picture. */
.album.wider {
  width: 306px;
}

.wider .cover {
  aspect-ratio: 16 / 9;
}

.single .cover {
  border-radius: 22px;
}

.single .tag {
  top: 10px;
  right: 13px;
  max-width: 82%;
}

.single .song {
  font-size: 13px;
  font-weight: 600;
}

.single .deck {
  bottom: 9px;
  gap: 3px;
}

.single .toggle {
  width: 28px;
  height: 28px;
}

.single .toggle svg {
  width: 16px;
  height: 16px;
}

.single .bar {
  width: 50%;
  height: 11px;
}

.single .bar::before,
.single .bar i {
  height: 4px;
  margin-top: -2px;
}

/* On a white cover the name and controls are dark, and the picture is left as it is. */
.light .cover::after {
  display: none;
}

.light .song {
  color: #111;
  text-shadow: none;
}

.light .toggle {
  background: #111;
  color: #fff;
}

.light .bar::before {
  background: rgba(0, 0, 0, 0.16);
}

.light .bar i {
  background: #111;
}

@media (max-width: 900px) {
  .rows {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .intro {
    grid-template-columns: 1fr;
  }
  .noki {
    margin: 14px 0 0;
  }
  main {
    padding: 92px 20px 72px;
  }
  .top {
    top: 22px;
    right: 20px;
  }
}

@media (max-width: 520px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .head {
    flex-wrap: wrap;
    gap: 0 8px;
  }
  .row .role {
    flex-basis: 100%;
    order: 3;
  }
  .when {
    margin-left: auto;
  }
  h1 {
    font-size: 30px;
  }
  .albums {
    gap: 14px;
  }
  .albums .album {
    width: calc((100% - 14px) / 2);
  }
  .albums .cover {
    border-radius: 24px;
  }
  .albums .tag {
    top: 10px;
    right: 13px;
  }
  .albums .song {
    font-size: 13px;
  }
  .albums .keys {
    gap: 4px;
  }
  .albums .toggle {
    width: 30px;
    height: 30px;
  }
  .albums .deck {
    bottom: 9px;
    gap: 3px;
  }
  .singles {
    gap: 14px;
  }
  .album.single {
    width: 150px;
  }
  .album.wide {
    width: 200px;
  }
  .album.wider {
    width: 267px;
  }
}

/* ---- The "not found" page (404.html) ---- */

.lost .lost-cat {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 0 22px;
}

.lost .sub {
  max-width: 520px;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.6;
}

.lost .lost-go {
  margin: 22px 0 0;
  font-size: 16px;
}

/* ==== Comfort at every size =================================================================
   Everything below is added on top of the rules above and only takes effect on narrower windows
   (a phone, a tablet, or a desktop window zoomed in), on touch screens, or on phones with a notch.
   A desktop window at its usual width and zoom is drawn exactly as before. ==================== */

/* -- Between the phone and desktop layouts -- */

/* Two columns of experience are too tight here (a zoomed-in desktop, a tablet on its side): the
   longest role was cut off with "…". One column, as on narrower windows. */
@media (max-width: 1059px) {
  .rows {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

/* Just above the phone layout a row is too short for name, role and dates on one line: the role
   takes its own line, as it does on a phone. */
@media (max-width: 600px) {
  .row .head {
    flex-wrap: wrap;
    gap: 0 8px;
  }
  .row .role {
    flex-basis: 100%;
    order: 3;
  }
  .row .when {
    margin-left: auto;
  }
}

/* A short window (a phone on its side, a heavily zoomed desktop): less empty space above the name. */
@media (max-width: 900px) and (max-height: 480px) {
  main {
    padding-top: 68px;
  }
}

/* -- Phones -- */

/* The singles become two even columns that fill the width; a song's own video keeps its shape and
   takes a full row. Squares move up to fill any gap beside them, so no row is left half empty. */
@media (max-width: 520px) {
  .singles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
  }
  .album.single,
  .album.wide,
  .album.wider {
    width: auto;
  }
  .album.wide,
  .album.wider {
    grid-column: 1 / -1;
  }
}

/* The narrowest phones: the section links sit closer so they clear the back arrow. */
@media (max-width: 340px) {
  .top {
    gap: 18px;
  }
}

/* -- Touch screens: everything looks the same, but is easier to hit -- */

/* Fast taps on the players (next, next, next) must not zoom the page, and a tap leaves no grey flash. */
.hit,
.toggle,
.step,
.play,
.skip,
.bar,
.back {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (pointer: coarse) {
  /* Small controls get an unseen area around them, about a fingertip (44px) where there is room.
     Each area stops short of its neighbour, so a tap never lands on the wrong control. */
  .top a,
  .links a,
  .skip,
  .play,
  .step,
  a.head,
  a.name {
    position: relative;
  }

  .top a::after,
  .links a::after,
  .back::after,
  .skip::after,
  .play::after,
  .step::after,
  a.head::after,
  a.name::after,
  .bar::after {
    content: "";
    position: absolute;
  }

  .top a::after,
  .links a::after {
    inset: -11px -8px;
  }

  .back::after {
    inset: -2px -4px;
  }

  .skip::after {
    inset: -8px -4px;
  }

  .play::after {
    inset: -6px -3px;
  }

  /* The arrows on an album: up into the picture, not down onto the progress line. */
  .step::after {
    inset: -8px -2px -2px;
  }

  a.head::after {
    inset: -10px 0;
  }

  /* A row's name: taller, and a little wider, than the word. */
  a.name::after {
    inset: -11px -6px;
  }

  /* The progress line is 10px tall; the area that seeks is taller. In the card it reaches up over
     the song's name; on a cover it reaches down to the cover's edge and not up onto the play button. */
  .player .bar::after {
    inset: -16px -6px -10px;
  }

  .album .bar::after {
    inset: -3px -10px -9px;
  }
}

/* A touch screen has no pointer resting on things, so the "pointed at" looks would stay stuck on
   whatever was tapped last. They are switched off there, and a press gives a small dip instead. */
@media (hover: none) {
  .cover:hover,
  .card:hover .media {
    transform: none;
    border-color: var(--line);
  }
  a.logo:hover,
  .art-link:hover .art {
    transform: none;
  }
  a.logo:hover {
    border-color: var(--line);
  }
  .row:has(a.name:hover) .logo {
    transform: none;
    border-color: var(--line);
  }
  .play:hover,
  .skip:hover,
  .toggle:hover,
  .step[data-step]:hover,
  .back:hover {
    transform: none;
  }
  .skip:hover {
    color: rgba(255, 255, 255, 0.78);
  }
  .back:hover,
  .top a:not([aria-current]):hover,
  .links a:hover {
    color: var(--dim);
  }
  .links a:hover {
    text-decoration: none;
  }
  .hi:hover {
    text-decoration-thickness: 1px;
  }
  .music:hover {
    color: inherit;
  }
  .music:hover .arr,
  .links a:hover .arr {
    transform: none;
  }
  .play:active,
  .skip:active,
  .toggle:active,
  .step[data-step]:active {
    transform: scale(0.92);
  }
}

/* -- Phones with a notch or rounded corners (the pages ask for the whole screen) --
   Held sideways, the page keeps clear of the cut-out. Where there is none these change nothing. */
@supports (padding: max(0px)) {
  main {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }
  .top {
    right: max(28px, env(safe-area-inset-right));
  }
  @media (max-width: 1180px) {
    .back {
      left: max(2px, calc(env(safe-area-inset-left) - 18px));
    }
  }
  @media (max-width: 900px) {
    main {
      padding-left: max(20px, env(safe-area-inset-left));
      padding-right: max(20px, env(safe-area-inset-right));
    }
    .top {
      right: max(20px, env(safe-area-inset-right));
    }
  }
}

/* -- Older phones (before 2022) that do not know the card player's sizing units --
   The player in the Claudesune Miku card gets fixed sizes there instead of collapsing. */
@supports not (width: 1cqw) {
  .art-link {
    height: 41%;
  }
  .media.player .art {
    height: 100%;
  }
  .cue {
    margin-top: 4px;
    font-size: 13px;
  }
  .ctl {
    gap: 10px;
    margin-top: 6px;
  }
  .play {
    width: 30px;
    height: 30px;
  }
  .skip {
    width: 27px;
    height: 27px;
  }
  .tname {
    margin-top: 5px;
    font-size: 11.5px;
  }
  .player .bar {
    width: 54%;
    margin-top: 1px;
  }
}
