:root {
  color-scheme: light dark;
  --fg: #111;
  --bg: #fff;
  --dim: #888;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ddd;
    --bg: #111;
    --dim: #777;
  }
}

body {
  max-width: 40rem;
  margin: 4rem auto;
  padding: 0 16px;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

a { color: inherit; }

h1, h2 {
  font-size: inherit;
  font-weight: normal;
  margin: 0;
}

header { margin-bottom: 4rem; }

section { margin-bottom: 4rem; }

h2::before { content: "# "; color: var(--dim); }

.none { color: var(--dim); }

.media img,
.media video {
  display: block;
  width: 100%;
  height: auto;
  margin: 1rem 0;
}

.media img,
.media figure { border-radius: 10px; overflow: hidden; }

figure {
  position: relative;
  margin: 1rem 0;
  -webkit-user-select: none;
  user-select: none;
}

figure video { margin: 0; }

/* Live Photos: the still gently scales while its clip plays, as in Photos. */
.live video { transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.live.playing video { transform: scale(1.03); }

/* Frosted controls, shared by the Live badge and the video buttons. */
.badge,
.controls button {
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(40, 40, 40, 0.42);
  color: #fff;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  font: 600 10px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  letter-spacing: 0.06em;
  pointer-events: none;
  transition: opacity 0.3s;
}

.badge svg { width: 13px; height: 13px; }

.live.playing .badge { opacity: 0; }

.clip video { cursor: pointer; }

.controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}

.controls button {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

.controls button:hover { background: rgba(60, 60, 60, 0.55); }
.controls button:active { transform: scale(0.92); }
.controls button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.controls svg { width: 18px; height: 18px; fill: currentColor; }

.toggle .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  fill: none;
}

.toggle .ring circle {
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

.toggle .glyph { display: grid; }
