/* SEVEN × Saudi National Day 96 — identity: «عزّنا بطبعنا» checkerboard, emerald crenellated frame */

@font-face { font-family: "SEVEN"; src: url("assets/fonts/SEVEN-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "SEVEN"; src: url("assets/fonts/SEVEN-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
  --ink: #0a1b1f;
  --teal: #043339;
  --emerald: #078751;
  --white: #fff;
  --white-70: rgb(255 255 255 / .7);

  --cell: 26px;                         /* background checker cell */
  --inset: 10px;                        /* gap between screen edge and frame */
  --tooth: 6px;                         /* crenellation tooth */
  --font: "SEVEN", "Segoe UI", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }

html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--white);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

/* ------------------------------------------------------------------ stage + frame */

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(var(--inset) + env(safe-area-inset-top, 0px))
    calc(var(--inset) + env(safe-area-inset-right, 0px))
    calc(var(--inset) + env(safe-area-inset-bottom, 0px))
    calc(var(--inset) + env(safe-area-inset-left, 0px));
  display: flex;
  /* the logo's checkerboard, ink and teal */
  background:
    radial-gradient(closest-side at 50% 45%, rgb(10 27 31 / .88), rgb(10 27 31 / .35)) fixed,
    conic-gradient(var(--teal) 0 25%, transparent 0 50%, var(--teal) 0 75%, transparent 0) 0 0 / calc(var(--cell) * 2) calc(var(--cell) * 2) fixed,
    var(--ink);
}

.frame {
  --max: 560px;
  position: relative;
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 3.2vh, 32px);
  padding: clamp(26px, 5vh, 44px) clamp(18px, 5vw, 36px) clamp(22px, 4vh, 36px);
  background: var(--ink);
  border: 3px solid var(--emerald);
  animation: rise .8s var(--ease) both;
}
/* crenellation: small emerald teeth along the inside of the frame, as in the logo */
.frame::before {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--emerald) 0 var(--tooth), transparent var(--tooth) calc(var(--tooth) * 4)) center top / calc(100% - var(--tooth) * 4) var(--tooth) no-repeat,
    repeating-linear-gradient(90deg, var(--emerald) 0 var(--tooth), transparent var(--tooth) calc(var(--tooth) * 4)) center bottom / calc(100% - var(--tooth) * 4) var(--tooth) no-repeat,
    repeating-linear-gradient(180deg, var(--emerald) 0 var(--tooth), transparent var(--tooth) calc(var(--tooth) * 4)) left center / var(--tooth) calc(100% - var(--tooth) * 4) no-repeat,
    repeating-linear-gradient(180deg, var(--emerald) 0 var(--tooth), transparent var(--tooth) calc(var(--tooth) * 4)) right center / var(--tooth) calc(100% - var(--tooth) * 4) no-repeat;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.mast { width: 100%; display: flex; justify-content: center; }
.natday { width: min(76%, 330px); }

.foot { margin-top: auto; }
.seven { width: clamp(96px, 28vw, 132px); opacity: .95; }

.meta { text-align: center; }
.title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(22px, 6.4vw, 32px);
  line-height: 1.25;
  text-wrap: balance;
}
.page-video .title { font-size: clamp(20px, 5.6vw, 32px); }
.sub {
  margin: 6px 0 0;
  color: var(--white-70);
  font-size: clamp(13px, 3.6vw, 15px);
  line-height: 1.5;
  text-wrap: balance;
}
.sub--en { margin-top: 2px; font-size: clamp(11px, 3vw, 13px); letter-spacing: .06em; opacity: .8; }

/* ------------------------------------------------------------------ sound page */

.player {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vh, 22px);
}

.field {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 46vh;
  max-height: 46dvh;
  cursor: pointer;
  touch-action: manipulation;
}
.field canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: clamp(64px, 19vw, 84px);
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--white);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: background .3s, color .3s, transform .3s var(--ease), opacity .3s;
  box-shadow: 0 0 0 6px var(--ink), 0 0 0 9px var(--emerald);
}
.play:hover { transform: translate(-50%, -50%) scale(1.04); }
.play:active { transform: translate(-50%, -50%) scale(.96); }
.play__icon { width: 44%; fill: currentColor; }
.play__icon--pause { display: none; }
.is-playing .play { background: rgb(10 27 31 / .72); color: var(--white); opacity: .9; }
.is-playing .play__icon--play { display: none; }
.is-playing .play__icon--pause { display: block; }

/* idle pulse on the button until the anthem starts */
.page-sound:not(.is-started) .play { animation: nudge 2.2s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { box-shadow: 0 0 0 6px var(--ink), 0 0 0 9px var(--emerald); }
  50%      { box-shadow: 0 0 0 10px var(--ink), 0 0 0 13px var(--emerald); }
}

.progress {
  width: 100%;
  padding: 8px 0;
  cursor: pointer;
  touch-action: none;
}
.progress__cells {
  display: flex;
  gap: 3px;
  height: 10px;
}
.progress__cells i {
  flex: 1;
  background: var(--teal);
  transition: background .2s;
}
.progress__cells i.on { background: var(--white); }
.progress__cells i.head { background: var(--emerald); }

.times {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: -8px;
  color: var(--white-70);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  direction: rtl;
}

.hint {
  min-height: 1.4em;
  margin: 0;
  color: var(--white-70);
  font-size: 14px;
  letter-spacing: .02em;
}

/* SoundCloud iframe: kept alive off-screen; slides up only as the iPhone fallback */
.sc {
  position: fixed;
  left: -9999px;
  bottom: 0;
  width: 320px;
  height: 120px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.sc.is-visible {
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 61;
  width: calc(100% - 32px);
  opacity: 1;
  pointer-events: auto;
  outline: 3px solid var(--emerald);
  outline-offset: 4px;
  background: var(--white);
}
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 20px calc(170px + env(safe-area-inset-bottom, 0px));
  background: rgb(10 27 31 / .82);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
.sheet__text { margin: 0; font-size: 16px; font-weight: 700; text-align: center; }

/* ------------------------------------------------------------------ video page */

.page-video .frame { --max: 980px; }

.film {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 28px);
}
.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 6px;
  background: var(--teal);
  border: 3px solid var(--emerald);
  box-shadow: 0 0 0 5px var(--ink), 0 0 0 7px var(--teal);
}
.screen iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.note {
  margin: 0;
  color: var(--white-70);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.note code { font-family: ui-monospace, Consolas, monospace; }

/* ------------------------------------------------------------------ larger screens */

@media (min-width: 700px) {
  :root { --inset: 24px; --tooth: 7px; --cell: 32px; }
}

@media (max-height: 640px) {
  .natday { width: min(60%, 260px); }
  .field { max-height: 38vh; max-height: 38dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
