/* Chantifa — protest-poster look: black, paper, signal red. */

:root {
  --bg: #0d0d0d;
  --bg-2: #181716;
  --paper: #f3eee4;
  --ink: #0d0d0d;
  --red: #e4002b;
  --red-dark: #a8001f;
  --muted: #9b968c;
  --line: #2c2a27;

  --font-display: 'Avenir Next Condensed', Impact, Haettenschweiler, 'Roboto Condensed',
    'sans-serif-condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 100% 0%, rgb(228 0 43 / 0.18), transparent 45%),
    radial-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1.5px) 0 0 / 6px 6px,
    var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

body.has-player {
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------------ */
/* Home                                                                      */
/* ------------------------------------------------------------------------ */

.home {
  max-width: 960px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 28px) calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 40px)
    calc(var(--safe-left) + 20px);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.2rem, 17vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.wordmark-accent {
  display: inline-block;
  margin-left: 0.04em;
  padding: 0 0.08em;
  background: var(--red);
  color: var(--paper);
  transform: rotate(-3deg) translateY(-0.02em);
}

.tagline {
  margin: 14px 0 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.toolbar {
  display: grid;
  gap: 12px;
  margin: 28px 0 8px;
}

.search {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--bg-2);
  font-size: 1.05rem;
  -webkit-appearance: none;
  appearance: none;
}

.search:focus {
  border-color: var(--red);
  outline: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Language filter is hidden for now. Delete this rule to bring it back. */
.chips,
.toolbar:has(> .chips:only-child) {
  display: none;
}

.chip {
  min-width: 48px;
  min-height: 40px;
  padding: 6px 14px;
  border: 2px solid var(--line);
  background: transparent;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

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

.section-title {
  margin: 28px 0 14px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.category-grid,
.match-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 14px;
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 128px;
  height: 100%;
  padding: 16px 14px 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--red);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  outline: none;
}

/* Stretch the list link over the whole card; the play button sits above it. */
.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card-link:focus-visible::after {
  outline: 3px solid var(--paper);
  outline-offset: 4px;
}

.category-card:active {
  transform: rotate(0deg) translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--red);
}

@media (hover: hover) {
  .category-card:hover {
    transform: rotate(0deg) scale(1.03);
  }
}

.card-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
}

.card-play svg,
.play-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.card-play:active {
  background: var(--red);
}

.category-card--red .card-play {
  background: var(--paper);
  color: var(--red);
}

.category-card--red {
  background: var(--red);
  color: var(--paper);
  box-shadow: 5px 5px 0 var(--paper);
}

.category-card--red:active {
  box-shadow: 2px 2px 0 var(--paper);
}

.category-card.is-empty {
  opacity: 0.45;
}

.category-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

/* Long titles: hyphenate only long words (German compounds), never short ones
   like "JUSTICE". js/fit-text.js shrinks whatever still overflows. */
.category-name,
.list-title {
  overflow-wrap: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 10 4 4;
  -webkit-hyphenate-limit-before: 4;
  -webkit-hyphenate-limit-after: 4;
}

/* Last resort after shrinking to the minimum size. */
.is-squeezed {
  overflow-wrap: anywhere;
}

.category-count {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.75;
}

.match-list {
  display: grid;
  gap: 10px;
}

.match {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-left: 5px solid var(--red);
  background: var(--bg-2);
  text-decoration: none;
}

.match-call {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
}

.match-response {
  color: var(--red);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
}

.list-nav {
  margin-bottom: 22px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  text-decoration: none;
}

.back-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: square;
}

.back-link .wordmark {
  font-size: 1.6rem;
}

.list-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 18px;
}

.list-title {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 11vw, 4.5rem);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
}

.list-count {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  color: var(--muted);
}

.play-btn {
  grid-column: 2;
  grid-row: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  box-shadow: 4px 4px 0 var(--paper);
  color: var(--paper);
  font-size: 1.1rem;
  text-decoration: none;
}

.play-btn:active {
  translate: 2px 2px;
  box-shadow: 2px 2px 0 var(--paper);
}

ol.match-list {
  counter-reset: chant;
}

ol.match-list .match {
  position: relative;
  padding-left: 52px;
  counter-increment: chant;
}

ol.match-list .match::before {
  content: counter(chant);
  position: absolute;
  top: 15px;
  left: 14px;
  width: 26px;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.match-call,
.match-response {
  white-space: pre-line;
}

/* Optional note on a chant (lists + player). */
.chant-comment {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 8px 0 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  opacity: 0.85;
}

.chant-comment::before {
  content: 'i';
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.25em;
  height: 1.25em;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 0.85em;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  transform: translateY(0.1em);
}

.slide-comment {
  max-width: 60ch;
  padding-top: 14px;
  font-size: 0.95rem;
  transition: opacity 0.2s ease;
}

.player.is-immersive .slide-comment {
  opacity: 0;
}

/* Favorite (heart) toggle */
.fav-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}

.fav-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}

.fav-btn[aria-pressed='true'],
.icon-btn.fav-btn[aria-pressed='true'] {
  background: transparent;
  color: var(--red);
}

.fav-btn[aria-pressed='true'] svg {
  fill: currentColor;
}

.fav-btn:active svg {
  transform: scale(0.85);
}

.match-item {
  position: relative;
}

.match-item .match {
  padding-right: 58px;
}

.match-fav {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  color: var(--muted);
}

.match-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.match-tags .tag {
  font-size: 0.72rem;
}

/* Start-page content sections (data/content.json) */
.content-section {
  margin-top: 40px;
}

.content-body {
  max-width: 62ch;
  padding: 18px 20px;
  border-left: 5px solid var(--red);
  background: var(--bg-2);
  line-height: 1.5;
}

.content-body > * {
  margin: 0;
}

.content-body > * + * {
  margin-top: 0.8em;
}

.content-body p {
  white-space: pre-line;
}

.content-body ul {
  padding-left: 1.2em;
}

.content-body li + li {
  margin-top: 0.4em;
}

.content-body li::marker {
  color: var(--red);
}

.content-body a {
  color: var(--paper);
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

/* Headings inside content (start-page sections and pages) */
.content-heading {
  margin-top: 1.6em !important;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.content-body > .content-heading:first-child {
  margin-top: 0 !important;
}

/* Content pages (legal notice, privacy policy) */
.page-title {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 3.6rem);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.page-body {
  max-width: 70ch;
  overflow-wrap: break-word;
}

/* Footer links */
.site-footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.site-footer a {
  display: inline-block;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--paper);
}

.load-error {
  display: grid;
  gap: 18px;
  max-width: 34rem;
}

.btn {
  justify-self: start;
  padding: 12px 22px;
  border: 0;
  background: var(--red);
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ------------------------------------------------------------------------ */
/* Player                                                                    */
/* ------------------------------------------------------------------------ */

.player {
  position: fixed;
  inset: 0;
  z-index: 10;
  height: 100dvh;
  background: var(--bg);
  color: var(--paper);
}

.player-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px) 8px calc(var(--safe-left) + 8px);
  background: linear-gradient(var(--bg) 55%, transparent);
}

.player-title {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-counter {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.icon-btn:active {
  background: rgb(255 255 255 / 0.1);
}

.icon-btn[aria-pressed='true'] {
  background: var(--red);
}

.icon-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  outline: none;
}

.track::-webkit-scrollbar {
  display: none;
}

.slide {
  display: flex;
  flex: 0 0 100%;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: calc(var(--safe-top) + 68px) calc(var(--safe-right) + 22px) calc(var(--safe-bottom) + 20px)
    calc(var(--safe-left) + 22px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  user-select: none;
  -webkit-user-select: none;
}

.slide-box {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

.chant {
  width: 100%;
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.98;
  text-transform: uppercase;
  hyphens: manual;
}

.chant p {
  margin: 0;
  white-space: pre-line;
  text-wrap: balance;
}

.chant-label {
  margin-bottom: 0.35rem !important;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.18em;
}

.chant-label--response {
  margin-top: 0.45em !important;
  padding-top: 0.35em;
  border-top: 0.06em solid var(--red);
  color: var(--red);
}

.chant-response {
  color: var(--red);
}

.slide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
}

.tag {
  padding: 3px 9px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tag:nth-child(odd) {
  transform: rotate(-2deg);
}

.tag:nth-child(even) {
  transform: rotate(1.5deg);
}

.tag--lang {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--line);
}

.slide--empty {
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: none;
  width: 56px;
  height: 56px;
  translate: 0 -50%;
  background: rgb(255 255 255 / 0.06);
}

.nav--prev {
  left: calc(var(--safe-left) + 10px);
}

.nav--next {
  right: calc(var(--safe-right) + 10px);
}

@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
  .nav {
    display: inline-grid;
  }

  .slide {
    padding-left: calc(var(--safe-left) + 84px);
    padding-right: calc(var(--safe-right) + 84px);
  }
}

.player-progress {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 5px;
  background: var(--line);
}

.player-progress-bar {
  height: 100%;
  background: var(--red);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.swipe-hint {
  position: absolute;
  right: calc(var(--safe-right) + 22px);
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 2;
  padding: 8px 14px;
  background: var(--red);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: nudge 1.4s ease-in-out 0.6s 3 both;
}

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-14px); }
}

.player-bar,
.nav,
.slide-tags,
.swipe-hint {
  transition: opacity 0.2s ease;
}

.player.is-immersive .player-bar,
.player.is-immersive .nav,
.player.is-immersive .slide-tags,
.player.is-immersive .swipe-hint {
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------------ */
/* Toast                                                                     */
/* ------------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 20px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 4px 4px 0 var(--red);
  translate: -50% 0;
}

/* Keep toasts clear of the swipe hint and tags while the player is open. */
.has-player .toast {
  top: calc(var(--safe-top) + 64px);
  bottom: auto;
}

.toast-action {
  padding: 6px 12px;
  border: 0;
  background: var(--red);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
