/* تحويشة العمر — هوية «حوشها صح» */

:root {
  --ink: #16150F;
  --cream: #FFF4DE;
  --paper: #FFFFFF;
  --lime: #C8F031;
  --green: #0B6E4F;
  --coral: #FF6B3D;
  --muted: #5C5A50;
  --line: #16150F;

  --font-display: "Lalezar", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans Arabic", system-ui, sans-serif;

  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-12: 48px;

  --radius-md: 20px;
  --radius-pill: 999px;
  --border: 3px solid var(--line);
  --shadow: 6px 6px 0 var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--green); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--space-4); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--ink); color: var(--lime); padding: 8px 16px; border-radius: var(--radius-pill); z-index: 10; }
.skip:focus { top: 8px; }

/* رمز الريال */
.rs { display: inline-block; width: 0.66em; height: 0.74em; vertical-align: -0.04em; fill: currentColor; color: inherit; flex-shrink: 0; }
.money { white-space: nowrap; }

/* ---------- الهيدر ---------- */
.top { border-bottom: var(--border); background: var(--cream); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-display); font-weight: 400; font-size: 26px; }
.brand-text small { font-size: 12px; color: var(--muted); }
.brand-mark { display: inline-flex; flex-direction: column; gap: 3px; }
.brand-mark i { display: block; width: 30px; height: 9px; border-radius: 5px; background: var(--ink); }
.brand-mark i:nth-child(1) { background: var(--coral); margin-inline-start: 5px; }
.brand-mark i:nth-child(2) { background: var(--green); }
.brand-mark i:nth-child(3) { margin-inline-start: 5px; }
.top-nav { display: flex; gap: var(--space-4); }
.top-nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; padding: 6px 2px; border-bottom: 3px solid transparent; }
.top-nav a:hover { border-color: var(--lime); }
@media (max-width: 520px) { .top-nav { display: none; } }

/* ---------- الهيرو ---------- */
.hero { padding-block: var(--space-12) var(--space-6); text-align: start; }
.sticker { display: inline-block; background: var(--coral); border: var(--border); border-radius: var(--radius-pill); padding: 2px 18px; font-family: var(--font-display); font-size: 20px; transform: rotate(-3deg); margin-bottom: var(--space-4); }
.hero h1 { font-size: clamp(44px, 9vw, 92px); }
.hero mark { background: var(--lime); color: var(--ink); padding: 0 12px; border-radius: 14px; }
.lead { margin-top: var(--space-4); font-size: clamp(17px, 2.4vw, 21px); color: var(--muted); max-width: 560px; }

/* ---------- البطاقات ---------- */
.card { background: var(--paper); border: var(--border); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow); }

.calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); padding-bottom: var(--space-12); }
.calc > * { min-width: 0; }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .result { position: sticky; top: 92px; }
}

/* ---------- المدخلات ---------- */
.inputs { display: flex; flex-direction: column; gap: var(--space-6); }
.field { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.field legend, .field label:not(.chip):not(.sr), .field-head label { font-weight: 700; font-size: 17px; padding: 0; }
.field legend { margin-bottom: 10px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.unit { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.err { font-size: 14px; color: #A0300F; font-weight: 700; }

.num-input { display: flex; align-items: center; gap: 10px; border: var(--border); border-radius: 14px; background: var(--cream); padding: 6px 18px; font-family: var(--font-display); font-size: 40px; }
.num-input:focus-within { background: var(--paper); outline: 3px solid var(--lime); outline-offset: 0; }
.num-input input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 0; outline: none; text-align: start; }
.num-input.small { font-size: 26px; max-width: 260px; padding-block: 4px; }
.num-input .suffix { font-family: var(--font-sans); font-size: 15px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.num-input.is-bad { border-color: #A0300F; }

.pill { background: var(--ink); color: var(--lime); border-radius: var(--radius-pill); padding: 2px 16px; font-family: var(--font-display); font-size: 22px; }

/* المنزلقات */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(to left, var(--green) var(--p, 0%), #E6DCC6 var(--p, 0%)); border: 2px solid var(--ink); }
.range::-moz-range-track { height: 10px; border-radius: 5px; background: #E6DCC6; border: 2px solid var(--ink); }
.range::-moz-range-progress { height: 10px; border-radius: 5px; background: var(--green); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); margin-top: -12px; }
.range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--coral); }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -6px; }

/* شرائح الأمثلة */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { position: relative; cursor: pointer; }
.chip input, .seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; border: var(--border); border-radius: var(--radius-pill); padding: 6px 16px; font-weight: 700; font-size: 15px; background: var(--cream); transition: transform .12s; }
.chip input:checked + span { background: var(--lime); }
.chip input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }
.chip:hover span { transform: translateY(-2px); }

/* اختيار السيناريو */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.seg label { position: relative; cursor: pointer; }
.seg span { display: flex; flex-direction: column; border: var(--border); border-radius: 14px; padding: 10px 14px; background: var(--cream); height: 100%; line-height: 1.4; }
.seg b { font-size: 15px; }
.seg small { font-size: 13px; color: var(--muted); }
.seg input:checked + span { background: var(--green); color: var(--cream); }
.seg input:checked + span small { color: var(--lime); }
.seg input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }

.more summary, .table-wrap summary { cursor: pointer; font-weight: 700; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker, .table-wrap summary::-webkit-details-marker { display: none; }
.more summary::before, .table-wrap summary::before { content: "+"; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; font-size: 18px; line-height: 1; }
.more[open] summary::before, .table-wrap[open] summary::before { content: "−"; background: var(--lime); }
.more[open] { display: flex; flex-direction: column; gap: var(--space-6); }

/* ---------- النتيجة ---------- */
.result { background: var(--lime); display: flex; flex-direction: column; gap: var(--space-4); }
.result-label { font-weight: 700; font-size: 18px; }
.big { font-family: var(--font-display); font-size: clamp(60px, 12vw, 104px); line-height: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.big .rs { width: 0.5em; height: 0.56em; }

.split { display: flex; height: 22px; border: var(--border); border-radius: var(--radius-pill); overflow: hidden; background: var(--paper); }
.split-saved { background: var(--green); transition: width .35s ease; }
.split-growth { background: var(--paper); background-image: repeating-linear-gradient(45deg, var(--ink) 0 2px, transparent 2px 9px); transition: width .35s ease; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: 0; }
.stats div { background: var(--paper); border: var(--border); border-radius: 14px; padding: 10px 14px; }
.stats dt { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stats dd { margin: 0; font-family: var(--font-display); font-size: 30px; line-height: 1.3; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex-shrink: 0; }
.dot.saved { background: var(--green); }
.dot.growth { background: var(--paper); background-image: repeating-linear-gradient(45deg, var(--ink) 0 1.5px, transparent 1.5px 4px); }

.insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.insights li { background: var(--cream); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 15px; line-height: 1.6; }
.insights strong { font-family: var(--font-display); font-weight: 400; font-size: 19px; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.btn { appearance: none; border: var(--border); background: var(--ink); color: var(--lime); font: inherit; font-weight: 700; font-size: 16px; padding: 10px 22px; border-radius: var(--radius-pill); cursor: pointer; text-decoration: none; min-height: 48px; display: inline-flex; align-items: center; transition: transform .12s; }
.btn:hover { transform: translateY(-2px); color: var(--lime); }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { color: var(--ink); }
.toast { font-size: 14px; font-weight: 700; }

/* ---------- الرسم ---------- */
.growth-sec { padding-bottom: var(--space-12); }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.sec-head h2, .how h2 { font-size: clamp(32px, 5vw, 48px); }
.legend { display: flex; gap: var(--space-4); font-size: 14px; font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-svg { width: 100%; height: auto; display: block; font-family: var(--font-sans); }
.chart-svg .grid { stroke: #E6DCC6; stroke-width: 1.5; }
.chart-svg .axis { stroke: var(--ink); stroke-width: 2.5; }
.chart-svg .tick { fill: var(--ink); font-size: 14px; font-weight: 500; }
.chart-svg .muted { fill: var(--muted); font-size: 13px; }
.chart-svg .hit { fill: transparent; }
.chart-svg .b-saved { fill: var(--green); }
.chart-svg .b-growth { fill: var(--lime); stroke: var(--ink); stroke-width: 2; }
.chart-svg .bar { cursor: pointer; outline: none; }
.chart-svg .bar:hover .hit, .chart-svg .bar.is-sel .hit, .chart-svg .bar:focus-visible .hit { fill: rgba(200, 240, 49, .22); }
.chart-detail { margin-top: var(--space-2); font-size: 15px; min-height: 1.7em; color: var(--muted); }
.chart-detail strong { color: var(--ink); }

.table-wrap { margin-top: var(--space-4); }
.table-scroll { overflow-x: auto; margin-top: var(--space-4); border: 2px solid var(--ink); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
th, td { padding: 10px 14px; text-align: start; white-space: nowrap; }
thead th { background: var(--ink); color: var(--cream); font-weight: 700; }
tbody tr:nth-child(even) { background: var(--cream); }
td:last-child { font-weight: 700; }

/* ---------- كيف نحسب ---------- */
.how { padding-bottom: var(--space-12); display: flex; flex-direction: column; gap: var(--space-6); }
.how-grid { display: grid; gap: var(--space-4); }
@media (min-width: 760px) { .how-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mini { display: flex; flex-direction: column; gap: 10px; box-shadow: none; }
.mini h3 { font-size: 26px; }
.mini p { font-size: 15px; color: var(--muted); }
.num-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--lime); border: var(--border); display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; }
.note { font-size: 14px; color: var(--muted); border-inline-start: 0; background: var(--paper); border: 2px dashed var(--ink); border-radius: 14px; padding: 12px 16px; }

/* ---------- الفوتر ---------- */
.foot { background: var(--green); color: var(--cream); border-top: var(--border); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding-block: var(--space-6); }
.foot-in p { flex: 1 1 220px; }
.foot strong { font-family: var(--font-display); font-weight: 400; font-size: 22px; }
.foot a { color: var(--lime); font-weight: 700; }
.partner { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.partner small { font-size: 12px; font-weight: 700; color: var(--cream); opacity: .85; }
.partner img { display: block; height: 72px; width: auto; }
.brand-mark.small i { width: 24px; height: 7px; background: var(--cream); }
.brand-mark.small i:nth-child(1) { background: var(--coral); }
.brand-mark.small i:nth-child(2) { background: var(--lime); }

/* ---------- شريط النتيجة السريع (الجوال) ---------- */
.quick { position: fixed; inset-inline: 12px; bottom: 12px; z-index: 6; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--cream); text-decoration: none; border-radius: var(--radius-pill); padding: 10px 20px; box-shadow: 0 6px 20px rgba(0,0,0,.18); transform: translateY(140%); transition: transform .25s ease; }
.quick.show { transform: none; }
.quick strong { font-family: var(--font-display); font-weight: 400; font-size: 24px; color: var(--lime); }
.quick-go { margin-inline-start: auto; font-size: 13px; font-weight: 700; text-decoration: underline; }
.quick:hover { color: var(--cream); }
@media (min-width: 900px) { .quick { display: none; } }
@media (max-width: 899px) { .foot { padding-bottom: 84px; } }
