:root {
  color-scheme: light dark;

  /* Fonts. Installed fonts only. Titles use a serif, everything else the
     system face. */
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", "DejaVu Serif", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --font-weight: 400;
  --font-size: 1rem;
  --font-mono-size: .875em;
  --line-height: 1.5;
  --font-title: clamp(2.25rem, 6vw, 3.5rem);
  --font-h1: 2rem;
  --font-h2: 1.25rem;
  --font-small: .875rem;

  /* Colours. The dark scheme below overrides the ones it names. */
  --color-text: #1a1a1c;
  --color-bg: #f4f2ed;
  --color-muted: color-mix(in srgb, var(--color-text) 64%, transparent);
  --color-faint: color-mix(in srgb, var(--color-text) 42%, transparent);
  --color-line: color-mix(in srgb, var(--color-text) 13%, transparent);
  --color-surface: color-mix(in srgb, var(--color-text) 5%, transparent);
  --color-surface-strong: color-mix(in srgb, var(--color-text) 10%, transparent);
  --color-card: #fffefb;
  --color-accent: #0b7566;
  --color-accent-text: #fff;
  --color-danger: #b8382c;
  --color-danger-text: #fff;
  --color-notice: #8f5f00;
  --color-shadow: rgb(40 30 10 / .16);

  /* The blurred album art behind a record page */
  --backdrop-opacity: .3;
  --backdrop-blur: 70px;

  /* Shape */
  --radius: 10px;
  --radius-pill: 999px;
  --art-radius: 6px;
  --line-width: 1px;

  /* Space and size */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3.5rem;
  --control-height: 2.75rem;
  --art-size: 24rem;
  --thumb-size: 2.75rem;
  /* Only the admin pages use these. */
  --admin-width: 72rem;
  --tile-size: 11rem;
  --search-height: 20rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-text: #edebe6;
    --color-bg: #0e0e0f;
    --color-card: #19191b;
    --color-accent: #5fd3bf;
    --color-accent-text: #08201c;
    --color-danger: #ff8073;
    --color-danger-text: #210806;
    --color-notice: #e8b75a;
    --color-shadow: rgb(0 0 0 / .55);
    --backdrop-opacity: .38;
  }
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--color-bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: var(--font-weight) var(--font-size)/var(--line-height) var(--font-body);
  color: var(--color-text); background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  transition: opacity .4s ease-out;
}
@starting-style { body { opacity: 0; } }
::selection { background: var(--color-accent); color: var(--color-accent-text); }

img { display: block; max-width: 100%; }
h1, h2, h3 { font-weight: 400; line-height: 1.1; margin: 0; overflow-wrap: anywhere; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: var(--font-h1); font-style: italic; letter-spacing: -.01em; }
h2 { font-size: var(--font-h2); }
p { margin: 0; overflow-wrap: anywhere; }
b, strong { font-weight: 600; }
code, kbd, samp, .mono { font-family: var(--font-mono); font-size: var(--font-mono-size); }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }

/* Controls */
label, .label { display: block; margin-bottom: var(--space-2); font-size: var(--font-small); color: var(--color-muted); }
input[type=text], input[type=search], input[type=password], textarea {
  display: block; width: 100%; font: inherit; color: var(--color-text);
  background: var(--color-surface); border: var(--line-width) solid var(--color-line);
  border-radius: var(--radius); padding: 0 var(--space-4); min-height: var(--control-height);
  transition: border-color .15s, background-color .15s;
}
input:hover, textarea:hover { border-color: var(--color-faint); }
input:focus, textarea:focus { outline: none; border-color: var(--color-accent); background: transparent; }
input::placeholder, textarea::placeholder { color: var(--color-faint); opacity: 1; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline: none; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font: inherit; font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap;
  min-height: var(--control-height); padding: 0 var(--space-5);
  border: 0; border-radius: var(--radius-pill);
  background: var(--color-accent); color: var(--color-accent-text); text-decoration: none;
  transition: background-color .15s, transform .1s;
}
button:hover, .button:hover { background: color-mix(in srgb, var(--color-accent) 86%, var(--color-text)); text-decoration: none; }
button:active, .button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.quiet, .button.quiet { background: var(--color-surface-strong); color: var(--color-text); }
button.quiet:hover, .button.quiet:hover { background: color-mix(in srgb, var(--color-text) 16%, transparent); }
button.link {
  min-height: 0; padding: 0; border-radius: 0; background: none; color: var(--color-accent); font-weight: inherit;
}
button.link:hover { background: none; text-decoration: underline; text-underline-offset: .2em; }
button.danger { background: var(--color-danger); color: var(--color-danger-text); }
button.danger:hover { background: color-mix(in srgb, var(--color-danger) 86%, var(--color-text)); }

.notice { font-size: var(--font-small); color: var(--color-notice); }
.notice.fault { color: var(--color-danger); }

/* The pages that a visitor sees: one composition in the middle of the screen. */
.stage {
  position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: var(--space-6) var(--space-4) var(--space-8);
  container-type: inline-size;
}
.wordmark {
  position: absolute; left: var(--space-5); bottom: var(--space-4);
  font-family: var(--font-display); font-style: italic; font-size: var(--font-small); color: var(--color-faint);
}

/* The album art, blurred and large, colours the page behind a record. */
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop img {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(var(--backdrop-blur)) saturate(1.4); opacity: var(--backdrop-opacity); transform: scale(1.3);
}
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--color-bg)); }

.sleeve { display: grid; gap: var(--space-6); width: 100%; max-width: calc(var(--art-size) * 2.4); }
.cover {
  width: 100%; max-width: var(--art-size); aspect-ratio: 1; object-fit: cover;
  border-radius: var(--art-radius); background: var(--color-surface-strong);
  box-shadow: 0 1.5rem 3.5rem -1rem var(--color-shadow), 0 0 0 var(--line-width) var(--color-line);
}
@starting-style { .cover { transform: translateY(.5rem); opacity: 0; } }
.cover { transition: transform .6s cubic-bezier(.2, .7, .2, 1), opacity .6s; }
.side { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.heading { display: flex; flex-direction: column; gap: var(--space-2); }
.from { font-size: var(--font-small); color: var(--color-muted); }
.sleeve h1 { font-size: var(--font-title); }
.artist { font-size: 1.125rem; color: var(--color-muted); }
@container (min-width: 50rem) {
  .sleeve { grid-template-columns: minmax(0, var(--art-size)) minmax(0, 1fr); gap: var(--space-8); align-items: end; }
}

/* A field and its button on one line */
.join { display: flex; gap: var(--space-2); }
.join input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--font-mono-size); }
.join button { flex: 0 0 auto; }

.get { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.get .button { min-height: 3.25rem; padding: 0 var(--space-6); font-size: 1.0625rem; }
.details { font-size: var(--font-small); color: var(--color-muted); }
.status { font-size: var(--font-small); color: var(--color-muted); }

.account { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; font-size: var(--font-small); color: var(--color-faint); }
.account form { display: inline; }
.account .mono { color: var(--color-muted); }

details summary { cursor: pointer; list-style: none; color: var(--color-accent); font-size: var(--font-small); width: fit-content; }
details summary::-webkit-details-marker { display: none; }
details summary:hover { text-decoration: underline; text-underline-offset: .2em; }
details[open] summary { margin-bottom: var(--space-3); color: var(--color-muted); }

/* A message page */
.message-card { width: 100%; max-width: 30rem; display: flex; flex-direction: column; gap: var(--space-4); }
.message-card h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
.message-card p { color: var(--color-muted); }

/* A small panel, for the admin sign-in */
.panel { width: 100%; max-width: 21rem; display: flex; flex-direction: column; gap: var(--space-5); }
.panel form { display: flex; flex-direction: column; gap: var(--space-4); }
.panel form button { margin-top: var(--space-2); width: 100%; }

@media (prefers-reduced-motion: reduce) {
  body, .cover { transition: none; }
}
