/* ═══════════════════════════════════════════════════════════════
   Qallak — site design system v4 · matched to the Qallak app
   One shared system for every page (landing + inner pages).
   Palette, type and surfaces mirror lib/core/theme/selam_colors.dart:
     primary blue #2563EB · teal accent #14B8A6 · amber #F59E0B
     light = soft gray #EEF0F3 · dark = deep navy #0B1120
   Type: DM Sans everywhere (app uses DM Sans for display + body).
   No all-side borders — tonal fills + soft shadows (selamCard look).

   NOTE ON TOKEN NAMES: the design-system token names below
   (--roast / --leaf / --honey) are legacy from the earlier editorial
   theme and are referenced ~40× here and inline in index.html.
   They are kept to avoid churn but now hold APP colors:
     --roast = app primary blue   --leaf = app teal   --honey = amber
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --paper:       #EEF0F3;   /* app backgroundLight */
  --paper-deep:  #E3E6EA;   /* footer / alternate bands */
  --surface:     #FFFFFF;   /* cards (surfaceLight) */
  --surface-2:   #ECEEF0;   /* chips, tonal fills (surfaceContainerLight) */
  --ink:         #0F172A;   /* textPrimaryLight */
  --ink-soft:    #434655;   /* onSurfaceVariantLight */
  --ink-faint:   #747686;   /* outlineLight */
  --line:        rgba(15, 23, 42, .10);
  --roast:       #2563EB;   /* app primary */
  --roast-deep:  #1D4ED8;   /* primary hover */
  --roast-tint:  rgba(37, 99, 235, .08);
  --on-roast:    #FFFFFF;   /* onPrimary */
  --leaf:        #14B8A6;   /* app teal accent */
  --leaf-tint:   rgba(20, 184, 166, .12);
  --honey:       #F59E0B;   /* app warning / decorative amber */
  --radius:      22px;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .07);
  --shadow:      0 2px 4px rgba(15, 23, 42, .05), 0 24px 56px rgba(15, 23, 42, .12);
  --font-display:'DM Sans', system-ui, -apple-system, sans-serif;
  --font:        'DM Sans', system-ui, -apple-system, sans-serif;
  --am:          'Noto Serif Ethiopic', 'DM Sans', serif;
  --am-sans:     'Noto Sans Ethiopic', var(--font);
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* ── Back-compat aliases (older inner-page markup) ── */
  --teal:        var(--leaf);
  --blue:        var(--roast);
  --blue-hi:     var(--roast-deep);
  --amber:       var(--honey);
  --amber-hi:    var(--honey);
  --primary-light: var(--roast);
  --muted:       var(--ink-soft);
  --text:        var(--ink);
  --slate:       var(--surface);
  --glass:       var(--surface);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper:       #0B1120;   /* app backgroundDark */
  --paper-deep:  #0B1320;
  --surface:     #161F2E;   /* surfaceDark */
  --surface-2:   #1E293B;   /* surfaceContainer dark */
  --ink:         #F1F5F9;   /* textDark */
  --ink-soft:    #94A3B8;   /* mutedDark */
  --ink-faint:   #64748B;
  --line:        rgba(148, 163, 184, .14);
  --roast:       #3B82F6;   /* primaryDark — brighter blue on navy */
  --roast-deep:  #60A5FA;
  --roast-tint:  rgba(59, 130, 246, .16);
  --on-roast:    #FFFFFF;
  --leaf:        #2DD4BF;   /* brighter teal on dark */
  --leaf-tint:   rgba(45, 212, 191, .14);
  --honey:       #FBBF24;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  --shadow:      0 2px 4px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}

/* Subtle grain — echoes the app's SelamAppBackground texture. Fixed, non-interactive. */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 3000;
  pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

::selection { background: rgba(37, 99, 235, .20); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.am      { font-family: var(--am); }
.am-sans { font-family: var(--am-sans); }

/* ── Ambient tint (blue + teal, matching app accents) ───────── */
.glow-1, .glow-2, .glow-3 {
  position: fixed; border-radius: 50%; filter: blur(110px);
  pointer-events: none; z-index: 0;
}
.glow-1 { width: 560px; height: 560px; top: -200px; right: -140px;
          background: radial-gradient(circle, rgba(20, 184, 166, .12), transparent 70%); }
.glow-2 { width: 480px; height: 480px; bottom: -180px; left: -160px;
          background: radial-gradient(circle, rgba(37, 99, 235, .12), transparent 70%); }
.glow-3 { display: none; }

/* ── Tilet stripe — woven Habesha border, site signature ──── */
.tilet {
  height: 4px; border: 0; width: 100%;
  background: repeating-linear-gradient(90deg,
    var(--roast) 0 46px, var(--leaf) 46px 82px,
    var(--honey) 82px 104px, var(--roast) 104px 150px);
  opacity: .85;
}

/* ── Floating island header ─────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 100;
  padding: 14px 16px 6px;
  background: transparent;
}
.nav-container {
  max-width: 1080px; margin: 0 auto; padding: 10px 12px 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}
.logo-lockup {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 1.22rem; letter-spacing: -.3px;
  font-family: var(--font-display);
}
.logo-lockup img { width: 30px; height: 30px; object-fit: contain; }
.logo-lockup .am { color: var(--roast); font-weight: 600; font-size: .92rem; }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-link {
  color: var(--ink-soft); font-size: .94rem; font-weight: 500;
  position: relative; padding: 2px 0;
  transition: color 160ms ease;
}
.nav-link:hover { color: var(--roast); }
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 100%; height: 1.5px; background: var(--roast);
  transform: scaleX(0); transform-origin: left;
  transition: transform 200ms var(--ease-out);
}
.nav-link:hover::after { transform: scaleX(1); }
.nav-right { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 0; background: var(--surface-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.theme-toggle:hover { background: var(--roast-tint); transform: translateY(-1px); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun  { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

.btn-launch {
  background: var(--roast); color: var(--on-roast);
  font-weight: 600; font-size: .9rem;
  padding: 10px 20px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
  transition: transform 160ms var(--ease-out), background 160ms ease, box-shadow 160ms ease;
}
.btn-launch:hover { transform: translateY(-2px); background: var(--roast-deep); box-shadow: 0 10px 26px rgba(37, 99, 235, .36); }
.btn-launch:active { transform: scale(0.96); }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 15px 13px 26px; border-radius: 999px; border: 0;
  font-family: var(--font); font-weight: 600; font-size: .97rem;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out),
              background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--roast); color: var(--on-roast);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .3);
}
.btn-primary:hover { background: var(--roast-deep); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(37, 99, 235, .38); }
.btn-primary:active { box-shadow: 0 4px 12px rgba(37, 99, 235, .22); }
/* Button-in-button trailing arrow chip */
.btn .chip-arrow {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .2);
  transition: transform 200ms var(--ease-out);
}
.btn:hover .chip-arrow { transform: translate(2px, -1px); }
.btn-ghost {
  background: var(--surface-2); color: var(--ink);
  padding: 13px 26px;
}
.btn-ghost:hover { background: var(--roast-tint); color: var(--roast); transform: translateY(-2px); }

/* ── Section primitives ─────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--roast-tint); color: var(--roast);
  font-size: .74rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.2rem); font-weight: 600;
  letter-spacing: -.02em; line-height: 1.06; margin-bottom: 16px; color: var(--ink);
}
.sub { color: var(--ink-soft); font-size: 1.1rem; max-width: 600px; }

/* ── Page header (inner pages) ──────────────────────────────── */
.page-header {
  max-width: 1080px; margin: 0 auto; padding: 84px 24px 44px;
  position: relative; z-index: 2;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.4vw, 3.8rem); font-weight: 600;
  letter-spacing: -.02em; line-height: 1.05; margin-bottom: 16px;
}
.page-subtitle { color: var(--ink-soft); max-width: 640px; font-size: 1.08rem; }

/* ── Legal / doc layout: sidebar + content ──────────────────── */
.container {
  max-width: 1080px; margin: 0 auto; padding: 40px 24px 96px;
  display: grid; grid-template-columns: 240px 1fr; gap: 48px;
  position: relative; z-index: 2;
}
@media (max-width: 860px) { .container { grid-template-columns: 1fr; } }
.sidebar { position: sticky; top: 96px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 860px) { .sidebar { position: static; flex-direction: row; flex-wrap: wrap; gap: 8px; } }
.sidebar-link {
  color: var(--ink-soft); font-size: .9rem; padding: 8px 14px;
  border-left: 2px solid transparent; border-radius: 0 10px 10px 0;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.sidebar-link:hover { color: var(--ink); background: var(--surface-2); }
.sidebar-link.active { color: var(--roast); border-left-color: var(--roast); background: var(--roast-tint); }
@media (max-width: 860px) {
  .sidebar-link { border-left: 0; background: var(--surface-2); border-radius: 999px; }
  .sidebar-link.active { background: var(--roast-tint); }
}

.content-body .section { margin-bottom: 44px; scroll-margin-top: 110px; }
.content-body .section-header {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 600; letter-spacing: -.3px;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.content-body p, .content-body li { color: var(--ink-soft); font-size: .98rem; margin-bottom: 12px; }
.content-body ul, .content-body ol { padding-left: 22px; margin-bottom: 14px; }
.content-body strong { color: var(--ink); }
.content-body a { color: var(--roast); }
.content-body a:hover { text-decoration: underline; }
.content-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.content-body th, .content-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.content-body th { color: var(--ink); background: var(--surface-2); }
.subsection { margin-top: 18px; }
.subsection-title {
  font-family: var(--font-display);
  font-size: 1.08rem; font-weight: 600; margin-bottom: 8px; color: var(--ink);
}

/* ── Details / accordion (inner FAQ pages) ──────────────────── */
details {
  border-radius: 18px; margin-bottom: 12px;
  background: var(--surface); box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: box-shadow 240ms var(--ease-out), transform 240ms var(--ease-out);
}
details:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
summary {
  cursor: pointer; padding: 18px 22px; font-weight: 600; font-size: 1rem;
  font-family: var(--font-display); list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  transition: background 160ms ease;
}
summary:hover { background: var(--roast-tint); }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: '+'; font-size: 1.4rem; color: var(--roast); flex-shrink: 0;
  font-family: var(--font); font-weight: 400;
  transition: transform 240ms var(--ease-spring);
}
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 22px 18px; color: var(--ink-soft); font-size: .95rem; }
details p a, details a { color: var(--roast); }

/* ── Cards / legacy glass alias → tonal card ────────────────── */
.glass {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer { background: var(--paper-deep); position: relative; z-index: 2; }
.footer-container {
  max-width: 1080px; margin: 0 auto; padding: 64px 24px 28px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
}
@media (max-width: 860px) { .footer-container { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-container { grid-template-columns: 1fr; } }
.footer-brand p { color: var(--ink-soft); font-size: .92rem; max-width: 300px; margin-top: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links h4 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .16em;
  color: var(--ink-faint); margin-bottom: 6px; font-weight: 600;
}
.footer-links a { color: var(--ink-soft); font-size: .93rem; padding: 2px 0; transition: color 160ms ease; }
.footer-links a:hover { color: var(--roast); }
.footer-bottom {
  max-width: 1080px; margin: 0 auto; padding: 22px 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.copyright { color: var(--ink-faint); font-size: .85rem; }
.footer-social, .social-links { display: flex; gap: 10px; flex-wrap: wrap; }
.footer-social a, .social-btn {
  color: var(--ink-soft); font-size: .88rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; background: var(--surface-2);
  display: inline-flex; align-items: center; gap: 7px;
  transition: color 160ms ease, background 160ms ease, transform 160ms var(--ease-out);
}
.footer-social a:hover, .social-btn:hover { color: var(--roast); background: var(--roast-tint); transform: translateY(-1px); }
.social-btn svg { width: 13px; height: 13px; fill: currentColor; }

/* ── Cookie banner ──────────────────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(110px);
  z-index: 200; display: none; align-items: center; gap: 18px;
  max-width: 620px; width: calc(100% - 32px);
  padding: 16px 22px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
  animation: cookieUp 420ms var(--ease-out) forwards;
}
@keyframes cookieUp { to { transform: translateX(-50%) translateY(0); } }
.cookie-text { font-size: .88rem; color: var(--ink-soft); flex: 1; }
.cookie-text a { color: var(--roast); }
.cookie-actions { display: flex; gap: 8px; }
.cookie-btn {
  font-family: var(--font); font-weight: 600; font-size: .85rem;
  padding: 9px 18px; border-radius: 999px; cursor: pointer; border: 0;
  transition: transform 160ms var(--ease-out), background 160ms ease, color 160ms ease;
}
.cookie-btn:active { transform: scale(0.96); }
.cookie-btn-accept { background: var(--roast); color: var(--on-roast); }
.cookie-btn-accept:hover { background: var(--roast-deep); }
.cookie-btn-decline { background: var(--surface-2); color: var(--ink-soft); }
.cookie-btn-decline:hover { background: var(--roast-tint); color: var(--roast); }

/* ── Live dot ───────────────────────────────────────────────── */
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--leaf); margin-right: 6px;
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Scroll reveal ──────────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }

/* ── Focus visibility ───────────────────────────────────────── */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--roast); outline-offset: 2px; border-radius: 6px;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
