/* ==========================================================================
   Nexluna — Premium Design System
   Author: mohamed-khairy-5i
   Luxurious, modern, RTL-first, accessible (WCAG AA), fully responsive.
   ========================================================================== */

/* ==========================================================================
   NAMED TOKEN SYSTEM — 5 colors, each with a reason (author: mohamed-khairy-5i)
   1. INK  (#0b1f24 deep teal-black) — text + dark canvas. Warmer than pure black,
      ties to the brand hue so the whole system feels of-a-piece, not generic.
   2. PAPER (#f7f5ef warm off-white) — light canvas. Warm, NOT the AI-default cream:
      lower chroma, reads as "paper", pairs with ink instead of terracotta.
   3. BRAND (#0f9488 → #14b8a6 teal-green) — the ONE accent. Used ONLY for the
      primary action + the conversion result. Discipline over decoration.
   4. AMBER (#e8a33d) — rare highlight only (favorites, a single stat). Never a CTA.
   5. LINE  (neutral border/muted) — structure without noise.
   Deliberately avoids: cream+serif+terracotta, near-black+acid-green, broadsheet.
   ========================================================================== */
:root {
  /* Brand — single restrained teal-green accent (Linear-style discipline) */
  --primary: #0f9488;
  --primary-600: #0d7d73;
  --primary-700: #0b665e;
  --primary-50: #e6f5f3;
  /* --ink: the ONLY brand colour allowed for text/links.
     --primary (#0f9488) is a *surface* colour: as text on white it is 3.74:1,
     below the WCAG AA 4.5:1 minimum for body text (axe: color-contrast).
     --ink is verified >=4.5:1 on white, paper, alt-light, primary-50 and
     surface-2 in both themes. Use --primary for fills, --ink for glyphs. */
  --ink: #0b665e;
  --accent: #14b8a6;
  --accent-600: #0d9488;
  --gold: #e8a33d;
  --danger: #d94f45;
  --warning: #e8a33d;

  /* Gradients — used sparingly, only on the result + primary action.
     SAFETY RULE (DESIGN_SPEC.md §3): white text on the brand gradient must
     always clear WCAG AA 4.5:1, so the lightest stop is #0e9484, never brighter. */
  --grad-brand: linear-gradient(135deg, #0c8578 0%, #0e8e80 50%, #0e9484 100%);
  --grad-brand-soft: linear-gradient(135deg, #14b8a6 0%, #0f9488 100%);
  --grad-gold: linear-gradient(135deg, #e8a33d, #d98826);

  /* Neutrals — warm paper (light) */
  --bg: #f7f5ef;
  --bg-tint: radial-gradient(1100px 560px at 88% -12%, #eaf5f2 0%, transparent 58%),
             radial-gradient(900px 460px at -8% 8%, #f2ede1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f2efe6;
  --surface-glass: rgba(255, 255, 255, 0.74);
  --text: #0b1f24;
  --text-muted: #566b70;
  --border: #e5e0d4;
  --ring: rgba(15, 148, 136, 0.24);

  --shadow-xs: 0 1px 2px rgba(11, 31, 36, 0.06);
  --shadow: 0 8px 24px -8px rgba(11, 31, 36, 0.16);
  --shadow-lg: 0 24px 60px -16px rgba(11, 31, 36, 0.24);
  --shadow-glow: 0 0 0 1px rgba(255,255,255,0.4) inset, 0 20px 48px -18px rgba(15,148,136,0.4);

  /* Focus ring — visible, consistent, works on both themes (DESIGN_SPEC.md §2) */
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent);

  /* Type scale (fluid) */
  --step--1: clamp(0.83rem, 0.79rem + 0.2vw, 0.94rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.08rem + 0.55vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.28rem + 1.05vw, 2.1rem);
  --step-3: clamp(2rem, 1.55rem + 2.1vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.9rem + 3vw, 4.4rem);

  /* Spacing */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 2.5rem; --sp-8: 3.5rem; --sp-9: 5rem;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --container: 1200px;
  /* Two deliberate typefaces: Tajawal (geometric display) + Cairo (body) */
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-display: 'Tajawal', 'Cairo', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Cairo', ui-monospace, monospace;
  /* Motion: spring-style easing (Pillar 2) */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.28s var(--ease);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071417;
    --bg-tint: radial-gradient(1100px 560px at 88% -12%, #0d2a29 0%, transparent 58%),
               radial-gradient(900px 460px at -8% 8%, #10201f 0%, transparent 55%);
    --surface: #0e2226;
    --surface-2: #142c30;
    --surface-glass: rgba(14, 34, 38, 0.66);
    --text: #eef4f2;
    --text-muted: #8ba3a3;
    --border: #1e3b3f;
    --primary-50: #0d2a29;
    /* On dark surfaces the deep ink would be unreadable — brighten it. */
    --ink: #2dd4bf;
    --ring: rgba(45, 212, 191, 0.32);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 20px 48px -18px rgba(20,184,166,0.42);
  }
}
html[data-theme='dark'] {
  --bg: #071417;
  --bg-tint: radial-gradient(1100px 560px at 88% -12%, #0d2a29 0%, transparent 58%),
             radial-gradient(900px 460px at -8% 8%, #10201f 0%, transparent 55%);
  --surface: #0e2226; --surface-2: #142c30; --surface-glass: rgba(14,34,38,0.66);
  --text: #eef4f2; --text-muted: #8ba3a3; --border: #1e3b3f; --primary-50: #0d2a29;
  --ink: #2dd4bf;
  --ring: rgba(45,212,191,0.32);
  --shadow: 0 8px 24px -8px rgba(0,0,0,0.55); --shadow-lg: 0 24px 60px -16px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 20px 48px -18px rgba(20,184,166,0.42);
}
html[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-tint: radial-gradient(1200px 600px at 90% -10%, #e9edff 0%, transparent 60%),
             radial-gradient(1000px 500px at -10% 10%, #e6fbf3 0%, transparent 55%);
  --surface: #ffffff; --surface-2: #f2f5fb; --surface-glass: rgba(255,255,255,0.72);
  --text: #101426; --text-muted: #616a80; --border: #e6eaf3; --primary-50: #eef2ff;
  --ring: rgba(79,70,229,0.22);
  --shadow: 0 8px 24px -8px rgba(23,31,84,0.18); --shadow-lg: 0 24px 60px -16px rgba(23,31,84,0.28);
  --shadow-glow: 0 0 0 1px rgba(255,255,255,0.4) inset, 0 20px 48px -18px rgba(79,70,229,0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--step-0);
  background: var(--bg);
  background-image: var(--bg-tint);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}
img, svg { max-width: 100%; display: block; }
a { color: var(--ink); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-700); }
ul { list-style: none; }
button { font-family: inherit; }

/* Display face on headings + the converter title — the two deliberate typefaces */
h1, h2, h3, .hero h1, .section-head h2, .converter-title, .converter-title * {
  font-family: var(--font-display);
  font-feature-settings: 'ss01' 1;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute; inset-inline-start: -999px; top: 0;
  background: var(--primary); color: #fff; padding: var(--sp-3) var(--sp-4);
  z-index: 1000; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { inset-inline-start: 0; color: #fff; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }
main { flex: 1 0 auto; }
.section { padding-block: var(--sp-9); }
.section-sm { padding-block: var(--sp-7); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding-block: var(--sp-3); }
.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 800; font-size: var(--step-1); color: var(--text); letter-spacing: -0.02em; }
.brand:hover { color: var(--ink); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; box-shadow: var(--shadow-xs); }
.brand span b { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links { display: flex; align-items: center; gap: var(--sp-1); }
.nav-links a {
  color: var(--text-muted); font-weight: 700; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm); font-size: var(--step--1); position: relative;
}
.nav-links a:hover, .nav-links a[aria-current='page'] { color: var(--ink); background: var(--primary-50); }
.nav-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px;
  cursor: pointer; color: var(--text); transition: all var(--transition);
}
.icon-btn:hover { background: var(--primary-50); border-color: var(--primary); color: var(--ink); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-btn svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; inset-inline: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--sp-3);
    gap: var(--sp-1); box-shadow: var(--shadow); max-height: 0; overflow: hidden; transition: max-height var(--transition);
  }
  .nav-links.open { max-height: 560px; }
  .nav-links a { padding: var(--sp-3); }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: var(--sp-9) var(--sp-8); text-align: center; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--grad-brand); opacity: 0.09;
  -webkit-mask: radial-gradient(80% 80% at 50% 0%, #000 40%, transparent 100%);
          mask: radial-gradient(80% 80% at 50% 0%, #000 40%, transparent 100%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  padding: var(--sp-2) var(--sp-4); border-radius: 999px; font-weight: 700; font-size: var(--step--1);
  color: var(--ink); margin-bottom: var(--sp-4);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.hero h1 { font-size: var(--step-4); font-weight: 800; line-height: 1.12; letter-spacing: -0.03em; margin-bottom: var(--sp-4); }
.hero h1 .grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .lead { font-size: var(--step-1); color: var(--text-muted); max-width: 660px; margin-inline: auto; }
.hero-cta { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-6); }
.hero-stats { display: flex; gap: var(--sp-6); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-7); }
.hero-stat b { display: block; font-size: var(--step-2); font-weight: 800; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stat span { color: var(--text-muted); font-size: var(--step--1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-weight: 800; font-size: var(--step-0); padding: var(--sp-3) var(--sp-6);
  border-radius: 999px; border: none; cursor: pointer; transition: all var(--transition); min-height: 3rem; /* 48px — DESIGN_SPEC §1 */
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
/* .btn svg is an internal glyph inside a 48px hit area — not a standalone target. */
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lg); filter: brightness(0.94); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-outline { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--ink); background: var(--primary-50); transform: translateY(-1px); }
.btn-outline:active { transform: translateY(0) scale(0.98); }
.btn-ghost { background: transparent; color: var(--primary-700); border: 1.5px solid transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--primary-50); border-color: var(--primary-50); }
.btn-ghost:active { transform: scale(0.98); }
.btn-sm { min-height: 2.5rem; padding: var(--sp-2) var(--sp-4); font-size: var(--step--1); }
.btn-sm:hover { filter: brightness(0.94); transform: translateY(-1px); }
.btn-sm:active { transform: scale(0.97); }
/* DESIGN_SPEC §2: explicit interactive states for the whole button family */
.btn:disabled, .btn[disabled], .btn-sm:disabled, .btn-outline:disabled, .btn-primary:disabled, .btn-ghost:disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none; transform: none !important; filter: none !important;
}
.btn:focus-visible, .btn-sm:focus-visible, .btn-outline:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-xs); }
.cta-actions .btn:focus-visible { box-shadow: var(--focus-ring), var(--shadow-xs); }
.cta-actions .btn:hover { transform: translateY(-2px); }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: var(--sp-5); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-5); box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: var(--grad-brand); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity var(--transition); pointer-events: none; }
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card:hover::after { opacity: 1; }
.card-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--primary-50); color: var(--ink); margin-bottom: var(--sp-3);
}
.card-icon svg { width: 28px; height: 28px; }
.card h3, .card .card-title { font-size: var(--step-1); margin-bottom: var(--sp-2); font-weight: 800; letter-spacing: -0.01em; }
.card p { color: var(--text-muted); font-size: var(--step--1); }
.card .arrow { position: absolute; inset-inline-end: var(--sp-5); bottom: var(--sp-5); color: var(--ink); opacity: 0; transform: translateX(6px); transition: all var(--transition); }
[dir="rtl"] .card .arrow { transform: translateX(-6px) scaleX(-1); }
.card:hover .arrow { opacity: 1; transform: translateX(0); }
[dir="rtl"] .card:hover .arrow { transform: translateX(0) scaleX(-1); }

/* ---------- Section heads ---------- */
.section-head { text-align: center; max-width: 720px; margin: 0 auto var(--sp-7); }
.section-head .eyebrow { margin-bottom: var(--sp-3); }
.section-head h2 { font-size: var(--step-2); margin-bottom: var(--sp-3); font-weight: 800; letter-spacing: -0.02em; }
.section-head p { color: var(--text-muted); font-size: var(--step-0); }

/* ---------- Converter widget ---------- */
.converter {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: clamp(var(--sp-5), 3vw, var(--sp-7)); box-shadow: var(--shadow-lg);
  max-width: 780px; margin-inline: auto; position: relative;
}
.converter-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.converter-title { font-size: var(--step-1); font-weight: 800; }
.toolbar-actions { display: flex; gap: var(--sp-2); }
.pill-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted); padding: var(--sp-2) var(--sp-3);
  border-radius: 999px; font-size: var(--step--1); font-weight: 700; cursor: pointer; transition: all var(--transition); min-height: 2.75rem; /* 44px touch target — DESIGN_SPEC §1 */
}
.pill-btn:hover { color: var(--ink); border-color: var(--primary); background: var(--primary-50); transform: translateY(-1px); }
.pill-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pill-btn:active { transform: scale(0.97); }
.pill-btn svg { width: 16px; height: 16px; }
.pill-btn.active { color: var(--gold); }

.tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.tab-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-weight: 700; font-size: var(--step--1);
  border-radius: 999px; cursor: pointer; min-height: 2.75rem; transition: all var(--transition);
}
.tab-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.tab-btn:hover { background: var(--primary-50); color: var(--ink); border-color: var(--primary); transform: translateY(-1px); }
.tab-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tab-btn:active { transform: scale(0.97); }
.tab-btn[aria-selected='true'] { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--shadow); }
.tab-btn[aria-selected='true'] svg { color: #fff; }

.conv-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-4); align-items: end; }
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-weight: 700; font-size: var(--step--1); color: var(--text-muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: var(--sp-3) var(--sp-4); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: var(--step-0);
  background: var(--surface); color: var(--text); min-height: 52px; transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); outline: none; }
.field input[aria-invalid='true'] { border-color: var(--danger); }
.field select { cursor: pointer; }

.swap-btn {
  align-self: center; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center;
  transition: all var(--transition); box-shadow: var(--shadow-xs);
}
.swap-btn svg { width: 22px; height: 22px; }
.swap-btn:hover { background: var(--grad-brand); color: #fff; border-color: transparent; transform: rotate(180deg); box-shadow: var(--shadow); }

.result {
  margin-top: var(--sp-5); background: linear-gradient(135deg, var(--primary-50), color-mix(in srgb, var(--accent) 10%, var(--surface)));
  border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5); text-align: center;
  min-height: 92px; display: grid; place-items: center; position: relative;
}
.result .value { font-size: var(--step-2); font-weight: 800; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; direction: ltr; }
.result .hint { color: var(--text-muted); font-size: var(--step--1); margin-top: var(--sp-1); }
.result.error .value { -webkit-text-fill-color: var(--danger); color: var(--danger); font-size: var(--step-0); }
.result .copy-result {
  position: absolute; inset-inline-end: var(--sp-3); top: var(--sp-3);
  border: 1px solid var(--border);   background: var(--surface); color: var(--text-muted);
  width: 2.75rem; height: 2.75rem; border-radius: 12px; cursor: pointer; display: grid; place-items: center; transition: all var(--transition);
  min-height: 2.75rem; /* 44px touch target — DESIGN_SPEC §1 */
}
.result .copy-result:hover { color: var(--primary-700); border-color: var(--primary); background: var(--primary-50); transform: translateY(-1px); }
.result .copy-result:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.result .copy-result:active { transform: scale(0.94); }
.result .copy-result svg { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .conv-grid { grid-template-columns: 1fr; }
  .swap-btn { justify-self: center; }
}

/* ---------- History ---------- */
.history { margin-top: var(--sp-5); }
.history h2 { font-size: var(--step-0); margin-bottom: var(--sp-3); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.history h2 > span { display: inline-flex; align-items: center; gap: 8px; }
.history h2 svg, .history h2 [data-icon] svg { width: 20px; height: 20px; flex-shrink: 0; }
.history .clear { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: var(--step--1); font-weight: 700; border-radius: 8px; padding: 4px 8px; }
.history .clear:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.history .clear:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.history-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--step--1); direction: ltr; text-align: start;
}
.history-item .t { color: var(--text-muted); font-size: 0.78rem; }
.history-empty { color: var(--text-muted); font-size: var(--step--1); text-align: center; padding: var(--sp-4); }

/* ---------- Info / formula ---------- */
.info-block { margin-top: var(--sp-6); }
.formula { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: var(--sp-4); direction: ltr; text-align: center; font-family: 'Courier New', monospace; line-height: 2; }
.conv-list li { padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.conv-list li:last-child { border-bottom: none; }

/* ---------- Comparison table (competitor analysis) ---------- */
.compare-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.compare { width: 100%; border-collapse: collapse; min-width: 620px; background: var(--surface); }
.compare th, .compare td { padding: var(--sp-4); text-align: center; border-bottom: 1px solid var(--border); }
.compare th:first-child, .compare td:first-child { text-align: start; font-weight: 700; }
.compare thead th { background: var(--surface-2); font-weight: 800; }
.compare .us { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); position: relative; }
.compare thead .us { background: var(--grad-brand); color: #fff; }
.compare .yes { color: var(--accent); font-weight: 800; }
.compare .no { color: var(--danger); }
.compare tbody tr:last-child td { border-bottom: none; }

/* ---------- Prose ---------- */
.prose { max-width: 760px; margin-inline: auto; }
.prose h2 { font-size: var(--step-2); margin: var(--sp-7) 0 var(--sp-3); font-weight: 800; letter-spacing: -0.02em; }
.prose h3 { font-size: var(--step-1); margin: var(--sp-5) 0 var(--sp-2); font-weight: 700; }
.prose p, .prose li { color: var(--text); margin-bottom: var(--sp-3); }
.prose ul, .prose ol { padding-inline-start: var(--sp-5); margin-bottom: var(--sp-4); }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose img { border-radius: var(--radius); box-shadow: var(--shadow); margin: var(--sp-5) auto; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--sp-4) 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--sp-3); text-align: start; }
.prose th { background: var(--surface-2); }
.article-hero { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--sp-5); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--step--1); color: var(--text-muted); margin-bottom: var(--sp-5); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--ink); }

/* ---------- Feature list ---------- */
.feature { display: flex; gap: var(--sp-4); align-items: flex-start; }
.feature .fi { flex-shrink: 0; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-50); color: var(--ink); }
.feature .fi svg { width: 26px; height: 26px; }
.feature h3 { font-size: var(--step-1); margin-bottom: var(--sp-1); font-weight: 800; }
.feature p { color: var(--text-muted); font-size: var(--step--1); }

/* ---------- CTA band ---------- */
/* Provenance / proof grid — verifiable accuracy claims (#accuracy section).
   Uses --ink for all glyphs so it stays AA-compliant in both themes. */
.proof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.proof-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.proof-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.proof-card b { display: block; font-size: var(--step-1); font-weight: 800; color: var(--ink); line-height: 1.2; }
.proof-card span { display: block; font-size: var(--step--1); font-weight: 700; color: var(--text); margin-top: var(--sp-1); }
.proof-card p { font-size: var(--step--1); color: var(--text-muted); margin-top: var(--sp-2); line-height: 1.7; }
.proof-note { margin-top: var(--sp-5); text-align: center; font-size: var(--step--1); color: var(--text-muted); line-height: 2; }
.proof-note a { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.cta-band { background: var(--grad-brand); border-radius: var(--radius-xl); padding: clamp(var(--sp-6), 5vw, var(--sp-8)); text-align: center; color: #fff; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.cta-band::before { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 300px at 80% -20%, rgba(255,255,255,0.25), transparent); }
.cta-band h2 { font-size: var(--step-2); font-weight: 800; margin-bottom: var(--sp-3); position: relative; }
.cta-band p { opacity: 0.95; margin-bottom: var(--sp-5); position: relative; }
.cta-band .btn-outline { background: #fff; color: var(--primary-700); border-color: #fff; position: relative; }
.cta-band .btn-outline:hover { background: rgba(255,255,255,0.9); }
.cta-band .btn-outline:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.65); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: var(--sp-6); margin-inline: auto; width: max-content; max-width: 90%;
  background: var(--text); color: var(--surface); padding: var(--sp-3) var(--sp-5); border-radius: 999px;
  font-weight: 700; font-size: var(--step--1); box-shadow: var(--shadow-lg); z-index: 2000;
  opacity: 0; transform: translateY(20px); transition: all var(--transition); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-block: var(--sp-7) var(--sp-5); margin-top: var(--sp-9); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-6); margin-bottom: var(--sp-6); }
.footer-grid h4, .footer-grid .footer-heading { font-size: var(--step-0); margin-bottom: var(--sp-3); font-weight: 800; }
.footer-grid a { display: block; color: var(--text-muted); padding: var(--sp-1) 0; font-size: var(--step--1); }
.footer-grid a:hover { color: var(--ink); }
.footer-bottom { text-align: center; color: var(--text-muted); font-size: var(--step--1); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.footer-dev { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--sp-2); text-align: center; color: var(--text-muted); font-size: var(--step--1); padding-top: var(--sp-3); }
.footer-dev .footer-dev-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.footer-dev .footer-dev-name:hover { text-decoration: underline; }
/* No opacity here: --text-muted (#566b70, 5.63:1 on white) is diluted to
   3.64:1 by opacity .8, failing AA. Muted tokens are already tuned for
   contrast, so dimming them further re-breaks them (axe: color-contrast). */
.footer-dev .footer-dev-role { color: var(--text-muted); }
.footer-dev-links { display: inline-flex; align-items: center; gap: var(--sp-2); margin-inline-start: var(--sp-1); }
.footer-dev-links a { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 12px; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease); }
.footer-dev-links a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.footer-dev-links a:hover { color: var(--ink); border-color: var(--primary); transform: translateY(-2px); }
.footer-dev-links svg { width: 16px; height: 16px; }
@media (max-width: 460px) { .footer-dev .footer-dev-role { flex-basis: 100%; } }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Ad container ---------- */
.ad-container { text-align: center; margin: var(--sp-6) 0; min-height: 90px; }
.ad-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: var(--sp-1); }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
/* Reveal only hides when JS is confirmed active (prevents empty-page flash & keeps content for crawlers) */
html.js-ready .reveal { opacity: 0; transform: translateY(24px); }
html.js-ready .reveal.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
@media (prefers-reduced-motion: reduce) { html.js-ready .reveal { opacity: 1; transform: none; } }

/* ---------- Chips & FAQ accordion (added Turn 2) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px;
}
.chip svg { width: 15px; height: 15px; color: var(--accent); }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.faq-item[open] { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow); }
.faq-item summary {
  cursor: pointer; font-weight: 700; font-size: var(--step-0); list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  border-radius: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.faq-item summary::after {
  content: '+'; font-size: 1.4em; font-weight: 400; color: var(--ink);
  transition: transform var(--transition); line-height: 1;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: var(--sp-3); color: var(--text-muted); }

/* ---------- Blog cards (added Turn 2) ---------- */
.blog-grid { align-items: stretch; }
.blog-card { padding: 0; display: flex; flex-direction: column; }
.blog-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; display: block; }
.blog-card-body { padding: var(--sp-5); position: relative; }
.blog-date { font-size: 0.72rem; color: var(--ink); font-weight: 700; }
.blog-card-body h3, .blog-card-body .card-title { font-size: var(--step-1); margin: var(--sp-2) 0; font-weight: 800; }
.blog-card-body p { color: var(--text-muted); font-size: var(--step--1); }
.blog-card .arrow { position: static; opacity: 0.85; margin-top: var(--sp-3); display: inline-block; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--sp-4) 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.prose th, .prose td { padding: var(--sp-3) var(--sp-4); text-align: start; border-bottom: 1px solid var(--border); }
.prose thead th { background: var(--surface-2); font-weight: 800; }
.prose tbody tr:last-child td { border-bottom: none; }

/* Inline icon sizing — inherit font size in text/buttons; big icons keep their explicit sizes above */
.btn [data-icon] svg, .eyebrow [data-icon] svg, .chip [data-icon] svg,
.pill-btn [data-icon] svg, .breadcrumb [data-icon] svg, .blog-date [data-icon] svg,
.article-meta [data-icon] svg { width: 1.15em; height: 1.15em; }
.tab-btn [data-icon] svg { width: 20px; height: 20px; }
.card .arrow svg, .blog-card .arrow svg { width: 20px; height: 20px; }

/* ==========================================================================
   LUXURY UPGRADE LAYER v3 — depth, color, character (author: mohamed-khairy-5i)
   ========================================================================== */

/* ---- Per-category accent palette ---- */
.cat-length   { --c1:#6366f1; --c2:#8b5cf6; }
.cat-weight   { --c1:#0ea5e9; --c2:#2563eb; }
.cat-area     { --c1:#10b981; --c2:#059669; }
.cat-volume   { --c1:#06b6d4; --c2:#0891b2; }
.cat-temperature { --c1:#f97316; --c2:#ef4444; }
.cat-data     { --c1:#8b5cf6; --c2:#6366f1; }
.cat-speed    { --c1:#f43f5e; --c2:#e11d48; }
.cat-time     { --c1:#14b8a6; --c2:#0d9488; }
.cat-pressure { --c1:#3b82f6; --c2:#6366f1; }
.cat-energy   { --c1:#eab308; --c2:#f59e0b; }
.cat-power    { --c1:#a855f7; --c2:#7c3aed; }
.cat-angle    { --c1:#ec4899; --c2:#db2777; }
.cat-fuel     { --c1:#22c55e; --c2:#16a34a; }
.cat-frequency{ --c1:#0ea5e9; --c2:#06b6d4; }

/* ---- Richer grid: bigger, breathing cards ---- */
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-5); }

.cat-card {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5); border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, color-mix(in srgb, var(--c1) 30%, transparent), transparent 55%) border-box;
  border: 1px solid transparent;
  box-shadow: 0 2px 6px -2px rgba(16,24,64,.08);
  overflow: hidden; isolation: isolate;
}
.cat-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c1) 16%, transparent), transparent 60%);
  transition: opacity var(--transition);
}
.cat-card::after { display: none; } /* disable generic border overlay */
.cat-card:hover { transform: translateY(-6px); box-shadow: 0 22px 44px -18px color-mix(in srgb, var(--c1) 55%, transparent); }
.cat-card:hover::before { opacity: 1; }
.cat-card:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 22px 44px -18px color-mix(in srgb, var(--c1) 55%, transparent); }
.cat-card .card-icon {
  width: 60px; height: 60px; flex-shrink: 0; margin: 0; border-radius: 18px;
  background: linear-gradient(140deg, var(--c1), var(--c2));
  color: #fff; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--c1) 70%, transparent);
  transition: transform var(--transition);
}
.cat-card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }
.cat-card .card-icon svg { width: 30px; height: 30px; }
.cat-card .card-icon svg [stroke] { stroke-width: 2; }
.cat-card-text { min-width: 0; }
.cat-card h3 { font-size: var(--step-0); margin: 0 0 2px; }
.cat-card p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.cat-card .arrow { inset-inline-end: var(--sp-4); bottom: auto; top: 50%; margin-top: -10px; color: var(--c1); }

/* stagger reveal */
html.js-ready .cat-card { transition-delay: var(--d, 0ms); }

/* ---- Hero: more depth & premium glow orbs ---- */
.hero { padding-block: clamp(var(--sp-7), 8vw, var(--sp-9)) var(--sp-8); }
.hero::after {
  content: ''; position: absolute; z-index: -1; width: 520px; height: 520px; border-radius: 50%;
  top: -220px; inset-inline-start: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(124,58,237,.28), transparent 65%);
  filter: blur(20px); pointer-events: none;
}
.hero h1 { font-weight: 900; }
.hero .lead { line-height: 1.85; }
.eyebrow { background: var(--surface-glass); backdrop-filter: blur(8px); font-weight: 800; }
.hero-stat b { font-size: var(--step-3); line-height: 1; }
.hero-stats { gap: clamp(var(--sp-4), 5vw, var(--sp-8)); padding: var(--sp-5) 0; }
.hero-stat { position: relative; padding-inline: var(--sp-4); }
.hero-stat + .hero-stat::before { content: ''; position: absolute; inset-inline-start: 0; top: 15%; height: 70%; width: 1px; background: var(--border); }

/* ---- Buttons: shinier ---- */
.btn-primary { position: relative; overflow: hidden; letter-spacing: .01em; }
.btn-primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
.btn-primary:hover::after { transform: translateX(120%); }

/* ---- Converter widget: more premium framing ---- */
.converter {
  border-radius: var(--radius-xl);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad-brand) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 30px 70px -30px rgba(79,70,229,.45), var(--shadow-xs);
}
.converter::before {
  content: ''; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(700px 220px at 100% -10%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 60%);
}
.converter > * { position: relative; z-index: 1; }

/* ---- Feature cards: give them surface + accent ---- */
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.feature:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-xs); }
.feature .fi {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 10px 24px -10px rgba(79,70,229,.6);
}
.feature .fi svg { width: 28px; height: 28px; }

/* ---- Section head eyebrow gradient ---- */
.section-head h2 { background: linear-gradient(120deg, var(--text), color-mix(in srgb, var(--primary) 55%, var(--text))); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---- Trust bar under hero ---- */
.trust-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-5); }
.trust-bar .chip { background: var(--surface-glass); backdrop-filter: blur(8px); padding: 8px 14px; }

/* ---- Compare table: premium ---- */
.compare thead .us { box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.compare .yes svg { display: inline-block; vertical-align: middle; }

/* ---- CTA band: richer ---- */
.cta-band { box-shadow: 0 30px 70px -24px rgba(79,70,229,.6); }

/* ---- Mobile polish ---- */
@media (max-width: 560px) {
  .cat-card { padding: var(--sp-4); gap: var(--sp-3); }
  .cat-card .card-icon { width: 52px; height: 52px; }
  .hero-stat + .hero-stat::before { display: none; }
}

/* ==========================================================================
   CONVERTER WIDGET v3 — premium, tactile, app-grade (author: mohamed-khairy-5i)
   ========================================================================== */

/* Segmented, scroll-snapping tab rail */
.tabs {
  gap: var(--sp-2); padding: 6px; margin-bottom: var(--sp-6);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  scroll-snap-type: x proximity; flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 1px solid transparent; background: transparent; scroll-snap-align: center;
  white-space: nowrap; flex: 0 0 auto; box-shadow: none;
}
.tab-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--border); }
.tab-btn[aria-selected='true'] { box-shadow: 0 8px 20px -8px rgba(79,70,229,.55); }

/* Toolbar becomes a subtle header strip */
.converter-toolbar {
  padding-bottom: var(--sp-4); margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.converter-title { font-size: var(--step-1); letter-spacing: -0.02em; }
.pill-btn { border-radius: 12px; }
.pill-btn.active { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }

/* Fields as elevated capsules with floating unit chips */
.field {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4); gap: var(--sp-2); transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--surface); }
.field label {
  display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase;
  letter-spacing: .08em; font-size: .7rem; font-weight: 800; color: var(--text-muted);
}
.field label svg { width: 14px; height: 14px; color: var(--ink); }
.field input {
  border: none; background: transparent; padding: 0; min-height: 44px;
  font-size: clamp(1.5rem, 4vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em;
  direction: ltr; text-align: start; box-shadow: none !important;
}
.field input:focus { outline: none; }
.field input::placeholder { font-weight: 600; color: var(--text-muted); }
/* The converted value is the most-read text on the site — it must clear AA.
   -webkit-text-fill-color wins over `color` in WebKit/Blink, so it has to
   carry --ink too, otherwise Chrome/Safari render it at 3.74:1. */
#nx-out { color: var(--ink); -webkit-text-fill-color: var(--ink); }
.field select {
  align-self: flex-start; width: auto; min-width: 0; min-height: 40px; cursor: pointer;
  padding: 6px 34px 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-weight: 700; font-size: var(--step--1);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center;
}
.field select:hover { border-color: var(--primary); }

/* Big central swap FAB with glow ring */
.conv-grid { align-items: stretch; gap: var(--sp-3); }
.swap-btn {
  width: 56px; height: 56px; align-self: center; border: none;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 12px 26px -8px rgba(79,70,229,.6);
}
.swap-btn svg { width: 24px; height: 24px; flex-shrink: 0; }
.swap-btn:hover { transform: rotate(180deg) scale(1.06); box-shadow: 0 18px 34px -10px rgba(79,70,229,.7); border: none; }
.swap-btn:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 12px 26px -8px rgba(79,70,229,.6); }
.swap-btn:active { transform: rotate(180deg) scale(0.94); }

/* Result: hero panel with animated sheen */
.result {
  margin-top: var(--sp-6); min-height: 118px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), color-mix(in srgb, var(--accent) 12%, var(--surface)));
  border: 1.5px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  overflow: hidden;
}
.result::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 160% at 0% 0%, rgba(255,255,255,.35), transparent 55%);
}
.result .value { font-size: clamp(1.6rem, 5vw, 2.4rem); }
.result .hint { font-weight: 600; }
.result .copy-result { border-radius: 12px; box-shadow: var(--shadow-xs); }

/* Info + formula: cleaner cards */
.formula {
  border: 1px solid var(--border); border-style: solid; border-radius: var(--radius);
  background: linear-gradient(var(--surface-2), var(--surface-2));
  color: var(--text); font-family: 'Cairo', var(--font);
}
.conv-list { display: grid; gap: 2px; }
.conv-list li {
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-weight: 600;
}
.info-block h2 { display: flex; align-items: center; gap: 8px; }
.info-block h2::before { content: ''; width: 4px; height: 18px; border-radius: 4px; background: var(--grad-brand); }

@media (max-width: 640px) {
  .conv-grid { grid-template-columns: 1fr; }
  .swap-btn { justify-self: center; transform: rotate(90deg); }
  .swap-btn:hover { transform: rotate(270deg) scale(1.06); }
}

/* ==========================================================================
   AD SLOTS — monetization-ready, non-intrusive, labelled (CLS-safe)
   ========================================================================== */
.ad-slot {
  display: block; margin: var(--sp-6) auto; max-width: 760px; width: 100%;
  min-height: 100px; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); position: relative; overflow: hidden;
}
.ad-slot::before {
  content: 'مساحة إعلانية'; position: absolute; top: 8px; inset-inline-start: 12px;
  font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
}
.ad-slot ins { display: block; }
.ad-inarticle { min-height: 250px; }
.ad-leaderboard { min-height: 90px; }
.ad-sidebar { min-height: 250px; }
@media (max-width: 640px) { .ad-slot { min-height: 100px; } }

/* ==========================================================================
   SIGNATURE + MOTION v4 — the converter as a precision instrument
   Orchestrated, spring-eased, reduced-motion honored (author: mohamed-khairy-5i)
   ========================================================================== */

/* --- Count-up result: the one bold motion moment --- */
.result-inner { display: grid; gap: 6px; place-items: center; }
.result-num {
  font-family: var(--font-mono, var(--font-display));
  font-weight: 800; font-size: clamp(2rem, 6vw, 3rem); line-height: 1;
  letter-spacing: -0.02em; direction: ltr;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; font-variant-numeric: tabular-nums;
}
.result-out { font-variant-numeric: tabular-nums; }
.result .hint .result-in { color: var(--ink); font-weight: 700; }

/* --- Skeleton shimmer (perceived performance, no blank flash) --- */
.conv-skeleton { display: grid; gap: var(--sp-4); }
.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-sm); }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 12%, transparent), transparent);
  transform: translateX(-100%); animation: sk-shimmer 1.3s var(--ease) infinite;
}
.sk-tabs { height: 48px; border-radius: 999px; }
.sk-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-3); align-items: center; }
.sk-field { height: 118px; border-radius: var(--radius-lg); }
.sk-swap { width: 56px; height: 56px; border-radius: 50%; }
.sk-result { height: 118px; border-radius: var(--radius-lg); }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
@media (max-width: 640px) { .sk-row { grid-template-columns: 1fr; } .sk-swap { justify-self: center; } }

/* --- Orchestrated hero load sequence: staggered rise, spring-settled --- */
@media (prefers-reduced-motion: no-preference) {
  html.js-ready .hero > .container > * { opacity: 0; transform: translateY(16px); animation: hero-rise 0.7s var(--ease-spring) forwards; }
  html.js-ready .hero .eyebrow    { animation-delay: 0.05s; }
  html.js-ready .hero h1          { animation-delay: 0.14s; }
  html.js-ready .hero .lead       { animation-delay: 0.24s; }
  html.js-ready .hero .hero-cta   { animation-delay: 0.34s; }
  html.js-ready .hero .hero-stats { animation-delay: 0.44s; }
  html.js-ready .hero .trust-bar  { animation-delay: 0.54s; }
  @keyframes hero-rise { to { opacity: 1; transform: none; } }
}

/* --- Spring easing on the primary interactive elements --- */
.btn-primary, .swap-btn, .cat-card, .feature, .tab-btn { transition-timing-function: var(--ease-spring); }

/* Reduced-motion: count-up disabled in JS; also freeze shimmer + hero */
@media (prefers-reduced-motion: reduce) {
  .sk::after { animation: none; }
  html.js-ready .hero > .container > * { opacity: 1; transform: none; animation: none; }
}

/* ============================================================
   SMART SEARCH (Pillar 4 — scoped deterministic NL search)
   The signature instrument's front door: one field, one answer.
   ============================================================ */
.smart-search-host { width: 100%; }
.smart-search {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  text-align: start;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}
.ss-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  letter-spacing: -0.01em;
}
.ss-label svg { width: 18px; height: 18px; color: var(--ink); flex: none; }
.ss-field { position: relative; }
#ss-input {
  width: 100%;
  font-family: var(--font);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  transition: border-color 0.2s var(--ease-spring), box-shadow 0.25s var(--ease-spring);
}
#ss-input::placeholder { color: var(--text-muted); font-weight: 500; }
#ss-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-50), var(--shadow-xs);
}
.ss-out {
  min-height: 0;
  overflow: hidden;
  transition: min-height 0.3s var(--ease);
}
.ss-out:empty { margin: 0; padding: 0; }
.ss-hint {
  margin-top: var(--sp-4);
  font-size: var(--step--1);
  color: var(--text-muted);
  line-height: 1.6;
}
.ss-answer {
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: ss-pop 0.42s var(--ease-spring) both;
}
@keyframes ss-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.ss-ans-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.05rem, 0.9rem + 1vw, 1.5rem);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4ch;
}
.ss-ans-num strong {
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--ink);
}
/* The "=" carries meaning in a conversion result, so it must stay legible:
   --text-muted at opacity .6 renders ~2.50:1 on white (AA needs 4.5:1). */
.ss-eq { color: var(--text-muted); margin: 0 0.2ch; }
.ss-open {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--ink);
  text-decoration: none;
  transition: gap 0.2s var(--ease-spring);
}
.ss-open:hover { gap: calc(var(--sp-2) + 4px); }
.ss-open svg { width: 16px; height: 16px; }
.ss-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}
.ss-chip {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ss-chip:hover {
  color: var(--ink);
  border-color: var(--primary);
  background: var(--primary-50);
  transform: translateY(-1px);
}
.ss-chip:active { transform: translateY(0) scale(0.97); }
.ss-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (max-width: 520px) {
  .smart-search { padding: var(--sp-4); }
  #ss-input { font-size: var(--step-0); padding: var(--sp-3) var(--sp-4); }
}
@media (prefers-reduced-motion: reduce) {
  .ss-answer { animation: none; }
  #ss-input, .ss-chip, .ss-open { transition: none; }
}

/* ============================================================
   CONVERSION-PAIR PAGES (Roadmap 1.1)
   Instant answer + reference table.
   ============================================================ */
.pair-answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.3rem, 1rem + 2vw, 2.4rem);
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.pair-res {
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--ink);
}
/* Same reasoning as .ss-eq — meaningful glyph, no opacity dimming. */
.pair-eq { color: var(--text-muted); margin: 0 0.3ch; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.conv-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.conv-table th,
.conv-table td {
  text-align: start;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--step-0);
}
.conv-table thead th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  position: sticky;
  top: 0;
}
.conv-table tbody tr:last-child td { border-bottom: 0; }
.conv-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.conv-table td:last-child { font-weight: 700; color: var(--ink); }

/* ==========================================================================
   ACCESSIBILITY — touch-target sizing (WCAG 2.5.5 / Apple HIG ~44px)
   Enlarges hit areas for small links & text buttons on touch/small screens
   without changing the visual footprint (padding expands the clickable box).
   ========================================================================== */
@media (max-width: 768px) {
  /* Breadcrumb links */
  .breadcrumb { gap: var(--sp-3); }
  .breadcrumb a {
    display: inline-flex; align-items: center;
    min-height: 44px; padding-inline: 4px;
  }
  /* Footer column links */
  .footer-grid a {
    min-height: 44px; display: flex; align-items: center;
    padding-block: var(--sp-2);
  }
  /* Developer credit: name + role tappable name */
  .footer-dev .footer-dev-name {
    display: inline-flex; align-items: center;
    min-height: 44px; padding-inline: 4px;
  }
  /* Developer credit: social icon buttons */
  .footer-dev-links { gap: var(--sp-3); }
  .footer-dev-links a { width: 44px; height: 44px; border-radius: 12px; }
  .footer-dev-links svg { width: 18px; height: 18px; }
  /* History "clear all" text button */
  .history .clear {
    display: inline-flex; align-items: center;
    min-height: 44px; padding: 0 var(--sp-3); border-radius: 10px;
  }
  /* Header / footer theme + nav toggles get comfortable hit area */
  .pill-btn { min-height: 44px; }
  /* Brand/logo link: keep 40px logo visual, expand tap box to 44px */
  .brand { min-height: 44px; }
  /* Smart-search suggestion chips */
  .ss-chip { min-height: 44px; display: inline-flex; align-items: center; }
}

/* PWA install CTA — progressive enhancement and accessible touch targets. */
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-4); }
.install-hint { margin: var(--sp-3) 0 0; color: var(--text-muted); font-size: .86rem; }
[data-pwa-install][hidden], [data-install-hint][hidden] { display: none !important; }
@media (max-width: 520px) {
  .cta-actions > .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cta-actions .btn { transition: none; }
}

/* Week 6: safe explanation and data-system controls */
.explain-box {
  margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--text);
  line-height: 1.8;
}
.data-system-control {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--text-muted);
  font-size: .82rem;
}
.data-system-select {
  min-height: 2.75rem;
  padding: .2rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.data-system-note { color: var(--text-muted); font-size: .92rem; }
@media (max-width: 560px) {
  .converter-toolbar { align-items: flex-start; gap: var(--sp-2); }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .data-system-control { order: 3; width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .explain-box { transition: none; }
}

/* Embeddable widget */
.embed-shell { max-width: 32rem; margin: 0 auto; padding: 1rem; }
.embed-shell .embed-form { display: grid; gap: .7rem; }
.embed-shell label { display: grid; gap: .25rem; font-weight: 600; }
.embed-shell input, .embed-shell select, .embed-shell button { min-height: 2.7rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; }
.embed-shell button { cursor: pointer; background: var(--accent-600); color: #fff; border-color: var(--accent-600); }
.embed-shell [data-embed-result] { margin-top: 1rem; min-height: 2.7rem; padding: .7rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.embed-shell [data-embed-result][data-state="error"] { color: var(--danger); }


/* Week 8: local client error boundary. */
.client-error-banner {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1rem;
  z-index: 1000;
  max-width: 42rem;
  margin-inline: auto;
  padding: .8rem 1rem;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  text-align: center;
  font-size: .9rem;
}


/* ========================================================================
   Nexluna Expansion UI — visible product layer
   This layer changes presentation only; conversion logic and data contracts
   remain untouched.
   ======================================================================== */
:root {
  --nx-ink-deep: #071b2a;
  --nx-ink-mid: #10364a;
  --nx-cyan: #35d0c2;
  --nx-violet: #7568ff;
  --nx-peach: #ffcf9f;
  --nx-grid-line: rgba(255,255,255,.11);
}

body {
  background-image:
    linear-gradient(rgba(15,148,136,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,148,136,.035) 1px, transparent 1px),
    var(--bg-tint);
  background-size: 36px 36px, 36px 36px, auto;
}

.site-header { border-bottom-color: color-mix(in srgb, var(--primary) 20%, var(--border)); }
.brand-logo { border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.hero {
  padding-block: clamp(3.5rem, 8vw, 7.5rem) clamp(2.5rem, 5vw, 5rem);
  text-align: start;
}
.hero::before {
  background:
    radial-gradient(circle at 8% 18%, rgba(117,104,255,.28), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(53,208,194,.24), transparent 32%),
    linear-gradient(130deg, var(--nx-ink-deep), var(--nx-ink-mid));
  opacity: 1;
  -webkit-mask: none;
  mask: none;
}
.hero .container { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
}
.hero-copy { max-width: 720px; }
.hero .eyebrow { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: var(--nx-cyan); box-shadow: none; }
.hero h1 { color: #fff; font-size: clamp(2.8rem, 6vw, 5.8rem); line-height: 1.02; }
.hero h1 .grad { background: linear-gradient(100deg, var(--nx-cyan), #b7fff4 52%, var(--nx-peach)); -webkit-background-clip: text; background-clip: text; }
.hero .lead { max-width: 650px; color: rgba(255,255,255,.74); font-size: clamp(1rem, 1.6vw, 1.25rem); }
.hero-cta { justify-content: flex-start; }
.hero .btn-primary { background: #fff; color: var(--nx-ink-deep); box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.hero .btn-primary:hover { color: var(--nx-ink-deep); background: var(--nx-peach); }
.hero .btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.85); }
.hero-stats { justify-content: flex-start; gap: clamp(1.25rem, 4vw, 3rem); }
.hero-stat b { background: linear-gradient(120deg, #fff, var(--nx-cyan)); -webkit-background-clip: text; background-clip: text; }
.hero-stat span { color: rgba(255,255,255,.65); }
.trust-bar { justify-content: flex-start; border-top-color: rgba(255,255,255,.16); }
.hero .chip { color: rgba(255,255,255,.78); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.smart-search-host { margin-inline: 0; }

.hero-preview {
  min-height: 360px; display: grid; place-items: center; position: relative;
  border: 1px solid rgba(255,255,255,.18); border-radius: 32px;
  background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.045));
  box-shadow: 0 28px 80px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.16);
  overflow: hidden; isolation: isolate;
}
.hero-preview::before, .hero-preview::after { content: ''; position: absolute; border-radius: 50%; filter: blur(2px); z-index: -1; }
.hero-preview::before { width: 220px; height: 220px; background: rgba(53,208,194,.24); inset-inline-end: -80px; top: -80px; }
.hero-preview::after { width: 180px; height: 180px; background: rgba(117,104,255,.28); inset-inline-start: -70px; bottom: -60px; }
.preview-orbit { width: min(78%, 300px); aspect-ratio: 1; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; display: grid; place-items: center; position: relative; }
.preview-orbit::before, .preview-orbit::after { content: ''; position: absolute; inset: 14%; border: 1px dashed rgba(255,255,255,.25); border-radius: 50%; }
.preview-orbit::after { inset: 30%; border-style: solid; border-color: rgba(53,208,194,.38); }
.preview-core { width: 42%; aspect-ratio: 1; border-radius: 28%; display: grid; place-items: center; background: linear-gradient(145deg, var(--nx-cyan), var(--nx-violet)); color: #fff; box-shadow: 0 0 0 12px rgba(53,208,194,.08), 0 18px 45px rgba(0,0,0,.3); }
.preview-core svg { width: 46%; height: 46%; }
.preview-label { position: absolute; padding: .5rem .75rem; border-radius: 10px; color: #fff; font: 700 .78rem var(--font-mono); background: rgba(7,27,42,.68); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.preview-label.top { top: 12%; inset-inline-end: 9%; }
.preview-label.bottom { bottom: 15%; inset-inline-start: 9%; }
.preview-label small { display: block; color: var(--nx-cyan); font: 600 .68rem var(--font); margin-top: .15rem; }

#converter { position: relative; }
#converter::before { content: 'تحويل واضح. نتيجة موثوقة.'; display: block; color: var(--ink); font-size: var(--step--1); font-weight: 800; letter-spacing: .08em; text-align: center; margin-bottom: var(--sp-3); }
.converter { border: 2px solid color-mix(in srgb, var(--primary) 30%, var(--border)); box-shadow: 0 26px 70px -24px color-mix(in srgb, var(--primary) 40%, transparent); }
.converter-toolbar { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.converter-result, .result-box { border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 9%, transparent); }

.section-head h2 { letter-spacing: -.04em; }
.card { border-radius: var(--radius-lg); }
.card-icon { border-radius: 18px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent); }
.cta-band { border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border)); background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 14%, var(--surface)), var(--surface)); }

@media (max-width: 900px) {
  .hero { text-align: center; }
  .hero-grid { grid-template-columns: 1fr; gap: var(--sp-7); }
  .hero-copy { margin-inline: auto; }
  .hero-cta, .hero-stats, .trust-bar { justify-content: center; }
  .smart-search-host { margin-inline: auto; }
  .hero-preview { min-height: 280px; max-width: 520px; width: 100%; margin-inline: auto; }
}

@media (max-width: 560px) {
  .hero { padding-block-start: 2.75rem; }
  .hero h1 { font-size: clamp(2.45rem, 14vw, 3.8rem); }
  .hero-stats { gap: var(--sp-4); }
  .hero-stat b { font-size: var(--step-1); }
  .hero-preview { min-height: 240px; border-radius: 24px; }
  .preview-label { font-size: .68rem; }
}

html[data-theme='dark'] .hero::before { background: linear-gradient(130deg, #04131e, #0c3040); }
html[data-theme='light'] .hero::before { background: linear-gradient(130deg, #102c43, #145e66); }


/* Category converter hero — shared visual language for every measurement page */
.category-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center; gap: var(--sp-6); padding: clamp(1.5rem, 4vw, 3rem);
  margin-block: var(--sp-5) var(--sp-7); border-radius: var(--radius-xl);
  color: #fff; background: linear-gradient(125deg, #082033, #123e51 62%, #0b756f);
  box-shadow: 0 24px 60px -22px rgba(8,32,51,.55);
}
.category-hero::before { content: ''; position: absolute; width: 280px; height: 280px; border-radius: 50%; background: rgba(53,208,194,.18); inset-inline-end: -80px; top: -150px; }
.category-hero-copy { position: relative; z-index: 1; }
.category-hero .eyebrow { margin-bottom: var(--sp-3); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #8df8eb; box-shadow: none; }
.category-hero h1 { font-size: clamp(2rem, 4.3vw, 3.6rem); line-height: 1.08; letter-spacing: -.04em; }
.category-hero h1 span { color: #8df8eb; }
.category-hero p { max-width: 700px; margin-top: var(--sp-3); color: rgba(255,255,255,.74); }
.category-hero-icon { position: relative; z-index: 1; width: 112px; height: 112px; display: grid; place-items: center; border-radius: 32px; background: linear-gradient(145deg, rgba(141,248,235,.95), rgba(117,104,255,.9)); color: #082033; box-shadow: 0 14px 36px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.6); }
.category-hero-icon svg { width: 56px; height: 56px; }
.category-hero-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: var(--sp-4); }
.category-hero-pills span { padding: .35rem .7rem; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: rgba(255,255,255,.86); background: rgba(255,255,255,.08); font-size: .78rem; font-weight: 700; }
@media (max-width: 620px) {
  .category-hero { grid-template-columns: 1fr; text-align: center; }
  .category-hero-icon { width: 82px; height: 82px; border-radius: 24px; margin-inline: auto; }
  .category-hero-icon svg { width: 42px; height: 42px; }
  .category-hero-pills { justify-content: center; }
}

/* ========================================================================
   ENGLISH LOCALE STYLES (/en/) — full parity with the Arabic expansion layer.
   build_en.py emits classes that previously had NO styles at all; this layer
   gives the English pages the same visual language as the Arabic site,
   following DESIGN_SPEC.md (touch targets, contrast, button hierarchy).
   ======================================================================== */
/* EN hero — same dark premium shell as the Arabic hero, so white headings clear AA */
.hero-redesign::before {
  background:
    radial-gradient(circle at 8% 18%, rgba(117,104,255,.28), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(53,208,194,.24), transparent 32%),
    linear-gradient(130deg, var(--nx-ink-deep), var(--nx-ink-mid));
  opacity: 1;
  -webkit-mask: none;
  mask: none;
}
.hero-redesign .eyebrow { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: var(--nx-cyan); box-shadow: none; }
.hero-redesign h1 { color: #fff; }
.hero-redesign h1 .grad { background: linear-gradient(100deg, var(--nx-cyan), #b7fff4 52%, var(--nx-peach)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-redesign .btn-primary { background: #fff; color: var(--nx-ink-deep); box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.hero-redesign .btn-primary:hover { background: var(--nx-peach); }
.hero-redesign .btn-ghost { color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.25); }
.hero-redesign .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.45); }

.hero-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5); }
.hero-actions .btn:focus-visible { box-shadow: var(--focus-ring), var(--shadow-xs); }
.hero-actions .btn:hover { transform: translateY(-2px); }
.hero-actions .btn-ghost:hover { background: rgba(255,255,255,.12); }

.hero-pills { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.hero-pills span {
  padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-muted); background: var(--surface); font-size: var(--step--1); font-weight: 700;
}

.hero-lead { color: var(--text-muted); font-size: var(--step-1); max-width: 620px; line-height: 1.7; }
.section-lead { color: var(--text-muted); font-size: var(--step-0); max-width: 620px; }

.section-muted { background: var(--surface-2); border-radius: var(--radius-xl); }
.section-muted .container { padding-block: var(--sp-8); }

/* EN home hero measure card — replaces the Arabic hero preview */
.hero-measure-card {
  position: relative; min-height: 300px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface);
  box-shadow: var(--shadow-lg); overflow: hidden; isolation: isolate; text-align: center;
}
.hero-measure-card strong { font-size: var(--step-3); font-weight: 800; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; display: block; line-height: 1.1; }
.hero-measure-card > span { color: var(--text-muted); font-size: var(--step--1); display: block; margin-top: var(--sp-1); }
.hero-measure-card .measure-mini {
  margin-top: var(--sp-5); display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5); border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: var(--step-0); font-weight: 800; color: var(--text);
}
.hero-measure-card .measure-mini b { color: var(--ink); }
.measure-orbit {
  position: absolute; inset-inline-end: -90px; top: -90px; width: 260px; height: 260px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 50%; opacity: .7;
}
.measure-label {
  position: absolute; inset-inline-start: var(--sp-4); top: var(--sp-4);
  padding: .3rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  color: var(--primary-700); background: var(--primary-50); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
}

/* EN category grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }
.category-card {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-5); border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.category-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.category-card:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-xs); }
.category-card .cat-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary-50); color: var(--ink); font-size: 1.4rem;
}
.category-card strong { font-size: var(--step-0); font-weight: 800; }
.category-card > span { color: var(--text-muted); font-size: var(--step--1); line-height: 1.55; }

/* EN feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-5); }
.feature-grid article {
  padding: var(--sp-5); border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); transition: box-shadow var(--transition), border-color var(--transition);
}
.feature-grid article:hover { box-shadow: var(--shadow-xs); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }
.feature-grid h3 { font-size: var(--step-0); margin-bottom: var(--sp-2); font-weight: 800; }
.feature-grid p { color: var(--text-muted); font-size: var(--step--1); line-height: 1.65; }
.feature-grid article::before {
  content: ''; display: block; width: 36px; height: 4px; border-radius: 2px;
  background: var(--grad-brand); margin-bottom: var(--sp-3);
}

/* EN related cards + content panel on converter pages */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
.related-card {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted); font-weight: 700; font-size: var(--step--1);
  transition: all var(--transition); min-height: 2.75rem; text-align: center;
}
.related-card:hover { color: var(--ink); border-color: var(--primary); background: var(--primary-50); transform: translateY(-2px); }
.related-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.content-panel {
  margin-top: var(--sp-7); padding: var(--sp-6); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.content-panel h2 { font-size: var(--step-1); font-weight: 800; margin-bottom: var(--sp-3); margin-top: var(--sp-5); }
.content-panel h2:first-child { margin-top: 0; }
.content-panel p { color: var(--text-muted); line-height: 1.8; }
.content-panel ul { padding-inline-start: var(--sp-5); }
.content-panel li { color: var(--text-muted); line-height: 1.8; }

.converter-shell { max-width: 100%; }

/* EN ghost button on the EN home only (DESIGN_SPEC §4 hierarchy) */
.btn-ghost:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* EN pair/compare numbers */
.pair-num { font-family: var(--font-mono); font-weight: 800; font-size: var(--step-2); color: var(--ink); }
.footer-badges { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-actions, .hero-pills { justify-content: flex-start; }
  .category-hero-pills { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-measure-card { min-height: 240px; }
  .footer-badges { justify-content: center; }
}
