/* Layout: utility site for Gulf workers. Header + country strip, two-column calculator (form | settlement statement), article with rules, FAQ, sources. */
:root {
  /* White theme only, colours taken from the Ehsebli logo */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F8F7;
  --ink: #26343C;         /* logo slate, deepened for body text */
  --slate: #364751;       /* logo slate */
  --muted: #64737B;
  --line: #E1E7E5;
  --brand: #005E3A;       /* logo emerald */
  --brand-ink: #FFFFFF;
  --brand-soft: #E6F2EC;
  --gold: #9A6C14;
  --gold-soft: #F7EED9;
  --warn: #9A3B12;
  --warn-soft: #FBE8DD;
  --cc: #005E3A;          /* active country colour, set per page */
  --shadow: 0 1px 2px rgba(38, 52, 60, .05), 0 10px 28px -16px rgba(38, 52, 60, .22);
  --font-display: "Readex Pro", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --r: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.6; }
a { color: var(--brand); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); font-weight: 600; }
h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* header */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--surface); }
.head-row { display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--slate); }
.brand .logo { height: 34px; width: auto; display: block; }
.site-foot .brand .logo { height: 30px; }
.nav { margin-inline-start: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-size: .92rem; font-weight: 500; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.menu-btn { display: none; margin-inline-start: auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .9rem; }
@media (max-width: 720px) { .nav { display: none; } .menu-btn { display: inline-flex; } }
.mobile-nav { display: none; border-top: 1px solid var(--line); padding-block: 8px 12px; }
.mobile-nav.open { display: grid; }
.mobile-nav a { padding: 10px 4px; color: var(--ink); text-decoration: none; font-weight: 500; }

/* breadcrumbs + page head */
.crumbs { font-size: .84rem; color: var(--muted); padding-top: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.page-head { padding-block: 10px 18px; display: grid; gap: 10px; }
.page-head .lede { color: var(--muted); max-width: 68ch; font-size: 1.04rem; }
.checked { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--gold); background: var(--gold-soft); border-radius: 999px; padding: 4px 12px; width: fit-content; font-weight: 500; }

/* country strip */
.countries { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 9px 14px; font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s; }
.chip:hover { border-color: color-mix(in srgb, var(--chip) 55%, var(--line)); }
.chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--chip); flex: none; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { border-color: var(--chip); background: color-mix(in srgb, var(--chip) 10%, var(--surface)); box-shadow: inset 0 0 0 1px var(--chip); }
.chip-label { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* calculator layout */
.calc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.form { padding: 22px; display: grid; gap: 16px; position: relative; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .field .lbl { font-size: .88rem; font-weight: 600; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .hint.on { color: var(--brand); }
.field .hint.off { color: var(--warn); }
.input, select.input { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 46px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.money { position: relative; }
.money .cur { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); font-size: .82rem; font-weight: 600; color: var(--muted); pointer-events: none; }
.money .input { padding-inline-start: 52px; font-variant-numeric: tabular-nums; }
details.more { border-top: 1px dashed var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--brand); }
details.more .field { margin-top: 12px; }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { font: inherit; font-size: .92rem; font-weight: 500; border: 0; background: transparent; color: var(--ink); border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--brand); font-weight: 600; }

/* no country yet */
.pick-first { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(2px); border-radius: var(--r); display: grid; place-items: center; text-align: center; padding: 24px; z-index: 2; }
.pick-first p { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.pick-first span { display: block; color: var(--muted); font-size: .9rem; margin-top: 4px; font-family: var(--font-body); font-weight: 400; }

/* settlement statement */
.statement { overflow: hidden; position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); }
.statement-top { padding: 22px 22px 18px; border-top: 5px solid var(--cc); background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 7%, var(--surface)), var(--surface)); }
.statement-top .k { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.amount { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 1.4rem + 2.6vw, 2.9rem); letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.amount .c { font-size: .45em; color: var(--muted); font-weight: 500; margin-inline-end: 6px; letter-spacing: 0; }
.statement-sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.lines { padding: 6px 22px 18px; }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.line:last-child { border-bottom: 0; }
.line .l { color: var(--muted); min-width: 0; flex: 1 1 auto; }
.line .v { font-family: var(--font-mono); font-size: .88rem; text-align: end; font-variant-numeric: tabular-nums; flex: 0 0 auto; max-width: 60%; }
.line.total { border-top: 1.5px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 12px; font-weight: 600; }
.line.total .l { color: var(--ink); }
.notes { margin: 0 22px 18px; padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); color: var(--ink); font-size: .86rem; display: grid; gap: 4px; }
.notes:empty { display: none; }
.err { margin: 0 22px 18px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; }
.statement-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.btn { font: inherit; font-size: .88rem; font-weight: 600; border-radius: 10px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* article */
.article { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 36px; align-items: start; }
@media (max-width: 960px) { .article { grid-template-columns: 1fr; } }
.prose { display: grid; gap: 22px; min-width: 0; }
.prose section { display: grid; gap: 10px; }
.prose p, .prose li { max-width: 70ch; }
.prose ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 520px; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
tr.here td { background: color-mix(in srgb, var(--cc) 8%, transparent); }
.example { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.faq { display: grid; gap: 8px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; color: var(--muted); }
.side { display: grid; gap: 14px; position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); }
@media (max-width: 960px) { .side { position: static; } }
.side .card { padding: 16px 18px; display: grid; gap: 10px; box-shadow: none; }
.side h3 { font-size: .95rem; }
.side ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9rem; }
.disclaimer { font-size: .84rem; color: var(--muted); }

/* ads */
.ad { margin: 26px 0; min-height: 0; }
.ad-ph { border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; display: grid; place-items: center; min-height: 100px; }

/* home */
.hero { position: relative; overflow: hidden; background: linear-gradient(180deg, #FFFFFF, var(--surface-2)); border-bottom: 1px solid var(--line); }
.hero::after { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23005E3A' stroke-opacity='.08' stroke-width='1'%3E%3Crect x='16' y='16' width='24' height='24'/%3E%3Crect x='16' y='16' width='24' height='24' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: linear-gradient(90deg, transparent 0%, #000 55%); -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%); }
.hero .wrap > * { min-width: 0; }
.hero .wrap { position: relative; z-index: 1; padding-block: 44px 36px; display: grid; gap: 16px; }
.hero h1 { max-width: 18ch; font-size: clamp(2rem, 1.3rem + 3vw, 3.2rem); }
.hero .lede { color: var(--muted); max-width: 60ch; font-size: 1.08rem; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 30px 0; }
@media (max-width: 900px) { .tools { grid-template-columns: 1fr; } }
.tool { padding: 20px; display: grid; gap: 10px; align-content: start; text-decoration: none; color: var(--ink); }
.tool:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.tool .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-family: var(--font-display); font-weight: 600; }
.tool p { color: var(--muted); font-size: .92rem; }
.tool .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tool .links a { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.trust { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 40px; }
@media (max-width: 900px) { .trust { grid-template-columns: 1fr; } }
.trust div { border-top: 2px solid var(--line); padding-top: 12px; display: grid; gap: 4px; }
.trust b { font-family: var(--font-display); font-weight: 600; }
.trust span { color: var(--muted); font-size: .92rem; }

/* hijri */
.hijri-today { padding: 20px 22px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; border-top: 5px solid var(--gold); }
.hijri-today .big { font-family: var(--font-display); font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 600; }
.hijri-today .ar { font-size: 1.3rem; color: var(--muted); direction: rtl; }
.conv { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 860px) { .conv { grid-template-columns: 1fr; } }
.conv .card { padding: 22px; display: grid; gap: 14px; align-content: start; }
.out { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.out .big { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; }
.out .sub { color: var(--muted); font-size: .9rem; }
.row3 { display: grid; grid-template-columns: .8fr 1.6fr 1fr; gap: 10px; }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 56px; }
.site-foot .wrap { padding-block: 28px; display: grid; gap: 16px; }
.foot-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; font-size: .9rem; }
@media (max-width: 760px) { .foot-cols { grid-template-columns: 1fr 1fr; } }
.foot-cols h4 { margin: 0 0 8px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.foot-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.foot-cols a { color: var(--ink); text-decoration: none; }
.foot-cols a:hover { color: var(--brand); }
.foot-note { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

.doc { max-width: 760px; display: grid; gap: 16px; padding-bottom: 20px; }
.doc h2 { margin-top: 12px; }
.loading .country-content { opacity: .45; transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Arabic / RTL ---------- */
.lang-switch { margin-inline-start: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .86rem; font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; font-family: "IBM Plex Sans Arabic", var(--font-body); }
.lang-switch:hover { background: var(--brand-soft); }
.lang-switch[lang="en"] { font-family: var(--font-body); }
html[lang="ar"] { --font-body: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif; --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
html[lang="ar"] body { line-height: 1.75; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.35; letter-spacing: 0; }
html[lang="ar"] .amount { letter-spacing: 0; }
html[dir="rtl"] .brand .logo { direction: ltr; }
html[dir="rtl"] .hero::after { transform: scaleX(-1); }
html[dir="rtl"] input[type="number"], html[dir="rtl"] input[type="date"] { text-align: right; }
bdi { unicode-bidi: isolate; }
@media (max-width: 720px) { .lang-switch { margin-inline-start: auto; } .lang-switch + .menu-btn { margin-inline-start: 8px; } }
html[lang="ar"] .line .v, html[lang="ar"] .example .num { font-family: var(--font-body); font-weight: 500; }
.ad-inline { margin: 4px 0; }
.ad-side .ad-ph { min-height: 600px; }
@media (max-width: 960px) { .ad-side .ad-ph { min-height: 250px; } }
