:root {
  --bg: #070b1a;
  --bg-alt: #0b1230;
  --panel: #111a3a;
  --line: rgba(255, 255, 255, 0.1);
  --text: #e9edff;
  --muted: #a3accc;
  --accent: #ffb454;
  --accent-ink: #1a1203;
  --accent-2: #5ad1ff;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Vazirmatn", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
:lang(fa) :is(h1, h2, h3), :lang(ar) :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.45; }
body:lang(fa), body:lang(ar) { line-height: 1.9; }

p { margin: 0 0 1em; }
a { color: var(--accent-2); }
img, canvas, svg { display: block; max-width: 100%; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); }

.skip {
  position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px;
}
.skip:focus { top: 8px; }

.draft-banner {
  background: #2a1f06; color: #ffd9a0; text-align: center;
  font-size: 0.875rem; padding: 6px 16px; border-bottom: 1px solid rgba(255, 180, 84, 0.25);
}

/* header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 11, 26, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 28px; height: 28px; }
.beta-tag { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; color: var(--accent-ink); background: var(--accent); padding: 2px 7px; border-radius: 999px; }
.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: 999px; font-size: 0.95rem;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav .nav-cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav .nav-cta:hover { background: #ffc374; color: var(--accent-ink); }

.header-tools { display: flex; align-items: center; gap: 10px; }
.lang select {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer;
}
.lang select:hover { border-color: rgba(255, 255, 255, 0.3); }

.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; padding: 0; }
.menu-toggle span { display: block; width: 18px; height: 2px; background: var(--text); margin: 4px auto; border-radius: 2px; }

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

/* hero */
.hero {
  position: relative; overflow: hidden;
  min-height: min(82vh, 760px);
  display: flex; align-items: center;
  background: radial-gradient(ellipse at 70% 40%, #14224d 0%, var(--bg) 62%);
}
:dir(rtl) .hero { background: radial-gradient(ellipse at 30% 40%, #14224d 0%, var(--bg) 62%); }
#sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(7, 11, 26, 0.85) 0%, rgba(7, 11, 26, 0.35) 55%, transparent 100%);
}
:dir(rtl) .hero::after { background: linear-gradient(to left, rgba(7, 11, 26, 0.85) 0%, rgba(7, 11, 26, 0.35) 55%, transparent 100%); }
.hero-inner { position: relative; z-index: 2; padding-block: 72px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); max-width: 16ch; text-wrap: balance; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 0.8em; }
:lang(fa) .eyebrow, :lang(ar) .eyebrow { letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 46ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: 12px 24px; border-radius: 999px; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ffc374; }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); }

/* sections */
.section { padding-block: clamp(56px, 9vw, 112px); }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.intro { color: var(--muted); max-width: 60ch; margin-bottom: 2.2em; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: step; }
.steps li {
  position: relative; counter-increment: step;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.steps li::before {
  content: counter(step);
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 180, 84, 0.15); color: var(--accent); font-weight: 700; margin-bottom: 14px;
}
:lang(fa) .steps li::before { content: counter(step, persian); }
:lang(ar) .steps li::before { content: counter(step, arabic-indic); }
.steps h3 { font-size: 1.15rem; }
.steps p { color: var(--muted); margin: 0; }

.cards { display: grid; gap: 18px; }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cards-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card h3 { font-size: 1.15rem; }
.card p { color: var(--muted); margin: 0; }
.card .chip { margin-bottom: 14px; }
.chip {
  display: inline-block; background: rgba(90, 209, 255, 0.14); color: var(--accent-2);
  font-size: 0.85rem; font-weight: 600; padding: 3px 12px; border-radius: 999px;
}
.note { margin: 28px 0 0; color: var(--muted); border-inline-start: 3px solid var(--accent); padding-inline-start: 14px; }

/* video */
.video { margin: 0; }
.video video { width: 100%; height: auto; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); border: 1px solid var(--line); }
.video figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.video figcaption strong { color: var(--text); font-weight: 600; }
.video-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 24px; }
.video-note { color: var(--muted); font-size: 0.9rem; margin: 18px 0 0; }

/* non-commercial notice */
.notice { border: 1px solid rgba(90, 209, 255, 0.35); background: rgba(90, 209, 255, 0.08); border-radius: 12px; padding: 12px 16px; font-size: 0.95rem; margin: 0 0 24px; max-width: 68ch; }
.notice-foot { width: 100%; font-size: 0.85rem; max-width: 80ch; }

/* faq */
details { border-bottom: 1px solid var(--line); padding: 4px 0; }
summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { color: var(--muted); margin: 0 0 16px; }

/* form */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
label { font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px rgba(90, 209, 255, 0.2); }
input:user-invalid { border-color: #ff7a7a; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.hint { margin: 0; font-size: 0.9rem; color: var(--muted); }
.status { grid-column: 1 / -1; margin: 0; padding: 12px 16px; border-radius: 12px; background: rgba(90, 209, 255, 0.12); color: var(--text); }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 32px; color: var(--muted); font-size: 0.95rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.footer-row p { margin: 0; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); }
.copy { width: 100%; font-size: 0.85rem; }

/* legal pages (datenschutz.html) */
.back-link { margin-inline-start: auto; color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; }
.back-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.legal { padding-block: clamp(40px, 7vw, 80px); }
.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 0.4em; }
.legal h2 { font-size: 1.25rem; margin-top: 2em; }
.legal p, .legal li { max-width: 68ch; }
.legal ul { padding-inline-start: 1.3em; margin: 0 0 1em; }
.legal address { font-style: normal; margin-bottom: 1em; }
.ph { background: rgba(255, 180, 84, 0.18); color: #ffd9a0; padding: 0 5px; border-radius: 4px; }
.draft-box {
  border: 1px solid rgba(255, 180, 84, 0.4); background: rgba(255, 180, 84, 0.08);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 2.4em; color: #ffd9a0; font-size: 0.95rem;
}
.draft-box ul { margin: 8px 0 0; }
.draft-box li { margin-bottom: 6px; }
.footer-links a[aria-current="page"] { color: var(--text); }

/* responsive */
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(7, 11, 26, 0.98); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; display: none; margin: 0;
  }
  .site-header.open .nav { display: flex; }
  .nav a { padding: 12px 8px; border-radius: 8px; }
  .nav .nav-cta { text-align: center; margin-top: 8px; }
  .header-tools { margin-inline-start: auto; }
  .hero { align-items: flex-start; min-height: 620px; }
  .hero-inner { padding-top: 40px; }
  .hero::after { background: linear-gradient(to bottom, rgba(7, 11, 26, 0.8) 0%, rgba(7, 11, 26, 0.2) 60%, transparent 100%); }
  :dir(rtl) .hero::after { background: linear-gradient(to bottom, rgba(7, 11, 26, 0.8) 0%, rgba(7, 11, 26, 0.2) 60%, transparent 100%); }
}
@media (max-width: 560px) {
  .form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---- Learn page ---- */
html[data-view="en"] [data-l]:not([data-l="en"]),
html[data-view="de"] [data-l]:not([data-l="de"]),
html[data-view="fa"] [data-l]:not([data-l="fa"]) { display: none; }
[data-l="fa"] { direction: rtl; text-align: right; }
.lesson-lang { display: flex; gap: 6px; }
.lesson-lang button { font: inherit; font-size: 0.85rem; padding: 5px 10px; border-radius: 8px; cursor: pointer; color: inherit; background: transparent; border: 1px solid rgba(255,255,255,0.25); }
.lesson-lang button[aria-pressed="true"] { background: rgba(90, 209, 255, 0.18); border-color: rgba(90, 209, 255, 0.6); }
.lessons .toc ol { padding-inline-start: 1.4em; margin: 0 0 1.5em; }
.lessons .lesson { margin-top: 2.4em; scroll-margin-top: 90px; }
.lessons .lesson h2 { margin-top: 0; }
.lessons pre { direction: ltr; text-align: left; overflow-x: auto; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 12px 14px; font-size: 0.85rem; line-height: 1.5; max-width: 100%; }
.lessons code { font-size: 0.9em; }
.lessons p code, .lessons li code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 5px; }
.lessons li { margin-bottom: 0.4em; }
.lessons .header-tools { gap: 12px; }
.lessons code { direction: ltr; unicode-bidi: isolate; }
.spec { margin: 0 0 12px; font-size: 0.9rem; }
.spec dt { font-weight: 700; color: var(--accent-2); margin-top: 8px; }
.spec dd { margin: 2px 0 0; }
.srcs { font-size: 0.85rem; margin: 0; }
