:root {
  --bg: #111316;
  --surface: #1b1e23;
  --frame: #0a0b0d;
  --text: #e9eaec;
  --muted: #9aa0a8;
  --border: #2a2e35;
  --accent: #6aa8ff;
  --accent-text: #0b1220;
  --frame-size: 420px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

/* ---------- header + category navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-title {
  flex: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  display: block;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border);
}

nav a:hover { border-color: var(--accent); }

nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* ---------- content ---------- */

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

h1 { margin: 8px 0 4px; font-size: 1.8rem; }
.intro { margin: 0 0 8px; color: var(--muted); }

.style {
  display: grid;
  grid-template-columns: var(--frame-size) 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Fixed, invisible square slot; each clip is centred in it at its own aspect
   ratio (no crop, no stretch) and the empty space takes the card's colour. */
.frame {
  width: var(--frame-size);
  height: var(--frame-size);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Shrink-wraps the video so the sound button sits on the clip's own corner. */
.clip {
  position: relative;
  display: flex;
  border-radius: 8px;
  overflow: hidden;
}

.clip video {
  display: block;
  max-width: var(--frame-size);
  max-height: var(--frame-size);
  width: auto;
  height: auto;
}

.frame.missing {
  background: var(--frame);
  border-radius: 8px;
}

.frame.missing span { color: var(--muted); font-size: 0.95rem; }

.text h2 { margin: 4px 0 8px; font-size: 1.25rem; }
.desc { margin: 0; }
.empty { color: var(--muted); }

/* ---------- sound toggle ---------- */

.sound {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6) no-repeat center / 22px;
  /* speaker with an X (muted) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E");
  cursor: pointer;
}

.sound[aria-pressed="true"] {
  background-color: var(--accent);
  /* speaker with sound waves */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E");
}

.sound:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- narrow screens ---------- */

@media (max-width: 760px) {
  .site-header { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px; }
  nav ul { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  main { padding: 16px; }
  /* The slot fills the card's width (100cqw), capped at 70% of the screen height. */
  .style {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    container-type: inline-size;
    --frame-size: min(100cqw, 70vh);
  }
  .frame { width: 100%; }
}
