@import url('https://fonts.googleapis.com/css2?family=Lalezar&family=Bebas+Neue&family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #0e0d0c;
  --surface: #17140f;
  --surface-2: #1f1a13;
  --text: #ede7dd;
  --text-dim: #a89e8c;
  --gold: #c9a24b;
  --gold-dim: #8a713a;
  --gold-hover: #dcb35f;
  --on-accent: #14110d;
  --crimson: #8a2f3b;
  --success-text: #8fd4a2;
  --danger-text: #e3919c;
  --line: #35302a;
  --gold-rgb: 201, 162, 75;
  --radius: 3px;
  --container: 1180px;
  color-scheme: dark;
}

/* حالت روشن - خودکار بر اساس تنظیمات سیستم کاربر */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5efe2;
    --surface: #eae1cd;
    --surface-2: #ded2b6;
    --text: #241f18;
    --text-dim: #6f6455;
    --gold: #8a5c15;
    --gold-dim: #b9944f;
    --gold-hover: #6f4710;
    --on-accent: #fbf6ec;
    --crimson: #8a2f3b;
    --success-text: #2f6142;
    --danger-text: #a23347;
    --line: #d9cdb4;
    --gold-rgb: 138, 92, 21;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 400;
  line-height: 1.85;
}

h1, h2, h3, .display {
  font-family: 'Lalezar', 'Vazirmatn', sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--text);
  margin: 0;
}

html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] .display {
  font-family: 'Bebas Neue', 'Vazirmatn', sans-serif;
  letter-spacing: 1px;
}

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

.meta {
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- سپروکت هول / نوار پرفراژ فیلم (عنصر امضا) ---------- */
.sprocket-strip {
  height: 22px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      to left,
      var(--bg) 0 10px,
      var(--surface) 10px 12px
    );
  position: relative;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  animation: strip-bars-drift 9s linear infinite;
}
.sprocket-strip::before,
.sprocket-strip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0; left: 0;
  height: 10px;
  transform: translateY(-50%);
  background-image: radial-gradient(circle, var(--bg) 2.6px, var(--gold-dim) 3px, transparent 3.4px);
  background-size: 22px 10px;
  background-position: 6px center;
  opacity: 0.85;
  animation: sprocket-drift 7s linear infinite;
}
.sprocket-strip::before { top: 4px; }
.sprocket-strip::after { top: 18px; animation-duration: 7.6s; animation-direction: reverse; }

@keyframes strip-bars-drift {
  from { background-position-x: 0; }
  to   { background-position-x: -12px; }
}
@keyframes sprocket-drift {
  from { background-position-x: 6px; }
  to   { background-position-x: -16px; }
}

/* ---------- هدر ---------- */
.site-header {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .brand {
  font-family: 'Lalezar', sans-serif;
  font-size: 1.7rem;
  color: var(--gold);
}
.site-header nav { display: flex; gap: 28px; align-items: center; }
.site-header nav a {
  font-size: 0.95rem;
  color: var(--text-dim);
  border-bottom: 1px solid transparent;
  padding-bottom: 4px;
  transition: color .2s, border-color .2s;
}
.site-header nav a:hover,
.site-header nav a.active { color: var(--gold); border-color: var(--gold); }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  border-inline-start: 1px solid var(--line);
  padding-inline-start: 20px;
}
.lang-switch a { color: var(--text-dim); padding: 0; }
.lang-switch a.active { color: var(--gold); }
.lang-switch a:hover { color: var(--gold); }
.lang-switch .lang-sep { color: var(--line); }

/* ---------- هیرو ---------- */
.hero {
  padding: 90px 0 70px;
  text-align: center;
}
.hero .eyebrow {
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--gold-dim);
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 18px;
}
.hero-photo {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 5px var(--surface);
  margin-bottom: 22px;
}

.about-grid {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
.about-photo {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.about-text {
  flex: 1;
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 720px;
  margin: 0;
}
@media (max-width: 600px) {
  .about-grid { flex-direction: column; align-items: center; text-align: center; }
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1.15;
}
.hero p.tagline {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 620px;
  margin: 22px auto 0;
}
.hero .stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 44px;
}
.hero .stats .num {
  font-family: 'Lalezar', sans-serif;
  font-size: 2.2rem;
  color: var(--gold);
  display: block;
}

/* ---------- بخش‌ها ---------- */
section.block { padding: 64px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 34px;
}
.section-head h2 { font-size: 1.9rem; }
.section-head a.more { color: var(--gold); font-size: 0.9rem; }

/* ---------- گرید فیلم‌ها ---------- */
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px;
}
.film-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s, border-color .25s;
}
.film-card:hover { transform: translateY(-4px); border-color: var(--gold-dim); }
.film-card .poster {
  aspect-ratio: 2/3;
  background: var(--surface-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-family: 'Lalezar', sans-serif;
  font-size: 1.1rem;
}
.film-card .body { padding: 16px 18px 20px; }
.film-card h3 { font-size: 1.25rem; margin-bottom: 6px; }
.film-card .meta { display: block; margin-bottom: 10px; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 100px;
  padding: 3px 10px;
  margin-top: 6px;
  margin-inline-end: 6px;
}

/* ---------- جزئیات فیلم ---------- */
.film-hero {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 46px;
  padding: 56px 0;
  align-items: start;
}
.film-hero .poster {
  aspect-ratio: 2/3;
  background: var(--surface) center/cover no-repeat;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.film-hero h1 { font-size: 2.6rem; margin-bottom: 10px; }
.film-hero .meta-row { display: flex; gap: 18px; margin-bottom: 22px; }
.film-hero .synopsis { color: var(--text-dim); font-size: 1.05rem; max-width: 640px; }
.trailer-link {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 22px;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 100px;
  font-size: 0.9rem;
}
.trailer-link:hover { background: var(--gold); color: var(--on-accent); }

.rating-block { margin-top: 28px; }
.rating-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.rating-stars { color: var(--gold); font-size: 1.2rem; letter-spacing: 2px; }
.rating-buttons { display: flex; gap: 4px; }
.rating-buttons button {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--line);
  cursor: pointer;
  padding: 2px;
  transition: color .15s, transform .15s;
}
.rating-buttons button:hover { color: var(--gold-dim); transform: scale(1.15); }

/* ---------- ریل جشنواره‌ها (تایم‌لاین فیلم‌استریپ) ---------- */
.reel {
  position: relative;
  padding: 30px 0;
  overflow-x: auto;
  display: flex;
  gap: 0;
}
.reel::-webkit-scrollbar { height: 6px; }
.reel::-webkit-scrollbar-thumb { background: var(--line); }
.frame {
  flex: 0 0 240px;
  border-inline-end: 2px dashed var(--line);
  padding: 0 24px;
  position: relative;
}
.frame:first-child { padding-inline-start: 0; }
.frame .year {
  font-family: 'Lalezar', sans-serif;
  color: var(--gold);
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
}
.frame h3 { font-size: 1.1rem; margin-bottom: 6px; }
.frame .film-ref { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 10px; }

/* ---------- تماس ---------- */
.social-icons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 34px 0 42px;
}
.social-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  transition: color .2s, border-color .2s, transform .2s, background .2s;
}
.social-icon svg { width: 21px; height: 21px; }
.social-icon:hover {
  color: var(--on-accent);
  background: var(--gold);
  border-color: var(--gold);
  transform: translateY(-3px);
}

.minimal-contact {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 34px;
}
.minimal-contact a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.92rem;
  letter-spacing: 0.2px;
}
.minimal-contact a svg { width: 15px; height: 15px; opacity: 0.75; }
.minimal-contact a:hover { color: var(--gold); }
.minimal-contact a:hover svg { opacity: 1; }

/* ---------- فوتر ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 26px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---------- flash messages ---------- */
.flash-wrap { max-width: var(--container); margin: 18px auto 0; padding: 0 28px; }
.flash {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 0.92rem;
  border: 1px solid var(--line);
}
.flash-success { border-color: #3c6e4a; color: var(--success-text); }
.flash-danger  { border-color: var(--crimson); color: var(--danger-text); }
.flash-warning { border-color: var(--gold-dim); color: var(--gold); }
.flash-info    { border-color: var(--line); color: var(--text-dim); }

/* ---------- پنل ادمین ---------- */
.admin-body { background: var(--surface); min-height: 100vh; }
.admin-shell { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  margin-bottom: 34px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.admin-header .brand { font-family: 'Lalezar', sans-serif; color: var(--gold); font-size: 1.4rem; }

.admin-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.admin-nav-link {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 100px;
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: color .15s, background .15s;
}
.admin-nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.admin-nav-link:hover { color: var(--text); background: var(--bg); }
.admin-nav-link.active { color: var(--on-accent); background: var(--gold); }
.admin-nav-logout { color: var(--danger-text); }
.admin-nav-logout:hover { color: var(--danger-text); background: var(--bg); }
.btn-logout { color: var(--text-dim); font-size: 0.85rem; }

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 44px; width: 100%; max-width: 380px;
}
.login-card h1 { font-family: 'Lalezar', sans-serif; color: var(--gold); font-size: 1.6rem; margin-bottom: 28px; text-align: center; }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 0.88rem; color: var(--text-dim); }
.field small.hint { display: block; margin-top: 5px; color: var(--text-dim); font-size: 0.78rem; }
.field .errors { color: var(--danger-text); font-size: 0.8rem; margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=file], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.95rem;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
.checkbox-field { display: flex; align-items: center; gap: 10px; }
.checkbox-field input { width: auto; }

.btn {
  display: inline-block;
  background: var(--gold);
  color: var(--on-accent);
  border: none;
  padding: 11px 26px;
  border-radius: 100px;
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { background: var(--gold-hover); }
.btn-outline {
  background: transparent; color: var(--text-dim); border: 1px solid var(--line);
  padding: 10px 20px; border-radius: 100px; font-size: 0.85rem; cursor: pointer;
}
.btn-danger { color: var(--danger-text); border-color: var(--crimson); }

.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 50px; }

.stat-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-card svg { width: 24px; height: 24px; color: var(--gold-dim); flex-shrink: 0; }
.stat-num { display: block; font-family: 'Lalezar', sans-serif; font-size: 1.9rem; color: var(--gold); line-height: 1; }
.stat-label { display: block; color: var(--text-dim); font-size: 0.8rem; margin-top: 5px; }

.analytics-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 26px;
}
.analytics-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.analytics-panel-title { display: flex; align-items: center; gap: 9px; }
.analytics-panel-title svg { width: 17px; height: 17px; color: var(--gold); flex-shrink: 0; }
.analytics-panel-title h3 { font-family: 'Vazirmatn', sans-serif; font-weight: 600; font-size: 0.98rem; color: var(--text); }
.analytics-bar-row { margin-bottom: 12px; }
.analytics-bar-row:last-child { margin-bottom: 0; }
.analytics-bar-label {
  display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 5px;
}
.analytics-bar-label .n { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.analytics-bar-track { background: var(--surface); border-radius: 100px; height: 7px; overflow: hidden; }
.analytics-bar-fill { background: var(--gold); height: 100%; border-radius: 100px; }
.rank-medal { font-size: 1.1rem; }
.admin-table th {
  text-align: right; font-size: 0.78rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.admin-table .row-actions { display: flex; gap: 10px; }
.admin-table .row-actions a, .admin-table .row-actions button {
  font-size: 0.8rem; color: var(--text-dim); background: none; border: none; cursor: pointer;
}
.admin-table .row-actions a:hover, .admin-table .row-actions button:hover { color: var(--gold); }

.empty-state {
  padding: 40px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 40px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .film-card { transition: none; }
  .sprocket-strip,
  .sprocket-strip::before,
  .sprocket-strip::after { animation: none; }
}

/* =========================================================
   RESPONSIVE DESIGN
   موبایل و تبلت
   ========================================================= */

/* ---------- Tablet ---------- */

@media (max-width: 900px) {

  .container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .film-hero {
    grid-template-columns: 240px 1fr;
    gap: 32px;
  }

  .film-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

}


/* ---------- Mobile ---------- */

@media (max-width: 720px) {

  /* =========================
     پایه
     ========================= */

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
    line-height: 1.8;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }


  /* =========================
     هدر
     ========================= */

  .site-header {
    padding: 18px 0;
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }

  .site-header .brand {
    font-size: 1.5rem;
  }

  .site-header nav {
    width: 100%;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
  }

  .site-header nav a {
    font-size: 0.88rem;
  }

  .lang-switch {
    padding-inline-start: 12px;
  }


  /* =========================
     Hero
     ========================= */

  .hero {
    padding: 55px 0 45px;
  }

  .hero .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 2px;
    margin-bottom: 14px;
  }

  .hero-photo {
    width: 105px;
    height: 105px;
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
    line-height: 1.2;
  }

  .hero p.tagline {
    max-width: 100%;
    padding: 0 5px;
    margin-top: 16px;
    font-size: 0.98rem;
    line-height: 1.9;
  }

  .hero .stats {
    gap: 28px;
    margin-top: 30px;
    flex-wrap: wrap;
  }

  .hero .stats .num {
    font-size: 1.9rem;
  }


  /* =========================
     About
     ========================= */

  .about-grid {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 22px;
  }

  .about-photo {
    width: 135px;
    height: 135px;
  }

  .about-text {
    width: 100%;
    max-width: 100%;
    font-size: 0.98rem;
    line-height: 1.9;
  }


  /* =========================
     Sections
     ========================= */

  section.block {
    padding: 45px 0;
  }

  .section-head {
    margin-bottom: 22px;
    gap: 12px;
  }

  .section-head h2 {
    font-size: 1.55rem;
  }

  .section-head a.more {
    font-size: 0.82rem;
    white-space: nowrap;
  }


  /* =========================
     Film Grid
     ========================= */

  .film-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .film-card {
    width: 100%;
  }

  .film-card .poster {
    width: 100%;
  }

  .film-card .body {
    padding: 14px 16px 18px;
  }

  .film-card h3 {
    font-size: 1.15rem;
  }

  .film-card .meta {
    font-size: 0.78rem;
  }


  /* =========================
     Film Detail
     ========================= */

  .film-hero {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 35px 0 45px;
  }

  .film-hero .poster {
    width: min(100%, 300px);
    margin: 0 auto;
  }

  .film-hero h1 {
    font-size: 2.15rem;
    line-height: 1.25;
    margin-bottom: 12px;
  }

  .film-hero .meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 18px;
  }

  .film-hero .synopsis {
    max-width: 100%;
    font-size: 0.98rem;
    line-height: 1.95;
  }

  .trailer-link {
    margin-top: 20px;
    padding: 9px 19px;
    font-size: 0.85rem;
  }


  /* =========================
     Rating
     ========================= */

  .rating-block {
    margin-top: 24px;
  }

  .rating-summary {
    flex-wrap: wrap;
    gap: 8px;
  }

  .rating-buttons {
    gap: 2px;
  }

  .rating-buttons button {
    font-size: 1.35rem;
    padding: 3px;
  }


  /* =========================
     Festival Reel
     ========================= */

  .reel {
    width: 100%;
    margin: 0;
    padding: 25px 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    box-sizing: border-box;
  }

  .frame {
    flex: 0 0 210px;
    padding: 0 20px;
  }

  .frame .year {
    font-size: 1.4rem;
  }

  .frame h3 {
    font-size: 1rem;
  }

  .frame .film-ref {
    font-size: 0.8rem;
  }


  /* =========================
     Contact
     ========================= */

  .social-icons {
    gap: 11px;
    margin: 25px 0 32px;
  }

  .social-icon {
    width: 46px;
    height: 46px;
  }

  .social-icon svg {
    width: 19px;
    height: 19px;
  }

  .minimal-contact {
    gap: 10px 22px;
    padding: 0 5px;
  }

  .minimal-contact a {
    font-size: 0.85rem;
  }


  /* =========================
     Footer
     ========================= */

  footer {
    padding: 22px 0;
    font-size: 0.78rem;
  }


  /* =========================
     Flash Messages
     ========================= */

  .flash-wrap {
    margin-top: 12px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .flash {
    padding: 10px 14px;
    font-size: 0.85rem;
  }


  /* =========================
     Admin
     ========================= */

  .admin-shell {
    padding: 24px 20px 60px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 25px;
    padding-bottom: 16px;
  }

  .admin-nav {
    width: 100%;
    gap: 5px;
  }

  .admin-nav-link {
    padding: 7px 11px;
    font-size: 0.8rem;
  }

  .stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    min-width: 0;
    padding: 14px;
    gap: 10px;
  }

  .stat-card svg {
    width: 20px;
    height: 20px;
  }

  .stat-num {
    font-size: 1.6rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  .analytics-panel {
    padding: 18px 16px;
  }

  .analytics-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .empty-state {
    padding: 28px 18px;
  }


  /* =========================
     Login
     ========================= */

  .login-shell {
    padding: 20px;
  }

  .login-card {
    padding: 30px 22px;
    max-width: 100%;
  }

  .login-card h1 {
    font-size: 1.45rem;
    margin-bottom: 22px;
  }

}


/* ---------- Small Phones ---------- */

@media (max-width: 400px) {

  /* Keep the same horizontal gutter on every page, including small phones */
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero {
    padding-top: 45px;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .hero .stats {
    gap: 20px;
  }

  .hero .stats .num {
    font-size: 1.7rem;
  }

  .section-head h2 {
    font-size: 1.4rem;
  }

  .film-card .body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .film-hero h1 {
    font-size: 1.95rem;
  }

  .frame {
    flex-basis: 190px;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

}



/* =========================
   Rich Text Editor
   ========================= */
.rich-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.rich-toolbar button,
.rich-toolbar select {
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
}
.rich-toolbar button:hover,
.rich-toolbar select:hover {
  border-color: var(--gold);
}
.rich-toolbar button.active {
  background: var(--gold);
  color: var(--on-accent);
  border-color: var(--gold);
}
.rich-toolbar .toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 3px;
}
.rich-content {
  min-height: 210px;
  padding: 14px 16px;
  outline: none;
  line-height: 1.95;
  font-size: 0.95rem;
  background: #fff;
  color: #241f18;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
  unicode-bidi: plaintext;
}
.rich-content:focus {
  box-shadow: inset 0 0 0 1px var(--gold);
}
.rich-content[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
.rich-content[dir="ltr"] {
  direction: ltr;
  text-align: left;
}
.rich-content p,
.rich-content div {
  margin: 0 0 0.85em;
}
.rich-content p:last-child,
.rich-content div:last-child {
  margin-bottom: 0;
}
.rich-content h2,
.rich-content h3 {
  color: var(--text);
  margin: 1em 0 0.5em;
  line-height: 1.45;
}
.rich-content h2 { font-size: 1.25rem; }
.rich-content h3 { font-size: 1.08rem; }
.rich-content ul,
.rich-content ol {
  margin: 0.5em 0 1em;
  padding-inline-start: 1.6em;
}
.rich-content blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-inline-start: 3px solid var(--gold);
  color: var(--text-dim);
}
.rich-content a {
  color: var(--gold);
  text-decoration: underline;
}
.rich-help {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.76rem;
  line-height: 1.7;
}

/* Rich text rendered on the public site */
.rich-text {
  line-height: 2;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.rich-text p,
.rich-text div {
  margin: 0 0 1em;
}
.rich-text p:last-child,
.rich-text div:last-child {
  margin-bottom: 0;
}
.rich-text h2,
.rich-text h3 {
  color: var(--text);
  margin: 1.2em 0 0.55em;
  line-height: 1.5;
}
.rich-text h2 { font-size: 1.25rem; }
.rich-text h3 { font-size: 1.08rem; }
.rich-text ul,
.rich-text ol {
  margin: 0.65em 0 1em;
  padding-inline-start: 1.7em;
}
.rich-text blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-inline-start: 3px solid var(--gold);
  color: var(--text-dim);
}
.rich-text a {
  color: var(--gold);
  text-decoration: underline;
}

@media (max-width: 720px) {
  .rich-toolbar {
    gap: 4px;
    padding: 7px;
  }
  .rich-toolbar button,
  .rich-toolbar select {
    height: 32px;
    min-width: 32px;
  }
  .rich-content {
    min-height: 190px;
    padding: 12px 13px;
    overflow-wrap: break-word;
    word-break: normal;
  }
}

/* ---------- Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  .film-card {
    transition: none;
  }

  .sprocket-strip,
  .sprocket-strip::before,
  .sprocket-strip::after {
    animation: none;
  }

}
