/* ============================================================
   RSI OFFICIAL · "الهوية الرسمية" · Research & Studies Institute
   SEU institutional vCard: the living official credential.
   World: official-paper light (porcelain blue) + navy ink #001D6C
   + teal #5DB5B3 as THE solid accent. The SEU seal gradient
   (teal 11CEC8 to blue 0080C0 to purple 61269D) is spent ONLY on:
   the seal-ring, the hero primary CTA, the dock wax-seal, and the
   install-sheet wax medallion. Everything else speaks navy ink.
   Geometry: certificate double-rules, dot-leader registry, 8px.
   Motion verb: the stamp-settle (one damped press, no drift).
   Rhythm: compressed document scale, 56px between blocks on
   mobile and 72px on desktop; ambient guilloche + ledger ruling
   keep every band textured. Mobile-first, RTL-safe, reduced-motion.
   ============================================================ */

:root {
    --paper: var(--tk-bg, #f4f7fb);
    --sheet: #ffffff;
    --sheet-2: #fbfcfe;
    --ink: var(--tk-primary, #001d6c);
    --txt: var(--tk-text, #142248);
    --muted: color-mix(in srgb, var(--tk-text, #142248) 62%, #ffffff);
    --dim: color-mix(in srgb, var(--tk-text, #142248) 42%, #ffffff);
    --teal: var(--tk-secondary, #5db5b3);
    --teal-deep: color-mix(in srgb, var(--tk-secondary, #5db5b3) 72%, #0a4b49);
    --purple: var(--tk-accent2, #61269d);
    --ok: var(--tk-success, #1a7f5a);
    --bad: #b3403a;
    /* the shared review partial reads var(--accent); keep it on-palette */
    --accent: var(--tk-primary, #001d6c);
    /* certificate rules */
    --line: rgba(0, 29, 108, .13);
    --line-2: rgba(0, 29, 108, .26);
    /* THE seal gradient: seal-ring · hero CTA · dock wax-seal · install medallion ONLY */
    --seal-grad: linear-gradient(135deg, #11cec8 0%, #0080c0 52%, #61269d 100%);
    --seal-conic: conic-gradient(from 210deg, #11cec8, #0080c0, #61269d, #11cec8);
    --r-lg: 12px;
    --r-md: 8px;
    --r-sm: 5px;
    --font-d: var(--tk-font-header, 'IBM Plex Sans Arabic'), 'IBM Plex Sans', system-ui, sans-serif;
    --font-b: var(--tk-font-content, 'IBM Plex Sans Arabic'), 'IBM Plex Sans', system-ui, sans-serif;
    --dock-h: 76px;
    --settle: cubic-bezier(.2, .75, .3, 1);
    /* elevation tiers: flat ledger paper vs raised official panel */
    --elev-1: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 8px 22px -18px rgba(0, 29, 108, .35);
    --elev-2: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 18px 44px -26px rgba(0, 29, 108, .45), 0 2px 8px -4px rgba(0, 29, 108, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--txt);
    font-family: var(--font-b);
    font-size: 15.5px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
bdi { unicode-bidi: isolate; }

::selection { background: var(--ink); color: #fff; }

/* ---------- Ambient: guilloche arcs + ledger ruling + seal watermarks + document frame ----------
   The ledger ruling (fine horizontal rule every 54px) keeps compressed
   section gaps from ever reading as blank paper. */
.fx { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.fx-guilloche {
    position: absolute; inset: -40%;
    background:
        repeating-radial-gradient(circle at 12% -10%, transparent 0 9px, rgba(0, 29, 108, .05) 9px 10px),
        repeating-radial-gradient(circle at 110% 108%, transparent 0 11px, rgba(93, 181, 179, .055) 11px 12px),
        repeating-linear-gradient(0deg, transparent 0 54px, rgba(0, 29, 108, .04) 54px 55px);
}
.fx-seal {
    position: absolute; width: min(78vw, 540px); aspect-ratio: 1;
    inset-block-start: -7%; inset-inline-end: -16%;
    background: url('/img/templates/rsi-official-vcard/seu-seal.png') center / contain no-repeat;
    opacity: .06; filter: saturate(.4);
}
.fx-seal-2 {
    position: absolute; width: min(52vw, 360px); aspect-ratio: 1;
    inset-block-end: -9%; inset-inline-start: -14%;
    background: url('/img/templates/rsi-official-vcard/seu-seal.png') center / contain no-repeat;
    opacity: .045; filter: saturate(.35);
}
/* fixed certificate frame: outer rule + inner hairline (the document edge) */
.fx-frame {
    position: fixed; inset: 7px; z-index: 65; pointer-events: none;
    border: 1px solid var(--line-2);
    box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--line);
}
@media (max-width: 759px) { .fx-frame { inset: 5px; box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--line); } }

/* intro-screen loader (hidden by scripts on load) */
#loader { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: var(--paper); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-block-start-color: var(--ink); animation: rsiSpin 1s linear infinite; }
@keyframes rsiSpin { to { transform: rotate(360deg); } }

/* ---------- Layout: the compressed document rhythm (S3) ---------- */
.rsi-wrap { max-width: 720px; margin-inline: auto; padding-inline: 22px; padding-block-end: calc(var(--dock-h) + 26px); }
.sec { padding-block: 28px; }
.sec-head { margin-block-end: 18px; }
/* registry sits tight under the hero: one identity block (O2) */
.sec-registry { padding-block: 20px 0; }

/* documentary kicker: teal ledger label + rule ending in a seal dot (no letterspacing, Arabic-safe) */
.kicker {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-d); font-size: 12.5px; font-weight: 600; color: var(--teal-deep);
}
.kicker::after {
    content: ""; flex: 1; height: 1px; background: var(--line-2);
    -webkit-mask-image: linear-gradient(to var(--flow-end, right), #000 60%, transparent);
            mask-image: linear-gradient(to var(--flow-end, right), #000 60%, transparent);
}
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--teal); flex: none; }
[dir="rtl"] .kicker::after { --flow-end: left; }
.sec-title {
    font-family: var(--font-d); font-size: clamp(1.6rem, 5.6vw, 2.15rem);
    font-weight: 700; line-height: 1.22; color: var(--ink);
    margin-block-start: 9px;
}
.sec-sub { color: var(--muted); font-size: 14.5px; margin-block-start: 7px; max-width: 54ch; }

/* ---------- Reveal: the stamp-settle ---------- */
.rv { opacity: 0; transform: translateY(14px) scale(1.012); transition: opacity .55s var(--settle), transform .55s var(--settle); }
.rv.in { opacity: 1; transform: none; }
.rv-d1 { transition-delay: .07s; }
.rv-d2 { transition-delay: .14s; }

.hero-load { opacity: 0; animation: stampIn .6s var(--settle) forwards; }
.hl-1 { animation-delay: .05s; }
.hl-2 { animation-delay: .14s; }
.hl-3 { animation-delay: .24s; }
.hl-4 { animation-delay: .36s; }
.hl-5 { animation-delay: .48s; }
@keyframes stampIn { from { opacity: 0; transform: translateY(12px) scale(1.02); } to { opacity: 1; transform: none; } }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; inset-block-start: 0; z-index: 60;
    display: flex; align-items: center; gap: 11px;
    margin-inline: -22px; padding: 11px 22px;
    background: rgba(244, 247, 251, .82);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-block-end: 1px solid var(--line);
}
.topbar-avatar { width: 36px; height: 36px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--line-2); }
.topbar-name { font-family: var(--font-d); font-weight: 600; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

/* language switcher (official pill) */
.lang-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 13px; border-radius: 999px;
    background: var(--sheet); border: 1px solid var(--line-2);
    color: var(--ink); font-family: var(--font-d); font-weight: 600; font-size: 12.5px;
}
.lang-menu {
    position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 8px);
    min-width: 160px; max-height: 280px; overflow-y: auto;
    background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md);
    padding: 6px; z-index: 80; box-shadow: var(--elev-2);
}
.lang-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--muted); }
.lang-item:hover { background: var(--paper); }
.lang-item.active { color: var(--teal-deep); font-weight: 700; }

/* ---------- Cover plate (contained banner, certificate mat) ---------- */
.cover-plate {
    margin-block-start: 16px; padding: 7px;
    background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md);
    box-shadow: var(--elev-1);
}
.cover-plate img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.cover-plate iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; border-radius: var(--r-sm); background: #000; }

/* ---------- HERO: the credential ---------- */
.cred { padding-block: 30px 8px; }
.cred-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 7px 14px; border-radius: 999px;
    background: var(--sheet); border: 1px solid var(--line-2);
    font-family: var(--font-d); font-size: 12px; font-weight: 600; color: var(--teal-deep);
    box-shadow: var(--elev-1);
}
.cred-eyebrow img { width: 18px; height: 18px; object-fit: contain; }

.cred-id { display: flex; align-items: center; gap: 18px; margin-block-start: 22px; }
/* the seal-ring: SEU gradient as a conic credential ring (signature use #1) */
.seal-ring {
    flex: none; width: 104px; height: 104px; border-radius: 50%;
    padding: 4px; background: var(--seal-conic);
    animation: ringSet 1.1s var(--settle) both; animation-delay: .3s;
    box-shadow: 0 10px 26px -12px rgba(0, 128, 192, .55);
}
@keyframes ringSet { from { transform: rotate(-140deg) scale(.92); } to { transform: none; } }
.seal-ring-in { width: 100%; height: 100%; border-radius: 50%; padding: 3px; background: var(--sheet); }
.seal-ring-in img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cred-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.cred-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: var(--r-sm);
    border: 1px solid var(--line-2); background: var(--sheet);
    font-family: var(--font-d); font-size: 12px; font-weight: 600; color: var(--ink);
    max-width: 100%;
}
.cred-chip i { color: var(--teal); font-size: 11px; }
.cred-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cred-name {
    font-family: var(--font-d);
    font-size: clamp(2.35rem, 9.6vw, 4.1rem);
    font-weight: 700; line-height: 1.14; color: var(--ink);
    margin-block-start: 18px; text-wrap: balance;
}
.cred-role { font-family: var(--font-d); font-weight: 500; font-size: clamp(1.02rem, 3.8vw, 1.3rem); color: var(--teal-deep); margin-block-start: 8px; }

/* attestation rule: certificate line drawing outward from the label */
.attest { display: flex; align-items: center; gap: 12px; margin-block-start: 20px; }
.attest-line { flex: 1; height: 1px; background: var(--line-2); transform-origin: center; animation: ruleDraw .9s var(--settle) both; animation-delay: .55s; }
@keyframes ruleDraw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.attest-label { flex: none; font-family: var(--font-d); font-size: 11.5px; font-weight: 600; color: var(--dim); }

.cred-desc { margin-block-start: 16px; color: var(--muted); font-size: 15px; max-width: 58ch; }
.cred-desc p { margin-block-end: .6em; }

.cred-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 22px; }

/* ---------- Buttons ---------- */
/* gradient CTA, signature use #2 (hero + modal confirm only) */
.btn-primary {
    position: relative; display: inline-flex; align-items: center; gap: 9px;
    padding: 14px 26px; border: 0; border-radius: var(--r-md);
    background: var(--seal-grad);
    color: #fff; font-family: var(--font-d); font-weight: 700; font-size: 14.5px;
    box-shadow: 0 12px 28px -12px rgba(0, 128, 192, .6);
    transition: transform .22s var(--settle), box-shadow .22s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px rgba(0, 128, 192, .7); }
.btn-primary:active { transform: scale(.98); }

/* solid ink button: every secondary conversion action speaks navy */
.btn-ink {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 14px 24px; border: 0; border-radius: var(--r-md);
    background: var(--ink); color: #fff;
    font-family: var(--font-d); font-weight: 600; font-size: 14.5px;
    transition: transform .22s var(--settle), background .22s ease;
}
.btn-ink:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--ink) 86%, #000); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 13px 22px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line-2);
    color: var(--ink); font-family: var(--font-d); font-weight: 600; font-size: 14px;
    transition: border-color .22s ease, transform .22s var(--settle), box-shadow .22s ease;
}
.btn-ghost:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--elev-1); }

.btn-mini {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0; border: 0; background: transparent;
    font-family: var(--font-d); font-size: 13.5px; font-weight: 700; color: var(--teal-deep);
    transition: gap .2s ease;
}
.btn-mini:hover { gap: 12px; }
.btn-mini i { font-size: 12px; }

.btn-primary:focus-visible, .btn-ink:focus-visible, .btn-ghost:focus-visible, .btn-mini:focus-visible {
    outline: 2px solid var(--teal); outline-offset: 2px;
}

/* ---------- Registry (customTexts as official dot-leader ledger) ---------- */
.reg-frame {
    position: relative; background: var(--sheet); border: 1px solid var(--line-2);
    border-radius: var(--r-md); padding: 22px 20px; box-shadow: var(--elev-1);
}
.reg-frame::after { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line); border-radius: var(--r-sm); pointer-events: none; }
.reg-title { display: flex; align-items: center; gap: 9px; font-family: var(--font-d); font-size: 12.5px; font-weight: 700; color: var(--teal-deep); margin-block-end: 6px; }
.reg-title i { font-size: 12px; }
.reg-row { display: flex; align-items: baseline; gap: 10px; padding-block: 11px; }
.reg-row + .reg-row { border-block-start: 1px solid var(--line); }
.reg-label { flex: none; font-size: 13.5px; font-weight: 500; color: var(--muted); max-width: 46%; }
.reg-dots { flex: 1; min-width: 24px; border-block-end: 2px dotted rgba(0, 29, 108, .28); transform: translateY(-4px); }
.reg-value { flex: none; font-family: var(--font-d); font-weight: 700; font-size: 15.5px; color: var(--ink); font-variant-numeric: tabular-nums; max-width: 52%; text-align: end; }

/* ---------- Quick actions: ONE balanced row of compact chips (O1) ----------
   nowrap + equal flex keeps 2, 3 or 4 chips on a single centered line;
   labels ellipsize instead of orphan-wrapping. */
.qa-row { display: flex; flex-wrap: nowrap; justify-content: center; gap: 8px; margin-block-start: 16px; }
.qa-item {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    flex: 1 1 0; min-width: 0; max-width: 150px;
    padding: 13px 4px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line);
    color: var(--muted); font-size: 12px; font-weight: 600;
    box-shadow: var(--elev-1);
    transition: transform .22s var(--settle), border-color .22s ease, color .22s ease;
}
.qa-item i { font-size: 17px; color: var(--ink); }
.qa-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-item:hover { transform: translateY(-3px); border-color: var(--teal); color: var(--ink); }

/* ---------- Services: the official catalogue (ordinal ledger rows) ---------- */
.svc-list { display: grid; gap: 12px; counter-reset: svc; }
.svc-row {
    position: relative; display: flex; gap: 14px; align-items: flex-start;
    padding: 18px 16px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line);
    border-inline-start: 3px solid var(--teal);
    box-shadow: var(--elev-1);
    transition: transform .25s var(--settle), box-shadow .25s ease, border-color .25s ease;
}
.svc-row:hover { transform: translateY(-3px); box-shadow: var(--elev-2); border-color: var(--line-2); border-inline-start-color: var(--teal); }
.svc-ord {
    counter-increment: svc; flex: none;
    width: 36px; height: 36px; display: grid; place-items: center;
    border: 1px solid var(--line-2); border-radius: var(--r-sm);
    font-family: var(--font-d); font-weight: 700; font-size: 13px; color: var(--teal-deep);
    font-variant-numeric: tabular-nums;
}
.svc-ord::before { content: counter(svc, decimal-leading-zero); unicode-bidi: isolate; direction: ltr; }
.svc-media { flex: none; width: 46px; height: 46px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; color: var(--teal-deep); font-size: 17px; background: var(--sheet-2); }
.svc-media img { width: 100%; height: 100%; object-fit: cover; }
.svc-body { min-width: 0; flex: 1; }
.svc-name { font-family: var(--font-d); font-size: 16.5px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.svc-desc { color: var(--muted); font-size: 13.5px; margin-block-start: 5px; }
.svc-cta { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-block-start: 12px; padding-block-start: 10px; border-block-start: 1px solid var(--line); }

/* ---------- Programs (products) ---------- */
.prg-grid { display: grid; gap: 14px; }
.prg-card {
    position: relative; border-radius: var(--r-md); padding: 22px 20px;
    background: var(--sheet); border: 1px solid var(--line-2);
    box-shadow: var(--elev-1);
    transition: transform .25s var(--settle), box-shadow .25s ease;
}
.prg-card:hover { transform: translateY(-3px); box-shadow: var(--elev-2); }
/* badge = the ink stamp */
.prg-stamp {
    position: absolute; inset-block-start: 14px; inset-inline-end: 14px;
    padding: 4px 11px; border: 1.5px solid var(--teal-deep); border-radius: var(--r-sm);
    color: var(--teal-deep); font-family: var(--font-d); font-size: 11px; font-weight: 700;
    transform: rotate(-5deg); background: rgba(93, 181, 179, .07);
}
[dir="rtl"] .prg-stamp { transform: rotate(5deg); }
.prg-img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); margin-block-end: 14px; }
.prg-name { font-family: var(--font-d); font-size: 17px; font-weight: 700; color: var(--ink); }
.prg-card.has-stamp .prg-name { padding-inline-end: 70px; }
.prg-desc { color: var(--muted); font-size: 13.5px; margin-block-start: 6px; }
.prg-price-row { display: flex; align-items: baseline; gap: 10px; margin-block-start: 14px; }
.prg-price { font-family: var(--font-d); font-size: 23px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.prg-price-old { color: var(--dim); font-size: 14px; text-decoration: line-through; font-variant-numeric: tabular-nums; }
.prg-stock { font-size: 12px; font-weight: 700; margin-block-start: 3px; }
.prg-stock.ok { color: var(--ok); }
.prg-stock.out { color: var(--bad); }
.prg-card .btn-ink { width: 100%; justify-content: center; margin-block-start: 16px; }

/* ---------- Archive (gallery: drifting plates with mat + caption ledger) ---------- */
.car { position: relative; }
.car-track {
    display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
    margin-inline: -22px; padding-inline: 22px; padding-block: 4px 10px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.car-track::-webkit-scrollbar { display: none; }
.car-item {
    flex: 0 0 72%; max-width: 330px; scroll-snap-align: center;
    background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md);
    padding: 7px; box-shadow: var(--elev-1);
}
.car-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.mas-cap { padding: 9px 6px 3px; font-family: var(--font-d); font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.car-nav {
    position: absolute; inset-block-start: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2);
    background: var(--sheet); color: var(--ink);
    display: grid; place-items: center; font-size: 13px; z-index: 5;
    box-shadow: var(--elev-1);
    transition: border-color .2s ease;
}
.car-nav:hover { border-color: var(--teal); }
.car-nav.prev { inset-inline-start: -8px; }
.car-nav.next { inset-inline-end: -8px; }
[dir="rtl"] .car-nav i { transform: scaleX(-1); }
@media (max-width: 759px) { .car-nav { display: none; } }

/* ---------- Media room (videos) ---------- */
.reel { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -22px; padding-inline: 22px; padding-block-end: 8px; scrollbar-width: none; }
.reel::-webkit-scrollbar { display: none; }
.reel-item { flex: 0 0 86%; scroll-snap-align: center; background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 7px; box-shadow: var(--elev-1); }
.reel-item:only-child { flex-basis: 100%; margin-inline: auto; }
.reel-item iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; border-radius: var(--r-sm); background: #000; }
.reel-label { padding: 10px 8px 4px; font-family: var(--font-d); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }

/* ---------- Statements (testimonials: horizontal ledger) ---------- */
.tm-track {
    display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
    margin-inline: -22px; padding-inline: 22px; padding-block: 4px 10px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tm-track::-webkit-scrollbar { display: none; }
.tm-card {
    flex: 0 0 84%; max-width: 380px; scroll-snap-align: center;
    position: relative; padding: 22px 20px 18px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line);
    border-block-start: 3px solid var(--teal);
    box-shadow: var(--elev-1);
}
.tm-card:only-child { margin-inline: auto; }
.tm-mark { position: absolute; inset-block-start: 12px; inset-inline-end: 16px; font-size: 26px; color: var(--teal); opacity: .35; }
.tm-stars { display: flex; gap: 3px; color: var(--teal-deep); font-size: 12.5px; margin-block-end: 10px; }
.tm-text { font-size: 14px; color: var(--txt); }
.tm-who { display: flex; align-items: center; gap: 11px; margin-block-start: 14px; padding-block-start: 12px; border-block-start: 1px solid var(--line); }
.tm-who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); }
.tm-name { font-family: var(--font-d); font-weight: 700; font-size: 13.5px; color: var(--ink); }
.tm-sub { color: var(--dim); font-size: 12px; }

/* Empty attestation register (S4): a real ledger awaiting its first entry,
   ghost rows + dashed seal socket, never an abandoned pill. */
.tm-empty {
    position: relative; background: var(--sheet); border: 1px solid var(--line-2);
    border-radius: var(--r-md); padding: 20px 20px 16px; box-shadow: var(--elev-1);
}
.tm-empty::after { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line); border-radius: var(--r-sm); pointer-events: none; }
.tm-ghost-row { display: flex; align-items: center; gap: 10px; padding-block: 13px; }
.tm-ghost-row + .tm-ghost-row { border-block-start: 1px solid var(--line); }
.tm-ghost { height: 9px; border-radius: 5px; background: var(--line); flex: none; }
.tm-ghost.g1 { width: 74px; }
.tm-ghost.g2 { width: 46px; opacity: .75; }
.tm-ghost-row .reg-dots { transform: none; border-block-end-color: rgba(0, 29, 108, .16); }
.tm-empty-seal {
    position: absolute; inset-block-start: 16px; inset-inline-end: 16px;
    width: 46px; height: 46px; border-radius: 50%;
    border: 1.5px dashed var(--line-2);
    display: grid; place-items: center; color: var(--line-2); font-size: 14px;
}
.tm-empty-note {
    text-align: center; color: var(--muted); font-size: 13px; line-height: 1.75;
    max-width: 42ch; margin-inline: auto; padding-block: 12px 2px;
}

/* The shared review CTA + submit speak the ink system (O5). The partial paints
   an inline background, so the override must carry weight. */
#statements .scaan-review-btn,
#statements .scaan-review-submit {
    background: var(--ink) !important;
    color: #fff !important;
    border-radius: var(--r-md) !important;
    font-family: var(--font-d) !important;
    letter-spacing: 0 !important;
    box-shadow: 0 10px 24px -14px rgba(0, 29, 108, .6) !important;
}
#statements .scaan-review-btn:hover,
#statements .scaan-review-submit:hover { filter: none !important; background: color-mix(in srgb, var(--ink) 86%, #000) !important; transform: translateY(-2px); }
#statements .scaan-review-btn { padding: 13px 26px !important; }
#statements #scaanReviewModal > div { font-family: var(--font-b) !important; border: 1px solid var(--line-2); }

/* ---------- Links & resources ---------- */
.link-grid { display: grid; gap: 10px; }
.link-card {
    display: flex; align-items: center; gap: 13px;
    padding: 15px 16px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line);
    box-shadow: var(--elev-1);
    transition: transform .22s var(--settle), border-color .22s ease;
}
.link-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.link-ic { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--sheet-2); border: 1px solid var(--line); font-size: 15px; color: var(--ink); flex: none; }
.link-label { font-weight: 700; font-size: 14px; font-family: var(--font-d); color: var(--ink); display: block; }
/* values: addresses wrap to two lines, URLs keep one LTR-isolated line (S6) */
.link-val {
    color: var(--muted); font-size: 12.5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
}
.link-val.is-url { display: block; white-space: nowrap; text-overflow: ellipsis; word-break: normal; }
/* unified affordance: navy chevron chip, mirrored in RTL (O3) */
.link-arrow {
    margin-inline-start: auto; flex: none;
    width: 32px; height: 32px; border-radius: var(--r-sm);
    border: 1px solid var(--line-2); background: var(--sheet-2);
    color: var(--ink); display: grid; place-items: center; font-size: 11px;
    transition: border-color .2s ease, color .2s ease;
}
.link-card:hover .link-arrow { border-color: var(--teal); color: var(--teal-deep); }
[dir="rtl"] .link-arrow i { transform: scaleX(-1); }
.iframe-wrap { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-2); margin-block-end: 12px; background: var(--sheet); }
.iframe-wrap iframe { width: 100%; min-height: 320px; border: 0; display: block; }

/* ---------- Panels & forms (raised official panel = tier 2) ---------- */
.panel {
    position: relative; border-radius: var(--r-md); padding: 24px 20px;
    background: var(--sheet); border: 1px solid var(--line-2);
    box-shadow: var(--elev-2);
}
.panel::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; height: 3px; border-start-start-radius: var(--r-md); border-start-end-radius: var(--r-md); background: var(--teal); opacity: .85; }

/* form fields as certificate entries (S5): registry tick on the label,
   paper-pressed field, ink focus with a teal halo */
.f-label { display: flex; align-items: center; gap: 7px; font-family: var(--font-d); font-size: 12.5px; font-weight: 700; color: var(--ink); margin-block: 14px 7px; }
.f-label::before { content: ""; flex: none; width: 5px; height: 5px; background: var(--teal); transform: rotate(45deg); }
.f-input, select.f-input, textarea.f-input {
    width: 100%; padding: 13px 15px; border-radius: var(--r-sm);
    background: linear-gradient(180deg, #ffffff, #f7fafd);
    border: 1px solid rgba(0, 29, 108, .22);
    box-shadow: inset 0 1px 2px rgba(0, 29, 108, .05);
    color: var(--txt); font-family: var(--font-b); font-size: 15px;
    min-height: 48px;
    transition: border-color .2s ease, box-shadow .2s ease;
    appearance: none; -webkit-appearance: none;
}
.f-input:hover { border-color: rgba(0, 29, 108, .38); }
.f-input:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(93, 181, 179, .22), inset 0 1px 2px rgba(0, 29, 108, .04);
    background: var(--sheet);
}
.f-input::placeholder { color: var(--dim); }
/* phone and code fields: LTR order inside the RTL form (S6) */
input.f-ltr { direction: ltr; text-align: start; unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
select.f-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23001d6c' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #ffffff, #f7fafd);
    background-repeat: no-repeat; background-position: calc(100% - 16px) center, center;
    background-size: 12px 8px, auto;
    padding-inline-end: 40px; text-overflow: ellipsis;
}
[dir="rtl"] select.f-input { background-position: 16px center, center; }
select.f-input option { background: var(--sheet); color: var(--txt); }
.grid-2f { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert-box { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-radius: var(--r-sm); font-size: 13.5px; margin-block-end: 14px; }
.alert-error { background: rgba(179, 64, 58, .08); border: 1px solid rgba(179, 64, 58, .35); color: var(--bad); }
.alert-success { background: rgba(26, 127, 90, .08); border: 1px solid rgba(26, 127, 90, .3); color: var(--ok); }

/* flatpickr: the official calendar */
.flatpickr-calendar { border: 1px solid var(--line-2) !important; border-radius: var(--r-md) !important; box-shadow: var(--elev-2) !important; font-family: var(--font-b) !important; }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { color: var(--ink) !important; fill: var(--ink) !important; font-family: var(--font-d) !important; }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { fill: var(--ink) !important; }
span.flatpickr-weekday { color: var(--teal-deep) !important; font-weight: 700 !important; }
.flatpickr-day { color: var(--txt) !important; font-variant-numeric: tabular-nums; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--ink) !important; border-color: var(--ink) !important; color: #fff !important; }
.flatpickr-day.today { border-color: var(--teal) !important; }
.flatpickr-day:hover { background: var(--paper) !important; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--dim) !important; }

/* ---------- Hours ---------- */
.hour-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 11px; border-block-end: 1px solid var(--line); font-size: 14px; }
.hour-row:last-child { border-block-end: 0; }
.hour-day { color: var(--muted); font-weight: 600; }
.hour-time { color: var(--txt); font-variant-numeric: tabular-nums; }
.hour-row.today .hour-day, .hour-row.today .hour-time { color: var(--teal-deep); font-weight: 700; }
.hour-24 { display: flex; align-items: center; gap: 10px; color: var(--teal-deep); font-weight: 700; font-size: 15px; }

/* ---------- Map: certificate mat with a paper placeholder (O4) ----------
   Outer rule + inner hairline mat like every plate; the paper placeholder
   sits BEHIND the embed, so while the iframe is empty or loading the card
   shows textured certificate paper, never a grey void. */
.map-wrap {
    position: relative; border-radius: var(--r-md); border: 1px solid var(--line-2);
    background: var(--sheet); padding: 7px; box-shadow: var(--elev-1);
}
.map-wrap::after { content: ""; position: absolute; inset: 3px; border: 1px solid var(--line); border-radius: calc(var(--r-md) - 3px); pointer-events: none; }
.map-holder { position: relative; height: 280px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--sheet-2); }
.map-ph {
    position: absolute; inset: 0; z-index: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    color: var(--dim); font-family: var(--font-d); font-size: 12.5px; font-weight: 600;
    background:
        repeating-radial-gradient(circle at 8% -12%, transparent 0 9px, rgba(0, 29, 108, .04) 9px 10px),
        linear-gradient(180deg, #fdfeff, #f4f8fc);
}
.map-ph i { font-size: 26px; color: var(--line-2); }
.map-holder iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; }

/* ---------- Payments ---------- */
.pay-grid { display: grid; gap: 12px; }
.pay-card { padding: 17px 16px; border-radius: var(--r-md); background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--elev-1); }
.pay-label { font-family: var(--font-d); font-weight: 700; font-size: 14px; color: var(--ink); margin-block-end: 6px; }
.pay-val { color: var(--muted); font-size: 13.5px; word-break: break-all; }
.pay-img { border-radius: var(--r-sm); max-height: 220px; margin-inline: auto; }

/* ---------- Channels (socials, centered flex) ---------- */
.soc-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.soc-item {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    flex: 0 1 106px; min-width: 94px;
    padding: 17px 8px; border-radius: var(--r-md);
    background: var(--sheet); border: 1px solid var(--line);
    font-size: 12px; color: var(--muted); font-weight: 600;
    box-shadow: var(--elev-1);
    transition: transform .22s var(--settle), border-color .22s ease, color .22s ease;
}
.soc-item i { font-size: 21px; color: var(--ink); transition: color .22s ease; }
.soc-item:hover { transform: translateY(-3px); border-color: var(--teal); color: var(--ink); }
.soc-item:hover i { color: var(--teal-deep); }

/* ---------- Footer ---------- */
.footer { text-align: center; padding-block: 26px 8px; color: var(--dim); font-size: 12.5px; }
.footer a { color: var(--muted); font-weight: 600; }
.footer-rule { display: flex; align-items: center; gap: 12px; margin-block-end: 14px; }
.footer-rule::before, .footer-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.footer-rule img { width: 26px; height: 26px; object-fit: contain; opacity: .55; }

/* ---------- Dock (document footer bar + wax-seal save, signature use #3) ---------- */
.dock {
    position: fixed; inset-block-end: 0; inset-inline: 0; z-index: 70;
    display: flex; justify-content: center;
    padding-block-end: calc(10px + env(safe-area-inset-bottom));
    pointer-events: none;
    transition: transform .35s var(--settle);
}
.dock.dock-hide { transform: translateY(130%); }
.dock-inner {
    pointer-events: auto;
    display: flex; align-items: center; gap: 4px;
    padding: 8px 14px; border-radius: 18px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line-2);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 18px 44px -18px rgba(0, 29, 108, .5);
}
.dock-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 56px; padding: 7px 6px; border: 0; background: transparent;
    color: var(--muted); font-size: 10.5px; font-weight: 700; border-radius: var(--r-md);
    transition: color .2s ease, background .2s ease;
}
.dock-btn i { font-size: 16px; color: var(--ink); transition: color .2s ease; }
.dock-btn:hover, .dock-btn:focus-visible { color: var(--ink); background: var(--paper); }
.dock-seal {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 58px; height: 58px; border-radius: 50%; border: 0;
    background: var(--seal-grad); color: #fff;
    font-size: 9.5px; font-weight: 700;
    transform: translateY(-16px);
    box-shadow: 0 12px 26px -10px rgba(0, 128, 192, .65), 0 0 0 4px var(--sheet);
    transition: transform .22s var(--settle);
}
.dock-seal i { font-size: 16px; }
.dock-seal:hover { transform: translateY(-18px); }

/* ---------- PWA install sheet: the desk docket (S1) ----------
   Porcelain paper, double rule, gradient wax medallion (sanctioned use #4),
   navy ink action. Sits above the dock, below every modal (overlays win). */
.rsi-pwa {
    position: fixed; inset-inline: 14px;
    inset-block-end: calc(var(--dock-h) + 18px + env(safe-area-inset-bottom));
    z-index: 85; max-width: 430px; margin-inline: auto;
    background: linear-gradient(180deg, #ffffff, #f8fafd);
    border: 1px solid var(--line-2); border-radius: var(--r-md);
    box-shadow: 0 26px 56px -22px rgba(0, 29, 108, .55);
    padding: 15px 16px 14px;
    visibility: hidden; opacity: 0; transform: translateY(24px) scale(1.01);
    transition: transform .45s var(--settle), opacity .4s ease, visibility 0s linear .45s;
}
.rsi-pwa::after { content: ""; position: absolute; inset: 4px; border: 1px solid var(--line); border-radius: calc(var(--r-md) - 3px); pointer-events: none; }
.rsi-pwa.on { visibility: visible; opacity: 1; transform: none; transition: transform .45s var(--settle), opacity .4s ease, visibility 0s; }
.rsi-pwa-x {
    position: absolute; inset-block-start: 7px; inset-inline-end: 7px;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--line-2); background: var(--sheet-2); color: var(--ink);
    display: grid; place-items: center; font-size: 14px; z-index: 2; padding: 0;
}
.rsi-pwa-x:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.rsi-pwa-row { display: flex; align-items: center; gap: 12px; padding-inline-end: 40px; }
.rsi-pwa-seal { flex: none; width: 52px; height: 52px; border-radius: 50%; padding: 3px; background: var(--seal-grad); box-shadow: 0 8px 18px -8px rgba(0, 128, 192, .55); }
.rsi-pwa-seal img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #fff; background: var(--sheet); }
.rsi-pwa-txt { min-width: 0; }
.rsi-pwa-txt strong { display: block; font-family: var(--font-d); font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.rsi-pwa-txt span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-block-start: 3px; }
.rsi-pwa-btn {
    display: flex; width: 100%; align-items: center; justify-content: center; gap: 9px;
    margin-block-start: 12px; padding: 12px 16px; border: 0; border-radius: var(--r-sm);
    background: var(--ink); color: #fff;
    font-family: var(--font-d); font-weight: 700; font-size: 13.5px;
    transition: background .2s ease, transform .2s var(--settle);
}
.rsi-pwa-btn:hover { background: color-mix(in srgb, var(--ink) 86%, #000); }
.rsi-pwa-btn:active { transform: scale(.985); }

/* ---------- Modals ---------- */
.pm-overlay {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(14, 27, 61, .5); backdrop-filter: blur(6px);
    opacity: 0; transition: opacity .3s ease; padding: 16px;
}
.pm-overlay.show { opacity: 1; }
.pm-box {
    position: relative; /* keeps the close X inside the box */
    width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
    border-radius: var(--r-lg); padding: 26px 22px;
    background: var(--sheet); border: 1px solid var(--line-2);
    box-shadow: var(--elev-2);
    transform: translateY(34px); transition: transform .35s var(--settle);
}
.pm-overlay.show .pm-box { transform: none; }
.pm-title { font-family: var(--font-d); font-size: 20px; font-weight: 700; color: var(--ink); }
.pm-sub { color: var(--muted); font-size: 13.5px; margin-block-start: 4px; }
.pm-close {
    position: absolute; inset-block-start: 16px; inset-inline-end: 16px;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--line-2); background: var(--sheet-2); color: var(--ink);
    display: grid; place-items: center; font-size: 14px;
}
.pm-head { position: relative; margin-block-end: 8px; padding-inline-end: 44px; }
.pm-actions { display: flex; gap: 10px; margin-block-start: 20px; }
.pm-actions .btn-ghost, .pm-actions .btn-ink, .pm-actions .btn-primary { flex: 1; justify-content: center; }
.qr-wrap { display: grid; place-items: center; padding: 14px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md); width: fit-content; margin: 18px auto; box-shadow: var(--elev-1); }
.share-row { display: flex; justify-content: center; gap: 12px; margin-block: 16px; }
.share-row a { width: 46px; height: 46px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--sheet-2); border: 1px solid var(--line-2); font-size: 16px; color: var(--ink); transition: transform .2s var(--settle), border-color .2s ease; }
.share-row a:hover { transform: translateY(-3px); border-color: var(--teal); }

@media (min-width: 480px) {
    .pm-overlay { align-items: center; }
}

/* ---------- Desktop: 72px document rhythm ---------- */
@media (min-width: 760px) {
    .rsi-wrap { max-width: 960px; }
    .sec { padding-block: 36px; }
    .sec-registry { padding-block: 26px 0; }
    .cred { padding-block: 46px 12px; }
    .cred-id { gap: 24px; }
    .seal-ring { width: 122px; height: 122px; }
    .svc-list { grid-template-columns: repeat(2, 1fr); }
    .prg-grid { grid-template-columns: repeat(3, 1fr); }
    .reel-item { flex-basis: 56%; }
    .reel-item:only-child { flex-basis: 72%; max-width: 740px; }
    .tm-card { flex-basis: 44%; }
    .tm-card:only-child { flex-basis: 60%; }
    .car-item { flex-basis: 34%; }
    .soc-item { flex-basis: 132px; }
    .qa-row { gap: 12px; }
    .qa-item { flex: 0 1 176px; padding: 15px 8px; }
    .reg-row { padding-block: 13px; }
    .cover-plate img { aspect-ratio: 16 / 6; }
    .map-holder { height: 320px; }
}

/* ---------- Reduced motion: the document simply lies still ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .seal-ring, .attest-line { animation: none !important; }
    .rv { opacity: 1; transform: none; transition: none; }
    .hero-load { opacity: 1 !important; transform: none !important; animation: none !important; }
    .dock, .pm-overlay, .pm-box { transition: none; }
    .rsi-pwa { transition: none; transform: none; }
    .btn-primary, .btn-ink, .btn-ghost, .btn-mini, .qa-item, .svc-row, .prg-card,
    .link-card, .soc-item, .share-row a, .dock-seal, .dock-btn, .rsi-pwa-btn { transition: none; }
    .btn-primary:hover, .btn-ink:hover, .btn-ghost:hover, .qa-item:hover, .svc-row:hover,
    .prg-card:hover, .link-card:hover, .soc-item:hover, .share-row a:hover, .dock-seal:hover { transform: none; }
}

/* ============================================================
   GLOBAL CONTAINMENT BASELINE: no horizontal wiggle at any
   width or zoom; scrollers keep their swipe to themselves.
   ============================================================ */
html { overflow-x: clip; }
body { overflow-x: clip; overscroll-behavior-x: none; max-width: 100%; }
.car-track, .reel, .tm-track,
[class*="-track"], [class*="-rail"], [class*="-carousel"], [class*="-scroll"] {
    overscroll-behavior-x: contain;
    max-width: 100vw;
}
