/* ==========================================================================
   onlinecalculator.ae — core stylesheet
   Design system: "Instrument"
   Ink panel = the tool. Paper ground = the explanation.
   Signal green is reserved EXCLUSIVELY for computed values.
   ========================================================================== */

:root {
  /* Palette */
  --ink:        #101720;
  --ink-soft:   #1B2430;
  --ink-line:   #2A3542;
  --paper:      #FAFAF8;
  --card:       #FFFFFF;
  --slate:      #58636F;
  --slate-soft: #8A939D;
  --rule:       #E2E4E1;
  --signal:     #0E9F6E;
  --signal-dim: #E6F5EF;
  --amber:      #B5751A;
  --amber-dim:  #FBF3E4;

  /* Type */
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Scale */
  --step--1: clamp(0.80rem, 0.77rem + 0.14vw, 0.875rem);
  --step-0:  clamp(1.00rem, 0.96rem + 0.20vw, 1.125rem);
  --step-1:  clamp(1.25rem, 1.16rem + 0.44vw, 1.50rem);
  --step-2:  clamp(1.56rem, 1.39rem + 0.85vw, 2.10rem);
  --step-3:  clamp(1.95rem, 1.63rem + 1.60vw, 2.95rem);

  /* Space */
  --gap:   1.25rem;
  --bay:   clamp(2.5rem, 6vw, 4.5rem);
  --shell: 1140px;
  --read:  68ch;

  --radius: 10px;
  --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

/* Every numeral on this site is monospaced and tabular. Non-negotiable —
   it is what makes a calculator read as an instrument rather than a blog. */
.num, input[type="number"], input[type="date"], .ledger, .readout__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: 1.25rem; }

a { color: var(--ink); text-decoration-color: var(--slate-soft); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--signal); }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 3px; }

/* ── Masthead ───────────────────────────────────────────────────────────── */

.masthead { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.masthead__bar { display: flex; align-items: center; gap: 1.5rem; height: 62px; }
.masthead a { color: #fff; text-decoration: none; }

.wordmark { display: flex; align-items: center; gap: 0.1rem; font-weight: 600; font-size: 1.06rem; letter-spacing: -0.02em; }
.wordmark__mark { width: 26px; height: 26px; margin-right: 0.5rem; border-radius: 6px; flex: none; }
.wordmark__ae { color: var(--signal); font-family: var(--mono); font-weight: 500; }

.masthead__nav { display: none; margin-left: auto; gap: 1.4rem; font-size: var(--step--1); }
.masthead__nav a { color: #B9C2CC; letter-spacing: 0.01em; }
.masthead__nav a:hover { color: #fff; }
@media (min-width: 860px) { .masthead__nav { display: flex; } }

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */

.crumbs { font-size: var(--step--1); color: var(--slate); padding: 1.1rem 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; }
.crumbs li::after { content: "/"; margin-left: 0.45rem; color: var(--slate-soft); }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--slate); text-decoration: none; }
.crumbs a:hover { color: var(--signal); }

/* ── Page head ──────────────────────────────────────────────────────────── */

.pagehead { padding: 1.5rem 0 0; }
.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--signal); margin: 0 0 0.6rem;
}
h1 { font-size: var(--step-3); line-height: 1.1; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 0.75rem; }
.standfirst { font-family: var(--serif); font-size: var(--step-1); line-height: 1.45; color: var(--slate); max-width: var(--read); margin: 0; }

/* ── Byline (E-E-A-T: named author + review date) ───────────────────────── */

.byline {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; align-items: center;
  font-size: var(--step--1); color: var(--slate);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 0.85rem 0; margin: 1.75rem 0 0;
}
.byline strong { color: var(--ink); font-weight: 600; }
.byline__verify { color: var(--signal); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ── The instrument ─────────────────────────────────────────────────────── */

.instrument {
  background: var(--ink); color: #fff; border-radius: var(--radius);
  margin: var(--gap) 0 0; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,23,32,.12), 0 12px 32px -12px rgba(16,23,32,.35);
}
.instrument__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.35rem; border-bottom: 1px solid var(--ink-line);
}
.instrument__title { font-size: var(--step--1); font-weight: 600; letter-spacing: 0.01em; margin: 0; }
.instrument__law { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--slate-soft); text-transform: uppercase; }

.instrument__body { display: grid; gap: 1.5rem; padding: 1.35rem; }
@media (min-width: 800px) { .instrument__body { grid-template-columns: 1fr 1fr; gap: 2rem; padding: 1.75rem; } }

.field { display: block; margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field__label { display: block; font-size: var(--step--1); font-weight: 500; color: #D4DAE1; margin-bottom: 0.4rem; }
.field__hint { display: block; font-size: 0.76rem; color: var(--slate-soft); margin-top: 0.35rem; line-height: 1.45; }

.field input, .field select {
  width: 100%; padding: 0.7rem 0.85rem;
  background: var(--ink-soft); color: #fff;
  border: 1px solid var(--ink-line); border-radius: var(--radius-sm);
  font-size: var(--step-0); font-family: var(--mono);
}
.field select { font-family: var(--sans); }
.field input:focus, .field select:focus { border-color: var(--signal); outline: none; }
.field input::placeholder { color: #4A5663; }

.field--prefix { position: relative; }
.field--prefix input { padding-left: 3.4rem; }
.field--prefix .field__unit {
  position: absolute; left: 0.85rem; bottom: 0.72rem;
  font-family: var(--mono); font-size: 0.82rem; color: var(--slate-soft);
  pointer-events: none;
}

.btn-calc {
  width: 100%; margin-top: 0.35rem; padding: 0.85rem 1rem;
  background: var(--signal); color: #06251A;
  border: 0; border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: var(--step-0); font-weight: 600;
  cursor: pointer; transition: filter .15s ease;
}
.btn-calc:hover { filter: brightness(1.08); }

/* Readout — the signature element */
.readout { display: flex; flex-direction: column; justify-content: center; }
.readout__label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate-soft); margin-bottom: 0.5rem; }
.readout__figure { display: flex; align-items: baseline; gap: 0.5rem; }
.readout__unit { font-family: var(--mono); font-size: 1.1rem; color: var(--slate-soft); }
.readout__value { font-size: clamp(2.4rem, 8vw, 3.6rem); font-weight: 500; letter-spacing: -0.03em; color: var(--signal); line-height: 1; }
.readout__value[data-empty="true"] { color: #37414D; }

.ledger { margin-top: 1.4rem; border-top: 1px solid var(--ink-line); font-size: var(--step--1); }
.ledger__row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--ink-line); }
.ledger__row:last-child { border-bottom: 0; }
.ledger__key { color: var(--slate-soft); font-family: var(--sans); }
.ledger__val { color: #E7EBEF; }
.ledger__row--total .ledger__key,
.ledger__row--total .ledger__val { color: #fff; font-weight: 600; }

.instrument__note {
  padding: 0.9rem 1.35rem; background: var(--ink-soft);
  border-top: 1px solid var(--ink-line);
  font-size: 0.78rem; color: var(--slate-soft); line-height: 1.55;
}

/* ── Prose ──────────────────────────────────────────────────────────────── */

.prose { max-width: var(--read); font-family: var(--serif); font-size: 1.06rem; line-height: 1.72; margin-top: var(--bay); }
.prose h2 { font-family: var(--sans); font-size: var(--step-2); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; margin: 2.6rem 0 0.9rem; }
.prose h3 { font-family: var(--sans); font-size: var(--step-1); font-weight: 600; margin: 2rem 0 0.6rem; }
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; }
.prose strong { font-weight: 600; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--signal); }

.hero { margin: 0 0 1.75rem; }
.hero img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius); border: 1px solid var(--rule);
  background: #F2F3F0;
}
.hero figcaption { font-family: var(--sans); font-size: 0.78rem; color: var(--slate-soft); margin-top: 0.5rem; }

.callout {
  border-left: 3px solid var(--amber); background: var(--amber-dim);
  padding: 1rem 1.15rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--sans); font-size: var(--step--1); line-height: 1.6; margin: 1.6rem 0;
}
.callout strong { display: block; margin-bottom: 0.25rem; color: var(--amber); }

.datatable { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: var(--step--1); margin: 1.5rem 0; }
.datatable th, .datatable td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--rule); }
.datatable th { background: #F2F3F0; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--slate); }
.datatable td:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── FAQ ────────────────────────────────────────────────────────────────── */

.faq { margin-top: var(--bay); max-width: var(--read); }
.faq h2 { font-size: var(--step-2); letter-spacing: -0.02em; font-weight: 600; margin: 0 0 1.25rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1rem 2rem 1rem 0; position: relative;
  font-weight: 500; font-size: var(--step-0); line-height: 1.45;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0.25rem; top: 0.95rem;
  font-family: var(--mono); font-size: 1.25rem; color: var(--signal); line-height: 1;
}
.faq details[open] summary::after { content: "\2212"; }
.faq__answer { font-family: var(--serif); color: var(--slate); padding: 0 0 1.15rem; line-height: 1.7; }
.faq__answer p { margin: 0 0 0.85rem; }
.faq__answer p:last-child { margin: 0; }

/* ── Sources (E-E-A-T) ──────────────────────────────────────────────────── */

.sources { margin-top: var(--bay); max-width: var(--read); border-top: 2px solid var(--ink); padding-top: 1.1rem; }
.sources h2 { font-size: var(--step-1); font-weight: 600; margin: 0 0 0.8rem; }
.sources ol { font-size: var(--step--1); color: var(--slate); padding-left: 1.2rem; margin: 0; }
.sources li { margin-bottom: 0.5rem; }

/* ── Related grid / internal linking ────────────────────────────────────── */

.related { margin-top: var(--bay); }
.related h2 { font-size: var(--step-2); letter-spacing: -0.02em; font-weight: 600; margin: 0 0 0.35rem; }
.related__sub { color: var(--slate); font-size: var(--step--1); margin: 0 0 1.35rem; }

.tilegrid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.tile {
  display: block; background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.05rem 1.15rem;
  text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
.tile:hover { border-color: var(--ink); transform: translateY(-2px); }
.tile__cat { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--signal); display: block; margin-bottom: 0.4rem; }
.tile__name { font-weight: 600; font-size: 0.98rem; line-height: 1.35; display: block; margin-bottom: 0.3rem; letter-spacing: -0.01em; }
.tile__desc { font-size: 0.83rem; color: var(--slate); line-height: 1.5; margin: 0; }
.tile__flag { display: inline-block; margin-left: 0.35rem; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; background: var(--signal-dim); color: var(--signal); padding: 0.12rem 0.35rem; border-radius: 3px; vertical-align: 1px; }

/* ── Category index (homepage) ──────────────────────────────────────────── */

.catrow { border-top: 1px solid var(--rule); padding: 1.6rem 0; display: grid; gap: 1rem; }
@media (min-width: 800px) { .catrow { grid-template-columns: 230px 1fr; gap: 2.5rem; } }
.catrow__head h2 { font-size: var(--step-1); font-weight: 600; margin: 0 0 0.25rem; letter-spacing: -0.015em; }
.catrow__head h2 a { text-decoration: none; }
.catrow__head h2 a:hover { color: var(--signal); }
.catrow__count { font-family: var(--mono); font-size: 0.72rem; color: var(--slate-soft); letter-spacing: 0.06em; }
.catrow__links { display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: start; }
.chip {
  font-size: 0.83rem; padding: 0.32rem 0.7rem; border: 1px solid var(--rule);
  border-radius: 100px; text-decoration: none; color: var(--slate); background: var(--card);
  transition: all .13s ease;
}
.chip:hover { border-color: var(--signal); color: var(--ink); }
.chip--uae { border-color: var(--signal); color: var(--ink); background: var(--signal-dim); font-weight: 500; }

/* ── Search ─────────────────────────────────────────────────────────────── */

.hunt { margin: 1.75rem 0 0; position: relative; max-width: 560px; }
.hunt input {
  width: 100%; padding: 0.95rem 1.1rem; font-size: var(--step-0); font-family: var(--sans);
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); color: var(--ink);
}
.hunt input:focus { border-color: var(--signal); outline: none; }
.hunt__results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  max-height: 320px; overflow-y: auto; box-shadow: 0 18px 40px -16px rgba(16,23,32,.3);
}
.hunt__results:empty { display: none; }
.hunt__hit { display: block; padding: 0.7rem 1.1rem; text-decoration: none; border-bottom: 1px solid var(--rule); font-size: 0.94rem; }
.hunt__hit:last-child { border-bottom: 0; }
.hunt__hit:hover { background: var(--signal-dim); }
.hunt__hit span { display: block; font-size: 0.74rem; color: var(--slate-soft); font-family: var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer { background: var(--ink); color: #99A3AE; margin-top: var(--bay); padding: var(--bay) 0 2rem; font-size: var(--step--1); }
.footer a { color: #99A3AE; text-decoration: none; }
.footer a:hover { color: #fff; }
.footer__grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.footer h3 { color: #fff; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--mono); font-weight: 500; margin: 0 0 0.8rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.45rem; }
.footer__base { border-top: 1px solid var(--ink-line); margin-top: 2.5rem; padding-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; }

/* ── Ad slots — reserved height prevents CLS ────────────────────────────── */

/* Ad slots. Collapsed until ads.js confirms a slot ID exists, so an
   unconfigured unit never leaves a blank gap. --live reserves height to
   prevent layout shift once an ad is actually inserted. */
.adslot { margin: var(--bay) auto 0; text-align: center; }
.adslot:empty { display: none; margin: 0; }
.adslot--live { min-height: 280px; position: relative; padding-top: 1.1rem; }
.adslot--live::before {
  content: "Advertisement";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--slate-soft);
}
/* Above the calculator: keep it shallow so the tool stays near the fold. */
.adslot--top { margin-top: var(--gap); }
.adslot--top.adslot--live { min-height: 110px; }
@media (min-width: 800px) { .adslot--top.adslot--live { min-height: 130px; } }


.skiplink {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--signal); color: #06251A; padding: 0.7rem 1.1rem;
  font-weight: 600; font-size: var(--step--1); border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}
.skiplink:focus { left: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Legal notice — visually distinct from editorial callouts */
.callout--legal {
  border-left-color: var(--slate);
  background: #F1F2EF;
  margin: 1.75rem 0 0;
  max-width: var(--read);
}
.callout--legal strong { color: var(--ink); }
.callout--legal a { color: var(--ink); text-decoration-color: var(--signal); }
.footer__legal { max-width: 62ch; line-height: 1.5; }
.footer__legal a { text-decoration: underline; }
