:root {
  --font-fa: "Vazirmatn", system-ui, sans-serif;
  --font-en: "JetBrains Mono", ui-monospace, monospace;
  --font-body: var(--font-fa);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --page-pad: clamp(1.125rem, 4vw, 4rem);
  --content-width: 78rem;
  --icon-radius: 20%;
  --border: rgba(242, 240, 234, 0.15);
  --background: #0b0b0b;
  --surface: rgba(20, 20, 19, 0.74);
  --text: #f2f0ea;
  --muted: #b7b3aa;
  --accent: #d08b34;
  --accent-ink: #1b1003;
  color-scheme: dark;
}

:root[lang="en"] {
  --font-body: var(--font-en);
}

:root[data-theme="light"] {
  --background: #f2f0ea;
  --surface: rgba(255, 255, 255, 0.72);
  --text: #181816;
  --muted: #5f5b54;
  --border: rgba(24, 24, 22, 0.17);
  --accent: #9d5d0d;
  --accent-ink: #fffaf3;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { min-width: 20rem; background: var(--background); }

body {
  min-width: 20rem;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 34rem),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 0) 0 0 / 2.625rem 2.625rem,
    var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 220ms var(--ease-in-out), color 220ms var(--ease-in-out);
}

img { display: block; max-inline-size: 100%; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--text);
  color: var(--background);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-shell {
  width: min(100%, var(--content-width));
  min-height: 100svh;
  margin: 0 auto;
  padding: max(var(--page-pad), env(safe-area-inset-top)) var(--page-pad) max(var(--page-pad), env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(2.5rem, 6vw, 6rem);
}

.site-header,
.site-footer,
.nav-links,
.header-tools,
.stat-list,
.store-list,
.tag-list,
.footer-links {
  display: flex;
  align-items: center;
}

.site-header {
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* Studio mark. Both shapes default to the dark-theme white; the light theme
   swaps in the two-tone brand colours. Only the fill transitions, matching
   the duration already used for the rest of the theme swap. */
.brand-mark {
  height: 1.5em;
  width: calc(1.5em * 1.42102);
  flex: none;
  overflow: visible;
}

.brand-mark-a,
.brand-mark-b {
  fill: #fff;
  transition: fill 220ms var(--ease-in-out);
}

:root[data-theme="light"] .brand-mark-a { fill: #e3c058; }
:root[data-theme="light"] .brand-mark-b { fill: #282a2c; }

.header-tools { gap: 0.5rem; }

.icon-button,
.language-link {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-family: var(--font-en);
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}

.icon-button:hover,
.language-link:hover {
  border-color: var(--text);
  background: var(--surface);
}

.icon-button:active,
.language-link:active,
.store-button:active,
.game-card:active {
  transform: scale(0.97);
}

.theme-symbol {
  position: relative;
  width: 1rem;
  height: 1rem;
  display: grid;
  place-items: center;
}

.theme-symbol svg {
  grid-area: 1 / 1;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: opacity 160ms var(--ease-out), transform 180ms var(--ease-out);
}

.theme-sun { opacity: 1; transform: scale(1) rotate(0); }
.theme-moon { opacity: 0; transform: scale(0.82) rotate(-18deg); }
:root[data-theme="light"] .theme-sun { opacity: 0; transform: scale(0.82) rotate(18deg); }
:root[data-theme="light"] .theme-moon { opacity: 1; transform: scale(1) rotate(0); }

.home-main { align-self: center; }

.home-kicker,
.eyebrow,
.game-kind,
.meta-label,
.footer-label,
.crumb,
.store-note {
  color: var(--muted);
  font-family: var(--font-en);
  font-size: clamp(0.65rem, 1vw, 0.75rem);
  letter-spacing: 0.12em;
}

.home-kicker { margin: 0 0 0.9rem; }

.home-title {
  max-width: 12ch;
  margin: 0 0 clamp(2rem, 5vw, 4rem);
  font-size: clamp(2.7rem, 8vw, 7.2rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.game-index {
  display: grid;
  border-block-start: 1px solid var(--border);
}

.game-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(2rem, 0.55fr) minmax(0, 1fr) minmax(8rem, 0.75fr) auto;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 2rem);
  min-height: clamp(6.25rem, 10vw, 9rem);
  padding: clamp(0.75rem, 1.5vw, 1.25rem) 0;
  border-block-end: 1px solid var(--border);
  isolation: isolate;
  transition: opacity 160ms ease, transform 180ms var(--ease-out);
}

.game-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(var(--page-pad) * -0.45);
  border-radius: 1.1rem;
  background: var(--surface);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 180ms ease, transform 220ms var(--ease-out);
}

.game-card:hover::after,
.game-card:focus-visible::after {
  opacity: 1;
  transform: scale(1);
}

.game-index.is-peeking .game-card:not(.is-peek-target) { opacity: 0.38; }

.game-number { color: var(--muted); font-family: var(--font-en); font-size: 0.72rem; }

.game-name {
  display: block;
  font-size: clamp(2rem, 6.4vw, 5.4rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.96;
  transition: color 160ms ease, transform 180ms var(--ease-out);
}

.game-card:hover .game-name,
.game-card:focus-visible .game-name { color: var(--accent); transform: translateX(var(--title-shift, -0.22em)); }
html[dir="ltr"] .game-card:hover .game-name,
html[dir="ltr"] .game-card:focus-visible .game-name { --title-shift: 0.22em; }

.game-kind { justify-self: end; text-align: end; }

.game-thumb {
  width: clamp(3.5rem, 7vw, 5.75rem);
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--icon-radius);
  object-fit: cover;
  box-shadow: 0 1.5rem 3rem -1.75rem rgba(0, 0, 0, 0.7);
  transition: transform 220ms var(--ease-out), box-shadow 220ms ease;
}

.game-card:hover .game-thumb,
.game-card:focus-visible .game-thumb { transform: rotate(-2deg) scale(1.04); box-shadow: 0 2rem 3.5rem -1.5rem rgba(0, 0, 0, 0.6); }

.game-preview {
  position: fixed;
  z-index: 5;
  width: clamp(12rem, 19vw, 17.5rem);
  aspect-ratio: 1;
  pointer-events: none;
  border-radius: var(--icon-radius);
  opacity: 0;
  overflow: hidden;
  box-shadow: 0 2rem 6rem -1.5rem rgba(0, 0, 0, 0.75);
  transition: opacity 180ms ease;
}

.game-preview.is-visible { opacity: 1; }
.game-preview img { width: 100%; height: 100%; object-fit: cover; }

.home-supporting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  margin-top: clamp(2rem, 5vw, 4rem);
}

.home-supporting p { max-width: 38ch; margin: 0; color: var(--muted); line-height: 1.8; }

.text-link {
  color: var(--text);
  border-block-end: 1px solid var(--accent);
  padding-block-end: 0.18rem;
  transition: color 160ms ease, border-color 160ms ease;
}

.text-link:hover { color: var(--accent); }

.site-footer {
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.stat-list { flex-wrap: wrap; gap: 0.65rem 1rem; color: var(--muted); }
.stat-list strong { color: var(--text); font-family: var(--font-en); font-size: 0.82rem; font-weight: 500; }
.footer-links { flex-wrap: wrap; gap: 0.85rem; color: var(--muted); font-size: 0.85rem; }
.footer-links a:hover { color: var(--accent); }

.content-main { align-self: start; }

.crumb {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  margin-block-end: clamp(2rem, 5vw, 4rem);
}

.crumb a { color: var(--muted); transition: color 160ms ease; }
.crumb a:hover { color: var(--accent); }

.game-hero {
  display: grid;
  grid-template-columns: minmax(10rem, 0.75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: clamp(2.5rem, 8vw, 8rem);
  min-height: min(66svh, 42rem);
}

.game-icon-frame {
  display: grid;
  place-items: center;
  padding: clamp(1.75rem, 4vw, 3.5rem);
  border: 1px solid var(--border);
  border-radius: clamp(1.5rem, 4vw, 3.5rem);
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(130%);
}

.game-icon-frame img {
  width: min(100%, 16rem);
  height: auto;
  border-radius: var(--icon-radius);
  box-shadow: 0 2.5rem 4.5rem -2rem rgba(0, 0, 0, 0.64);
}

.eyebrow { margin: 0 0 0.85rem; }

.game-page-title,
.document-title {
  margin: 0;
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 0.94;
}

.game-description {
  max-width: 37ch;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.9;
}

.tag-list { flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 1.75rem; padding: 0; list-style: none; }

.tag-list li {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.store-list { flex-wrap: wrap; gap: 0.65rem; }

.store-button {
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-weight: 700;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.store-button:hover { border-color: var(--text); background: var(--text); color: var(--background); }
.store-button--primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.store-button--primary:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); filter: brightness(1.06); }

.store-note { margin: 0.9rem 0 0; letter-spacing: 0.04em; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.56fr);
  gap: clamp(2rem, 6vw, 6rem);
  margin-top: clamp(4rem, 8vw, 8rem);
  padding-top: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--border);
}

.detail-grid h2,
.document-main h2 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  letter-spacing: -0.035em;
}

.detail-grid p,
.detail-grid li,
.document-main p,
.document-main li {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.9;
}

.detail-grid ul,
.document-main ul { padding-inline-start: 1.15rem; }

.facts {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.facts div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: var(--font-en); font-size: 0.78rem; text-align: end; }

.document-main { width: min(100%, 46rem); margin-inline: auto; padding-block: clamp(1rem, 5vw, 4rem); }
.document-title { margin-bottom: 1.75rem; }
.document-lede { margin: 0 0 3rem; color: var(--muted); font-size: 1.1rem; line-height: 1.9; }
.document-main section { margin-top: 2.5rem; }
.contact-card { padding: 1.25rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); }
.measurement-control { margin: 0.25rem 0 0; }
.measurement-status { min-height: 1.5rem; margin: 0.85rem 0 0; color: var(--muted); line-height: 1.8; }

@media (min-width: 721px) {
  .page--home .site-shell { gap: clamp(1.5rem, 3vw, 3rem); }
  .page--home .home-title { margin-bottom: clamp(1.5rem, 2.5vw, 2.5rem); }
  .page--home .game-card { min-height: 0; padding-block: 0.4rem; }
  .page--home .home-supporting { margin-top: clamp(1.5rem, 2.5vw, 2.5rem); }
}

@media (hover: hover) and (pointer: fine) {
  .site-header a,
  .site-footer a { transition: color 160ms ease; }
  .site-header a:hover { color: var(--accent); }
}

@media (max-width: 720px) {
  .site-shell { gap: 2.5rem; }
  .site-header { align-items: flex-start; }
  .game-card { grid-template-columns: 1.8rem minmax(0, 1fr) auto; min-height: 5.75rem; gap: 0.75rem; }
  .game-kind { display: none; }
  .game-name { font-size: clamp(2rem, 13vw, 3.65rem); }
  .game-thumb { width: 3.5rem; }
  .home-supporting { grid-template-columns: 1fr; align-items: start; }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .game-preview { display: none; }
  .game-hero { grid-template-columns: 1fr; gap: 2rem; min-height: auto; }
  .game-icon-frame { width: min(100%, 19rem); padding: 1.5rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .store-list { display: grid; grid-template-columns: 1fr; }
  .store-button { width: 100%; }
}

@media (max-width: 380px) {
  .brand { font-size: 0.9rem; }
  .game-card { grid-template-columns: 1.45rem minmax(0, 1fr) auto; }
  .game-thumb { width: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .game-icon-frame,
  .contact-card,
  .game-card::after { background: var(--background); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --muted: #e4e0d7; --border: rgba(242, 240, 234, 0.55); }
  :root[data-theme="light"] { --muted: #35322e; --border: rgba(24, 24, 22, 0.58); }
}

/* The home page is an index, not a catalogue: it keeps the original, theatrical composition. */
.page--home {
  overflow: hidden;
}

body.page--home {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 0) 0 0 / 2.625rem 2.625rem,
    var(--background);
}

:root.has-ambient-grid body.page--home { background: var(--background); }

.ambient-grid {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100vw;
  height: 100svh;
  pointer-events: none;
}

.page--home .site-shell {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  padding-block: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-bottom));
  gap: 0;
}

.page--home .site-header,
.page--home .home-main,
.page--home .site-footer {
  position: relative;
  z-index: 1;
}

.page--home .site-header {
  align-self: start;
}

.page--home .home-main {
  display: grid;
  min-height: 0;
  place-items: center;
}

.page--home .game-index {
  width: min(100%, 94rem);
  border: 0;
}

.page--home .game-card {
  display: grid;
  grid-template-columns: minmax(3.5rem, 0.36fr) minmax(0, 1fr) minmax(9rem, 0.32fr);
  align-items: baseline;
  min-height: 0;
  padding: clamp(0.3rem, 0.7vh, 0.7rem) 0;
  border: 0;
  gap: clamp(1rem, 3vw, 3.5rem);
  opacity: 1;
}

.page--home .game-card::after,
.page--home .game-card:hover::after,
.page--home .game-card:focus-visible::after {
  display: none;
}

.page--home .game-number {
  align-self: center;
  color: var(--muted);
  font-size: clamp(0.68rem, 0.8vw, 0.76rem);
  letter-spacing: 0.12em;
}

.page--home .game-name {
  color: var(--text);
  font-size: clamp(3.45rem, 9.1vw, 8.8rem);
  font-weight: 800;
  letter-spacing: -0.085em;
  line-height: 0.86;
  white-space: nowrap;
}

.page--home .game-kind {
  align-self: center;
  justify-self: start;
  color: var(--muted);
  font-size: clamp(0.67rem, 0.86vw, 0.8rem);
  opacity: 0;
  transform: translateY(0.3rem);
  transition: opacity 160ms ease, transform 180ms var(--ease-out);
}

html[dir="rtl"] .page--home .game-kind {
  justify-self: end;
  text-align: end;
}

.page--home .game-thumb {
  display: none;
}

.page--home .game-index.is-peeking .game-card:not(.is-peek-target) .game-name,
.page--home .game-index.is-keyboard-active .game-card:not(.is-peek-target) .game-name {
  opacity: 0.24;
}

.page--home .game-card.is-peek-target .game-kind,
.page--home .game-card:focus-visible .game-kind {
  opacity: 1;
  transform: translateY(0);
}

.page--home .game-card:focus-visible .game-name {
  color: var(--accent);
  transform: none;
}

.page--home .game-preview {
  top: 0;
  left: 0;
  width: clamp(12rem, 18vw, 17rem);
  border-radius: var(--icon-radius);
  clip-path: inset(7% round var(--icon-radius));
  transition: opacity 160ms ease, clip-path 220ms var(--ease-out);
}

.page--home .game-preview.is-visible {
  clip-path: inset(0 round var(--icon-radius));
}

.page--home .site-footer {
  align-self: end;
  padding-top: 0;
  border-top: 0;
}

@media (hover: hover) and (pointer: fine) {
  .page--home .game-card.is-peek-target .game-name {
    color: var(--text);
    transform: translateX(-0.08em);
  }

  html[dir="ltr"] .page--home .game-card.is-peek-target .game-name {
    transform: translateX(0.08em);
  }
}

@media (max-width: 720px) {
  .page--home {
    overflow: visible;
  }

  .page--home .site-shell {
    min-height: 100svh;
    padding-block: max(1.125rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-bottom));
    gap: 2.25rem;
  }

  .page--home .home-main {
    display: block;
  }

  .page--home .game-index {
    width: 100%;
    border-block-start: 1px solid var(--border);
  }

  .page--home .game-card {
    grid-template-columns: 1.8rem minmax(0, 1fr) auto;
    align-items: center;
    min-height: 5.75rem;
    padding: 0.7rem 0;
    border-block-end: 1px solid var(--border);
    gap: 0.8rem;
  }

  .page--home .game-number {
    align-self: center;
    font-size: 0.66rem;
  }

  .page--home .game-name {
    font-size: clamp(2.55rem, 13vw, 4.3rem);
    letter-spacing: -0.075em;
    line-height: 0.9;
    white-space: normal;
  }

  .page--home .game-kind {
    display: none;
  }

  .page--home .game-thumb {
    display: block;
    width: clamp(3.5rem, 17vw, 4.5rem);
    height: auto;
    border-radius: var(--icon-radius);
    box-shadow: none;
    transform: none;
  }

  .page--home .site-footer {
    padding-top: 0;
  }
}

@media (max-width: 380px) {
  .page--home .game-card {
    grid-template-columns: 1.35rem minmax(0, 1fr) auto;
    gap: 0.6rem;
  }

  .page--home .game-name {
    font-size: clamp(2.3rem, 12.5vw, 3.2rem);
  }
}
