/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/LibreBaskerville-Italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/LibreBaskerville-Italic-latinext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/LibreBaskerville-Regular-latin.woff2') format('woff2');
}

/* ---------- Base ---------- */
:root {
  --ink: #f2f0ec;
  --bg: #000;
  --edge: 46px;      /* header inset, left and right, per the Canva header */
  --cap-edge: 38px;  /* captions sit a little closer to the edge */
  --top: 44px;
  --nav: 13px;       /* header */
  --body: 16px;      /* captions under the videos */
  --wave-w: 120px;   /* start value; JS matches it to TARA MALEK's width */
  --wave-h: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  font-family: 'Libre Baskerville', Baskerville, Georgia, 'Times New Roman', serif;
  font-style: italic;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* The site fades up once the loading screen is done with it. */
.topbar, .reel, .wave, .legal {
  opacity: 0;
  transition: opacity 1s ease;
}
body.up .topbar,
body.up .reel,
body.up .wave,
body.up .legal { opacity: 1; }

/* ---------- Loading screen ---------- */
/* While it is up, nothing scrolls — not the page behind it, not the screen
   itself. Removed in script.js the moment the clips are buffered. */
html.loading,
html.loading body {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

.loader {
  touch-action: none;
  overscroll-behavior: contain;
}
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease;
}
.loader.gone {
  opacity: 0;
  pointer-events: none;
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.loader-inner .loader-pct { margin-top: 6px; }
/* more specific than the .wave-svg sizing further down */
.loader .loader-wave {
  width: 200px;
  height: 70px;
}
.loader-name {
  font-size: var(--nav);
  letter-spacing: .2em;
  opacity: .8;
}
.loader-pct {
  font-size: var(--nav);
  letter-spacing: .14em;
  opacity: .45;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;   /* digits don't jiggle while counting */
}

/* ---------- Top bar — scrolls away with the page ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Row 1 is the tagline's own height, so changing the waveform's size never
     shifts CONTACT and TARA MALEK. */
  grid-template-rows: auto auto;
  row-gap: 14px;
  padding: var(--top) var(--edge) 0;
  pointer-events: none;
  font-size: var(--nav);
  line-height: 1.55;
  letter-spacing: .07em;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .55);
}
.topbar a { pointer-events: auto; }

.tagline   { grid-area: 1 / 1; }
.contact   { grid-area: 2 / 1; justify-self: start; }
.signature { grid-area: 2 / 2; justify-self: end; white-space: nowrap; }

/* ---------- Contact hover swap ---------- */
.contact {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  outline: none;
}
.contact-label,
.contact-mail {
  display: block;
  transition: opacity .45s ease;
}
.contact-mail {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
}
.contact:hover .contact-label,
.contact:focus-visible .contact-label { opacity: 0; }
.contact:hover .contact-mail,
.contact:focus-visible .contact-mail { opacity: 1; }

/* the one in the last caption is right-aligned, so it has to grow leftwards */
.contact-foot .contact-mail { left: auto; right: 0; }

/* ---------- Wave / sound toggle — the one element that stays put ---------- */
.wave {
  position: fixed;
  top: calc(var(--top) - 10px);
  right: var(--edge);
  z-index: 60;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  color: inherit;
  filter: drop-shadow(0 1px 10px rgba(0, 0, 0, .55));
}
.wave { width: var(--wave-w); }   /* JS narrows this to TARA MALEK's width */
.wave-svg {
  width: 100%;
  height: var(--wave-h);
  display: block;
  overflow: visible;
}
.wave-svg rect { fill: currentColor; }
.wave:hover .wave-svg { opacity: .78; }
.wave:focus { outline: none; }
.wave:focus-visible {
  outline: 1px solid rgba(242, 240, 236, .6);
  outline-offset: 10px;
}

/* ---------- Reel ---------- */
.reel {
  display: block;
  font-size: 0;   /* kills inline-block gaps: no seams between clips */
}
.clip {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  /* The still frame sits behind the video (set in script.js) — same framing
     as object-fit: cover, so nothing shifts if it ever shows. */
  background-color: var(--bg);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.clip video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: transparent;
}

/* ---------- Captions, sitting on the clip itself ---------- */
.caption {
  position: absolute;
  left: var(--cap-edge);
  right: var(--cap-edge);
  bottom: 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 0;
  font-size: clamp(11px, 3.1vw, var(--body));
  line-height: 1.4;
  letter-spacing: .06em;
  text-shadow: 0 1px 18px rgba(0, 0, 0, .6), 0 0 3px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.caption > * { pointer-events: auto; }
.caption > *:last-child { text-align: right; }
.caption a { transition: opacity .35s ease; }
.caption a:hover { opacity: .68; }
.caption .contact:hover { opacity: 1; }

/* ---------- Hidden Spotify host ---------- */
.spotify-host {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: .01;
  pointer-events: none;
  z-index: -1;
}
.spotify-host iframe { border: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  /* Desktop proportions carried over: at 1440 px the inset is 3.19 % of the
     width, the header sits 3.06 % down, captions 2.64 % in and 1.81 % up.
     Those translate directly. The type does not — 0.90 % would be 3.5 px on a
     390 px screen — so it goes to the smallest size that still reads. */
  :root {
    --edge: 13px;      /* 3.19 % of 390 = 12.5 */
    --cap-edge: 10px;  /* 2.64 % of 390 = 10.3 */
    --top: 16px;
    --nav: 8px;
    --wave-w: 58px;
    --wave-h: 24px;
  }
  .topbar { row-gap: 7px; }
  .loader .loader-wave { width: 132px; height: 46px; }
  .loader-name, .loader-pct { font-size: 11px; }
  .contact-mail { font-size: 7px; letter-spacing: .03em; }
  .caption { bottom: 8px; gap: 9px; font-size: 8px; }   /* 1.81 % of 390 = 7.0 */
  .legal { padding-left: 22px; padding-right: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .topbar, .reel, .wave, .legal, .loader,
  .contact-label, .contact-mail { transition-duration: .01ms; }
}
