/* Dune Scholars site styles. Plain CSS, no build step.
   Layout: single 1100px column; header and footer shared by every page.
   Logical properties (inline/block) are used throughout so an Arabic, right-to-left
   version only needs <html lang="ar" dir="rtl">. */
/* Colour tokens. Roles, not colour names; values and contrast are listed in DESIGN.md.
   Light mode = white canvas, midnight header/footer, turquoise only for buttons and highlights.
   Dark mode  = midnight canvas, slate panels, turquoise focus colour. */
:root {
  --bg: #FFFFFF;            /* page canvas */
  --surface: #FFFFFF;       /* cards, form panels */
  --ink: #0B1B3D;           /* body text, headings, outline buttons */
  --heading: #0B1B3D;
  --muted: #4A5568;         /* secondary text (7.5:1 on white) */
  --line: #E2E8F0;          /* borders, dividers (decorative) */
  --field-line: #718096;    /* form field borders (4.0:1 on white) */
  --logo-tile: #16324F;     /* logo tile in the header, so it stands out from --chrome */
  --accent: #2BE0D4;        /* primary buttons, highlights, markers (never text on white) */
  --accent-soft: #E0FAF8;   /* tag and icon backgrounds, hovers */
  --on-accent: #0B1B3D;     /* text on --accent (10:1) */
  --link: #0B6E69;          /* links and status tags (6.1:1 on white) */
  --eyebrow: #0B6E69;       /* small uppercase labels */
  --focus: #0B1B3D;         /* focus ring on light backgrounds */
  --chrome: #0B1B3D;        /* header and footer background */
  --chrome-ink: #FFFFFF;
  --chrome-muted: #CBD5E0;
  --chrome-line: #2D3748;
  --panel: #0B1B3D;         /* call-to-action box */
  --panel-ink: #FFFFFF;
  --badge: #0B1B3D;
  --on-badge: #FFFFFF;
  --sky: #F4F7FA;           /* hero background */
  --dune-1: #E2E8F0;
  --dune-2: #CBD5E0;
  --dune-3: #8A9A9A;
  --grid: rgba(11, 27, 61, 0.07);   /* hero grid lines */
  --card-line: #BDEBE7;             /* thin turquoise-tinted card borders (decorative) */
  --contour-1: #CBD5E0; --contour-2: #A9B6C2; --contour-3: #8A9A9A; --contour-4: #0B6E69; /* hero contour lines */
  --f-display: 'Space Grotesk', 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif; /* Readex Pro covers Arabic */
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace; /* labels, tags, badges */
  --f-body: 'IBM Plex Sans', 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A192F;
    --surface: #112240;
    --ink: #E2E8F0;
    --heading: #FFFFFF;
    --muted: #A0AEC0;
    --line: #2D3748;
    --field-line: #8A9A9A;
    --logo-tile: #0B1B3D;
    --accent: #2BE0D4;
    --accent-soft: #16324F;
    --on-accent: #0A192F;
    --link: #2BE0D4;
    --eyebrow: #2BE0D4;
    --focus: #2BE0D4;
    --chrome: #112240;
    --chrome-ink: #FFFFFF;
    --chrome-muted: #A0AEC0;
    --chrome-line: #2D3748;
    --panel: #112240;
    --panel-ink: #FFFFFF;
    --badge: #FFFFFF;
    --on-badge: #0A192F;
    --sky: #0D1F3A;
    --dune-1: #16324F;
    --dune-2: #1C2D4A;
    --dune-3: #2D3748;
    --grid: rgba(43, 224, 212, 0.08);
    --card-line: rgba(43, 224, 212, 0.28);
    --contour-1: #1C2D4A; --contour-2: #2D3748; --contour-3: #3E5A7A; --contour-4: #2BE0D4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
:lang(ar) body, body:lang(ar) { line-height: 1.8; }
img, svg { max-width: 100%; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--heading); font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 16px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.wrap {
  max-width: 1100px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.eyebrow {
  font-family: var(--f-display);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--eyebrow);
}
.lede { color: var(--muted); font-size: 1.15rem; max-width: 60ch; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Header ---------- */
.site-header { border-block-end: 1px solid var(--chrome-line); background: var(--chrome); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--chrome-ink); text-decoration: none; font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; }
.brand svg { width: 38px; height: 38px; flex: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.nav a { color: var(--chrome-ink); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, 0.12); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--accent); }
.lang { font-size: 0.9rem; color: var(--chrome-muted); padding-inline-start: 8px; border-inline-start: 1px solid var(--chrome-line); margin-inline-start: 4px; }
.lang small { font-size: 0.75rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem/1 var(--f-display);
  padding: 14px 22px; border-radius: 999px;
  border: 2px solid var(--ink); color: var(--ink); background: transparent;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Hero ---------- */
.hero { background: var(--sky); overflow: hidden; }
.hero .wrap { padding-block: clamp(48px, 9vw, 96px) 0; display: flex; flex-direction: column; gap: 20px; }
.hero h1 { max-width: 16ch; }
.dunes { width: 100%; height: clamp(90px, 16vw, 170px); margin-block-start: clamp(24px, 5vw, 48px); }
.dunes .d1 { fill: var(--dune-1); }
.dunes .d2 { fill: var(--dune-2); }
.dunes .d3 { fill: var(--dune-3); }
.dune-wrap { position: relative; }
.dune-wrap .sun {
  position: absolute; inset-inline-end: 18%; top: 4%;
  width: clamp(36px, 6vw, 72px); aspect-ratio: 1; border-radius: 50%;
  background: var(--accent);
}
.page-head { padding-block: clamp(40px, 7vw, 72px) clamp(24px, 4vw, 40px); display: flex; flex-direction: column; gap: 14px; }

/* ---------- Sections ---------- */
section.band { padding-block: clamp(40px, 7vw, 72px); }
section.band + section.band { padding-block-start: 0; }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-block-end: 28px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.point { border-block-start: 3px solid var(--accent); padding-block-start: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.point p { color: var(--muted); }
.prose { max-width: 66ch; display: flex; flex-direction: column; gap: 16px; }
.prose p { color: var(--ink); }
.prose ul { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.prose li::marker { color: var(--accent); }

/* ---------- Game cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0;
}
.card-art { aspect-ratio: 16 / 10; width: 100%; max-width: 100%; background: #0A1013; display: grid; place-items: center; overflow: hidden; position: relative; }
.card-art img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-art.soon { background: linear-gradient(180deg, var(--sky), var(--accent-soft)); }
.card-art .digits { font-family: var(--f-display); font-weight: 600; font-size: clamp(2.4rem, 7vw, 4rem); color: var(--link); letter-spacing: 0.08em; }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body p { color: var(--muted); }
.card-body .actions { margin-block-start: auto; padding-block-start: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.78rem; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.badge { position: absolute; inset-block-start: 14px; inset-inline-start: 14px; background: var(--badge); color: var(--on-badge); font: 600 0.78rem/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 11px; border-radius: 999px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: start; }
.mail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.mail-addr { font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; word-break: break-all; user-select: all; }
form.contact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.hint { font-size: 0.88rem; color: var(--muted); }
.hidden-field { position: absolute; inset-inline-start: -9999px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--chrome); border-block-start: 1px solid var(--chrome-line); margin-block-start: clamp(40px, 7vw, 72px); }
.site-footer .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; color: var(--chrome-muted); font-size: 0.92rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.site-footer nav a { padding-block: 8px; }
.site-footer a { color: var(--chrome-ink); }

@media (max-width: 760px) {
  .grid-3, .cards, .contact-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .nav { gap: 4px 2px; }
  .nav a { padding: 10px 9px; }
}
@media (max-width: 480px) {
  .nav a { padding: 10px 8px; }
  .lang { padding-inline-start: 6px; margin-inline-start: 2px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a { transition: background-color 0.15s ease; }
}

.more-soon { margin-block-start: 22px; color: var(--muted); }
.more-soon b { color: var(--heading); }
/* Prose inside the page wrapper: align with the page heading, keep lines readable. */
.wrap.prose { max-width: 1100px; }
.wrap.prose > * { max-width: 66ch; }

/* ---------- For teachers and schools ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack-tight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tools { display: flex; flex-direction: column; border-block-start: 1px solid var(--line); }
.tool {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 40px;
  padding-block: 28px; border-block-end: 1px solid var(--line);
}
.tool-head { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tool-head h3 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); }
.tool-pitch { color: var(--muted); font-size: 1.08rem; max-width: 36ch; }
.tool-icon {
  width: 44px; height: 44px; padding: 9px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); border: 1px solid var(--card-line);
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.tool-feats { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.tool-feats li::marker { color: var(--accent); }
.tag.status { background: transparent; border: 1px solid var(--link); color: var(--link); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 40px; align-items: start; }
.split .prose { gap: 14px; }
.cta {
  background: var(--panel); color: var(--panel-ink); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 20px 32px;
  align-items: center; justify-content: space-between;
}
.cta .stack { max-width: 56ch; gap: 8px; }
.cta p { color: inherit; opacity: 0.85; }
.cta h2 { color: var(--panel-ink); }
.cta :focus-visible { outline-color: var(--accent); } /* turquoise on the midnight/slate panel: 9.6:1 or more */
/* Home: compact tool list */
.tool-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; border-block-start: 1px solid var(--line); }
.tool-mini a {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: start;
  padding-block: 18px; border-block-end: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.tool-mini .tool-icon { grid-row: span 2; width: 40px; height: 40px; padding: 8px; }
.tool-mini b { font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; }
.tool-mini span { color: var(--muted); }
.tool-mini a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.section-foot { margin-block-start: 22px; }
@media (max-width: 760px) {
  .tool, .split, .tool-mini { grid-template-columns: minmax(0, 1fr); }
  .tool { padding-block: 24px; }
}

/* ---------- Tech layer: mono labels, hero grid + contour lines, dashboard cards, glow (dark only) ---------- */
h1 { letter-spacing: -0.02em; }
/* monospace labels */
.eyebrow, .tag, .badge, .lang small { font-family: var(--f-mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.eyebrow { font-size: 0.78rem; letter-spacing: 0.1em; }
.tag { font-size: 0.75rem; border-radius: 6px; padding: 4px 8px; }
.badge { border-radius: 6px; font-size: 0.75rem; }
.tag.status { display: inline-flex; align-items: center; gap: 6px; }
.tag.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* hero: faint grid + contour-line dunes that draw in once */
.hero { position: relative; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 75% 45%, #000 35%, transparent 80%);
          mask-image: radial-gradient(ellipse 80% 90% at 75% 45%, #000 35%, transparent 80%); }
.contours { width: 100%; height: clamp(90px, 16vw, 170px); margin-block-start: clamp(24px, 5vw, 48px); overflow: visible; }
.contours path { fill: none; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.contours .c1 { stroke: var(--contour-1); } .contours .c2 { stroke: var(--contour-2); }
.contours .c3 { stroke: var(--contour-3); } .contours .c4 { stroke: var(--contour-4); stroke-width: 2.5; }
.contours circle { fill: var(--contour-4); }
.dune-wrap .sun { background: var(--accent); }
@media (prefers-color-scheme: dark) {
  .contours .c4 { filter: drop-shadow(0 0 6px rgba(43, 224, 212, 0.7)); }
  .dune-wrap .sun { box-shadow: 0 0 0 8px rgba(43, 224, 212, 0.12), 0 0 40px rgba(43, 224, 212, 0.45); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero::before { animation: ds-fade 1.6s ease-out both; }
  .contours { animation: ds-reveal 2.6s cubic-bezier(.3,.7,.2,1) both; } /* clip reveal: works at any width */
  .contours circle { opacity: 0; animation: ds-fade .5s ease-out 2.2s forwards; }
  .dune-wrap .sun { animation: ds-fade 1.2s ease-out .4s both; }
}
@keyframes ds-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ds-fade { from { opacity: 0; } to { opacity: 1; } }
/* dashboard cards */
.card, form.contact, .mail-card { border-color: var(--card-line); }
.tool-icon { border: 1px solid var(--card-line); background: var(--accent-soft); stroke-width: 1.75; }
.point h3 { display: flex; align-items: center; gap: 10px; }
.point .tool-icon { width: 36px; height: 36px; padding: 7px; }
@media (prefers-color-scheme: dark) {
  .card, form.contact, .mail-card { background: rgba(17, 34, 64, 0.72); }
  .btn.primary { box-shadow: 0 0 0 1px rgba(43, 224, 212, 0.5), 0 0 22px rgba(43, 224, 212, 0.35); }
  .card:hover, .tool-mini a:hover .tool-icon { box-shadow: 0 0 0 1px rgba(43, 224, 212, 0.45), 0 0 24px rgba(43, 224, 212, 0.18); }
  .cta { border-color: rgba(43, 224, 212, 0.35); box-shadow: 0 0 40px rgba(43, 224, 212, 0.10); }
}
@media (prefers-reduced-motion: no-preference) { .card, .tool-icon { transition: box-shadow .2s ease, border-color .2s ease; } }

/* ---------- Review fixes ---------- */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
.skip:focus-visible { outline-color: var(--accent); }
.nav a:focus-visible { outline-offset: -3px; outline-color: var(--chrome-ink); }
.nav a[aria-current="page"]:focus-visible { outline-color: var(--on-accent); }
.field input, .field select, .field textarea { border-color: var(--field-line); }
.brand svg > rect:first-of-type { fill: var(--logo-tile); }
@media (prefers-color-scheme: dark) {
  .card-art.soon { background: linear-gradient(180deg, #16324F, #112240); }
}
.btn[aria-disabled="true"] { cursor: default; color: var(--muted); border-color: var(--field-line); border-style: dashed; }
.btn[aria-disabled="true"]:hover { background: transparent; }

/* ---------- App previews on /schools/ ---------- */
.tool-shot { grid-column: 1 / -1; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.tool-shot img { width: 100%; height: auto; border: 1px solid var(--card-line); border-radius: var(--radius); background: #F4F7FA; }
.tool-shot figcaption { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
