/* =========================================================================
   להיט המיחזור של ישראל — voting wireframe
   RTL-first, WCAG 2.2 AA / IS 5568. Logical properties throughout.
   ========================================================================= */

/* ---------- Brand font: Ezer Taagid ---------- */
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_Thin_6aa93a.woff2') format('woff2');       font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_UltraLight_7dc4f5.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_Light_0bb730.woff2') format('woff2');      font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_Regular_995a89.woff2') format('woff2');    font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_SemiBold_ea579f.woff2') format('woff2');   font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_Bold_2f505c.woff2') format('woff2');       font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'EzerTaagid'; src: url('https://fonts.activated.digital/EzerTaagid_Black_cc751b.woff2') format('woff2');      font-weight: 900; font-style: normal; font-display: swap; }

/* ---------- Design tokens ---------- */
:root {
  --orange-1: #f29730;
  --orange-2: #ee7b3b;
  --bg-gradient:  linear-gradient(106deg, var(--orange-1) 2%, var(--orange-2) 98%);
  --btn-gradient: linear-gradient(127deg, var(--orange-1) 2%, var(--orange-2) 98%);

  --ink:        #141414;   /* body text — ~11:1 on the orange bg */
  --ink-soft:   #333333;
  --white:      #ffffff;
  --panel:      #ffffff;
  --gray-200:   #e4e4e4;
  --gray-300:   #d9d9d9;
  --line:       #1c1c1c;

  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 6px 18px rgba(0, 0, 0, 0.22);
  --shadow-sm:  0 3px 8px rgba(0, 0, 0, 0.25);

  --focus:      3px solid #10263f;
  --focus-ring: 0 0 0 6px rgba(255, 255, 255, 0.85);

  --container:  1120px;
  --tap:        44px;      /* minimum touch target */

  --font: "EzerTaagid", "Assistant", "Heebo", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Clip the off-canvas nav panel (fixed, slid off the inline edge) so it never
     creates horizontal overflow. */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg-gradient) fixed;
  line-height: 1.5;
  overflow-x: hidden;
}

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

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

button { font-family: inherit; }

/* ---------- Accessibility utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: 12px;
  z-index: 1000;
  background: var(--white);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: inset-block-start 0.15s ease;
}
.skip-link:focus { inset-block-start: 0; }

/* Visible focus on every focusable element (SC 2.4.7 / 2.4.11) */
:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

/* ---------- Decorations (non-semantic, hidden from AT) ---------- */
.decorations {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.decorations img { position: absolute; }
.deco-cat   { inline-size: clamp(220px, 24vw, 460px); inset-block-end: 0; inset-inline-start: 1vw; }
.deco-notes { inline-size: clamp(90px, 10vw, 180px); inset-block-start: 34%; inset-inline-end: 1vw; opacity: 0.95; }
@media (max-width: 1100px) { .decorations { display: none; } }

/* ---------- Layout ---------- */
.page { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }
.container { inline-size: min(100% - 2rem, var(--container)); margin-inline: auto; }
main { flex: 1 0 auto; padding-block: clamp(1.5rem, 4vw, 3rem); }

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 20;
  padding-block: 14px;
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; }
.brand img { inline-size: clamp(120px, 14vw, 190px); height: auto; }

/* ---------- Hero ---------- */
.hero { text-align: center; max-inline-size: 60ch; margin-inline: auto; margin-block-end: clamp(1.5rem, 4vw, 2.5rem); }
.hero h1 {
  font-weight: 800;
  font-size: clamp(1.9rem, 5.5vw, 3.6rem);
  line-height: 1.08;
  margin-block-end: 0.6em;
}
.hero .lead { font-weight: 600; font-size: clamp(1.05rem, 2.4vw, 1.6rem); margin-block-end: 0.5em; }
.hero .sub  { font-weight: 300; font-size: clamp(1rem, 2vw, 1.35rem); }
.hero .cap  { font-weight: 400; font-size: 1.05rem; margin-block-start: 1rem; }

/* ---------- Group grid + cards ---------- */
.groups {
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  list-style: none;
  margin: 0;
  padding: 0;
}
.groups > li { min-inline-size: 0; }
@media (max-width: 860px)  { .groups { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .groups { grid-template-columns: 1fr; max-inline-size: 420px; margin-inline: auto; } }

.card { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.card-badge {
  position: relative;
  z-index: 2;
  margin-block-end: -22px;
  padding: 8px 26px;
  background: var(--btn-gradient);
  border: 3px solid var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
}

/* thumbnail is a link on the home page */
.card-thumb {
  display: block;
  inline-size: 100%;
  border: 8px solid var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  aspect-ratio: 224 / 360;
  background: #12141b;
}
.card-thumb img,
.card-thumb video { inline-size: 100%; block-size: 100%; object-fit: cover; }
a.card-thumb { text-decoration: none; }
a.card-thumb::after {
  /* play affordance — white disc, revealed on hover / keyboard focus */
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 66px; height: 66px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transition: opacity 0.15s ease;
}
a.card-thumb::before {
  /* triangle pointing right — media controls are never mirrored in RTL */
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  margin: auto;
  width: 0; height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 21px solid #12141b;
  transform: translateX(3px);
  opacity: 0;
  transition: opacity 0.15s ease;
}
a.card-thumb:hover::after,
a.card-thumb:hover::before,
a.card-thumb:focus-visible::after,
a.card-thumb:focus-visible::before { opacity: 1; }
/* no hover on touch — keep the affordance visible there */
@media (hover: none) {
  a.card-thumb::after,
  a.card-thumb::before { opacity: 1; }
}

/* Voted state: the looping teaser gives way to the "artists smiling" photo.
   (Set via JS on the card and on the lightbox body; the vote stepper text
   carries the same information, so this is never a color/image-only signal.) */
.card-voted { display: none; }
.voted .card-loop { display: none; }
.voted .card-voted { display: block; }
.voted .loop-toggle { display: none; }
.voted a.card-thumb::after,
.voted a.card-thumb::before { opacity: 0; }

/* Pause/play control for the auto-looping teaser (SC 2.2.2) */
.loop-toggle {
  position: absolute;
  inset-block-end: 12px;
  inset-inline-start: 16px;
  z-index: 2;
  inline-size: 36px;
  block-size: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  cursor: pointer;
}
.loop-toggle:hover { background: var(--white); }
.loop-toggle svg { inline-size: 16px; block-size: 16px; }

/* percentage badge shown after the viewer has voted */
.card-percent {
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
  color: var(--white);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.overlay-percent { margin: 0; pointer-events: none; }
.thumb-wrap { position: relative; inline-size: 100%; }
.thumb-wrap .overlay-percent {
  position: absolute;
  inset-block-end: 14px;
  inset-inline: 0;
  text-align: center;
}

.center-note {
  text-align: center;
  font-weight: 500;
  font-size: 1.1rem;
  margin-block-start: 1.4rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-block-size: var(--tap);
  padding: 12px 22px;
  border: 2px solid var(--white);
  border-radius: var(--radius-sm);
  background: var(--btn-gradient);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-block { inline-size: 100%; }

.btn-vote {
  background: rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.btn-vote .icon-heart { inline-size: 22px; block-size: 22px; }

.link-back {
  display: inline-block;
  margin-block-start: 8px;
  font-weight: 600;
  text-underline-offset: 4px;
}

/* ---------- Vote stepper (after first vote) ---------- */
.vote { inline-size: 100%; display: grid; justify-items: center; gap: 6px; }
.vote-label { font-weight: 600; font-size: 1rem; }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  box-shadow: var(--shadow-sm);
}
.stepper button {
  min-inline-size: var(--tap);
  min-block-size: var(--tap);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.stepper button:hover { background: var(--gray-200); }
.heart-count {
  position: relative;
  inline-size: 46px; block-size: 40px;
  display: grid; place-items: center;
}
.heart-count .icon-heart { inline-size: 40px; block-size: 40px; color: var(--orange-2); }
/* Dark chip so the count meets 4.5:1 over both the orange heart and gray stepper (SC 1.4.3). */
.heart-count .num {
  position: absolute;
  inset: 0;
  margin: auto;
  inline-size: fit-content;
  block-size: fit-content;
  min-inline-size: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  text-align: center;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--white);
}

/* ---------- Single group page ---------- */
.group-detail {
  display: grid;
  /* media (first DOM child) stays phone-sized; the text takes the flexible track */
  grid-template-columns: minmax(300px, 392px) 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 820px) {
  .group-detail { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.group-info .group-name { font-weight: 800; font-size: clamp(1.8rem, 4vw, 3rem); margin-block-end: 0.4em; }
.group-info .group-artist { font-weight: 600; font-size: 1.15rem; margin-block-end: 0.6em; }
.group-info p  { font-weight: 300; font-size: 1.15rem; max-inline-size: 40ch; }
@media (max-width: 820px) { .group-info p { margin-inline: auto; } }

.video-card {
  inline-size: 100%;
  max-inline-size: 392px;
  margin-inline: auto;
  border: 12px solid var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  background: #12141b;
}
.video-card video { inline-size: 100%; block-size: auto; display: block; aspect-ratio: 9 / 14; object-fit: cover; }
.video-card .song-badge {
  position: absolute;
  inset-block-start: -3px;
  inset-inline: 22px;
  z-index: 3;
  padding: 8px 20px;
  background: var(--btn-gradient);
  border: 3px solid var(--white);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}
/* Centered so the big percentage clears the native <video> control bar at the bottom. */
.video-card .overlay-percent {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

/* ---------- Dialogs (native <dialog>) ---------- */
dialog {
  border: none;
  border-radius: 22px;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  inline-size: min(92vw, 560px);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: var(--white);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog[hidden] { display: none; }
.dialog-title { font-weight: 800; font-size: clamp(1.4rem, 4vw, 2rem); text-align: center; }
.dialog-sub   { text-align: center; font-weight: 400; color: var(--ink-soft); margin-block-start: 6px; }

.field { margin-block-start: 1.6rem; }
.field label { display: block; text-align: center; font-weight: 600; margin-block-end: 8px; font-size: 1.15rem; }
.field input {
  inline-size: 100%;
  min-block-size: 52px;
  padding: 10px 16px;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.06em;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}
.field input[aria-invalid="true"] { border-color: #a11212; }
.dialog dialog { }
.dialog-actions { margin-block-start: 1.4rem; }

.form-error {
  margin-block-start: 12px;
  min-block-size: 1.4em;
  text-align: center;
  color: #7a0d0d;
  font-weight: 700;
}
.form-error:empty { min-block-size: 0; }

.dialog-alt {
  margin-block-start: 1.2rem;
  text-align: center;
}
.dialog-alt button {
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 8px;
  min-block-size: var(--tap);
}

/* warning dialog (max votes) */
.dialog-warning { text-align: center; }
.dialog-warning .warn-icon { inline-size: 64px; block-size: 64px; margin-inline: auto; color: var(--ink); }

/* ---------- Clip lightbox ---------- */
.dialog-clip {
  background: transparent;
  box-shadow: none;
  padding: 0;
  inline-size: min(92vw, 400px);
  overflow: visible;
}
.dialog-clip::backdrop {
  background: rgba(32, 17, 4, 0.6);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

.clip-close {
  position: absolute;
  inset-block-start: -54px;
  inset-inline-end: 0;
  min-inline-size: var(--tap);
  min-block-size: var(--tap);
  border: 0;
  background: none;
  color: var(--white);
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.clip-head { text-align: center; }
.clip-badge { display: inline-block; font-size: 1.3rem; }

.clip-media { max-inline-size: none; }
.clip-media .overlay-percent { z-index: 2; }

/* voted: the smiling photo covers the player (playback resumes only if the vote is removed).
   visibility (not just overlay) so the hidden player also leaves the tab order. */
.voted .clip-media video { visibility: hidden; }
.clip-voted { display: none; }
.voted .clip-voted {
  display: block;
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  z-index: 1;
}

.clip-nav-row {
  display: flex;
  align-items: center;
  /* arrows hug the dialog edges (as in the mock), vote pill stays centered */
  justify-content: space-between;
  gap: 12px;
  margin-block-start: 16px;
}
.clip-nav-row .vote { inline-size: auto; }
/* solid-enough pill so the dark label stays ≥4.5:1 over the dark backdrop */
.dialog-clip .btn-vote { background: rgba(255, 255, 255, 0.85); }
.dialog-clip .btn-vote:hover { background: var(--white); }
.dialog-clip .vote-label,
.clip-meta {
  color: var(--white);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.clip-nav {
  min-inline-size: var(--tap);
  min-block-size: var(--tap);
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--white);
  cursor: pointer;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}
.clip-nav svg { inline-size: 32px; block-size: 32px; }
.clip-nav:hover svg { transform: scale(1.15); }

.clip-meta {
  margin-block-start: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 1.15rem;
}

/* ---------- Toast / live status ---------- */
.toast {
  position: fixed;
  inset-block-end: 20px;
  inset-inline: 0;
  margin-inline: auto;
  inline-size: max-content;
  max-inline-size: 92vw;
  background: var(--ink);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 600;
  z-index: 80;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast[data-show="true"] { opacity: 1; transform: translateY(0); }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.16);
  border-block-start: 1px solid rgba(0, 0, 0, 0.15);
  padding-block: 24px;
  margin-block-start: 2rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.footer-logos { display: flex; align-items: center; gap: 22px; }
.footer-logos img { block-size: clamp(44px, 6vw, 62px); inline-size: auto; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.footer-links a { font-weight: 600; text-underline-offset: 3px; }
.footer-copy { font-size: 0.9rem; color: var(--ink-soft); inline-size: 100%; }

/* ---------- Content pages (accessibility statement) ---------- */
.prose { max-inline-size: 70ch; margin-inline: auto; background: rgba(255,255,255,0.9); color: var(--ink);
         padding: clamp(1.5rem, 4vw, 3rem); border-radius: var(--radius); box-shadow: var(--shadow); }
.prose h1 { font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.6rem); margin-block-end: 0.6em; }
.prose h2 { font-weight: 700; font-size: 1.4rem; margin-block: 1.4em 0.4em; }
.prose p, .prose li { font-size: 1.05rem; }
.prose ul { padding-inline-start: 1.4em; }
.prose a { text-underline-offset: 3px; }

/* ---------- Isolate LTR runs (phones, numbers) in RTL text ---------- */
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Motion preferences (SC 2.3.3 / 2.2.2) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
