/* MAGI Labs base layout. Colours, fonts and shapes come from the active theme file (themes/*.css).
   Themes only set the tokens below (plus small optional extras). Layout lives here. */
:root {
  --navy: #0E1B3D; --copper: #C8732E; --copper-dark: #A95A1D; --grey: #8A94A6; --white: #FFFFFF;
  --bg: var(--navy); --bg-alt: #13224A; --surface: #16244A; --surface-border: rgba(255,255,255,.12);
  --text: #E8ECF4; --muted: #AEB7C7; --heading: #FFFFFF; --accent: var(--copper); --accent-hover: #DB8645;
  --on-accent: var(--navy); --btn2-bg: transparent; --btn2-text: #FFFFFF; --btn2-border: rgba(255,255,255,.4);
  --header-bg: rgba(14,27,61,.92); --header-border: rgba(255,255,255,.1); --menu-bg: #16244A;
  --hero-bg: var(--bg); --radius: 14px; --radius-sm: 8px; --shadow: none; --blur: none;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: var(--font); --font-rtl: "Vazirmatn", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  --h-weight: 700; --h-spacing: -0.01em; --h1-size: clamp(2rem, 4.5vw, 3.25rem);
  --logo-ondark: inline-block; --logo-onlight: none; --focus: #F2A35E;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.65 var(--font); }
[dir="rtl"] body { font-family: var(--font-rtl); line-height: 1.85; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); font-weight: var(--h-weight); letter-spacing: var(--h-spacing); line-height: 1.2; margin: 0 0 .6em; }
[dir="rtl"] :is(h1, h2, h3) { font-family: var(--font-rtl); letter-spacing: 0; line-height: 1.5; }
h1 { font-size: var(--h1-size); }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.container { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--accent); color: var(--on-accent); padding: .5rem 1rem; z-index: 100; border-radius: var(--radius-sm); }
.skip:focus { top: 1rem; }
.logo-ondark { display: var(--logo-ondark); }
.logo-onlight { display: var(--logo-onlight); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); border-bottom: 1px solid var(--header-border); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand img { height: 40px; width: auto; }
.header-tools { display: flex; align-items: center; gap: .5rem; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border: 1px solid var(--btn2-border); border-radius: var(--radius-sm); color: var(--btn2-text); font-size: .9rem; white-space: nowrap; }
.menu summary::-webkit-details-marker { display: none; }
.menu-theme summary { border-color: var(--accent); }
.menu-icon { font-size: 1rem; line-height: 1; }
.menu-theme .menu-icon { width: 14px; height: 14px; font-size: 0; border-radius: 50%; background: linear-gradient(135deg, var(--bg) 50%, var(--accent) 50%); border: 1px solid var(--btn2-border); }
.menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 190px; margin: 0; padding: .35rem; list-style: none; background: var(--menu-bg); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border: 0; background: none; color: var(--text); font: inherit; font-size: .95rem; text-align: start; text-decoration: none; border-radius: calc(var(--radius-sm) - 2px); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list [aria-current="page"], .menu-list [aria-pressed="true"] { background: var(--surface-border); }
.menu-list [aria-pressed="true"]::after, .menu-list [aria-current="page"]::after { content: "✓"; margin-inline-start: auto; color: var(--accent); }
.dot { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, var(--d1) 50%, var(--d2) 50%); border: 1px solid var(--surface-border); flex: none; }
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; padding-block: .6rem; }
  .header-tools { width: 100%; justify-content: space-between; }
  .menu summary { padding: .4rem .55rem; font-size: .85rem; }
  .header-tools .btn-sm { padding: .45rem .7rem; }
  .header-tools { gap: .35rem; }
  .menu-lang summary span:last-child, .theme-prefix { display: none; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .8rem 1.35rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-family: inherit; transition: background .15s, color .15s, border-color .15s; }
.btn-sm { padding: .5rem .95rem; font-size: .9rem; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--btn2-bg); color: var(--btn2-text); border-color: var(--btn2-border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { padding: .55rem 0; color: var(--accent); background: none; }
.btn-ghost::after { content: "→"; }
[dir="rtl"] .btn-ghost::after { content: "←"; }

/* AI translation note */
.ai-note { background: var(--surface); border-bottom: 1px solid var(--surface-border); font-size: .9rem; padding: .5rem 0; color: var(--muted); }

/* Hero */
.hero { background: var(--hero-bg); padding: clamp(2.5rem, 6vw, 5rem) 0; }
.hero-inner { display: grid; gap: 2rem; align-items: center; justify-items: center; text-align: center; }
.hero-logo { width: min(260px, 62vw); }
.hero-logo img { width: 100%; height: auto; }
.hero-text { max-width: 720px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: .75rem; }
[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .95rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1.5rem; }
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 5fr 7fr; text-align: start; justify-items: start; }
  .hero-logo { width: 100%; max-width: 320px; justify-self: center; }
  .hero-actions { justify-content: flex-start; }
}

/* Sections */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-intro { max-width: 760px; color: var(--muted); margin-bottom: 2rem; }
.grid { display: grid; gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }

/* Services */
.services-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.service { padding: 1.6rem; display: flex; flex-direction: column; }
.service p { color: var(--muted); }
.service-num { font-size: .85rem; font-weight: 700; color: var(--accent); margin-bottom: .5rem; }
.points { list-style: none; padding: 0; margin: 0 0 1rem; font-size: .95rem; }
.points li { position: relative; padding-inline-start: 1.2rem; margin-bottom: .35rem; }
.points li::before { content: ""; position: absolute; inset-inline-start: 0; top: .65em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.service .btn-ghost { margin-top: auto; align-self: flex-start; }
.later { margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }

/* Themes showcase */
.themes-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.theme-card { display: flex; flex-direction: column; gap: .4rem; padding: .9rem; text-align: start; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--surface-border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, transform .15s; }
.theme-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.theme-card[aria-pressed="true"] { border-color: var(--accent); }
.preview { display: flex; flex-direction: column; gap: 6px; height: 120px; padding: 10px; margin-bottom: .4rem; border-radius: calc(var(--radius) - 6px); background: var(--p-bg); border: 1px solid rgba(127,127,127,.25); overflow: hidden; }
.pv-bar { height: 8px; border-radius: 3px; background: var(--p-surface); }
.pv-line { height: 7px; width: 70%; border-radius: 3px; background: var(--p-text); opacity: .85; }
.pv-line.short { width: 45%; opacity: .45; }
.pv-blocks { display: flex; gap: 6px; flex: 1; }
.pv-blocks span { flex: 1; border-radius: 4px; background: var(--p-surface); border: 1px solid rgba(127,127,127,.2); }
.pv-btn { height: 10px; width: 34%; border-radius: 3px; background: var(--p-accent); }
.theme-card-name { font-weight: 700; color: var(--heading); }
.theme-card-desc { font-size: .88rem; color: var(--muted); }
.theme-card-action { margin-top: auto; font-size: .85rem; font-weight: 600; color: var(--accent); }
.theme-card .when-on, .theme-card[aria-pressed="true"] .when-off { display: none; }
.theme-card[aria-pressed="true"] .when-on { display: inline; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { padding: 1.4rem; border-top: 3px solid var(--accent); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.step p { color: var(--muted); margin: 0; }
.step-num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; margin-bottom: .75rem; }

/* About */
.about { max-width: 820px; }
.about-text p { font-size: 1.1rem; }

/* Contact */
.contact { display: grid; gap: 2rem; }
@media (min-width: 900px) { .contact { grid-template-columns: 5fr 7fr; align-items: start; } }
.contact-direct { list-style: none; padding: 0; margin: 0; }
.contact-direct li { margin-bottom: .5rem; }
.contact-direct span, .contact-pending { color: var(--muted); }
.contact-form { padding: 1.6rem; display: grid; gap: 1rem; }
.contact-form label { display: grid; gap: .35rem; font-size: .92rem; font-weight: 600; color: var(--heading); }
.contact-form input, .contact-form select, .contact-form textarea { font: inherit; font-weight: 400; padding: .7rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--surface-border); background: var(--bg); color: var(--text); width: 100%; }
.contact-form button { justify-self: start; }
.form-note { margin: 0; font-size: .9rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--header-border); padding: 2rem 0; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-inner img { height: 30px; width: auto; }
.footer-inner p { margin: 0; }
