/*
 * DEV/PLAY – سنگ، کاغذ، قیچی · shared stylesheet (RTL / Persian)
 * ---------------------------------------------------------------
 * MARKUP CONTRACT (every page: <html lang="fa" dir="rtl">, body.page)
 *
 * Skip link:  <a class="skip-link" href="#main">پرش به محتوا</a>
 *
 * Header (optional on any page):
 *   header.site-header > .container.site-header__inner
 *     > a.brand[href] > span.brand__mark + span.brand__name  ("DEV/PLAY")
 *     > button.nav-toggle[data-nav-toggle][aria-expanded="false"][aria-controls="site-nav"]
 *     > nav.site-nav#site-nav[data-nav] > ul.site-nav__list > li > a.site-nav__link(.is-active)
 *   Nav state: [data-nav].is-open  +  button[aria-expanded="true"]  (body.nav-open optional)
 *
 * Main: <main id="main">
 *   Hero:  section.hero > .container.hero__inner
 *            > .hero__copy > p.proof (true product fact, above headline)
 *                          + h1.hero__title + p.hero__lead
 *                          + .hero__actions > a.btn.btn--primary.btn--lg[data-cta="primary"][href="game.php"]
 *            > .hero__media > img.hero__img (img/hero-graphic.jpg)
 *   Game:  section.game-section > .container > .game-card > div[data-game-root]
 *            ([data-game-root] is only given a full-width block box; its children are never styled here)
 *   Rules (dark band): section.section.band--dark.how#how
 *            > .container > header.section__head > h2.section__title + p.section__lead
 *            > ul.rules-grid > li.rule-card > .rule-card__art (svg|img) + h3.rule-card__title + p.rule-card__text
 *            > p.rule-note   (pull-quote sentence about 5 points)
 *   Generic: section.section(.band--light|.band--dark), .section__head, .card, .card__body, .grid, .stack
 *   Document pages: article.doc > h1, h2, p, ul, ol, blockquote, .doc__meta
 *
 * Footer: footer.site-footer(.site-footer--compact) > .container.footer__inner
 *     > a.brand + p.footer__tagline ("محصولی از تیم نرم‌افزاری ما")
 *     > nav.footer__nav > ul > li > a
 *     > ul.contact-list > li.contact-item > span.contact-item__label + span.contact-item__value
 *         (phone/email values: <a class="ltr" dir="ltr" href="tel:|mailto:">)
 *     > p.footer__copy
 *
 * Buttons: .btn + .btn--primary | .btn--secondary | .btn--ghost ; size .btn--lg ; .btn--block
 *          disabled: [disabled], [aria-disabled="true"]
 * Forms:   .form > .field > label.field__label + .input|.textarea|.select + .field__hint + .field__error
 *          states: .is-invalid / [aria-invalid="true"] (error visible), .is-valid, .form__status.is-success|.is-error
 * Utilities: .container, .ltr, .visually-hidden, .is-hidden / [hidden], .text-muted, .badge
 * Reveal:  [data-reveal] becomes visible with .is-visible (works without JS: visible by default
 *          unless html.js is present)
 * State names for JS: .is-open, .is-active, .is-visible, .is-hidden, .is-invalid, .is-valid, .is-scrolled (header)
 */

/* ---------- Tokens ---------- */
:root {
  --c-bg: #eef4ff;
  --c-surface: #ffffff;
  --c-ink: #172a4b;
  --c-ink-soft: #4a5973;
  --c-muted: #62728c;
  --c-line: #d7e1f1;
  --c-primary: #305be8;
  --c-primary-dark: #2346c0;
  --c-orange: #ff9a51;
  --c-pink: #f9b9cf;
  --c-orange-soft: #ffe6d3;
  --c-focus: #ff9a51;

  --font-body: var(--mrc-font-fa, "Vazirmatn", system-ui, sans-serif);
  --font-display: var(--mrc-font-fa-display, var(--mrc-font-fa, "Vazirmatn", system-ui, sans-serif));

  --fs-base: 14px;
  --fs-small: 12.5px;
  --fs-lead: clamp(14px, 0.9rem + 0.3vw, 16px);
  --fs-h1: clamp(24px, 1.2rem + 2.4vw, 32px);
  --fs-h2: clamp(20px, 1rem + 1.2vw, 26px);
  --fs-h3: 16px;

  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 32px;
  --r-pill: 999px;

  --shadow-soft: 0 10px 30px -12px rgba(23, 42, 75, 0.22), 0 2px 6px rgba(23, 42, 75, 0.06);
  --shadow-lift: 0 16px 34px -12px rgba(48, 91, 232, 0.5), 0 3px 8px rgba(23, 42, 75, 0.1);

  --gap: clamp(16px, 3vw, 28px);
  --section-y: clamp(40px, 8vw, 88px);
  --container: 1120px;
  --tap: 48px;
  --t-fast: 160ms;
  --t-med: 260ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.9;
  direction: rtl;
  text-align: start;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; display: block; }
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0 0 0.5em; font-family: var(--font-display); line-height: 1.45; font-weight: 800; color: inherit; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--c-primary); text-underline-offset: 3px; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--c-primary-dark); }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--c-pink); color: var(--c-ink); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; text-align: start; }
.text-muted { color: var(--c-muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.is-hidden, [hidden] { display: none !important; }

.skip-link {
  position: absolute; inset-block-start: -80px; inset-inline-start: 12px; z-index: 100;
  background: var(--c-ink); color: #fff; padding: 12px 20px; border-radius: var(--r-pill);
  text-decoration: none; transition: inset-block-start var(--t-fast) var(--ease);
}
.skip-link:focus { inset-block-start: 12px; color: #fff; }

/* ---------- Header / nav ---------- */
.site-header {
  position: relative; z-index: 20;
  background: rgba(238, 244, 255, 0.92);
  border-block-end: 1px solid var(--c-line);
}
.site-header.is-scrolled { box-shadow: var(--shadow-soft); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--c-ink); font-family: var(--font-display); font-weight: 900; min-height: var(--tap); }
.brand:hover { color: var(--c-ink); }
.brand__mark {
  width: 34px; height: 34px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--c-orange) 0 50%, var(--c-primary) 50% 100%);
  border: 2px solid var(--c-ink);
}
.brand__name { font-size: 18px; letter-spacing: 0.04em; direction: ltr; unicode-bidi: isolate; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border-radius: var(--r-pill);
  border: 2px solid var(--c-ink); background: var(--c-surface); color: var(--c-ink); cursor: pointer;
  font: inherit;
}
.nav-toggle[aria-expanded="true"] { background: var(--c-ink); color: #fff; }

.site-nav {
  position: absolute; inset-inline: 0; inset-block-start: 100%;
  background: var(--c-surface); border-block-end: 1px solid var(--c-line);
  box-shadow: var(--shadow-soft);
  padding: 8px 16px 16px;
  display: none;
}
.site-nav.is-open { display: block; animation: fade-down var(--t-med) var(--ease); }
.site-nav__list { list-style: none; display: grid; gap: 4px; }
.site-nav__link {
  display: flex; align-items: center; min-height: var(--tap); padding-inline: 18px;
  border-radius: var(--r-pill); color: var(--c-ink); text-decoration: none; font-weight: 600;
}
.site-nav__link:hover { background: var(--c-bg); color: var(--c-primary); }
.site-nav__link.is-active, .site-nav__link[aria-current="page"] { background: var(--c-orange-soft); color: var(--c-ink); }

@keyframes fade-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 28px;
  border: 2px solid transparent; border-radius: var(--r-pill);
  font-family: var(--font-body); font-size: 15px; font-weight: 800; line-height: 1.4;
  text-decoration: none; cursor: pointer; text-align: center;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn--lg { min-height: 56px; padding: 14px 40px; font-size: 16px; }
.btn--block { display: flex; width: 100%; }
.btn--primary {
  background: var(--c-primary); color: #fff; border-color: var(--c-primary);
  box-shadow: 0 8px 18px -8px rgba(48, 91, 232, 0.55), 0 2px 4px rgba(23, 42, 75, 0.1);
}
.btn--primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn--primary:active { transform: translateY(1px) scale(0.985); box-shadow: 0 2px 6px rgba(23, 42, 75, 0.25); }
.btn--secondary { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-ink); }
.btn--secondary:hover { background: var(--c-orange); border-color: var(--c-ink); color: var(--c-ink); transform: translateY(-2px); }
.btn--secondary:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--c-primary); border-color: var(--c-line); }
.btn--ghost:hover { border-color: var(--c-primary); background: var(--c-surface); }
.band--dark .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; box-shadow: none; transform: none; }

/* ---------- Cards / badges ---------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-soft); overflow: hidden;
}
.card__body { padding: clamp(18px, 3vw, 28px); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px;
  border-radius: var(--r-pill); background: var(--c-pink); color: var(--c-ink);
  font-size: var(--fs-small); font-weight: 700;
}
.grid { display: grid; gap: var(--gap); }
.stack > * + * { margin-block-start: 16px; }

/* ---------- Hero (proof-led, magazine split) ---------- */
.hero { padding-block: clamp(28px, 6vw, 64px) clamp(20px, 4vw, 40px); }
.hero__inner { display: grid; gap: var(--gap); align-items: center; }
.hero__copy { position: relative; }
.proof {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 16px; padding: 6px 18px;
  background: var(--c-orange); color: var(--c-ink);
  border-radius: var(--r-pill); border: 2px solid var(--c-ink);
  font-weight: 800; font-size: 13px; line-height: 1.6;
}
.hero__title {
  font-size: var(--fs-h1); font-weight: 900; line-height: 1.5;
  margin-block-end: 12px; padding-block-start: 14px;
  border-block-start: 3px solid var(--c-ink);
  text-wrap: balance;
}
.hero__lead { font-size: var(--fs-lead); color: var(--c-ink-soft); max-width: 52ch; margin-block-end: 22px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero__media {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: 12px; max-width: 460px; width: 100%; margin-inline: auto;
}
.hero__img { width: 100%; border-radius: calc(var(--r-lg) - 10px); aspect-ratio: 1 / 1; object-fit: cover; background: var(--c-bg); }
.hero--art .hero__media {
  aspect-ratio: 1 / 1; padding: 0;
  background: var(--c-surface) url("../img/hero-graphic.jpg") center / cover no-repeat;
}
.hero--short { padding-block: clamp(24px, 4vw, 44px) 8px; }
.hero--short .hero__inner { grid-template-columns: 1fr; text-align: start; }

/* ---------- Game section ---------- */
.game-section { padding-block: clamp(12px, 3vw, 28px) var(--section-y); }
.game-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: clamp(12px, 3vw, 28px); width: 100%; position: relative;
}
.game-card::before {
  content: ""; position: absolute; inset-inline: 28px; inset-block-start: -1px; height: 4px;
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  background: linear-gradient(90deg, var(--c-orange), var(--c-pink), var(--c-primary));
}
[data-game-root] { display: block; width: 100%; }

/* ---------- Sections / editorial bands ---------- */
.section { padding-block: var(--section-y); }
.band--light { background: var(--c-bg); color: var(--c-ink); }
.band--dark { background: var(--c-ink); color: #fff; }
.band--dark a { color: var(--c-pink); }
.section__head { max-width: 62ch; margin-block-end: clamp(20px, 4vw, 36px); padding-block-start: 14px; border-block-start: 3px solid currentColor; }
.section__title { font-size: var(--fs-h2); font-weight: 900; margin-block-end: 8px; }
.section__lead { color: var(--c-ink-soft); margin: 0; font-size: var(--fs-lead); }
.band--dark .section__lead { color: #c9d4ea; }

.rules-grid { list-style: none; display: grid; gap: var(--gap); grid-template-columns: 1fr; margin-block-end: clamp(20px, 4vw, 36px); }
.rule-card {
  background: var(--c-surface); color: var(--c-ink);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-soft);
  display: grid; gap: 8px; align-content: start;
  transition: transform var(--t-med) var(--ease);
}
.rule-card:hover { transform: translateY(-3px); }
.rule-card__art {
  width: 96px; height: 96px; display: grid; place-items: center; margin-block-end: 6px;
  background: var(--c-orange-soft); border-radius: var(--r-md); color: var(--c-ink);
  padding: 14px;
}
.rule-card:nth-child(2) .rule-card__art { background: var(--c-pink); }
.rule-card:nth-child(3) .rule-card__art { background: #dbe5ff; }
.rule-card__art svg, .rule-card__art img { width: 100%; height: 100%; }
.rule-card__title { font-size: var(--fs-h3); margin: 0; }
.rule-card__text { margin: 0; color: var(--c-ink-soft); }

.rule-note {
  margin: 0; max-width: 40ch; font-family: var(--font-display);
  font-size: clamp(17px, 1rem + 0.8vw, 22px); font-weight: 800; line-height: 1.8;
  padding-inline-start: 18px; border-inline-start: 5px solid var(--c-orange);
}

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; color: var(--c-ink); }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: 12px 20px;
  background: var(--c-surface); color: var(--c-ink);
  border: 2px solid var(--c-line); border-radius: var(--r-pill);
  font: inherit; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { border-radius: var(--r-md); min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-muted); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--c-muted); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { border-color: var(--c-primary); box-shadow: 0 0 0 4px rgba(48, 91, 232, 0.2); outline: none; }
.field__hint { font-size: var(--fs-small); color: var(--c-muted); }
.field__error { display: none; font-size: var(--fs-small); color: #b3261e; font-weight: 700; }
.is-invalid .input, .is-invalid .textarea, .is-invalid .select,
.input.is-invalid, .textarea.is-invalid, [aria-invalid="true"] { border-color: #b3261e; }
.is-invalid .field__error, .field.is-invalid .field__error { display: block; }
.is-valid .input, .input.is-valid { border-color: #1b7f4b; }
.form__status { padding: 12px 18px; border-radius: var(--r-md); display: none; font-weight: 700; }
.form__status.is-success { display: block; background: #dff5e8; color: #0f5c34; }
.form__status.is-error { display: block; background: #fde4e2; color: #8c1d18; }

/* ---------- Documents (legal / text pages) ---------- */
.doc { max-width: 70ch; margin-inline: auto; padding: var(--section-y) 16px; }
.doc h1 { font-size: var(--fs-h1); font-weight: 900; padding-block-start: 14px; border-block-start: 3px solid var(--c-ink); }
.doc h2 { font-size: var(--fs-h2); margin-block-start: 2em; }
.doc h3 { font-size: var(--fs-h3); margin-block-start: 1.6em; }
.doc p, .doc li { color: var(--c-ink-soft); }
.doc ul, .doc ol { padding-inline-start: 1.4em; margin-block-end: 1em; }
.doc li + li { margin-block-start: 0.4em; }
.doc blockquote { margin: 1.6em 0; padding-inline-start: 18px; border-inline-start: 5px solid var(--c-orange); font-weight: 700; color: var(--c-ink); }
.doc__meta { font-size: var(--fs-small); color: var(--c-muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-surface); border-block-start: 1px solid var(--c-line);
  padding-block: clamp(28px, 5vw, 48px); text-align: center;
}
.footer__inner { display: grid; justify-items: center; gap: 16px; }
.footer__tagline { margin: 0; font-weight: 800; font-size: 15px; color: var(--c-ink); }
.footer__nav ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.footer__nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 16px;
  border-radius: var(--r-pill); color: var(--c-ink); text-decoration: none; font-weight: 600;
}
.footer__nav a:hover { background: var(--c-bg); color: var(--c-primary); }
.contact-list {
  list-style: none; width: 100%; max-width: 920px;
  display: grid; grid-template-columns: 1fr; gap: 10px; margin-block-start: 4px;
}
.contact-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--c-bg); border: 1px solid var(--c-line); border-radius: var(--r-md);
  padding: 12px 16px; overflow-wrap: anywhere;
}
.contact-item__label { font-size: var(--fs-small); color: var(--c-muted); font-weight: 700; }
.contact-item__value { color: var(--c-ink); font-weight: 600; }
.contact-item__value a { color: var(--c-primary); font-weight: 700; text-decoration: none; display: inline-block; min-height: 24px; }
.contact-item__value a:hover { text-decoration: underline; }
.footer__copy { margin: 0; font-size: var(--fs-small); color: var(--c-muted); }
.site-footer--compact { padding-block: 20px; }

/* ---------- Reveal (subtle) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(10px); transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- ≥360px ---------- */
@media (min-width: 360px) {
  .container { padding-inline: 20px; }
  .rule-card__art { width: 104px; height: 104px; }
}

/* ---------- ≥768px ---------- */
@media (min-width: 768px) {
  .container { padding-inline: 32px; }
  .nav-toggle { display: none; }
  .site-nav { position: static; display: block; background: transparent; border: 0; box-shadow: none; padding: 0; }
  .site-nav__list { display: flex; gap: 4px; }
  .hero__inner { grid-template-columns: 1.15fr 0.85fr; gap: clamp(24px, 5vw, 56px); }
  .hero--short .hero__inner { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: repeat(3, 1fr); }
  .contact-list { grid-template-columns: 1.6fr 1fr 1fr; }
  .contact-item { padding: 14px 20px; }
  .game-card { padding: 28px; }
}

/* ---------- ≥1200px ---------- */
@media (min-width: 1200px) {
  .container { padding-inline: 0; }
  .hero { padding-block-start: 64px; }
  .rule-card { padding: 28px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .btn--primary:hover, .btn--secondary:hover, .rule-card:hover { transform: none; }
  .js [data-reveal] { opacity: 1; transform: none; }
}