/* Home page (/, /transfer, /cash). Header and footer styles live in site.css. */
:root {
  /* Brand */
  --green: #198754;          /* hero, footer, selected text accents */
  --green-dark: #146C43;     /* selected button text */
  --green-tint: #DDF0E5;     /* selected button fill */
  --green-soft: #E7F3EE;     /* active nav item, best-rate box */
  --green-ink: #22543F;      /* text on green-soft */
  --link: #0B6E4F;
  --link-hover: #075039;
  /* Neutrals */
  --ink: #0F1A24;            /* main text */
  --muted: #4A5866;          /* secondary text */
  --line: #E3E7EC;           /* card borders */
  --line-soft: #EEF1F4;      /* table row dividers */
  --input-line: #D5DBE1;
  --page: #F6F7F9;           /* page background */
  --card: #FFFFFF;
  --chip: #F0F2F5;           /* provider initials tile */
  /* Accents */
  --tag-bg: #FDF0D5;         /* BEST RATE / purity / Transfer tags */
  --tag-fg: #7A4F06;
  --fresh: #1E9E6A;          /* rate updated < 3 h */
  --aging: #E0A33A;          /* 3–24 h */
  --stale: #A4361B;          /* > 24 h, gold price drop */
  --warn: #8A2E14;
  /* Shape */
  --r-card: 16px;
  --r-tile: 14px;
  --r-btn: 9px;
  --r-group: 12px;
  --container: 1180px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;   /* equal-width digits so table columns line up */
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
.container { max-width: var(--container); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hero ---------- */
.hero { background: var(--green); color: #fff; }
.hero .container { padding-top: 40px; padding-bottom: 44px; display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.hero-copy { flex: 1 1 440px; min-width: 0; }
.hero-badge { margin: 0 0 16px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; background: rgba(0,0,0,0.18); padding: 6px 12px; border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-white { background: #fff; }
.dot-fresh { background: var(--fresh); }
.dot-aging { background: var(--aging); }
.dot-stale { background: var(--stale); }
.hero h1 { margin: 0; font-size: 46px; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; }
.hero-lead { margin: 16px 0 0; font-size: 18px; line-height: 1.55; max-width: 520px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 22px; font-size: 15px; }
.hero-points div { display: flex; align-items: center; gap: 8px; }

/* ---------- Segmented button groups (calculator + table) ---------- */
.seg { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line); padding: 4px; border-radius: var(--r-group); }
.seg button {
  flex: 1 1 0; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-btn);
  background: var(--card); color: var(--muted); font: 700 15px Manrope, sans-serif; cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--green-tint); color: var(--green-dark); }
.seg button .count { opacity: 0.7; font-weight: 600; }
.seg button:focus-visible, .dir-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Calculator ---------- */
.calc { flex: 1 1 420px; min-width: 0; background: var(--card); color: var(--ink); border-radius: 20px; padding: 22px 24px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); }
.calc .seg { margin-bottom: 16px; }
.dirs { display: flex; gap: 8px; margin: -8px 0 20px; }
.dir-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 2px solid var(--input-line); border-radius: 10px; background: var(--card); color: var(--muted);
  font: 700 15px Manrope, sans-serif; cursor: pointer;
}
.dir-btn[aria-pressed="true"] { background: var(--green-tint); color: var(--green-dark); border-color: #fff; }
.calc-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.field { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.amount-box { display: flex; align-items: center; border: 1.5px solid var(--input-line); border-radius: 12px; padding: 0 14px; min-height: 56px; }
.amount-box input { flex: 1; min-width: 0; border: 0; outline: none; font: 400 24px Manrope, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink); background: transparent; }
.amount-box .unit { font-weight: 800; font-size: 16px; }
.amount-box select { min-height: 44px; border: 0; background: transparent; font: 800 16px Manrope, sans-serif; color: var(--ink); cursor: pointer; }
/* width: 100% stops long currency names (from the lazily loaded list) widening the card */
.cur-select { width: 100%; min-width: 0; min-height: 59px;border: 1.5px solid var(--input-line); border-radius: 12px; padding: 0 14px; font: 800 16px Manrope, sans-serif; color: var(--ink); background: var(--card); }
.fixed-cur { min-height: 59px; display: flex; align-items: center; border: 1.5px solid var(--input-line); border-radius: 12px; padding: 0 14px; background: var(--page); font: 800 16px Manrope, sans-serif; }
.best-box { margin-top: 14px; background: var(--green-soft); border-radius: var(--r-tile); padding: 12px 16px; }
.best-box .k { font-size: 13px; font-weight: 600; color: var(--green-ink); }
.best-box .row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; margin-top: 2px; }
.best-box .amount { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.best-box .provider { font-size: 14px; font-weight: 600; }
.best-box .when { font-size: 13px; color: var(--green-ink); margin-top: 2px; }
.best-box .warn { font-size: 13px; font-weight: 700; color: var(--warn); margin-top: 4px; }
.empty-box { margin-top: 14px; border: 1.5px dashed #C9D1D9; border-radius: var(--r-tile); padding: 12px 16px; font-size: 14px; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding-top: 56px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.section-head p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.section-head a { font-weight: 700; font-size: 15px; }

/* ---------- Rate table ---------- */
.compare { padding-top: 48px; }
.table-controls { width: 500px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow-x: auto; }
table.rates { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rates th { text-align: left; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 16px; font-weight: 700; }
/* Every column after Provider is centred, so values sit in the middle of their column whatever their length */
table.rates th:not(:first-child), table.rates td:not(:first-child) { text-align: center; }
table.rates th.has-select { padding-top: 10px; padding-bottom: 10px; }
table.rates td { padding: 12px 16px; border-top: 1px solid var(--line-soft); }
table.rates th:first-child, table.rates td:first-child { padding-left: 20px; }
table.rates td.num { font-size: 16px; font-weight: 400; white-space: nowrap; }
table.rates .col-when { white-space: nowrap; }
table.rates td.num.best { font-weight: 800; }   /* cash: best buy / best sell */
table.rates td.fee { color: var(--muted); }
table.rates tr.is-best { background: #F7FBF9; }
.th-select { min-height: 38px; padding: 0 10px; border: 1px solid var(--input-line); border-radius: 8px; background: var(--card); font: 700 14px Manrope, sans-serif; color: var(--ink); cursor: pointer; }
.prov { display: flex; align-items: center; gap: 12px; }
/* Name + tag wrap inside this box, so a long name breaks beside the logo instead of under it */
.prov-text { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 4px; overflow-wrap: anywhere; }
/* Phones only: the update time under the name replaces the Updated column,
   and the rate under the amount replaces the rate column */
.prov-text .prov-when, .get-rate { display: none; }
.prov-text .prov-when { flex-basis: 100%; white-space: nowrap; }
.ini { width: 36px; height: 36px; border-radius: 10px; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: var(--muted); flex: none; overflow: hidden; }
.ini img { width: 100%; height: 100%; object-fit: contain; }
.prov-text > a, .prov-text > span:first-child { font-weight: 400; font-size: 16px; color: var(--ink); text-decoration: none; }
.tag { font-size: 12px; font-weight: 800; color: var(--tag-fg); background: var(--tag-bg); padding: 3px 8px; border-radius: 6px; }
.when { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.when .dot, .legend .dot { width: 9px; height: 9px; }
.empty-row td { padding: 36px 20px; text-align: center; color: var(--muted); }
.table-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Cards (gold + popular transfers share one style) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-tile); padding: 16px; text-decoration: none; color: var(--ink); }
a.tile:hover { color: var(--ink); border-color: var(--green); }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-title { font-weight: 800; font-size: 15px; }
.tile .tag { padding: 4px 8px; }
.tile-value { font-size: 24px; font-weight: 400; letter-spacing: -0.02em; margin-top: 4px; }
.tile-unit { font-size: 13px; color: var(--muted); }
.tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.tile-foot .muted { color: var(--muted); }
.tile-foot .val { color: var(--ink); }
.down { color: var(--stale); }
.arrow { font-weight: 800; color: var(--green); }

/* ---------- FAQ (cards, same style as .tile) ---------- */
.faq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 14px; align-items: start; }
.faq-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-tile); }
.faq-card[open] { border-color: #B9DCC8; }
.faq-card summary { display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer; list-style: none; }
.faq-card summary::-webkit-details-marker { display: none; }
.faq-card summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: var(--r-tile); }
.faq-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; justify-content: center; }
.faq-q { flex: 1 1 auto; font-weight: 700; font-size: 15px; line-height: 1.4; }
.faq-chev { flex: none; color: var(--muted); display: inline-flex; transition: transform .15s ease; }
.faq-card[open] .faq-chev { transform: rotate(180deg); color: var(--green); }
.faq-card p { margin: 0; padding: 12px 16px 16px 66px; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.6; color: var(--muted); }
@media (max-width: 640px) { .faq-card p { padding-left: 16px; } }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  /* First screen: headline + calculator + best rate, with the table peeking in below.
     The lead text and check points stay in the HTML (and on desktop) but are hidden here. */
  .hero .container { padding-top: 16px; padding-bottom: 20px; gap: 16px; }
  .hero-badge { margin-bottom: 10px; font-size: 12px; padding: 4px 10px; }
  .hero h1 { font-size: 26px; line-height: 1.15; }
  .hero-lead, .hero-points { display: none; }
  .calc { padding: 14px; border-radius: 16px; }
  .calc .seg { margin-bottom: 12px; }
  .calc .seg button { min-height: 40px; }
  .dirs { margin: -4px 0 12px; }
  .calc-fields { flex-wrap: nowrap; gap: 10px; }
  .calc-fields .field { flex: 2 1 0; gap: 4px; }
  .calc-fields .field:first-child { flex-grow: 3; }
  /* Cash → Sell: the amount box also holds the currency picker, so stack the fields
     (the fixed "AED" field is only visible in that mode) */
  .calc-fields:has(#to-fixed:not([hidden])) { flex-wrap: wrap; }
  .calc-fields:has(#to-fixed:not([hidden])) .field { flex-basis: 100%; }
  .field label, .field .label { font-size: 11px; }
  .amount-box { min-height: 52px; padding: 0 10px; }
  .amount-box input { font-size: 20px; }
  .cur-dd-lg .cur-dd-btn { min-height: 52px; padding: 0 10px; }
  .cur-dd-lg .cur-dd-name { display: none; }
  .fixed-cur { min-height: 52px; padding: 0 10px; font-size: 14px; }
  .best-box, .empty-box { margin-top: 12px; }
  .table-controls { width: 100%; }
  .seg { flex-wrap: wrap; }

  /* Rate tables fit the screen: Fee and Updated columns hide, update time moves under the name */
  table.rates th, table.rates td { padding: 10px 6px; }
  table.rates th:first-child, table.rates td:first-child { padding-left: 12px; }
  table.rates th:last-child, table.rates td:last-child { padding-right: 12px; }
  table.rates th { font-size: 11px; letter-spacing: 0.04em; }
  table.rates .col-fee, table.rates .col-when { display: none; }
  table.rates td.num { font-size: 14px; }
  .prov { gap: 8px; }
  .ini { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
  .prov-text { column-gap: 6px; row-gap: 2px; }
  .prov-text > a, .prov-text > span:first-child { font-size: 14px; line-height: 1.3; }
  .prov-text .tag { font-size: 10px; padding: 2px 6px; }
  .prov-text .prov-when { display: inline-flex; gap: 5px; font-size: 12px; }
  .prov-when .dot { width: 7px; height: 7px; }
  /* Transfer: fold the rate column into "You get"; the currency picker header sits above the merged column */
  table.rates.transfer td.col-rate, table.rates.transfer th.col-get { display: none; }
  table.rates td.col-get { font-weight: 700; }
  .get-rate { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
  .cur-dd-sm .cur-dd-btn { min-height: 32px; padding: 0 7px; gap: 4px; font-size: 13px; }
  .cur-dd-sm .cur-flag { width: 16px; height: 16px; }
}

/* ---------- Currency dropdowns with flags (built by /js/cur-dropdown.js over .cur-picker selects) ---------- */
.cur-dd { position: relative; min-width: 0; }
.cur-dd-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.cur-dd-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 800 16px Manrope, sans-serif; cursor: pointer; text-align: left; }
.cur-dd-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.cur-dd-btn .cur-dd-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--muted); }
.cur-dd-caret { flex: none; width: 0; height: 0; margin-left: auto; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; }
.cur-dd-btn[aria-expanded="true"] .cur-dd-caret { transform: rotate(180deg); }
/* Calculator "You receive" field */
.cur-dd-lg .cur-dd-btn { min-height: 59px; padding: 0 14px; border: 1.5px solid var(--input-line); border-radius: 12px; background: var(--card); }
/* Inside the amount box (cash sell) */
.cur-dd-inline { flex: none; }
.cur-dd-inline .cur-dd-btn { min-height: 44px; width: auto; }
/* Table header */
.cur-dd-sm { display: inline-block; }
.cur-dd-sm .cur-dd-btn { width: auto; min-height: 38px; gap: 6px; padding: 0 10px; border: 1px solid var(--input-line); border-radius: 8px; background: var(--card); font: 700 14px Manrope, sans-serif; }
.cur-dd-sm .cur-flag { width: 18px; height: 18px; }

.cur-flag { flex: none; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--chip); }
.cur-flag-empty { display: inline-block; }

.cur-dd-pop { position: fixed; z-index: 1000; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-group); box-shadow: 0 12px 32px rgba(15, 26, 36, 0.16); overflow: hidden; }
.cur-dd-search { flex: none; margin: 8px; padding: 9px 12px; border: 1.5px solid var(--input-line); border-radius: var(--r-btn); font: 500 15px Manrope, sans-serif; color: var(--ink); background: var(--card); outline: none; }
.cur-dd-search:focus { border-color: var(--green); }
.cur-dd-list { flex: 1 1 auto; list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; overscroll-behavior: contain; }
.cur-dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.cur-dd-item .cur-dd-code { font-weight: 800; }
.cur-dd-item .cur-dd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.cur-dd-item:hover, .cur-dd-item.is-active { background: var(--page); }
.cur-dd-item[aria-selected="true"] { background: var(--green-tint); color: var(--green-dark); }
.cur-dd-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cur-dd-empty { padding: 14px 10px; color: var(--muted); font-size: 14px; }
