/*
 * Landing page for kafgirwars.ir — "the game's world as a poster". Hard-edged blocky panels, gold gradient
 * buttons and the lobby's sky→grass horizon, all copied from client/index.html's own palette so this reads as
 * the same game, not a redesigned mockup. One file, vanilla, no framework.
 */

:root {
  color-scheme: dark;
  --red: #e63946; --blue: #4895ef; --gold: #ffd23f; --green: #3ddc84;
  --bg: #0b1020; --panel: #121a30; --panel2: #151c33; --ink: #0a0d18;
  --text: #f4f6fb; --muted: rgba(244, 246, 251, .66);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---- reset & base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", -apple-system, "Segoe UI", Tahoma, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* self-hosted Vazirmatn: same two subsets (Arabic block covers Persian + its ۰-۹ digits, Latin covers the
   English wordmark/APK/PWA bits) the game itself pulls from @fontsource, just copied to static files instead
   of importing the npm package — this page is not built by Vite. */
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/vazirmatn-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/vazirmatn-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/vazirmatn-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/vazirmatn-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/vazirmatn-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/vazirmatn-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 800; font-display: swap; src: url("assets/fonts/vazirmatn-arabic-800-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 800; font-display: swap; src: url("assets/fonts/vazirmatn-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }

/* ---- brand ---- */
.brand { font-weight: 800; font-size: clamp(20px, 5vw, 28px); letter-spacing: -0.02em; }
.brand em { font-style: normal; color: var(--gold); }
.wordmark { font-size: 11px; letter-spacing: .28em; color: var(--gold); font-weight: 800; }

/* ---- shared blocky panel look: dark navy, 3px ink border, offset hard shadow, never rounded ---- */
.feature-tile, .mode-tile, .stage, .how-steps li, .tab, .btn, .facts li {
  border-radius: 0;
  border: 2px solid var(--ink);
}

/* ---- reveal-on-load: staggered fade + rise, ~250ms cadence, ease-out ---- */
.reveal { animation: reveal 480ms var(--ease-out) both; animation-delay: calc(var(--d, 0) * 70ms + 100ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ---- hero: the lobby sky → grass horizon, floating weapon silhouettes, two walking players ---- */
/* flex column + margin-top:auto on .ground-row (the classic "sticky footer" trick), not absolute positioning for
   the text/CTA layer: min-height is a *floor*, and on a short/wide viewport (a landscape phone) the upper-third
   text block and the grass-line CTA block need to be able to push the hero taller than 100vh and simply stack in
   normal flow instead of overlapping — which is exactly what this gives for free, at every viewport. */
.hero { position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; display: flex; flex-direction: column; align-items: center; }
.hero-sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #5aa9ff 0%, #8fd0ff 46%, #bfe7ff 62%, #3f9a2e 62%, #3f9a2e 100%);
}
.hero-sky::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 24px 24px;
}
.grass { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 32%; background: repeating-linear-gradient(90deg, #4cc03a 0 24px, #2f8a24 24px 48px); }
/* a darker seam at the tree line, plus a soft shadow bleeding a little way down into the grass below it */
.grass::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 3px; background: #1f6b1a; }
.grass::after { content: ""; position: absolute; inset-inline: 0; inset-block-start: 3px; block-size: 30px; background: linear-gradient(180deg, rgba(0, 0, 0, .3), transparent); }

/* chunky voxel clouds: 2-3 offset rectangles (the <i> children) per cloud, not a single soft blob. Different
   size/opacity/speed per cloud (negative delays so they don't all start clustered at the left edge) read as
   depth — bigger and more opaque is "closer", smaller and hazier is "further". */
.cloud { position: absolute; animation: drift linear infinite; }
.cloud i { position: absolute; background: #fff; display: block; }
.cloud i:nth-child(1) { inset-inline-start: 0; inset-block-end: 0; inline-size: 68%; block-size: 62%; }
.cloud i:nth-child(2) { inset-inline-start: 16%; inset-block-start: 0; inline-size: 58%; block-size: 68%; }
.cloud i:nth-child(3) { inset-inline-start: 50%; inset-block-end: 6%; inline-size: 44%; block-size: 55%; }
.cloud-a { inset-block-start: 8%; inset-inline-start: -20%; inline-size: 130px; block-size: 54px; opacity: .95; animation-duration: 65s; }
.cloud-b { inset-block-start: 24%; inset-inline-start: -20%; inline-size: 82px; block-size: 36px; opacity: .65; animation-duration: 95s; animation-delay: -30s; }
.cloud-c { inset-block-start: 4%; inset-inline-start: -20%; inline-size: 68px; block-size: 30px; opacity: .5; animation-duration: 120s; animation-delay: -70s; }
.cloud-d { inset-block-start: 16%; inset-inline-start: -20%; inline-size: 104px; block-size: 44px; opacity: .8; animation-duration: 78s; animation-delay: -45s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(140vw); } }

/* two elements, not one: the outer .floater plays the one-shot .reveal entrance (opacity/translateY), the inner
   <img> plays the continuous .bob float (translateY/rotate) — both animate `transform`, and two animations on the
   very same element fighting over one property is undefined/flickery, so each gets its own element instead.
   All in a top band clear of the centred brand/headline column below (inset-inline-start 2%/36%/68%: healthy
   gaps from 360px up to 1440px, checked at both ends). */
.floater { position: absolute; inline-size: clamp(120px, 11vw, 170px); block-size: auto; }
/* at 120px+ each, three of these plus the sticker cannot share the top band with a 36px+ brand line on a 360-390px
   phone without touching it (measured: they did) — the sticker alone (much smaller) is enough sky decoration
   below 640px; the full set comes back once there is room for it. */
@media (max-width: 767px) { .floater { display: none; } }
.floater-spatula { inset-block-start: 5%; inset-inline-start: 2%; }
.floater-pot { inset-block-start: 0%; inset-inline-start: 18%; inline-size: clamp(108px, 8.5vw, 138px); }
.floater-slipper { inset-block-start: 8%; inset-inline-start: 68%; inline-size: clamp(114px, 9.5vw, 150px); }
.floater img.bob { inline-size: 100%; block-size: auto; filter: drop-shadow(4px 6px 0 rgba(0, 0, 0, .25)); animation: bob 4.6s ease-in-out infinite; animation-delay: calc(var(--d, 0) * 300ms); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-16px) rotate(4deg); } }

.sticker { position: absolute; inset-block-start: 3%; inset-inline-start: 90%; inline-size: clamp(46px, 7vw, 64px); block-size: clamp(46px, 7vw, 64px); overflow: hidden; }
.sticker .spr.spin36 { animation-duration: 8s; }

.hero-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; max-width: 720px; padding: 0 20px; margin-block-start: clamp(56px, 10vh, 100px); }
.brandrow { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.brand { font-weight: 800; font-size: clamp(36px, 2.5vw + 28px, 72px); letter-spacing: -0.02em; }
/* the headline used to be a short 3-4 word line (font-size up to 92px); now it carries the full pitch sentence,
   so it's sized/constrained like the old .subline instead — max-width 640px, a much smaller clamp — while
   keeping the bold weight + text-shadow so it still reads as *the* headline, not body copy. */
.headline { font-size: clamp(20px, 1.6vw + 16px, 34px); font-weight: 800; line-height: 1.35; text-shadow: 2px 2px 0 rgba(0, 0, 0, .22); margin-block-start: 4px; max-width: 640px; }

/* the two walkers + the CTA block, sitting together right at the grass line — pushed to the bottom of the flex
   column by margin-block-start:auto whenever the hero has slack (i.e. almost always); on a short/wide viewport
   where hero-content + ground-row genuinely don't both fit in 100vh, the hero itself just grows instead of the
   two overlapping (see the .hero comment above). */
.ground-row { position: relative; z-index: 2; margin-block-start: auto; padding-block: clamp(16px, 4vh, 36px) clamp(14px, 3vh, 28px); display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 2.5vw, 28px); padding-inline: 10px; }
.cta-block { display: flex; flex-direction: column; align-items: center; gap: 10px; max-inline-size: 580px; }
.walker { flex: none; inline-size: clamp(150px, 10.5vw + 109px, 260px); aspect-ratio: 1 / 1; overflow: hidden; }
.walker-flip { inline-size: 100%; block-size: 100%; }
.walker-blue .walker-flip { transform: scaleX(-1); }
@media (max-width: 479px) { .walker-blue { display: none; } }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 14px 22px; font-weight: 800; font-size: 15px; white-space: nowrap; border-width: 3px; box-shadow: 3px 3px 0 rgba(0, 0, 0, .4); transition: transform 140ms var(--ease-out); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .4); }
.btn-primary { background: linear-gradient(180deg, #ffe066 0%, #ffd23f 55%, #f2b705 100%); color: #2a1d00; box-shadow: inset 0 -5px 0 rgba(150, 95, 0, .45), inset 0 3px 0 rgba(255, 255, 255, .55), 3px 3px 0 rgba(0, 0, 0, .4); font-size: 17px; padding: 16px 26px; }
.btn-primary:active { box-shadow: inset 0 -5px 0 rgba(150, 95, 0, .45), inset 0 3px 0 rgba(255, 255, 255, .55), 1px 1px 0 rgba(0, 0, 0, .4); }
.btn-secondary { background: var(--panel); color: #fff; }
.btn-bazaar { background: var(--green); color: #04220f; }

.cta-chip { font-size: 12.5px; color: var(--text); background: rgba(10, 13, 24, .82); padding: 8px 14px; max-inline-size: 480px; }
.cta-chip a { color: var(--gold); text-decoration: underline; }

.facts { display: flex; gap: 8px; list-style: none; padding: 0; flex-wrap: wrap; justify-content: center; }
.facts li { background: rgba(10, 13, 24, .78); padding: 4px 12px; font-size: 12px; font-weight: 700; color: var(--gold); }

/* ---- sprite playback: 36-frame turntables and the 6-frame walk cycle, both left→right translateX sheets ---- */
/* physical left/top, not inset-inline-start: translateX() always moves in physical pixels regardless of page
   direction, and the sheet's frame 0 is always its physical-leftmost frame — pinning with a logical property
   would put frame 0 at the wrong edge on this RTL page and the animation would drag the sheet off in the wrong
   direction entirely (it did, before this comment existed). */
.spr { display: block; position: absolute; top: 0; left: 0; z-index: 1; block-size: 100%; inline-size: auto; max-inline-size: none; }
@keyframes spr-play { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.spr.spin36 { animation: spr-play 1.8s steps(36) infinite; }
.spr.spin6 { animation: spr-play 900ms steps(6) infinite; }
.turntable:hover .spr.spin36 { animation-play-state: paused; }

/* ---- features strip ---- */
.features { max-width: 1100px; margin: 0 auto; padding: 30px 20px; display: grid; grid-template-columns: 1fr; gap: 12px; }
.feature-tile { background: var(--panel); box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); padding: 18px; }
.feature-tile b { display: block; color: var(--gold); font-size: 16px; margin-block-end: 6px; }
.feature-tile p { color: var(--muted); font-size: 13px; }

/* ---- weapons ---- */
.weapons { max-width: 900px; margin: 0 auto; padding: 10px 20px 44px; text-align: center; }
.section-head { display: flex; align-items: center; justify-content: center; gap: 16px; }
.section-head h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 800; }
.portrait { inline-size: 46px; block-size: 46px; object-fit: cover; object-position: 50% 12%; border: 2px solid var(--ink); background: var(--panel2); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0; }
.tab { background: var(--panel2); padding: 9px 15px; font-weight: 700; font-size: 13px; box-shadow: 2px 2px 0 rgba(0, 0, 0, .3); transition: transform 140ms var(--ease-out), background-color 140ms ease, color 140ms ease; }
.tab:active { transform: translate(1px, 1px); }
.tab[aria-selected="true"] { background: var(--gold); color: #2a1d00; }
/* the stage is the 4:3/16:9 "photo card"; each panel becomes its direct flex children (display:contents) so the
   turntable can take a flat 70% of the card's own height and the caption pins to the bottom edge below it —
   [hidden] still wins over display:contents (equal specificity, but the browser only ever applies one `display`
   and the attribute selector is listed second below, so it's the one that's cascade-order-last for a hidden panel). */
.stage { background: var(--panel); box-shadow: 5px 5px 0 rgba(0, 0, 0, .35); padding: 20px 20px 16px; border-width: 3px; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.tab-panel { display: contents; }
.tab-panel[hidden] { display: none; }
.turntable { inline-size: auto; block-size: 70%; aspect-ratio: 1 / 1; overflow: hidden; position: relative; }
/* a soft gold spotlight and a dark ground-shadow ellipse, both behind the sprite (z-index:0 vs .spr's 1) so they
   read as lighting on the weapon rather than sitting on top of it */
.turntable::before { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(closest-side, rgba(255, 210, 63, .1), transparent 72%); }
.turntable::after { content: ""; position: absolute; inset-inline: 18%; inset-block-end: 4%; block-size: 14%; z-index: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent 75%); }
.caption { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.weapon-name { font-size: 22px; font-weight: 800; }
.weapon-blurb { color: var(--muted); font-size: 15px; max-width: 46ch; margin-inline: auto; }
@media (min-width: 640px) {
  .stage { aspect-ratio: 16 / 9; padding: 22px 28px 18px; }
}

/* ---- modes ---- */
.modes { max-width: 1100px; margin: 0 auto; padding: 10px 20px 44px; text-align: center; }
.modes h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 800; margin-block-end: 16px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-tile { background: var(--panel2); box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); padding: 16px 10px; border-width: 3px; }
.mode-tile b { display: block; color: var(--gold); font-size: 14px; margin-block-end: 4px; }
.mode-ico { display: inline-block; margin-inline-end: 4px; font-size: 15px; }
.mode-tile p { color: var(--muted); font-size: 12px; }

/* ---- how to play ---- */
.how { max-width: 900px; margin: 0 auto; padding: 10px 20px 54px; text-align: center; }
.how h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 800; margin-block-end: 16px; }
.how-steps { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
.how-steps li { background: var(--panel); box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); padding: 18px; border-width: 3px; }
.step-n { display: block; color: var(--gold); font-size: 26px; font-weight: 900; }
.how-steps b { display: block; font-size: 15px; margin: 4px 0; }
.how-steps p { color: var(--muted); font-size: 12px; }

/* ---- footer ---- */
.site-footer { padding: 22px 20px 34px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; max-width: 1100px; margin: 0 auto; border-block-start: 2px solid rgba(255, 255, 255, .08); font-size: 12px; color: var(--muted); }
.footer-links { display: flex; gap: 14px; }
.footer-links a { color: var(--muted); text-decoration: underline; }
.footer-brand { display: flex; gap: 10px; align-items: center; }

/* ---- breakpoints: 360px base up through 1440px ---- */
@media (min-width: 640px) {
  .features { grid-template-columns: repeat(3, 1fr); }
  .mode-grid { grid-template-columns: repeat(4, 1fr); }
  .how-steps { grid-template-columns: repeat(3, 1fr); }
}
/* ---- motion ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .cloud, .floater img.bob { animation: none !important; transform: none !important; }
  .spr.spin36, .spr.spin6 { animation: none !important; transform: translateX(0) !important; }
}
