/*
 * Support portal stylesheet. Dark by default; [data-theme="light"] switches.
 * --brand and --accent come from /css/brand.css (generated from portal.config.json).
 * Spacing scale: 4 8 12 16 24 32 48 64 96. No inline styles anywhere (strict CSP).
 */
:root {
  --brand: #0e7c66;
  --accent: #f4b942;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Verdana, Geneva, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  --radius-lg: 20px;
  --max: 1160px;
  --nav-h: 64px;
  color-scheme: dark;
  --bg: #0b1214;
  --bg-2: #0f181b;
  --surface: #141f23;
  --surface-2: #1a272c;
  --line: #26363c;
  --text: #e8eff1;
  --muted: #a3b4b9;
  --link: color-mix(in srgb, var(--brand) 45%, #ffffff);
  --brand-ink: color-mix(in srgb, var(--brand) 40%, #ffffff);
  --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-2: 0 8px 24px rgb(0 0 0 / 0.35);
  --shadow-4: 0 24px 64px rgb(0 0 0 / 0.5);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8f8;
  --bg-2: #eef3f3;
  --surface: #ffffff;
  --surface-2: #f2f6f6;
  --line: #d6e0e1;
  --text: #11201f;
  --muted: #4b5d60;
  --link: color-mix(in srgb, var(--brand) 80%, #000000);
  --brand-ink: color-mix(in srgb, var(--brand) 82%, #000000);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --ok: #15803d;
  --warn: #a16207;
  --err: #b91c1c;
  --shadow-1: 0 1px 2px rgb(16 32 31 / 0.08);
  --shadow-2: 0 8px 24px rgb(16 32 31 / 0.1);
  --shadow-4: 0 24px 64px rgb(16 32 31 / 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-family: var(--font-display); font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -0.01em; }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 20px; }
p { margin: 0 0 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 16px; border-radius: 8px; }
.skip:focus { top: 8px; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* ---- navbar --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 16px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 700; min-width: 0; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--brand-soft); }
.nav-tools { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 17px; }
  .nav-tools { margin-left: auto; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text); cursor: pointer;
  }
  .menu-btn svg { width: 22px; height: 22px; }
}

/* iPhone-style theme switch: pill track, sliding knob. */
.theme-switch {
  position: relative; width: 52px; height: 32px; flex: none;
  border: 0; border-radius: 999px; padding: 0; cursor: pointer;
  background: #3a4a50; transition: background 0.2s ease;
}
.theme-switch[aria-checked="true"] { background: var(--brand); }
.theme-switch .knob {
  position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 0.3);
  display: grid; place-items: center; transition: transform 0.2s ease;
}
.theme-switch[aria-checked="true"] .knob { transform: translateX(20px); }
.theme-switch svg { width: 16px; height: 16px; color: #475569; }
.theme-switch .sun { display: none; }
.theme-switch[aria-checked="true"] .sun { display: block; color: #d97706; }
.theme-switch[aria-checked="true"] .moon { display: none; }

/* ---- buttons and forms ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, transparent); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-weight: 600; }
.hint { color: var(--muted); font-size: 14px; }
input[type="text"], input[type="search"], input[type="email"], input[type="tel"], input[type="password"],
input[type="url"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2); color: var(--text); font: inherit;
}
textarea { min-height: 128px; resize: vertical; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--err); }
.field-error { color: var(--err); font-size: 14px; font-weight: 600; }
.check { display: flex; gap: 12px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); flex: none; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 16px; }
.alert-error { border-color: color-mix(in srgb, var(--err) 55%, transparent); background: color-mix(in srgb, var(--err) 10%, var(--surface)); }
.alert-ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }

/* ---- hero ----------------------------------------------------------------- */
.hero { position: relative; isolation: isolate; overflow: hidden; color: #fff; padding: 72px 0 64px; }
.hero-bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 30% 70%; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(100deg, rgb(4 14 18 / 0.92) 0%, rgb(4 14 18 / 0.82) 45%, rgb(4 14 18 / 0.55) 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--brand) 35%, transparent), transparent 60%);
}
.hero .eyebrow { color: var(--accent); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 13px; margin-bottom: 12px; }
.hero h1 { color: #fff; max-width: 16ch; }
.hero .lead { color: #dbe7ea; font-size: 18px; max-width: 54ch; }
.hero-search { display: flex; gap: 8px; max-width: 620px; margin: 24px 0 16px; }
.hero-search input { background: rgb(255 255 255 / 0.96); color: #0b1214; border-color: transparent; min-height: 52px; font-size: 17px; }
.hero-search input::placeholder { color: #5b6b70; }
.hero-search .btn { min-height: 52px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgb(255 255 255 / 0.12); color: #fff; font-size: 14px; font-weight: 600; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.status-pill.open::before { background: #4ade80; box-shadow: 0 0 0 4px rgb(74 222 128 / 0.25); }
.status-pill.closed::before { background: #fbbf24; }
@media (max-width: 520px) {
  .hero { padding: 48px 0 40px; }
  .hero-search { flex-direction: column; }
}

/* ---- sections, cards ------------------------------------------------------ */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.section-head p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-1);
}
a.card { display: block; color: var(--text); text-decoration: none; transition: border-color 0.15s ease, transform 0.15s ease; }
a.card:hover { border-color: var(--brand); transform: translateY(-2px); }
.card h3 { margin-bottom: 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }
.icon-tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 12px; }
.icon-tile svg { width: 22px; height: 22px; }
/* a.channel-card: link cards (email, Telegram) must beat the a.card block rule */
.channel-card, a.channel-card { display: flex; gap: 12px; align-items: center; padding: 16px; }
.channel-card .icon-tile { margin: 0; flex: none; }
.channel-card .name { font-weight: 700; }
.channel-card .how { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.page-head { padding: 48px 0 24px; }
.page-head p { color: var(--muted); max-width: 60ch; font-size: 18px; }
.narrow { max-width: 720px; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 32px; font-size: 24px; }
.prose ul { padding-left: 24px; }
.prose li { margin-bottom: 6px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.loading { color: var(--muted); }

/* ---- help centre accordion ------------------------------------------------ */
.kb-search { display: flex; gap: 8px; margin-bottom: 24px; }
.kb-list { display: grid; gap: 12px; }
.kb-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kb-q {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 20px; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600;
  font-size: 17px; text-align: left; cursor: pointer; border-radius: var(--radius);
}
.kb-q svg { width: 20px; height: 20px; flex: none; transition: transform 0.2s ease; color: var(--muted); }
.kb-q[aria-expanded="true"] svg { transform: rotate(180deg); }
.kb-a { padding: 0 20px 16px; }
.kb-a p { white-space: pre-line; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.kb-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

/* ---- status result -------------------------------------------------------- */
.status-card { border-left: 4px solid var(--brand); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.badge.open { color: var(--warn); }
.badge.pending { color: var(--link); }
.badge.resolved, .badge.closed { color: var(--ok); }
.badge.waiting { color: var(--warn); }
.badge.active { color: var(--ok); }
.ref { font-family: var(--mono); font-weight: 700; letter-spacing: 0.04em; }

/* ---- footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 32px 0; margin-top: 48px; color: var(--muted); font-size: 14px; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-legal { display: grid; gap: 4px; }
.footer-legal a, .footer-legal .footer-owner { color: var(--text); }

/* ---- 404 ------------------------------------------------------------------ */
.notfound { text-align: center; padding: 96px 0; }
.notfound .code { font-family: var(--font-display); font-size: 72px; color: var(--brand-ink); line-height: 1; margin-bottom: 16px; }

/* ---- kiosk ---------------------------------------------------------------- */
.kiosk-body { font-size: 19px; }
.kiosk-body .site-header .nav-links, .kiosk-body .menu-btn { display: none; }
.kiosk-wrap { display: grid; gap: 24px; padding: 24px 0 48px; }
@media (min-width: 900px) { .kiosk-wrap { grid-template-columns: 1fr 1.3fr; align-items: start; } }
.kiosk-intro h1 { font-size: clamp(32px, 4vw, 44px); }
.kiosk-chat { height: min(72vh, 760px); }
.kiosk-idle { margin-top: 16px; }

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

/* ---- shared bits used by several pages ---------------------------------------------- */
.kb-item h3 { margin: 0; font-size: inherit; }
button.card { font: inherit; color: var(--text); text-align: left; cursor: pointer; width: 100%; }
button.card { transition: border-color 0.15s ease, transform 0.15s ease; }
button.card:hover { border-color: var(--brand); transform: translateY(-2px); }
.push-card { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-top: 24px; }
.push-card > div { flex: 1 1 280px; }
.push-card h3 { margin: 0 0 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 16px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.kiosk-mount { height: 100%; }

/* No-JavaScript form results (public/result.html) */
.result-card p:last-child { margin-bottom: 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.result-list { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 4px; }
.result-card .ref { white-space: nowrap; }

/* ---- staff-edited content: specials, stores, rewards, B-BBEE, investors ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: end; margin-bottom: 16px; }
.filters .field { flex: 1 1 200px; min-width: 0; }
.filters .field.grow { flex: 3 1 260px; }
.filters-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters + .muted { margin: 0 0 16px; }
.offer-grid, .store-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); margin-bottom: 32px; }
.store-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.offer { display: flex; flex-direction: column; gap: 12px; }
.offer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.offer-head h3 { margin: 0; overflow-wrap: anywhere; }
.card .offer-price { flex: none; margin: 0; padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: 18px; color: var(--text); background: color-mix(in srgb, var(--accent) 28%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); white-space: nowrap; }
.offer-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.store h3 { overflow-wrap: anywhere; }
.store .facts { margin-bottom: 12px; }
.store .facts dd { color: var(--text); }
.bbbee-level { font-family: var(--font-display); font-size: clamp(36px, 6vw, 52px); line-height: 1.1; font-weight: 700; color: var(--brand-ink); margin: 0 0 4px; }
.card p.bbbee-level { color: var(--brand-ink); }
.ir-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); margin-bottom: 32px; }
.ir-grid h2, .channel-hint h2 { font-size: 20px; margin: 0 0 12px; }
.ir-grid .result-list li { color: var(--text); overflow-wrap: anywhere; }
.result-list li.past { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.card + .card, .narrow > .card { margin-bottom: 16px; }
/* cards in a grid line up by the grid gap, not the stacked-card margin */
.grid > .card { margin-bottom: 0; }
.channel-hint { margin-top: 8px; margin-bottom: 32px; }
.channel-hint p { margin-bottom: 12px; }
.hint-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
/* Hide the "On your phone" box when no messaging channel is switched on. */
.channel-hint:not(:has(li)) { display: none; }

/* A page that ends on a shaded section runs straight into the footer: no dark strip between them. */
main:has(> .section-alt:last-child) + .site-footer { margin-top: 0; }
