/* ==========================================================================
   High Functioning Brains (HFB) — shared site stylesheet
   One file for every page. Calm, low-sensory, mobile-first.
   Themes: dark (default) → dim → light, stored in localStorage "hfb-theme"
   (same key the Play Together game uses).
   ========================================================================== */

/* ---------- Theme tokens ---------- */
:root,
html[data-theme="dark"] {
  --bg: #080c22;
  --bg-glow-a: rgba(42, 195, 254, .10);
  --bg-glow-b: rgba(155, 60, 240, .12);
  --surface: #111839;
  --surface-2: #18214d;
  --border: #2c3772;
  --text: #eef1ff;
  --muted: #b9c1e8;
  --link: #93cbff;
  --link-hover: #c4e3ff;
  --accent: #8fd3ff;
  --accent-2: #c9a8ff;
  --btn-text: #ffffff;
  --btn-a: #2360d6;
  --btn-b: #6a34cf;
  --btn-ghost-text: #eef1ff;
  --focus: #ffd98a;
  --live-bg: rgba(64, 214, 170, .14);
  --live-text: #9ff3d6;
  --planned-bg: rgba(170, 130, 255, .16);
  --planned-text: #dccbff;
  --header-bg: rgba(8, 12, 34, .94);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --art-frame: #000000;
  color-scheme: dark;
}
html[data-theme="dim"] {
  --bg: #25376a;
  --bg-glow-a: rgba(150, 200, 255, .16);
  --bg-glow-b: rgba(190, 160, 255, .16);
  --surface: #2f4482;
  --surface-2: #384f93;
  --border: #5a70b6;
  --text: #ffffff;
  --muted: #e0e6ff;
  --link: #d9eeff;
  --link-hover: #ffffff;
  --accent: #bfe6ff;
  --accent-2: #e2d3ff;
  --btn-text: #ffffff;
  --btn-a: #1d55c4;
  --btn-b: #5f2cc0;
  --btn-ghost-text: #ffffff;
  --focus: #ffe3a3;
  --live-bg: rgba(120, 240, 205, .18);
  --live-text: #cffbea;
  --planned-bg: rgba(210, 190, 255, .20);
  --planned-text: #f1e9ff;
  --header-bg: rgba(37, 55, 106, .95);
  --shadow: 0 10px 28px rgba(10, 18, 60, .30);
  --art-frame: #000000;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #edf2fd;
  --bg-glow-a: rgba(176, 214, 250, .55);
  --bg-glow-b: rgba(222, 212, 246, .65);
  --surface: #ffffff;
  --surface-2: #f5f3fd;
  --border: #cfd6ee;
  --text: #141a3a;
  --muted: #444d7a;
  --link: #2a3fbb;
  --link-hover: #1a2a8a;
  --accent: #1f5fcf;
  --accent-2: #6a31c4;
  --btn-text: #ffffff;
  --btn-a: #2457d0;
  --btn-b: #6a31c4;
  --btn-ghost-text: #141a3a;
  --focus: #1d3fbf;
  --live-bg: #def5ec;
  --live-text: #0b5e49;
  --planned-bg: #eee6fc;
  --planned-text: #55279f;
  --header-bg: rgba(237, 242, 253, .96);
  --shadow: 0 8px 24px rgba(40, 60, 140, .10);
  --art-frame: #000000;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem;          /* 18px base for readability */
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1000px 640px at 0% -10%, var(--bg-glow-a), transparent 65%),
    radial-gradient(900px 640px at 100% 0%, var(--bg-glow-b), transparent 65%);
  background-repeat: no-repeat;
}
:lang(fa) {
  font-family: "Vazirmatn", "Vazir", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.9;
}
img, picture, svg { max-width: 100%; height: auto; display: block; }
main { flex: 1 0 auto; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-inline-start: 1.25rem; }
li + li { margin-top: .35rem; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .75rem; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 7vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 4.6vw, 2.125rem); }
h3 { font-size: 1.25rem; }
strong, b { font-weight: 700; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  background: var(--surface); color: var(--text); padding: .75rem 1rem; border-radius: 10px;
  border: 2px solid var(--focus);
}
.skip-link:focus { top: 12px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 12px; min-height: 68px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; margin-inline-end: auto;
  min-height: 44px;
}
.brand:hover { color: var(--text); }
.brand img { width: 44px; height: 44px; }
.brand-name { font-size: 1.05rem; line-height: 1.2; }
.brand-name .short { display: none; }
@media (max-width: 400px) {
  .brand-name .full { display: none; }
  .brand-name .short { display: inline; font-size: 1.2rem; }
}

.header-tools { display: flex; align-items: center; gap: 8px; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 14px;
  font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
}
.tool-btn:hover { background: var(--surface-2); }
.tool-btn svg { width: 20px; height: 20px; flex: none; }
.menu-btn { display: none; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.site-nav li + li { margin: 0; }
.site-nav a {
  display: block; padding: .55rem .85rem; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 1rem;
}
.site-nav a:hover { background: var(--surface); }
.site-nav a[aria-current="page"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }

/* Mobile navigation: collapses behind the Menu button (only when JS is available). */
@media (max-width: 899px) {
  .js .menu-btn { display: inline-flex; }
  .site-nav { width: 100%; padding: 0 0 12px; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: .85rem 1rem; border-radius: 12px; font-size: 1.125rem; }
  .js .site-nav { display: none; }
  .js .site-nav.is-open { display: block; }
  .header-row { flex-wrap: wrap; }
  .header-row .site-nav { order: 3; }
  .js .site-nav.is-open { border-top: 1px solid var(--border); padding-top: 8px; }
}
@media (min-width: 900px) {
  .header-row .site-nav { order: 0; margin-inline-end: 8px; }
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section + .section { padding-top: 16px; }
@media (min-width: 768px) { .section { padding: 80px 0; } .section + .section { padding-top: 24px; } }
.section-head { max-width: 46rem; margin-bottom: 28px; }
.eyebrow {
  display: inline-block; font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .5rem;
}
.lead { font-size: clamp(1.15rem, 3.4vw, 1.35rem); color: var(--muted); max-width: 40rem; }
.muted { color: var(--muted); }
.small { font-size: 1rem; }
.prose { max-width: 44rem; }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 48px; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) {
  .hero { padding: 72px 0 64px; }
  .hero-grid { grid-template-columns: 1.15fr .85fr; gap: 56px; }
}
.hero h1 { margin-bottom: 1rem; }
.hero .tagline { font-size: clamp(1.15rem, 3.4vw, 1.35rem); color: var(--muted); margin-bottom: 1.75rem; max-width: 36rem; }
.hero-art { margin: 0; justify-self: center; width: min(100%, 300px); }
@media (min-width: 900px) { .hero-art { width: min(100%, 420px); } }
.art-frame {
  background: var(--art-frame); border-radius: 28px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.art-frame img { width: 100%; }
.hero-art figcaption, .art-caption { margin-top: .75rem; font-size: 1rem; color: var(--muted); text-align: center; }
.page-hero { padding: 40px 0 8px; }
@media (min-width: 768px) { .page-hero { padding: 64px 0 8px; } }
.page-hero .lead { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: .75rem 1.4rem; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1.05rem; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; text-align: center;
}
.btn-primary { color: var(--btn-text); background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); }
.btn-primary:hover { color: var(--btn-text); filter: brightness(1.08); text-decoration: none; }
.btn-ghost { color: var(--btn-ghost-text); background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { color: var(--btn-ghost-text); background: var(--surface-2); text-decoration: none; }
@media (max-width: 479px) { .actions .btn { width: 100%; } }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid { gap: 20px; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow);
}
@media (min-width: 768px) { .card { padding: 28px; } }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: .5rem; }
.card p { color: var(--muted); }
.card-link { display: block; color: var(--text); text-decoration: none; height: 100%; }
.card-link:hover { color: var(--text); background: var(--surface-2); }
.card-link .more { color: var(--link); font-weight: 700; }
.card-link:hover .more { text-decoration: underline; }

.feature {
  display: grid; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 24px; box-shadow: var(--shadow);
}
@media (min-width: 860px) { .feature { grid-template-columns: 1fr 1fr; padding: 40px; gap: 40px; } }
.feature > :last-child { margin-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .9rem; font-weight: 700; line-height: 1; padding: .45rem .7rem; border-radius: 999px;
  margin-bottom: .85rem;
}
.badge-live { background: var(--live-bg); color: var(--live-text); }
.badge-planned { background: var(--planned-bg); color: var(--planned-text); }
.badge-live::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

.note {
  border: 1px solid var(--border); border-inline-start: 4px solid var(--accent-2);
  background: var(--surface); border-radius: 14px; padding: 16px 18px; color: var(--text);
}
.note > :last-child { margin-bottom: 0; }

.check-list { list-style: none; padding: 0; }
.check-list li { position: relative; padding-inline-start: 1.6rem; }
.check-list li::before {
  content: ""; position: absolute; inset-inline-start: .15rem; top: .62em;
  width: .55rem; height: .55rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* Game preview tile (pure CSS, no screenshot needed) */
.game-tile {
  border-radius: 20px; padding: 22px; border: 1px solid var(--border);
  background:
    radial-gradient(400px 260px at 15% 0%, rgba(79,124,255,.35), transparent 70%),
    radial-gradient(400px 260px at 100% 100%, rgba(139,92,246,.35), transparent 70%),
    #0b1033;
  color: #eef1ff;
}
.game-tile .fa { font-size: 1.6rem; font-weight: 700; margin: 0 0 .25rem; }
.game-tile .en { margin: 0 0 1rem; color: #c9d0f5; }
.game-tile .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-tile .choice {
  aspect-ratio: 1 / 1; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(160,175,255,.3);
  font-size: clamp(2.2rem, 10vw, 3.2rem);
}
.game-tile .stars { margin: 1rem 0 0; letter-spacing: .25rem; font-size: 1.2rem; }



/* Symbol / quote */
.symbol { display: grid; gap: 28px; align-items: center; }
@media (min-width: 860px) { .symbol { grid-template-columns: .8fr 1.2fr; gap: 48px; } }
.symbol .art-frame { max-width: 300px; margin: 0 auto; width: 100%; }
@media (min-width: 860px) { .symbol .art-frame { max-width: 380px; } }
blockquote.founder {
  margin: 0; padding: 0; font-size: clamp(1.15rem, 3.2vw, 1.3rem); line-height: 1.75;
}
blockquote.founder p { margin-bottom: 1rem; }
.fa-motto { font-size: clamp(1.25rem, 4vw, 1.5rem); font-weight: 700; color: var(--accent); margin: .5rem 0 .25rem; }
.founder-sign { color: var(--muted); font-size: 1rem; }

/* Timeline / roadmap */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.steps .step-label { font-weight: 700; color: var(--accent); min-width: 5.5rem; }
.steps p { margin: 0; color: var(--muted); }

/* Swatches (press kit) */
.swatches { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.swatch { border-radius: 16px; border: 1px solid var(--border); overflow: hidden; background: var(--surface); }
.swatch span { display: block; height: 64px; }
.swatch p { margin: 0; padding: 10px 12px; font-size: .95rem; }

/* Contact band */
.band {
  border-radius: 24px; padding: 28px 24px; border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}
@media (min-width: 768px) { .band { padding: 44px; } }
.band > :last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-grid { display: grid; gap: 28px; padding: 40px 0 24px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand { display: flex; gap: 12px; align-items: center; margin-bottom: .75rem; font-weight: 700; }
.footer-brand img { width: 40px; height: 40px; }
.site-footer h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 0; }
.site-footer li a { display: inline-block; padding: .35rem 0; }
.footer-base { border-top: 1px solid var(--border); padding: 18px 0 28px; font-size: 1rem; color: var(--muted); }
.footer-base p { margin: 0 0 .25rem; }

/* ---------- Motion: off unless the user is fine with it ---------- */
@media (prefers-reduced-motion: no-preference) {
  a, .btn, .tool-btn, .card-link, .site-nav a { transition: background-color .2s ease, color .2s ease, filter .2s ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}
