/* Public site (home, factions, guide, FAQ). The game itself lives at /play. */
:root {
  --bg: #17120d;
  --bg-deep: #100c08;
  --surface: #211a12;
  --surface-2: #2b2218;
  --border: rgba(232, 196, 120, 0.16);
  --text: #f3e9d8;
  --muted: #bfae94;
  --gold: #e0ad4c;
  --gold-soft: #f2cd85;
  --on-gold: #1b1309;
  --ring: #f2cd85;
  --radius: 14px;
  --wrap: 1120px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-fa: 'Vazirmatn', system-ui, sans-serif;
  --font-title: 'Cinzel', 'Vazirmatn', serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
html[lang='en'] body { line-height: 1.65; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-soft); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.latin { font-family: var(--font-title); letter-spacing: 0.04em; }
html[lang='en'] h1, html[lang='en'] h2 { font-family: var(--font-title); letter-spacing: 0.02em; }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--gold); color: var(--on-gold); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
section { padding: clamp(56px, 9vw, 104px) 0; }
.eyebrow { color: var(--gold); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; display: block; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 62ch; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(23, 18, 13, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand small { display: block; font-family: var(--font-title); color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; line-height: 1.2; }
.brand span { line-height: 1.2; }
.nav { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; transition: color 0.2s, background 0.2s; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current='page'] { color: var(--gold-soft); }
.lang { color: var(--muted); text-decoration: none; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-weight: 600; }
.lang:hover { color: var(--text); border-color: var(--gold); }
.menu { display: none; margin-inline-start: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; color: var(--text); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--surface); }
.menu-panel { position: absolute; inset-inline-end: 0; top: 52px; width: min(280px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); display: grid; gap: 2px; }
.menu-panel a { color: var(--text); text-decoration: none; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.menu-panel a:hover, .menu-panel a[aria-current='page'] { background: var(--surface-2); color: var(--gold-soft); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 12px; font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s; touch-action: manipulation; }
.btn:active { transform: scale(0.97); }
.btn-gold { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--on-gold); box-shadow: 0 8px 24px rgba(224, 173, 76, 0.25); }
.btn-gold:hover { box-shadow: 0 10px 32px rgba(224, 173, 76, 0.4); }
.btn-ghost { color: var(--text); border-color: rgba(243, 233, 216, 0.3); background: rgba(23, 18, 13, 0.4); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.9rem; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.center .actions { justify-content: center; }

/* Hero */
.hero { position: relative; min-height: min(88vh, 760px); display: grid; align-items: end; padding: 0; overflow: hidden; isolation: isolate; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(16, 12, 8, 0.15) 0%, rgba(16, 12, 8, 0.55) 45%, var(--bg) 100%); }
.hero .wrap { padding-top: 120px; padding-bottom: clamp(48px, 8vw, 88px); }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); margin-bottom: 4px; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.hero .latin-title { font-family: var(--font-title); color: var(--gold-soft); font-size: clamp(1rem, 2.4vw, 1.35rem); letter-spacing: 0.18em; margin-bottom: 18px; display: block; }
.hero p { font-size: clamp(1.05rem, 2vw, 1.25rem); max-width: 56ch; color: #ece0cb; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); }
.chips { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 20px; color: var(--muted); font-size: 0.92rem; padding: 0; list-style: none; }
.chips li { display: flex; align-items: center; gap: 6px; }
.chips svg { width: 18px; height: 18px; color: var(--gold); }
.page-hero { min-height: 0; }
.page-hero .wrap { padding-top: clamp(96px, 14vw, 150px); }
.page-hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); }

/* Cards and grids */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: linear-gradient(180deg, var(--surface), rgba(33, 26, 18, 0.6)); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card p { color: var(--muted); margin: 0; font-size: 0.98rem; }
.card h3 { margin-bottom: 6px; }
.icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: rgba(224, 173, 76, 0.12); color: var(--gold); margin-bottom: 14px; }
.icon svg { width: 26px; height: 26px; }
.section-head { margin-bottom: 40px; }

.steps { counter-reset: step; }
.step { position: relative; text-align: center; padding-top: 12px; }
.step img { width: 150px; height: 150px; margin: 0 auto 10px; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5)); }
.step h3::before { counter-increment: step; content: counter(step, persian); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--on-gold); font-size: 0.85rem; margin-inline-end: 8px; vertical-align: 2px; }
html[lang='en'] .step h3::before { content: counter(step); }

.faction { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); min-height: 420px; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; text-decoration: none; color: var(--text); transition: transform 0.3s var(--ease), border-color 0.3s; }
.faction > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform 0.6s var(--ease); }
.faction::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 25%, rgba(16, 12, 8, 0.92) 78%); }
.faction:hover { border-color: var(--gold); }
.faction:hover > img { transform: scale(1.04); }
.faction .body { padding: 24px; }
.faction p { color: #dccdb4; margin: 0 0 10px; }
.badge { display: inline-block; background: rgba(224, 173, 76, 0.16); color: var(--gold-soft); border: 1px solid rgba(224, 173, 76, 0.35); border-radius: 999px; padding: 2px 12px; font-size: 0.85rem; font-weight: 700; }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.split img { border-radius: var(--radius); }
.art { max-width: min(380px, 100%); margin: 0 auto; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.55)); }
.alt { background: var(--bg-deep); border-block: 1px solid var(--border); }

/* Factions page */
.faction-block { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.faction-block .cover { border-radius: var(--radius); border: 1px solid var(--border); aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 28px; }
.unit { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.unit img { width: 96px; height: 96px; margin: 0 auto 6px; }
.unit strong { display: block; font-size: 0.95rem; }
.unit span { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.facts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.facts svg { width: 20px; height: 20px; color: var(--gold); flex: none; margin-top: 4px; }

/* Guide */
.doc { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: start; }
.toc { position: sticky; top: 88px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.toc strong { display: block; margin-bottom: 8px; color: var(--gold); font-size: 0.9rem; }
.toc ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 0.95rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--gold-soft); }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 56px; scroll-margin-top: 90px; display: flex; align-items: center; gap: 12px; }
.prose h2:first-child { margin-top: 0; }
.prose h2 .icon { margin: 0; width: 42px; height: 42px; flex: none; }
.prose p, .prose li { color: #e2d6c2; }
.prose ul { padding-inline-start: 22px; }
.prose li { margin-bottom: 6px; }
.prose figure { margin: 24px 0; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.prose figure img { width: 140px; height: 140px; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.5)); }
.tip { background: rgba(224, 173, 76, 0.08); border-inline-start: 3px solid var(--gold); border-radius: 10px; padding: 14px 18px; margin: 20px 0; color: var(--text); }
.res { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.res div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.res b { display: block; color: var(--gold-soft); }
.res span { color: var(--muted); font-size: 0.9rem; }

/* FAQ */
.faq { max-width: 800px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 0.2s; }
.faq details[open] { border-color: rgba(224, 173, 76, 0.45); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 22px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 56px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 20px; height: 20px; flex: none; color: var(--gold); transition: transform 0.25s var(--ease); }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq .answer { padding: 0 22px 20px; color: var(--muted); }
.faq .answer p:last-child { margin: 0; }

/* CTA band and footer */
.cta { position: relative; overflow: hidden; isolation: isolate; text-align: center; }
.cta > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 0.35; }
.cta::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at center, rgba(23, 18, 13, 0.4), var(--bg) 75%); }
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 32px; color: var(--muted); font-size: 0.92rem; background: var(--bg-deep); }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h2 { font-size: 1rem; color: var(--text); margin-bottom: 10px; font-family: inherit; letter-spacing: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--gold-soft); }
.site-footer .copy { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 20px; font-size: 0.85rem; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }

/* Reveal on scroll: only when JS runs and motion is welcome, so content is never hidden from crawlers. */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
  html.js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (max-width: 900px) {
  .nav, .site-header .lang, .site-header .btn { display: none; }
  .menu { display: block; }
  .split, .faction-block, .doc { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
  .site-footer .wrap > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .actions .btn { flex: 1 1 100%; }
  .faction { min-height: 380px; }
}

/* Faction town halls float over their land. */
.faction .emblem { position: absolute; top: 18px; left: 50%; width: 62%; max-width: 230px; transform: translateX(-50%); filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.6)); z-index: 0; transition: transform 0.5s var(--ease); }
.faction:hover .emblem { transform: translateX(-50%) translateY(-6px); }
.cover-wrap { position: relative; }
.cover-wrap .emblem { position: absolute; left: 50%; top: 50%; width: 52%; max-width: 280px; transform: translate(-50%, -50%); filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.6)); }
.split > *, .doc > *, .faction-block > * { min-width: 0; }
