/* Mawiza — mawiza.ca
 *
 * The site has to feel like the app: deep navy, one gold accent, cloud-white
 * text, regal and quiet. Colours are lifted from src/theme/tokens.ts so the
 * two never drift into different products.
 *
 * Fonts are SELF-HOSTED and subsetted (20KB for both). A privacy-first app
 * cannot send its visitors to fonts.gstatic.com to read its privacy policy —
 * that is the exact leak the page is promising doesn't happen.
 *
 * Every colour pair below was measured, not eyeballed. The one that needed a
 * change is gold on white: the app's goldDeep (#9A7B1E) is 3.81:1 and fails AA
 * for body text, so light mode uses #7C6415 (5.39:1). The app never faces this
 * because the app has no light theme.
 */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('cormorant-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Brand mark only — the one Arabic string on the site. */
@font-face {
  font-family: 'Amiri Brand';
  src: url('amiri-brand.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a1a33;
  --surface: #10233f;
  --raised: #17304f;
  --sunken: #061020;
  --hairline: #26456f;
  --hairline-faint: #1b3252;

  --ink: #eaf1fa;
  --muted: #a9c0de;
  --faint: #7c93b4;

  --accent: #c9a227;
  --accent-bright: #e7c766;
  --on-accent: #0a1a33;

  --sheen: #eaf1fa14;
  --shadow: 0 1px 2px #02081459, 0 8px 28px #0208143d;

  --measure: 66ch;
  --gutter: 20px;
  --radius: 14px;
  --radius-lg: 20px;

  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;

  color-scheme: dark light;
}

/* The app ships dark only; the site follows the reader's system. Guarded so an
   explicit data-theme="light" always wins over the media query. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f7f9fc;
    --surface: #ffffff;
    --raised: #ffffff;
    --sunken: #eef2f8;
    --hairline: #d8e1ee;
    --hairline-faint: #e6ecf5;

    --ink: #0a1a33;
    --muted: #4a6285;
    --faint: #5f7490;

    --accent: #7c6415;
    --accent-bright: #6b5512;
    --on-accent: #ffffff;

    --sheen: #0a1a330a;
    --shadow: 0 1px 2px #0a1a330f, 0 8px 28px #0a1a3314;
  }
}

:root[data-theme='light'] {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --raised: #ffffff;
  --sunken: #eef2f8;
  --hairline: #d8e1ee;
  --hairline-faint: #e6ecf5;

  --ink: #0a1a33;
  --muted: #4a6285;
  --faint: #5f7490;

  --accent: #7c6415;
  --accent-bright: #6b5512;
  --on-accent: #ffffff;

  --sheen: #0a1a330a;
  --shadow: 0 1px 2px #0a1a330f, 0 8px 28px #0a1a3314;
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── type ─────────────────────────────────────────────────────────────── */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4rem);
  letter-spacing: 0.01em;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin-bottom: 0.5em;
}

h3 {
  font-size: 1.2rem;
  font-family: var(--font-body);
  font-weight: 650;
  letter-spacing: 0.01em;
  margin-bottom: 0.45em;
}

p {
  margin: 0 0 1.1em;
  max-width: var(--measure);
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent-bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

strong {
  font-weight: 650;
  color: var(--ink);
}

small {
  font-size: 0.875rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--sunken);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

/* The brand mark. NEVER give this letter-spacing — Arabic is a connected
   script and tracking breaks the joins. Same rule the app enforces. */
.arabic {
  font-family: 'Amiri Brand', serif;
  letter-spacing: normal;
  line-height: 1.9;
  direction: rtl;
  unicode-bidi: isolate;
}

/* ── layout ───────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 18px;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 650;
  z-index: 10;
}

.skip:focus {
  left: 0;
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header {
  border-bottom: 1px solid var(--hairline-faint);
  background: var(--bg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand:hover {
  color: var(--accent-bright);
}

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  /* Primary navigation, so sized for a thumb rather than to scrape past the
     24px floor in WCAG 2.2 SC 2.5.8. The negative inline margin keeps the
     visual spacing while the padding grows the hit area. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  margin: 0 -6px;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 4px;
}

main {
  display: block;
  padding: clamp(40px, 8vw, 72px) 0 24px;
}

section {
  margin-bottom: clamp(44px, 8vw, 72px);
}

section:last-of-type {
  margin-bottom: 0;
}

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding-bottom: clamp(12px, 3vw, 24px);
}

.hero .arabic {
  display: block;
  font-size: clamp(2rem, 6vw, 2.75rem);
  color: var(--accent-bright);
  margin: 0.15em 0 0.25em;
}

.hero p.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.2vw, 1.5rem);
  color: var(--muted);
  margin: 0 auto 1.4em;
  max-width: 34ch;
  text-wrap: balance;
}

.hero .meaning {
  color: var(--faint);
  font-size: 0.95rem;
  max-width: 46ch;
  margin: 0 auto;
}

/* ── cards ────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-top-color: var(--sheen);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 30px);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 18px;
}

.panel h2:first-child,
.panel h3:first-child {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 8px;
}

.grid .panel {
  margin-top: 0;
  padding: 24px;
}

.grid h3 {
  margin-bottom: 8px;
  color: var(--accent-bright);
}

.grid p {
  color: var(--muted);
  font-size: 0.97rem;
  margin: 0;
  max-width: none;
}

/* The founder's story. Set in the display face because it is the one place on
   the site speaking in a person's voice rather than the product's. */
.story {
  border-left: 2px solid var(--accent);
  padding-left: clamp(18px, 4vw, 26px);
  margin: 0;
}

.story p {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink);
}

.story footer {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--faint);
  margin-top: 4px;
}

/* ── buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  font-size: 1rem;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: var(--radius);
  min-height: 44px;
  line-height: 1.3;
}

.btn:hover {
  background: var(--accent-bright);
  color: var(--on-accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.note {
  color: var(--faint);
  font-size: 0.93rem;
  max-width: 34ch;
}

/* ── lists ────────────────────────────────────────────────────────────── */

ul,
ol {
  max-width: var(--measure);
  padding-left: 1.3em;
  margin: 0 0 1.1em;
}

li {
  margin: 0.45em 0;
}

li::marker {
  color: var(--accent);
}

.plain {
  list-style: none;
  padding-left: 0;
}

.plain li {
  padding-left: 1.6em;
  position: relative;
}

.plain li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── tables ───────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.1em;
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  color: var(--faint);
  font-size: 0.9rem;
  padding-bottom: 8px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--hairline-faint);
}

th {
  color: var(--accent);
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--hairline);
}

td {
  color: var(--muted);
}

td:first-child {
  color: var(--ink);
  font-weight: 500;
  /* Stops the first column from being squeezed until "api.open-meteo.com"
     shatters across three lines. The container scrolls if it has to. */
  min-width: 9.5em;
}

/* A hostname is one token; breaking it mid-word makes it unreadable. */
td small {
  display: inline-block;
  color: var(--faint);
  white-space: nowrap;
}

/* ── meta / footer ────────────────────────────────────────────────────── */

.updated {
  color: var(--faint);
  font-size: 0.9rem;
  border-top: 1px solid var(--hairline-faint);
  padding-top: 16px;
  margin-top: 8px;
}

.site-footer {
  border-top: 1px solid var(--hairline-faint);
  margin-top: clamp(56px, 10vw, 88px);
  padding: 32px 0 44px;
  color: var(--faint);
  font-size: 0.92rem;
  text-align: center;
}

.site-footer p {
  max-width: none;
  margin: 0 0 6px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer .arabic {
  display: inline-block;
  color: var(--accent);
  font-size: 1.6rem;
  margin-bottom: 10px;
}

/* Standfirst under an h1 on the interior pages. */
.lede {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  line-height: 1.4;
  color: var(--muted);
  margin-top: 0.5em;
  max-width: 34ch;
}

.btn-row-center {
  justify-content: center;
}

/* A scrollable table has to be reachable without a pointer, so it takes focus
   (tabindex="0" in the markup). Without a visible ring the focus lands
   somewhere invisible, which is worse than not being focusable at all. */
.table-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
