/* ==========================================================================
   Bandeja — shared base for pages in the new landing design (/ and /desk/).

   Tokens, fonts, the header with the B mark, the ticket CTA, the scroll
   reveal, the footer and reduced motion. Page sections live in home.css and
   desk.css. /faq/ and 404 still load styles.css, the previous visual
   language; nothing here is shared with it.

   Rules from the design hand-off:
   - Background #07090C, ink #EEF2F4, muted #9AA6AD / #6B7785.
   - Lime #C8F04B (text on lime #131803) only on CTAs and live markers.
   - Vegan for the wordmark only, Outfit for Latin, Vazirmatn for Persian.
   - Persian is the default (rtl); English is opt-in.
   ========================================================================== */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/outfit-var.woff2') format('woff2');
}

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/vazirmatn-var.woff2') format('woff2');
}

/* Subset to the six letters of "Bandeja" (3 KB instead of 196 KB). If the
   wordmark text ever changes, re-subset from the source TTF — see CLAUDE.md. */
@font-face {
  font-family: 'Vegan';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../fonts/vegan-wordmark.woff2') format('woff2');
}

:root {
  --bg: #07090c;
  --surface: #141a20;
  --ink: #eef2f4;
  --muted: #9aa6ad;
  --faint: #6b7785;
  --line: rgb(238 242 244 / 0.08);
  --lime: #c8f04b;
  --lime-ink: #131803;
  /* Hover and selection only ever get brighter, never lime (owner's rule):
     lime is for the CTA fill and live markers, not for interaction states. */
  --shine: #ffffff;
  --glow: 0 0 14px rgb(255 255 255 / 0.35);
  --gutter: clamp(20px, 4vw, 56px);
  --gutter-wide: clamp(20px, 6vw, 96px);
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  /* Outfit first in both languages: Persian falls through to Vazirmatn, and
     Latin inside Persian copy (app.bandeja.ir) stays in Outfit. */
  font-family: 'Outfit', 'Vazirmatn', system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--shine);
  text-shadow: var(--glow);
}

:focus-visible {
  outline: 2px solid var(--shine);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgb(238 242 244 / 0.24);
  color: var(--shine);
}

.skip-link {
  position: absolute;
  top: -48px;
  inset-inline-start: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 500;
}

.skip-link:focus {
  top: 12px;
}

.skip-link:hover {
  color: var(--lime-ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ header */

.top {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px var(--gutter);
}

.top__mark {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
}

/* The B mark. assets/b-sprite.png is a 48-frame strip, 15:16 per frame,
   shown at --bm-w × --bm-h (45×48 by default): the strip is 48 frames wide,
   and frame 47 (the finished B) sits at -47 frame widths. The draw takes
   10.67% of 15s = 1.6s, then holds until the loop restarts. */
.bmark {
  --bm-w: 45px;
  --bm-h: 48px;
  display: block;
  width: var(--bm-w);
  height: var(--bm-h);
  background: var(--ink);
  -webkit-mask-image: url('../assets/b-sprite.png');
  mask-image: url('../assets/b-sprite.png');
  -webkit-mask-size: calc(var(--bm-w) * 48) var(--bm-h);
  mask-size: calc(var(--bm-w) * 48) var(--bm-h);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  animation: bwrite 15s 0.3s infinite both;
}

@keyframes bwrite {
  0% {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
    animation-timing-function: steps(47);
  }
  10.67%,
  100% {
    -webkit-mask-position: calc(var(--bm-w) * -47) 0;
    mask-position: calc(var(--bm-w) * -47) 0;
  }
}

.top__nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 32px);
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

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

.top__link--cta {
  color: var(--ink);
}

/* The swap slot: "For clubs" on the home page, "Home" on every other page,
   in the same place. Fixed to the wider of the two labels in each language
   (measured in em, so it holds at every font size), with the text set
   against the language button, so the swap never moves a thing. */
.top__link--swap {
  min-width: 5.6em;
  text-align: end;
}

html[lang="en"] .top__link--swap {
  min-width: 4.1em;
}

/* The page's call to action in the header: underlined, never lime. */
.top__link--cta {
  padding-bottom: 2px;
  border-bottom: 1px solid rgb(238 242 244 / 0.35);
}

/* Two buttons, one shown: the language you are not in. i18n.js moves
   .is-active, so the visible button always switches. */
.lang-switch {
  display: flex;
}

.lang-switch__btn {
  /* Fixed width, so "English" ↔ "فارسی" never nudges the tabs beside it. */
  min-width: 4.2em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.lang-switch__btn[lang="fa"] {
  font-family: 'Vazirmatn', system-ui, sans-serif;
}

.lang-switch__btn:hover {
  color: var(--shine);
  text-shadow: var(--glow);
}

.lang-switch__btn.is-active {
  display: none;
}

/* ----------------------------------------------------------------- ticket */

/* A ticket: dark stub with the live marker, a torn edge, lime half to go. */
.ticket {
  display: flex;
  align-items: stretch;
  border-radius: 14px;
  overflow: hidden;
  font-size: 16px;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ticket:hover {
  transform: translateY(-3px);
}

.ticket:focus-visible {
  border-radius: 14px;
}

.ticket__live {
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.ticket__tear {
  position: relative;
  z-index: 1;
  width: 0;
  border-inline-start: 2px dashed var(--bg);
}

.ticket__go {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  background: var(--lime);
  color: var(--lime-ink);
  transition: filter 0.25s ease;
  font-weight: 500;
}

.live-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
}

.live-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--lime);
  animation: livepulse 1.8s ease-out infinite;
}

@keyframes livepulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* Scroll reveal. main.js adds .js-anim and .is-visible; without JS the
   ticket is simply there. The delay set by main.js is overridden: the ticket
   is alone in its section. */
.js-anim .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.6s var(--ease) 0.2s, transform 1.8s var(--ease) 0.2s;
}

.js-anim .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Once revealed, hand transform back to the hover lift. */
.js-anim .ticket.reveal.is-visible {
  transition: opacity 1.6s var(--ease) 0.2s, transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js-anim .ticket.reveal.is-visible:hover {
  transform: translateY(-3px);
}

/* ------------------------------------------------------------------ footer */

/* Same information as the footer on /faq/ and /desk/: brand, quick links,
   support, business details, the Enamad seal, then copyright. Restyled
   quieter for this page. */
.footer {
  padding: 40px var(--gutter) 44px;
  border-top: 1px solid rgb(238 242 244 / 0.06);
  font-size: 13px;
}

.footer__top {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr) auto;
  gap: 36px 32px;
  align-items: start;
}

.footer__col {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.wordmark {
  justify-self: start;
  font-family: 'Vegan', 'Outfit', sans-serif;
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  direction: ltr;
}

.footer__line {
  max-width: 34ch;
  color: var(--faint);
  font-size: 13px;
}

.footer__h {
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}

.footer__list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__list a {
  color: var(--muted);
}

.footer__list a:hover {
  color: var(--shine);
  text-shadow: var(--glow);
}

/* Underlined links: the underline brightens with the text. */
.top__link--cta:hover,
.clubs__cta:hover,
.link-quiet:hover {
  border-bottom-color: rgb(255 255 255 / 0.85);
}

/* Links that sit on the lime fill keep their dark text, and the lime
   itself just shines a little. */
.skip-link:hover,
.ticket:hover {
  color: var(--lime-ink);
  text-shadow: none;
}

.ticket:hover .ticket__go {
  filter: brightness(1.08) saturate(1.05);
}

.ticket:hover .ticket__live {
  color: var(--ink);
}

.footer__note {
  color: var(--faint);
  line-height: 1.5;
}

.footer__contact {
  display: inline-block;
  padding-block: 2px;
}

/* Enamad seal. Fetched live from trustseal.enamad.ir, which only serves
   bandeja.ir itself; main.js adds .is-loaded when the image arrives and
   .is-unavailable to the column when it fails, so localhost and visitors
   outside Iran get no blank tile and no orphaned heading. */
.footer__col--seals {
  justify-items: start;
}

.footer__seal {
  display: grid;
  justify-items: start;
}

.footer__seal img {
  display: block;
  max-width: 110px;
  height: auto;
}

.footer__seal.is-loaded img {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.footer__col--seals.is-unavailable {
  display: none;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgb(238 242 244 / 0.06);
}

.footer__copy {
  color: var(--faint);
  font-size: 12px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .footer__top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 28px;
  }

  .footer__col--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .top {
    gap: 12px;
    padding: 20px 16px;
  }

  .top__mark {
    min-width: 36px;
  }

  .bmark {
    --bm-w: 33.75px;
    --bm-h: 36px;
  }

  .top__nav {
    gap: 14px;
    font-size: 13px;
  }

  .lang-switch__btn {
    min-width: 3.9em;
    font-size: 13px;
  }

  .footer__top {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* Narrow phones: the four tabs stay, in place, just tighter. */
@media (max-width: 400px) {
  .top {
    padding-inline: 12px;
  }

  .top__nav {
    gap: 10px;
    font-size: 12px;
  }

  .lang-switch__btn {
    min-width: 3.6em;
    font-size: 12px;
  }
}

@media (max-width: 340px) {
  .top {
    gap: 8px;
    padding-inline: 10px;
  }

  .top__nav {
    gap: 8px;
  }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .bmark {
    animation: none !important;
    -webkit-mask-position: calc(var(--bm-w) * -47) 0 !important;
    mask-position: calc(var(--bm-w) * -47) 0 !important;
  }

  .live-dot::after {
    animation: none;
    opacity: 0;
  }

  .ticket,
  .js-anim .reveal {
    transition: none;
  }

  .js-anim .reveal {
    opacity: 1;
    transform: none;
  }

  .ticket:hover,
  .js-anim .ticket.reveal.is-visible:hover {
    transform: none;
  }
}
