/* Instrument Serif and IBM Plex Mono (SIL Open Font License), latin, from Google Fonts, served from fonts/ */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-latin.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-italic-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-500-latin.woff2) format('woff2'); }

:root {
  --ink: #eef3fa;
  --bg: #3d5a7c;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
body.ready canvas { opacity: 1; }
body.dragging canvas { cursor: grabbing; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title, .hint, .now, .controls, .credit {
  position: fixed;
  z-index: 2;
  color: var(--ink);
  transition: color .6s var(--ease), opacity .8s var(--ease);
}

.title { top: 28px; left: 32px; }
.title h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.005em;
}
.title h1 em { font-style: italic; }
.title p { margin-top: 10px; opacity: .7; }

.hint { top: 34px; right: 32px; opacity: .55; }

.now {
  left: 32px;
  bottom: 30px;
  max-width: 40vw;
}
.now h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(44px, 6vw, 84px);
  line-height: .9;
  letter-spacing: -0.01em;
}
.now p { margin-top: 12px; opacity: .7; }

.controls {
  right: 32px;
  bottom: 30px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  backdrop-filter: blur(8px);
}
.controls button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.controls button:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.controls button[aria-pressed="true"]:not(.play) { background: var(--ink); color: var(--bg); }
.controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.controls .play { display: flex; align-items: center; gap: 8px; padding-left: 14px; }
.controls .play i {
  width: 9px; height: 10px; display: block;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.controls .play[aria-pressed="false"] i {
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.credit {
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  font-size: 9px;
  opacity: .45;
  white-space: nowrap;
}
.credit a { color: inherit; }

@media (max-width: 760px) {
  .title { top: 20px; left: 20px; }
  .title h1 { font-size: 24px; }
  .hint { display: none; }
  .now { left: 20px; right: 20px; bottom: 92px; max-width: none; }
  .now h2 { font-size: 46px; }
  .controls { left: 12px; right: 12px; bottom: 28px; justify-content: space-between; }
  .controls button { padding: 10px 10px; letter-spacing: .06em; }
  .controls .play span { display: none; }
  .credit { white-space: normal; text-align: center; width: 90%; bottom: 8px; }
}

body.capture .title,
body.capture .hint,
body.capture .now,
body.capture .controls,
body.capture .credit { display: none; }
body.capture canvas { opacity: 1; transition: none; inset: auto; top: 0; left: 0; }
body.capture { overflow: visible; }

@media (prefers-reduced-motion: reduce) {
  canvas { transition: none; }
}
