/* ============================================================
   khamenei-online.org — Design System v2
   Brand identity matched to the bot logo:
     Deep navy  #16314e   (logo ring + bottom script)
     Teal       #2f93ad   (AI network / tech accents)
     Teal-light #5bb8d4
     Gold       #c9a227   (frame, ornaments, top script)
   Static · no-build · RTL-first · dual-lang (ar default / en)
   ============================================================ */
:root {
  --navy: #16314e;
  --navy-deep: #0f2335;
  --navy-soft: #1d456b;
  --teal: #2f93ad;
  --teal-light: #5bb8d4;
  --teal-ink: #1c6275;
  --gold: #c9a227;
  --gold-soft: #e7d9a8;

  --bg-grad: linear-gradient(135deg, #16314e 0%, #1d456b 55%, #0f2335 100%);
  --surface: #ffffff;
  --surface-alt: #f5f7fa;
  --surface-tint: #eef4f7;
  --ink: #15212e;
  --ink-soft: #51616f;
  --line: #e1e8ef;
  --accent: var(--teal);
  --accent-ink: var(--teal-ink);
  --accent-soft: #e6f2f6;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 12px rgba(15,35,53,.07);
  --shadow: 0 12px 36px rgba(15,35,53,.13);
  --shadow-lg: 0 24px 60px rgba(15,35,53,.20);
  --maxw: 900px;
  --ring: 0 0 0 3px rgba(91,184,212,.45);

  --font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

body {
  font-family: var(--font-ar);
  background: var(--surface-alt);
  color: var(--ink);
  line-height: 1.85;
  font-size: clamp(16px, 1rem + 0.15vw, 18px);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html[lang="en"] body { font-family: var(--font-en); line-height: 1.7; }

a { color: var(--accent-ink); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header { background: var(--bg-grad); color: #fff; padding: 14px 0; position: sticky; top: 0; z-index: 50; border-bottom: 2px solid rgba(201,162,39,.55); box-shadow: var(--shadow-sm); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 1rem; color: #fff; }
.brand img { width: 44px; height: 44px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(201,162,39,.6); background: #fff; }
.brand .dot { width: 42px; height: 42px; border-radius: 50%; background: var(--teal); display: grid; place-items: center; font-size: 1.25rem; flex: none; box-shadow: 0 0 0 2px rgba(201,162,39,.6); }
.nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.nav a { color: #d4e0ea; font-size: .92rem; }
.nav a:hover { color: #fff; text-decoration: none; }
.lang-toggle { color: var(--gold-soft); border: 1px solid rgba(201,162,39,.5); border-radius: var(--radius-pill); padding: 5px 15px; font-size: .85rem; transition: all .18s; }
.lang-toggle:hover { color: var(--navy); background: var(--gold); border-color: var(--gold); text-decoration: none; }

/* Hero */
.hero { background: var(--bg-grad); color: #fff; padding: 72px 0 84px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 12%, rgba(91,184,212,.22), transparent 55%); pointer-events: none; }
.hero-logo { width: 132px; height: 132px; margin: 0 auto 26px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(201,162,39,.65), 0 16px 40px rgba(0,0,0,.35); background: #fff; position: relative; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); font-weight: 600; line-height: 1.42; margin-bottom: 18px; position: relative; }
.hero p { color: #c9d6e3; max-width: 660px; margin: 0 auto 32px; font-size: clamp(1rem, 1.05rem, 1.12rem); position: relative; }
.honorific { color: var(--gold); font-weight: 600; }
.cta { display: inline-flex; align-items: center; gap: 10px; background: #229ED9; color: #fff; font-weight: 600; padding: 15px 32px; border-radius: var(--radius-pill); font-size: 1.06rem; box-shadow: 0 10px 28px rgba(34,158,217,.40); transition: transform .16s, box-shadow .16s; position: relative; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(34,158,217,.52); text-decoration: none; }
.cta:active { transform: translateY(0); }

/* Sections */
section.block { padding: 58px 0; }
section.block.alt { background: var(--surface); }
.block h2 { font-size: clamp(1.35rem, 2.4vw, 1.6rem); color: var(--navy); margin-bottom: 24px; font-weight: 600; position: relative; padding-bottom: 12px; }
.block h2::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 58px; height: 3px; background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: 3px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--teal-light); }
.card .ic { font-size: 1.8rem; margin-bottom: 12px; }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--accent-ink); font-weight: 600; }
.card p { color: var(--ink-soft); font-size: .96rem; }

/* Legal / prose */
.legal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 44px clamp(24px, 5vw, 56px); margin: 44px auto; max-width: 820px; }
.legal h1 { font-size: clamp(1.6rem, 3vw, 1.9rem); color: var(--navy); margin-bottom: 6px; }
.legal .updated { color: var(--ink-soft); font-size: .9rem; margin-bottom: 30px; }
.legal h2 { font-size: 1.2rem; color: var(--accent-ink); margin: 32px 0 12px; }
.legal p, .legal li { color: var(--ink); margin-bottom: 12px; }
.legal ul { padding-inline-start: 26px; }
.legal a { font-weight: 500; }
.legal code { background: var(--surface-tint); padding: 2px 7px; border-radius: 6px; font-size: .92em; color: var(--teal-ink); }
.callout { background: var(--accent-soft); border-inline-start: 4px solid var(--teal); border-radius: var(--radius-sm); padding: 17px 19px; margin: 22px 0; color: var(--teal-ink); }

/* Footer */
.site-footer { background: var(--navy-deep); color: #93a6b8; padding: 40px 0; font-size: .9rem; border-top: 2px solid rgba(201,162,39,.4); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.site-footer a { color: #cad7e3; }
.site-footer .fnav { display: flex; gap: 20px; flex-wrap: wrap; }

/* Lang visibility — JS swaps innerHTML; no CSS hiding (elements carry both data-ar & data-en). */

/* Responsive */
@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; }
  .nav { gap: 14px; }
  .hero { padding: 56px 0 64px; }
  .hero-logo { width: 108px; height: 108px; }
}

/* ============================================================
   === expansion pages ===
   Components: inner hero, numbered steps, tier cards (graded),
   quote-box, chat bubbles, architecture strip, lead/arrow links.
   RTL-first; all logical props so the dir-toggle flips correctly.
   ============================================================ */

/* Inner page hero (smaller than home) */
.hero.inner { padding: 56px 0 56px; }
.hero.inner h1 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); }
.hero.inner .sub { color: #c9d6e3; max-width: 720px; margin: 14px auto 0; font-size: clamp(1rem, 1.05rem, 1.1rem); line-height: 1.85; position: relative; }

/* Generic prose intro inside blocks */
.lead { color: var(--ink-soft); max-width: 760px; margin-bottom: 26px; }

/* Arrow link on cards */
.card .arrow { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-weight: 600; color: var(--teal-ink); font-size: .95rem; }
.card .arrow::after { content: "←"; transition: transform .15s; }
html[lang="en"] .card .arrow::after { content: "→"; }
.card a.arrow:hover { text-decoration: none; }
.card a.arrow:hover::after { transform: translateX(-4px); }
html[lang="en"] .card a.arrow:hover::after { transform: translateX(4px); }
a.cardlink { text-decoration: none; color: inherit; display: block; }
a.cardlink:hover { text-decoration: none; }

/* Numbered vertical steps */
.steps { list-style: none; counter-reset: step; max-width: 780px; margin: 8px auto 0; padding: 0; }
.steps > li { position: relative; padding-inline-start: 64px; padding-bottom: 30px; border-inline-start: 2px solid var(--line); margin-inline-start: 22px; }
.steps > li:last-child { border-inline-start-color: transparent; padding-bottom: 4px; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; inset-inline-start: -23px; top: -4px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-grad); color: #fff; font-weight: 600; font-size: 1.1rem;
  display: grid; place-items: center;
  box-shadow: 0 0 0 4px var(--surface-alt), 0 6px 16px rgba(15,35,53,.18);
}
.steps h3 { font-size: 1.12rem; color: var(--navy); margin-bottom: 7px; font-weight: 600; }
.steps p { color: var(--ink-soft); margin: 0; }
section.block.alt .steps > li::before { box-shadow: 0 0 0 4px var(--surface), 0 6px 16px rgba(15,35,53,.18); }

/* Quote / verbatim box */
.quote-box { background: var(--surface-tint); border: 1px solid var(--line); border-inline-start: 5px solid var(--gold); border-radius: var(--radius); padding: 24px 26px; margin: 26px auto; max-width: 780px; box-shadow: var(--shadow-sm); }
.quote-box .qb-title { font-weight: 600; color: var(--accent-ink); margin-bottom: 12px; font-size: .98rem; }
.quote-box blockquote { margin: 0; color: var(--ink); font-size: 1.02rem; line-height: 1.95; }
.quote-box.apology { border-inline-start-color: var(--teal); }

/* Tier cards (graded authority) */
.tiers { display: grid; gap: 18px; max-width: 820px; margin: 0 auto; }
.tier { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); border-inline-start: 5px solid var(--line); }
.tier .tier-tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 11px; border-radius: var(--radius-pill); margin-bottom: 9px; }
.tier h3 { font-size: 1.1rem; color: var(--navy); margin-bottom: 7px; font-weight: 600; }
.tier p { color: var(--ink-soft); margin: 0; }
.tier.t1 { border-inline-start-color: var(--gold); background: linear-gradient(180deg, #fffdf6, #fff); }
.tier.t1 .tier-tag { background: #f6eccc; color: #8a6d18; }
.tier.t2 { border-inline-start-color: var(--teal); }
.tier.t2 .tier-tag { background: var(--accent-soft); color: var(--teal-ink); }
.tier.t3 { border-inline-start-color: var(--teal-light); }
.tier.t3 .tier-tag { background: #eaf5fa; color: var(--teal-ink); }
.tier.t4 { border-inline-start-color: #aab8c4; }
.tier.t4 .tier-tag { background: #eef2f5; color: #5b6b78; }

/* Architecture strip */
.arch-strip { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; max-width: 860px; margin: 10px auto 0; }
.arch-step { flex: 1 1 160px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 14px; text-align: center; font-weight: 600; color: var(--navy); font-size: .95rem; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.arch-arrow { display: grid; place-items: center; color: var(--gold); font-size: 1.5rem; padding: 0 6px; }
.arch-arrow::before { content: "←"; }
html[lang="en"] .arch-arrow::before { content: "→"; }
@media (max-width: 640px) {
  .arch-strip { flex-direction: column; }
  .arch-arrow::before { content: "↓"; }
  html[lang="en"] .arch-arrow::before { content: "↓"; }
}

/* Chat bubbles (Telegram-like) */
.chat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.chat-card { background: #e9eef3; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.chat-card .ctitle { font-weight: 600; color: var(--navy); font-size: .92rem; margin-bottom: 14px; opacity: .85; }
.bubble { max-width: 86%; padding: 11px 15px; border-radius: 16px; margin-bottom: 12px; line-height: 1.8; font-size: .98rem; position: relative; box-shadow: 0 1px 2px rgba(15,35,53,.10); }
.bubble.q { background: #d7f0d2; color: #1d3a16; margin-inline-start: auto; border-end-end-radius: 5px; }
.bubble.a { background: #fff; color: var(--ink); margin-inline-end: auto; border-end-start-radius: 5px; }
.bubble.a.placeholder { color: var(--ink-soft); font-style: italic; }
.chat-card .caption { font-size: .85rem; color: var(--ink-soft); margin-top: 6px; }

/* List with bold lead (charter) */
.lead-list { list-style: none; padding: 0; max-width: 800px; margin: 0 auto; }
.lead-list > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.lead-list b { color: var(--accent-ink); display: block; margin-bottom: 4px; }
.lead-list span { color: var(--ink-soft); }

/* Center helper */
.center { text-align: center; }
.mt-cta { margin-top: 28px; }

/* Comparison strip (traditional ↔ assistant) */
.compare { display: grid; gap: 14px; max-width: 860px; margin: 0 auto; }
.compare-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 14px; }
.compare-cell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); color: var(--ink-soft); font-size: .98rem; display: flex; align-items: center; }
.compare-cell.old { border-inline-start: 4px solid #c2cdd8; background: var(--surface-alt); }
.compare-cell.new { border-inline-start: 4px solid var(--teal); color: var(--ink); }
.compare-vs { display: grid; place-items: center; color: var(--gold); font-size: 1.3rem; font-weight: 600; min-width: 34px; }
.compare-vs::before { content: "←"; }
html[lang="en"] .compare-vs::before { content: "→"; }
@media (max-width: 640px) {
  .compare-row { grid-template-columns: 1fr; }
  .compare-vs::before { content: "↓"; }
  html[lang="en"] .compare-vs::before { content: "↓"; }
}
