/*
 * The podcast's look: the Base's paper and ink, Instrument Serif for what is
 * read as a title, Inter for the rest — and each recording's picture
 * (art.js), the one colourful thing on the page. Calm, one column, large
 * enough to hit with a thumb.
 */

@font-face {
  font-family: 'Instrument Serif';
  src: url('./fonts/instrument-serif-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('./fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('./fonts/inter-var-normal.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* The angle a playing picture turns by: animatable, as a typed property. */
@property --turn {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

:root {
  --paper: #f5f2ec;
  --paper-raised: #fdfbf7;
  --paper-sunk: #ebe5da;
  --ink: #1b3038;
  --ink-dim: #5a6c71;
  --ink-faint: #9aa7a9;
  --line: rgba(27, 48, 56, 0.1);
  --predigt: #a4543a;
  --vortrag: #4c7262;
  --workshop: #9c7428;
  --serif: 'Instrument Serif', 'Iowan Old Style', Palatino, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --gutter: 20px;
  --width: 640px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow: 0 24px 48px -28px rgba(27, 48, 56, 0.55);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161b1e;
    --paper-raised: #1f262a;
    --paper-sunk: #262e32;
    --ink: #efe9de;
    --ink-dim: #a9b3b4;
    --ink-faint: #6f7d80;
    --line: rgba(239, 233, 222, 0.1);
    --predigt: #e19676;
    --vortrag: #93bba8;
    --workshop: #d8b468;
    --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

body.with-mini {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

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

/* ---------- the pictures (art.js) ---------- */

.art {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper-sunk);
  --blur: 22px;
}

/* The colour field, larger than its frame and blurred into one. */
.art__paint {
  position: absolute;
  inset: -25%;
  background-image: var(--art);
  filter: blur(var(--blur)) saturate(1.25);
  transform: rotate(var(--turn)) scale(1.05);
}

.art.is-playing .art__paint {
  animation: turn 48s linear infinite;
}

@keyframes turn {
  to {
    --turn: 360deg;
  }
}

/*
 * Over the colour, sharp: fine rings spreading from where it turns, as
 * sound from where it is made, and a fine grain, as on paper.
 */
.art::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-radial-gradient(circle at var(--source, 50% 50%), rgb(255 252 245 / 0.16) 0 1px, transparent 1.5px var(--ring, 22px)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.75;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at var(--source, 50% 50%), #000 0%, #000 35%, transparent 85%);
  mask-image: radial-gradient(circle at var(--source, 50% 50%), #000 0%, #000 35%, transparent 85%);
}

.art--hero {
  aspect-ratio: 4 / 3.4;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.art--cover {
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 8px auto 26px;
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.art--banner {
  aspect-ratio: 16 / 8;
  border-radius: 26px;
  margin: 12px 0 26px;
  box-shadow: var(--shadow);
}

.art--thumb {
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  --blur: 7px;
  --ring: 7px;
}

.art--mini {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  --blur: 5px;
  --ring: 5px;
}

/* ---------- the top ---------- */

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--width);
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) var(--gutter) 6px;
}

.brand {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.top__abo {
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink-dim);
  padding: 8px 0 8px 12px;
}

.top__abo[aria-current='page'] {
  color: var(--ink);
}

body[data-page='episode'] .top {
  display: none;
}

.status {
  max-width: var(--width);
  margin: 4px auto 0;
  padding: 0 var(--gutter);
  font-size: 13px;
  color: var(--ink-dim);
}

.status button {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

.view {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- the newest, large ---------- */

.hero {
  position: relative;
  margin: 16px 0 8px;
}

.hero__link {
  display: block;
  position: relative;
  text-decoration: none;
  color: #fbf8f2;
}

.hero__link .art::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, transparent 52%, rgb(20 14 12 / 0.5) 100%);
}

.hero__text {
  position: absolute;
  left: 22px;
  right: 96px;
  bottom: 22px;
  z-index: 2;
}

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 8.5vw, 42px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 6px 0 6px;
  text-wrap: balance;
}

.hero__by {
  font-size: 14px;
  opacity: 0.86;
}

.hero__heard {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 10px;
  z-index: 2;
  height: 3px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.22);
}

.hero__heard > span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: #fbf8f2;
}

.hero__play {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: #fbf8f2;
  color: #1b3038;
  box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.6);
  cursor: pointer;
  transition: transform 160ms var(--ease);
}

.hero__play:active {
  transform: scale(0.94);
}

.hero__play svg {
  width: 26px;
  height: 26px;
}

/* ---------- finding ---------- */

.find {
  margin: 18px 0 4px;
}

.search {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--paper-sunk);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 11px 14px 11px 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa7a9' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  background-position: 13px center;
}

.search::placeholder {
  color: var(--ink-faint);
}

.chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip {
  flex: none;
  border: 0;
  border-radius: 999px;
  background: none;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.chip[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- the list ---------- */

.list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row__link {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  text-decoration: none;
}

.row__text {
  min-width: 0;
  flex: 1;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}

.meta--light {
  color: inherit;
  opacity: 0.88;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 650;
}

.kind {
  font-weight: 650;
  color: var(--kind-color, var(--ink-dim));
}

[data-kind='predigt'] {
  --kind-color: var(--predigt);
}

[data-kind='vortrag'] {
  --kind-color: var(--vortrag);
}

[data-kind='workshop'] {
  --kind-color: var(--workshop);
}

.row__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.12;
  margin: 2px 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row__by {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-dim);
}

.saved-mark svg {
  display: block;
  width: 14px;
  height: 14px;
  color: var(--ink-faint);
}

.heard {
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--paper-sunk);
  overflow: hidden;
}

.heard > span {
  display: block;
  height: 100%;
  background: var(--kind-color, var(--ink));
}

.empty {
  padding: 48px 0;
  color: var(--ink-dim);
  text-align: center;
  list-style: none;
}

/* ---------- one recording ---------- */

.show {
  padding-top: calc(10px + env(safe-area-inset-top));
}

.back {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 6px 0 4px -8px;
  border-radius: 50%;
  color: var(--ink);
}

.back svg {
  width: 24px;
  height: 24px;
}

.show > .meta {
  justify-content: center;
}

.show__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 9vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.012em;
  margin: 8px 0 6px;
  text-align: center;
  text-wrap: balance;
}

.show__by {
  margin: 0;
  font-size: 16px;
  color: var(--ink-dim);
  text-align: center;
}

.show__summary {
  font-size: 17px;
  line-height: 1.6;
  margin: 26px 0 0;
}

.deck {
  margin: 22px 0 0;
}

.scrub {
  width: 100%;
  margin: 0;
  appearance: none;
  height: 28px;
  background: transparent;
  cursor: pointer;
  --at: 0%;
}

.scrub::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--kind-color, var(--ink)) var(--at), var(--paper-sunk) var(--at));
}

.scrub::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--kind-color, var(--ink)) var(--at), var(--paper-sunk) var(--at));
}

.scrub::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--paper);
}

.scrub::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--paper);
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.icon-button svg {
  width: 28px;
  height: 28px;
}

.play-button {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform 160ms var(--ease);
}

.play-button:active {
  transform: scale(0.95);
}

.play-button svg {
  width: 32px;
  height: 32px;
}

.speed {
  justify-self: start;
  min-width: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--paper-sunk);
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.save {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 8px 0;
}

.save svg {
  width: 24px;
  height: 24px;
}

.save[data-state='saved'] {
  color: var(--kind-color, var(--ink));
}

/* On a phone the icon alone: the word would push the row out. */
@media (max-width: 519px) {
  .save span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .controls {
    gap: 6px;
  }
}

.deck__note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: center;
}

/* The transcript: what is said now, lit; a tap goes there. */
.transcript {
  margin: 30px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.cues {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cue {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 6px 12px;
  margin: 0 -12px;
  border-radius: 10px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-faint);
  cursor: pointer;
  transition: background-color 240ms var(--ease), color 240ms var(--ease);
}

.cue[aria-current='true'] {
  color: var(--ink);
  background: color-mix(in srgb, var(--kind-color, var(--ink)) 12%, transparent);
}

/* ---------- subscribing, signing in ---------- */

.abo h1,
.welcome__text {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.05;
  margin: 0 0 8px;
}

.abo__text {
  font-size: 17px;
  color: var(--ink-dim);
  margin: 0 0 24px;
}

.stack {
  display: grid;
  gap: 10px;
}

.abo__more {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 30px;
}

.welcome {
  padding-top: 16px;
}

.welcome .art {
  margin-bottom: 26px;
}

.welcome__text {
  font-size: 34px;
  margin-bottom: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button--big {
  width: 100%;
  padding: 16px 22px;
  font-size: 17px;
}

.button--quiet {
  background: var(--paper-sunk);
  color: var(--ink);
}

.text-button {
  border: 0;
  background: none;
  padding: 8px;
  font-size: 14px;
  color: var(--ink-dim);
  cursor: pointer;
}

/* ---------- the bar at the bottom ---------- */

.mini {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 5;
  max-width: calc(var(--width) - 20px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 8px 9px 9px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper-raised) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.mini[hidden] {
  display: none;
}

.mini__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  text-decoration: none;
}

.mini__title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini__time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

.mini__play,
.mini__close {
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.mini__play {
  width: 44px;
  height: 44px;
  background: var(--ink);
  color: var(--paper);
}

.mini__play svg {
  width: 20px;
  height: 20px;
}

.mini__close {
  width: 36px;
  height: 36px;
  background: none;
  color: var(--ink-dim);
}

.mini__close svg {
  width: 20px;
  height: 20px;
}

.mini__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
}

.mini__bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--kind-color, var(--ink));
}

/* A few words for a moment, above the bar. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 6;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

body.with-mini .toast {
  bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ---------- a page of its own (http.rs) ---------- */

body.note main {
  max-width: 520px;
  margin: 0 auto;
  padding: 80px var(--gutter);
}

body.note h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  margin: 0 0 12px;
}

body.note p {
  color: var(--ink-dim);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  .art.is-playing .art__paint {
    animation: none;
  }
}
