/*
 * Know Qatar design system (facelift, Oct 2026). Loaded after app.css; refines tokens and adds components.
 * Contemporary Qatari minimalism: pearl surfaces, confident maroon, restrained gold, Sadu used sparingly.
 * Everything uses logical properties so Arabic (RTL) mirrors correctly.
 */

/* ---------- Tokens ---------- */

:root {
    --ink: #24161B;            /* warm charcoal, not pure black */
    --ink-soft: #5E4A50;
    --bg: #FBF8F4;
    --pearl-2: #F6EFE6;        /* warmer pearl band */
    --rose: #F7ECEE;           /* soft maroon band */
    --surface: #FFFFFF;
    --line: #EBE1DC;
    --brand-deep: #5C0C24;

    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 80px; --s-10: 96px;
    --r-card: 14px; --r-ctl: 10px; --r-pill: 999px;
    --shadow-1: 0 1px 2px rgba(36, 22, 27, .06), 0 2px 8px -2px rgba(36, 22, 27, .06);
    --shadow-2: 0 12px 32px -12px rgba(36, 22, 27, .22);
    --wrap: 1280px;
    --read: 760px;
    --t-fast: 160ms;
    --tone-0: #F6E7EB; --tone-0-ink: #8A1538;
    --tone-1: #F3EBDD; --tone-1-ink: #7A5A1E;
    --tone-2: #E8EFEA; --tone-2-ink: #2E6A4A;
    --tone-3: #E9EDF4; --tone-3-ink: #2F4F7A;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #F3ECE6; --ink-soft: #C3AEB2; --bg: #150A0D; --pearl-2: #1C0E12; --rose: #2A121A; --surface: #21121A; --line: #3A2028;
        --tone-0: #3A1620; --tone-0-ink: #F0A3B5; --tone-1: #33281A; --tone-1-ink: #E6C98F;
        --tone-2: #18291F; --tone-2-ink: #8FD3AE; --tone-3: #18202E; --tone-3-ink: #A9C2E8;
        --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6);
    }
}
:root[data-theme="dark"] {
    --ink: #F3ECE6; --ink-soft: #C3AEB2; --bg: #150A0D; --pearl-2: #1C0E12; --rose: #2A121A; --surface: #21121A; --line: #3A2028;
    --tone-0: #3A1620; --tone-0-ink: #F0A3B5; --tone-1: #33281A; --tone-1-ink: #E6C98F;
    --tone-2: #18291F; --tone-2-ink: #8FD3AE; --tone-3: #18202E; --tone-3-ink: #A9C2E8;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6);
}
html[data-contrast="high"] { --pearl-2: #FFFFFF; --rose: #FFFFFF; --tone-0: #FFFFFF; --tone-1: #FFFFFF; --tone-2: #FFFFFF; --tone-3: #FFFFFF; --tone-0-ink: #5C0C24; --tone-1-ink: #000; --tone-2-ink: #000; --tone-3-ink: #000; }

/* ---------- Base type: never thin, never tiny ---------- */

body { font-weight: 400; font-size: 1.0625rem; line-height: 1.65; }
[dir="rtl"] body { line-height: 1.85; }
h1, h2, h3 { color: var(--ink); }
.wrap { max-width: var(--wrap); }
main:focus { outline: none; }

.icon, .icon-sm, .icon-xs, .search-svg, .type-icon, .quick-icon, .persona-icon, .xtile-icon, .empty-icon {
    fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none;
}
.icon { width: 24px; height: 24px; }
.icon-sm { width: 18px; height: 18px; }
.icon-xs { width: 15px; height: 15px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

.kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--s-2); font-size: 0.875rem; font-weight: 600; color: var(--brand); }
.kicker-light { color: var(--gold-light); }
.hint { font-size: 0.875rem; color: var(--ink-soft); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 var(--s-5);
    font: inherit; font-weight: 600; text-decoration: none; border-radius: var(--r-ctl); cursor: pointer;
    transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn-primary { background: #8A1538; color: #FBF6EF; border: 0; }
.btn-primary:hover { background: #6E0F2C; color: #FBF6EF; }
.btn-secondary { background: var(--surface); color: var(--brand); border: 1.5px solid var(--brand); }
.btn-secondary:hover { background: var(--brand-wash); color: var(--brand); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: var(--brand); white-space: nowrap; }
.link-arrow:hover { text-decoration: underline; }
.link-arrow .icon-sm { transition: transform var(--t-fast); }
.link-arrow:hover .icon-sm { transform: translateX(3px); }
[dir="rtl"] .link-arrow:hover .icon-sm { transform: scaleX(-1) translateX(3px); }

.icon-btn {
    display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%;
    color: var(--brand); background: transparent; border: 1px solid var(--field); text-decoration: none; cursor: pointer;
}
.icon-btn:hover, .icon-btn[aria-current="page"] { background: var(--brand-wash); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s-4);
    font: inherit; font-size: 0.9375rem; font-weight: 500; color: var(--ink); text-decoration: none; cursor: pointer;
    background: var(--surface); border: 1px solid var(--field); border-radius: var(--r-pill);
    transition: background-color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { border-color: var(--brand); }
.chip[aria-current="page"], .chip[aria-pressed="true"] { background: #8A1538; border-color: #8A1538; color: #FBF6EF; }
.chip-filter { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.chip-filter[hidden] { display: none; }

.type { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; font-weight: 600; color: var(--brand); }
.type-icon { width: 14px; height: 14px; }

/* ---------- Header ---------- */

.masthead { display: none; }
.hdr { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); transition: box-shadow var(--t-fast); }
.hdr.is-compact { box-shadow: var(--shadow-1); }
.hdr-top { display: flex; align-items: center; gap: var(--s-5); min-height: 72px; transition: min-height var(--t-fast); }
.hdr.is-compact .hdr-top { min-height: 60px; }
.hdr-search { flex: 1; display: flex; justify-content: center; }
.hdr-utils { display: flex; align-items: center; gap: var(--s-2); }
.hdr-utils .langswitch { min-height: 44px; }
.hdr-nav { border-top: 1px solid var(--line); }
.hdr-nav .wrap { display: flex; gap: var(--s-1); overflow-x: auto; scrollbar-width: none; }
.hdr-nav .wrap::-webkit-scrollbar { display: none; }
.hdr-nav a {
    position: relative; display: inline-flex; align-items: center; min-height: 46px; padding: 0 var(--s-4);
    color: var(--ink-soft); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.hdr-nav a:hover { color: var(--brand); }
.hdr-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.hdr-nav a[aria-current="page"]::after { content: ""; position: absolute; inset-inline: var(--s-4); bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: #8A1538; }
.hdr-nav .hdr-nav-about { margin-inline-start: auto; }
.hdr.is-compact .hdr-nav a { min-height: 40px; }

/* ---------- Search ---------- */

.search, .search-header, .search-hero { position: relative; flex: initial; max-width: none; margin: 0; order: initial; }
.search-header { width: 100%; max-width: 560px; }
.search-box { position: relative; display: flex; align-items: center; }
.search .search-icon, .gov-search .search-icon { position: absolute; inset-inline-start: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; stroke: currentColor; fill: none; }
.search input[type="search"], .gov-search input[type="search"] {
    width: 100%; height: 48px; padding-inline: 46px 16px; font: inherit; font-size: 1rem; font-weight: 400; color: var(--ink);
    background: var(--surface); border: 1.5px solid var(--field); border-radius: var(--r-ctl); -webkit-appearance: none; appearance: none;
}
.search input[type="search"]:focus-visible, .gov-search input[type="search"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.search-hero input[type="search"], .gov-search input[type="search"] { height: 60px; font-size: 1.0625rem; padding-inline-end: 120px; border-radius: 14px; border-color: transparent; box-shadow: var(--shadow-2); }
.search-label { display: block; margin-bottom: var(--s-2); font-weight: 600; color: inherit; }
.search-submit {
    position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); min-height: 44px; padding: 0 var(--s-5);
    font: inherit; font-weight: 600; color: #FBF6EF; background: #8A1538; border: 0; border-radius: var(--r-ctl); cursor: pointer;
}
.search-submit:hover { background: #6E0F2C; }

.search-list { min-width: min(520px, calc(100vw - 32px)); padding: var(--s-2); border-radius: var(--r-card); }
.search-option a { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; }
.search-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--tone-0); color: var(--tone-0-ink); }
.search-ico-gov, .search-ico-service { background: var(--tone-3); color: var(--tone-3-ink); }
.search-ico-place { background: var(--tone-2); color: var(--tone-2-ink); }
.search-ico-tool, .search-ico-data { background: var(--tone-1); color: var(--tone-1-ink); }
.search-svg { width: 20px; height: 20px; }
.search-body { display: grid; min-width: 0; }
.search-title { font-weight: 600; color: var(--ink); }
.search-meta { font-size: 0.8125rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Hero ---------- */

.hero2 { background: #8A1538; color: #FBF6EF; --focus: #EBD3A4; }
.hero2-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--s-7); align-items: center; padding-block: clamp(40px, 6vw, 80px) clamp(40px, 6vw, 72px); }
.hero2-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.5rem, 5.2vw, 4rem); line-height: 1.08; color: #FBF6EF; letter-spacing: -0.01em; }
[dir="rtl"] .hero2-title { line-height: 1.3; letter-spacing: 0; }
.hero2-lead { max-width: 34em; margin-top: var(--s-4); font-size: clamp(1.125rem, 1.6vw, 1.3125rem); color: rgba(251, 246, 239, .9); }
.hero2 .search-hero { margin-top: var(--s-6); max-width: 640px; }
.hero2 .search-label { color: #FBF6EF; font-size: 1.0625rem; }
.hero2-popular { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-top: var(--s-4); font-size: 0.9375rem; color: rgba(251, 246, 239, .85); }
.hero2-popular a { color: #FBF6EF; font-weight: 500; text-decoration: underline; text-decoration-color: rgba(235, 211, 164, .7); text-underline-offset: 4px; }
.hero2-popular a:hover { text-decoration-color: #EBD3A4; }
.hero2-visual { position: relative; }
.hero2-visual .photo { margin: 0; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow-2); }
.hero2-visual .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-credit { font-size: 0.75rem; padding: 4px 8px; }
.hero2-visual .photo-credit { position: absolute; inset-inline-end: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); border-radius: 6px; color: #fff; }
.hero2-visual .photo-credit a { color: #fff; }
/* Fallback art: three Qatari arches over a Sadu ground (no photo needed). */
.hero2-art { position: relative; aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; gap: 6%; padding: 0 8% 12%;
    background: radial-gradient(120% 90% at 70% 10%, rgba(235, 211, 164, .22), transparent 60%), #6E0F2C; }
.hero2-art::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 12%; background: var(--sadu) repeat-x left / auto 100%; opacity: .9; }
.hero2-art .arch { width: 24%; height: 62%; border-radius: 999px 999px 0 0; background: linear-gradient(180deg, rgba(251, 246, 239, .16), rgba(251, 246, 239, .04)); border: 2px solid rgba(235, 211, 164, .5); border-bottom: 0; }
.hero2-art .arch:nth-child(2) { height: 78%; }

/* ---------- Qatar now ---------- */

.now { background: var(--surface); border-bottom: 1px solid var(--line); }
.now-inner { display: flex; align-items: center; gap: var(--s-6); flex-wrap: wrap; padding-block: var(--s-4); }
.now-title { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font); font-size: 0.875rem; font-weight: 700; color: var(--brand); text-transform: none; }
.now-title .pulse { background: #8A1538; }
.now-title .pulse::after { background: #8A1538; }
.now-list { display: flex; flex: 1; gap: var(--s-6); list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.now-list li { display: grid; min-width: max-content; }
.now-value { font-size: 1.375rem; font-weight: 700; color: var(--ink); line-height: 1.2; font-feature-settings: "tnum" 1; }
.now-word { font-size: 1.125rem; }
.now-label { font-size: 0.8125rem; color: var(--ink-soft); }
.now-updated { font-size: 0.8125rem; color: var(--ink-soft); }

/* ---------- Quick actions ---------- */

.quick { background: var(--bg); padding-block: var(--s-5); }
.quick-list { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.quick-list a {
    display: flex; flex-direction: column; align-items: center; gap: var(--s-2); min-height: 96px; padding: var(--s-3) var(--s-2);
    text-align: center; text-decoration: none; color: var(--ink); font-size: 0.9375rem; font-weight: 600; line-height: 1.3;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); transition: border-color var(--t-fast), transform var(--t-fast);
}
.quick-list a:hover { border-color: var(--brand); color: var(--brand); }
.quick-icon { width: 30px; height: 30px; padding: 0; color: var(--brand); }

/* ---------- Section bands (rhythm) ---------- */

.band { padding-block: clamp(48px, 6vw, 80px); }
.band-pearl { background: var(--pearl-2); }
.band-white { background: var(--surface); }
.band-explore { background: var(--bg); }
.band-rose { background: var(--rose); }
.band-head { max-width: 46em; margin-bottom: var(--s-6); }
.band-head h2 { font-family: var(--font-display); font-size: clamp(1.75rem, 3vw, 2.375rem); font-weight: 600; color: var(--brand); line-height: 1.2; }
[dir="rtl"] .band-head h2 { font-family: var(--font-display); }
.band-head p { margin-top: var(--s-2); font-size: 1.125rem; color: var(--ink-soft); }
.band-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-5); max-width: none; flex-wrap: wrap; }

/* ---------- Personas ---------- */

.persona-grid, .tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.tool-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.persona {
    display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); min-height: 100%;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.persona:hover { border-color: var(--brand); box-shadow: var(--shadow-1); background: var(--surface); }
.persona-icon { width: 48px; height: 48px; padding: 11px; border-radius: 12px; background: var(--tone-0); color: var(--tone-0-ink); }
.persona.tone-1 .persona-icon { background: var(--tone-1); color: var(--tone-1-ink); }
.persona.tone-2 .persona-icon { background: var(--tone-2); color: var(--tone-2-ink); }
.persona.tone-3 .persona-icon { background: var(--tone-3); color: var(--tone-3-ink); }
.persona a { margin-top: var(--s-2); font-size: 1.1875rem; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.3; }
.persona p { font-size: 0.9375rem; color: var(--ink-soft); line-height: 1.5; flex: 1; }
.persona-start { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s-2); font-weight: 600; font-size: 0.9375rem; color: var(--brand); }
.persona-start .icon-sm { transition: transform var(--t-fast); }
.persona:hover .persona-start .icon-sm { transform: translateX(3px); }
[dir="rtl"] .persona:hover .persona-start .icon-sm { transform: scaleX(-1) translateX(3px); }
.persona.row-link:hover a { text-decoration: none; color: var(--brand); }

.plan-cta {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; margin-top: var(--s-6);
    padding: var(--s-5) var(--s-6); background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid #8A1538; border-radius: var(--r-card);
}
.plan-cta h3 { font-size: 1.375rem; font-weight: 700; }
.plan-cta p { color: var(--ink-soft); }
.plan-cta-action { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); }

/* ---------- Guide cards ---------- */

.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.guide-card {
    display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-card); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.band-white .guide-card { background: var(--bg); }
.guide-card:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
.guide-card-topic { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--gold-ink); }
.guide-card-title { font-size: 1.125rem; font-weight: 700; line-height: 1.35; color: var(--ink); text-decoration: none; }
.guide-card-summary { font-size: 0.9375rem; color: var(--ink-soft); line-height: 1.5; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.guide-card-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); font-size: 0.8125rem; color: var(--ink-soft); }
.guide-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.guide-card-go { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s-1); font-weight: 600; font-size: 0.9375rem; color: var(--brand); }
.row-link:hover .guide-card-title { color: var(--brand); text-decoration: none; }

.topic-block + .topic-block { margin-top: var(--s-7); }
.topic-block[hidden] { display: none; }
.topic-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-4); font-size: 1.375rem; font-weight: 700; color: var(--brand); }
.topic-head .icon { color: var(--gold-ink); }
.pagehead-search { margin-top: var(--s-5); max-width: 640px; }
.pagehead-search .search-label { color: #FBF6EF; }

/* ---------- Explore (visual tiles) ---------- */

.explore-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(150px, auto); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.xtile {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--s-2); min-height: 150px; padding: var(--s-5);
    border-radius: var(--r-card); overflow: hidden; background: var(--tone-0); color: var(--tone-0-ink); transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.xtile.tone-1 { background: var(--tone-1); color: var(--tone-1-ink); }
.xtile.tone-2 { background: var(--tone-2); color: var(--tone-2-ink); }
.xtile.tone-3 { background: var(--tone-3); color: var(--tone-3-ink); }
.xtile-big { grid-column: span 2; grid-row: span 2; min-height: 316px; }
.xtile:hover { box-shadow: var(--shadow-2); background-color: inherit; }
.xtile-icon { position: absolute; inset-inline-end: var(--s-5); top: var(--s-5); width: 40px; height: 40px; opacity: .85; }
.xtile-big .xtile-icon { width: 64px; height: 64px; }
.xtile-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: .02em; opacity: .85; }
.xtile-body > a { font-size: 1.1875rem; font-weight: 700; color: inherit; text-decoration: none; line-height: 1.25; }
.xtile-big .xtile-body > a { font-size: 1.75rem; font-family: var(--font-display); }
.xtile-summary { max-width: 32em; font-size: 0.9375rem; line-height: 1.5; opacity: .9; }
.xtile.has-photo { color: #fff; background: #2A0B15; }
.xtile .tile-photo { position: absolute; inset: 0; margin: 0; }
.xtile .tile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xtile .tile-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 6, 10, .15) 0%, rgba(20, 6, 10, .35) 45%, rgba(20, 6, 10, .92) 100%); }
.xtile .tile-photo .photo-credit { position: absolute; inset-inline-end: 8px; top: 8px; z-index: 3; padding: 2px 8px; background: rgba(0, 0, 0, .55); border-radius: 6px; color: #fff; font-size: 0.6875rem; font-weight: 500; line-height: 1.5; }
.xtile .tile-photo .photo-credit a { color: #fff; font: inherit; text-decoration: underline; }
.xtile.row-link:hover .photo-credit a { text-decoration: underline; }
.xtile-body { position: relative; z-index: 1; }
.xtile.row-link:hover .xtile-body > a { color: inherit; text-decoration: underline; }

/* ---------- Qatar at a glance ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.stat-card { display: flex; flex-direction: column; gap: 4px; padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.stat-card-label { font-size: 0.9375rem; font-weight: 600; color: var(--ink-soft); }
.stat-card-value { font-size: clamp(1.75rem, 2.6vw, 2.25rem); font-weight: 700; color: var(--ink); line-height: 1.15; font-feature-settings: "tnum" 1; }
[dir="rtl"] .stat-card-value { font-size: clamp(1.5rem, 2.3vw, 1.9rem); }
.stat-card .change { padding-top: 0; font-size: 0.875rem; flex-wrap: wrap; white-space: normal; }
.change-vs { font-weight: 400; color: var(--ink-soft); }
.stat-card-spark { margin: var(--s-2) 0 0; }
.stat-card-spark .spark { height: 40px; }
.spark-area { fill: color-mix(in srgb, var(--gold) 18%, transparent); }
.spark-line { stroke: var(--brand); stroke-width: 2.25; }
.spark-dot { fill: var(--surface); stroke: var(--brand); }
.stat-card-src { margin-top: auto; padding-top: var(--s-2); font-size: 0.75rem; color: var(--ink-soft); }

/* ---------- Government panel ---------- */

.gov-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-7); align-items: center; padding: clamp(24px, 4vw, 48px); background: var(--pearl-2); border-radius: 20px; border: 1px solid var(--line); }
.gov-panel h2 { font-family: var(--font-display); font-size: clamp(1.625rem, 2.6vw, 2.125rem); font-weight: 600; color: var(--brand); line-height: 1.25; }
.gov-panel-text > p:not(.kicker) { margin-top: var(--s-3); font-size: 1.125rem; color: var(--ink-soft); }
.gov-panel .chip-row { margin-top: var(--s-5); }
.gov-panel-actions { display: flex; flex-direction: column; gap: var(--s-4); }
.gov-search label { display: block; margin-bottom: var(--s-2); font-weight: 600; }
.gov-panel-actions .hint, .pagehead-note { display: flex; align-items: flex-start; gap: 8px; }
.gov-search-hero { margin-top: var(--s-5); max-width: 680px; }

/* ---------- Riyal ---------- */

.riyal-peg { font-size: 1.375rem !important; font-weight: 700; color: var(--ink) !important; }
.fx-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); list-style: none; margin: 0 0 var(--s-3); padding: 0; }
.fx-card { padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.fx-card-code { font-size: 1.25rem; font-weight: 700; color: var(--brand); letter-spacing: .04em; }
.fx-card-name { font-size: 0.875rem; color: var(--ink-soft); }
.fx-card-rate { margin-top: var(--s-2); font-weight: 600; font-feature-settings: "tnum" 1; }
.fx-card-sub { font-size: 0.8125rem; color: var(--ink-soft); font-feature-settings: "tnum" 1; }

/* ---------- Updates and trust ---------- */

.updates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-6); align-items: center; }
.updates h2 { font-size: clamp(1.375rem, 2.2vw, 1.75rem); font-weight: 700; color: var(--ink); }
.band-rose .notify-field input { background: var(--surface); }
.trust { padding-block: var(--s-6); border-top: 1px solid var(--line); }
.trust-inner { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.trust-inner h2 { font-family: var(--font); font-size: 1rem; font-weight: 700; color: var(--ink); }
.trust-list { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); list-style: none; margin: 0; padding: 0; flex: 1; color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- Government entity cards ---------- */

.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.entity-card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.entity-card:hover { border-color: var(--brand); box-shadow: var(--shadow-1); background: var(--surface); }
.entity-card-type { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--tone-3-ink); }
.entity-card h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.35; }
.entity-card h3 a { color: var(--ink); text-decoration: none; }
.entity-card-what { font-size: 0.9375rem; color: var(--ink-soft); line-height: 1.5; }
.entity-card-services { list-style: none; margin: var(--s-1) 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.9375rem; }
.entity-card-services li { display: flex; gap: 6px; align-items: flex-start; }
.entity-card-services .icon-xs { margin-top: 5px; color: var(--good); }
.entity-card-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin-top: auto; padding-top: var(--s-2); font-size: 0.8125rem; color: var(--ink-soft); }
.entity-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.chip-nav { margin-bottom: var(--s-5); }
.result-line { display: flex; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); font-weight: 600; }
.dir-group h2 { display: flex; align-items: center; gap: 10px; }

/* ---------- Empty states ---------- */

.empty-state { max-width: 560px; margin: var(--s-6) auto; padding: var(--s-7) var(--s-5); text-align: center; background: var(--surface); border: 1px dashed var(--field); border-radius: var(--r-card); }
.empty-icon { width: 44px; height: 44px; color: var(--gold-ink); }
.empty-state h2 { margin-top: var(--s-3); font-size: 1.375rem; font-weight: 700; color: var(--ink); }
.empty-state p { margin-top: var(--s-2); color: var(--ink-soft); }
.empty-state .cta-row { justify-content: center; }

/* ---------- Footer ---------- */

.footer { display: none; }
.ftr { background: #2A0B15; color: rgba(251, 246, 239, .82); --focus: #EBD3A4; }
.ftr .wrap { padding-block: var(--s-7) var(--s-6); }
.ftr-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: var(--s-6); }
.ftr-logo { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: #FBF6EF; }
.ftr-independent { margin-top: var(--s-3); max-width: 30em; font-size: 0.9375rem; }
.ftr-trust { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); font-size: 0.875rem; color: #EBD3A4; }
.ftr-trust span { display: inline-flex; align-items: center; gap: 6px; }
.ftr-col { display: flex; flex-direction: column; gap: var(--s-2); }
.ftr-col h2 { margin-bottom: var(--s-1); font-family: var(--font); font-size: 0.9375rem; font-weight: 700; color: #FBF6EF; }
.ftr-col a { color: rgba(251, 246, 239, .82); text-decoration: none; font-size: 0.9375rem; padding-block: 2px; }
.ftr-col a:hover { color: #EBD3A4; text-decoration: underline; }
.ftr-col a[aria-current="true"] { color: #EBD3A4; font-weight: 600; }
.ftr-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid rgba(251, 246, 239, .14); font-size: 0.875rem; }
.ftr-bottom a { color: #EBD3A4; }
html[data-contrast="high"] .ftr { background: #000; color: #fff; }

/* ---------- Bottom navigation (phones) ---------- */

.bnav { display: none; }
@media (max-width: 767px) {
    .bnav {
        position: fixed; inset-inline: 0; bottom: 0; z-index: 35; display: grid; grid-template-columns: repeat(5, 1fr);
        padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px -8px rgba(36, 22, 27, .2);
    }
    .bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
    .bnav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
    .bnav a[aria-current="page"] { color: var(--brand); }
    .bnav a[aria-current="page"] svg { stroke-width: 2.3; }
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    html { scroll-padding-bottom: 80px; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .quick-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .persona-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fx-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ftr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ftr-brand { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
    html { scroll-padding-top: 140px; }
    .hdr-top { flex-wrap: wrap; gap: var(--s-2) var(--s-3); padding-block: var(--s-2); min-height: 0; }
    .hdr-search { order: 3; flex-basis: 100%; }
    .search-header { max-width: none; }
    .hdr-utils { margin-inline-start: auto; }
    .hdr-nav .hdr-nav-about { margin-inline-start: 0; }
    .hero2-grid { grid-template-columns: 1fr; gap: var(--s-5); }
    .hero2-visual { display: none; }
    .gov-panel, .updates { grid-template-columns: 1fr; gap: var(--s-5); }
    .explore-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .hdr-nav { display: none; }
    .hdr.is-compact .hdr-search { display: none; }
    .hdr-utils .hdr-saved { display: none; }
    .quick { padding-block: var(--s-4); }
    .quick-list { display: flex; overflow-x: auto; gap: var(--s-2); padding-bottom: 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
    .quick-list li { flex: 0 0 auto; scroll-snap-align: start; }
    .quick-list a { min-height: 0; flex-direction: row; padding: 10px 14px; border-radius: var(--r-pill); white-space: nowrap; font-size: 0.9375rem; }
    .quick-icon { width: 20px; height: 20px; }
    .now-inner { gap: var(--s-3); }
    .now-list { flex-basis: 100%; gap: var(--s-5); }
    .now-value { font-size: 1.1875rem; }
    .stat-grid { gap: var(--s-3); }
    .stat-card { padding: var(--s-4); }
    .fx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .explore-grid { grid-auto-rows: minmax(120px, auto); gap: var(--s-3); }
    .xtile { min-height: 120px; padding: var(--s-4); }
    .xtile-big { min-height: 220px; }
    .xtile-big a { font-size: 1.375rem; }
    .xtile-icon { width: 30px; height: 30px; inset-inline-end: var(--s-4); top: var(--s-4); }
    .plan-cta { padding: var(--s-5); }
    .search-hero input[type="search"], .gov-search input[type="search"] { height: 56px; padding-inline-end: 96px; }
    .search-submit { padding: 0 var(--s-4); }
}
@media (max-width: 520px) {
    .persona-grid { grid-template-columns: 1fr; gap: var(--s-3); }
    .persona { flex-direction: row; flex-wrap: wrap; align-items: center; padding: var(--s-4); gap: var(--s-1) var(--s-3); }
    .persona-icon { width: 44px; height: 44px; padding: 10px; }
    .persona a { margin-top: 0; flex: 1; font-size: 1.0625rem; }
    .persona p { flex-basis: 100%; }
    .persona-start { display: none; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card-value { font-size: 1.5rem; }
    .xtile-big { grid-column: span 2; grid-row: span 1; }
    .ftr-grid { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
}

@media (prefers-reduced-motion: reduce) {
    .hdr, .hdr-top, .quick-list a, .persona, .guide-card, .xtile, .link-arrow .icon-sm, .persona-start .icon-sm { transition: none !important; }
}

/* Photo credits: required by the licences, kept tiny and quiet. */
.photo-credit, .xtile .tile-photo .photo-credit, .hero2-visual .photo-credit {
    padding: 1px 6px !important; font-size: 10px !important; font-weight: 400 !important; line-height: 1.6 !important;
    background: rgba(0, 0, 0, .32) !important; border-radius: 4px; opacity: .75; transition: opacity var(--t-fast);
}
.photo-credit:hover, .photo-credit:focus-within { opacity: 1; }
.photo-credit a { text-decoration: none !important; }
.xtile .tile-photo .photo-credit { top: auto !important; bottom: 6px; inset-inline-end: 6px; }
.hero2-visual .photo-credit { bottom: 8px; inset-inline-end: 8px; }
.xtile .tile-photo::after { background: linear-gradient(180deg, rgba(20, 6, 10, .15) 0%, rgba(20, 6, 10, .4) 45%, rgba(20, 6, 10, .94) 100%) !important; }

/* ---------- Guide article: at-a-glance, TOC, helpful widget ---------- */

.pagehead-meta span { display: inline-flex; align-items: center; gap: 6px; }

.glance { margin-bottom: var(--s-6); }
.glance-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px;
    margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
}
.glance:has(.glance-cost) .glance-grid { border-radius: var(--r-card) var(--r-card) 0 0; }
.glance-grid > div { padding: var(--s-4); background: var(--surface); }
.glance-grid dt { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-soft); }
.glance-grid dt .icon-sm { color: var(--gold-ink); }
.glance-grid dd { margin: 0; font-weight: 600; color: var(--ink); line-height: 1.4; }
.glance-cost {
    display: flex; align-items: flex-start; gap: 8px; margin: 1px 0 0; padding: var(--s-4);
    background: var(--surface); border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--r-card) var(--r-card);
    font-size: 0.9375rem; line-height: 1.6; color: var(--ink-soft);
}
.glance-cost .icon-sm { flex: none; margin-top: 3px; color: var(--gold-ink); }
.glance-cost strong { color: var(--ink); font-weight: 600; }

.toc ul { gap: 6px !important; }
.toc a { font-size: 0.9375rem; color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }

.helpful { margin-top: var(--s-7); padding: var(--s-5); background: var(--pearl-2); border-radius: var(--r-card); text-align: center; }
.helpful-ask { font-weight: 600; margin-bottom: var(--s-3); }
.helpful-buttons { display: flex; justify-content: center; gap: var(--s-3); }
.helpful-buttons[hidden], .helpful-ask[hidden] { display: none; }
.helpful-done, .helpful-correct { font-size: 0.9375rem; color: var(--ink-soft); }
.helpful noscript form { display: flex; justify-content: center; gap: var(--s-3); margin-top: var(--s-3); }

@media (max-width: 960px) {
    .glance-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Map: search + mobile Map/List toggle ---------- */

.map-toolbar { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-4); }
.map-search { flex: 1; min-width: 220px; max-width: 420px; }
.map-search input { height: 48px; }
.map-view-toggle { display: inline-flex; border: 1.5px solid var(--field); border-radius: var(--r-pill); padding: 3px; }
.map-view-toggle[hidden] { display: none; }
.map-view-toggle button {
    display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; font: inherit; font-weight: 600;
    color: var(--ink-soft); background: transparent; border: 0; border-radius: var(--r-pill); cursor: pointer;
}
.map-view-toggle button[aria-pressed="true"] { background: #8A1538; color: #FBF6EF; }
.map-group[data-map-group] summary { cursor: pointer; }
[data-map-item][hidden] { display: none; }

@media (max-width: 767px) {
    .map-view-toggle { display: inline-flex; }
    body:not(.map-show-list) .map-list, body:not(.map-show-list) .map-list-title { display: none; }
    body.map-show-list .map-canvas, body.map-show-list .map-attrib { display: none; }
}
