/* ============================================================
   QLPCO design tokens
   Every colour, font and spacing value in the site comes from
   here. Nothing else in the codebase writes a raw hex value.
   Change a value here and it changes everywhere.
   ============================================================ */

:root {
  /* --- brand -------------------------------------------------
     These values are taken from the live qlpco.net Astra palette so
     the WordPress site and this app read as one brand. The names are
     role-based, not hue-based, on purpose: the last rebrand meant
     renaming tokens as well as changing them. Now it is a value edit. */
  --c-brand:        #0028FF;   /* primary — qlpco.net brand blue */
  --c-brand-deep:   #002C9C;   /* hover / pressed */
  --c-brand-lift:   #4E68FE;   /* lighter accent on white */
  --c-brand-tint:   #E6EAFF;   /* light fills, badges */
  --c-brand-bright: #9CB6FF;   /* accent on dark panels — lifted so it still
                                  separates from the blue-cast --c-ink-panel */

  /* --- neutrals --------------------------------------------- */
  --c-ink:          #1F2933;   /* headings only */
  --c-ink-panel:    #1B2D8C;   /* footer and dark panels. Blue-cast, not slate:
                                  a neutral navy next to the #0028FF logo read
                                  like a different palette. Dark enough that a
                                  full-width block is not as loud as the raw
                                  accent. White text on it is past 9:1. */
  --c-ink-soft:     #48515B;   /* body copy, secondary text */
  --c-ink-mute:     #B4BFCA;   /* secondary text on dark surfaces */
  --c-paper:        #F7FBFC;   /* page background */
  --c-paper-alt:    #EDF3F5;   /* alternating section bands */
  --c-card:         #FFFFFF;   /* cards, panels */
  --c-line:         #DCE3E5;   /* borders, dividers */
  --c-line-soft:    #EDF1F3;   /* dividers inside lists */

  /* --- status ------------------------------------------------
     Not brand colours. Green here means "verified", not "QLPCO".
     While the brand was green the two were the same hex and the map
     was ambiguous; a blue brand separates them. Leave these alone. */
  --c-verified:     #00805A;   /* AED checked in last 90 days */
  --c-unconfirmed:  #C98A00;   /* reported, not yet verified */
  --c-issue:        #D2362C;   /* fault reported */
  --c-unknown:      #8E9AA3;   /* status missing or unrecognised */

  /* --- type ------------------------------------------------- */
  /* IBM Plex Sans Arabic carries both scripts and is the workhorse.
     Sora is Latin-only, used for English display headings.
     In RTL the display role falls back to Plex Arabic. */
  --font-body:    'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-display: 'Sora', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --fs-xs:   0.75rem;    /* 12px — captions, legends */
  --fs-sm:   0.8125rem;  /* 13px — labels, meta */
  --fs-base: 0.9375rem;  /* 15px — body */
  --fs-lg:   1.0625rem;  /* 17px — lead paragraphs */
  --fs-h3:   1.1875rem;  /* 19px */
  --fs-h2:   clamp(1.625rem, 3vw, 2.25rem);
  --fs-h1:   clamp(2.125rem, 4.6vw, 3.375rem);

  --lh-tight: 1.15;
  --lh-body:  1.55;

  /* --- spacing (4px scale) ---------------------------------- */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.25rem;  --sp-6: 1.5rem;   --sp-8: 2rem;     --sp-10: 2.5rem;
  --sp-12: 3rem;    --sp-16: 4rem;

  /* --- shape ------------------------------------------------ */
  --r-sm: 8px;   --r-md: 10px;   --r-lg: 16px;   --r-xl: 20px;   --r-pill: 999px;
  --shadow-card: 0 4px 15px rgba(31, 41, 51, 0.07);
  --shadow-lift: 0 18px 40px -18px rgba(0, 40, 155, 0.45);

  --wrap: 1160px;   /* max content width */
}

/* RTL: the display face has no Arabic glyphs, so swap it out */
html[dir="rtl"] {
  --font-display: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

/* ============================================================
   Base element styles built from the tokens above
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, figure, ul { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); line-height: var(--lh-tight); font-weight: 700; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-5); }
.stack > * + * { margin-top: var(--sp-4); }
.muted { color: var(--c-ink-soft); }
.lead  { font-size: var(--fs-lg); color: var(--c-ink-soft); }

/* buttons -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-base);
  border: none; border-radius: var(--r-md); padding: 0.8125rem 1.375rem;
  cursor: pointer; transition: background .15s, color .15s;
}
.btn--primary { background: var(--c-brand); color: #fff; }
.btn--primary:hover { background: var(--c-brand-deep); }
.btn--primary:disabled { background: #A6B0BC; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--c-brand-deep); border: 1.5px solid var(--c-brand); }
.btn--ghost:hover { background: var(--c-brand-tint); }
.btn--danger { background: var(--c-issue); color: #fff; }

/* cards ---------------------------------------------------- */
.card {
  background: var(--c-card); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); padding: var(--sp-6);
}

/* forms ---------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--c-ink-soft); margin-bottom: var(--sp-2); }
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--font-body); font-size: var(--fs-base);
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  padding: 0.6875rem 0.8125rem; background: #FCFDFE; color: var(--c-ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--c-brand); border-color: var(--c-brand);
}
.field .errorlist { list-style: none; color: var(--c-issue); font-size: var(--fs-xs); margin-top: var(--sp-1); }
.field .helptext { display: block; font-size: var(--fs-xs); color: var(--c-ink-soft); margin-top: var(--sp-1); }

/* status dots (AED map + list) ------------------------------ */
.dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.dot--verified    { background: var(--c-verified); }
.dot--unconfirmed { background: var(--c-unconfirmed); }
.dot--issue       { background: var(--c-issue); }

/* motion ----------------------------------------------------
   Shared scroll-reveal: mark any element data-reveal, base.html's
   IntersectionObserver adds .is-visible the first time it enters
   view. data-reveal-delay staggers a group. Falls back to visible
   with no JS or under prefers-reduced-motion (see below). */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: .08s; }
[data-reveal-delay="2"] { transition-delay: .16s; }
[data-reveal-delay="3"] { transition-delay: .24s; }
[data-reveal-delay="4"] { transition-delay: .32s; }
[data-reveal-delay="5"] { transition-delay: .4s; }

.card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); border-color: var(--c-brand); }

.btn { transition: background .15s, color .15s, transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn--primary:hover { box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(0); }

/* Section depth ---------------------------------------------------------
   `.depth` layers a soft brand glow over the paper gradient. It is pure CSS,
   so it costs nothing to load and never fights the text on top of it — the
   supplied photography is social-media graphics with Arabic text burnt in,
   which would clash with our own headings and cannot be translated.

   To drop in a real photograph later, set --hero-image on the section to a
   CSS image value pointing at a static file — see templates/pages/home.html
   for a worked example. The tint and readability scrim are handled below.

   Never put an example image reference in a comment in this file, not even a
   fake one. collectstatic scans the whole stylesheet for image references
   without stripping comments first, so a made-up path in prose fails the
   production build with MissingFileError. This warning is deliberately worded
   to avoid containing the pattern it warns about. */
/* The layer order matters and is easy to get wrong: a pseudo-element at
   z-index:-1 inside an `isolation:isolate` parent paints behind that parent's
   own background, so the gradient hid the photograph completely. Instead the
   element carries the gradient, ::before paints the photo over it at
   --hero-opacity, and direct children are lifted above both. */
.depth {
  position: relative;
  background:
    radial-gradient(60% 70% at 85% 0%, color-mix(in srgb, var(--c-brand) 12%, transparent) 0%, transparent 60%),
    radial-gradient(45% 60% at 0% 100%, color-mix(in srgb, var(--c-brand-lift) 10%, transparent) 0%, transparent 55%),
    linear-gradient(180deg, var(--c-paper) 0%, var(--c-paper-alt) 100%);
}
.depth::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--hero-image, none);
  background-size: cover;
  background-position: center;
  opacity: var(--hero-opacity, 0.14);
}
.depth > * { position: relative; }

/* Dark panels get the mark as a large watermark rather than a photograph. */
.depth--dark {
  position: relative;
  overflow: hidden;
  background: var(--c-ink-panel);
}
.depth--dark::after {
  content: "";
  position: absolute;
  inset-inline-end: -4%;
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  height: 320px;
  pointer-events: none;
  background: var(--mark-url) no-repeat center / contain;
  opacity: 0.06;
}
.depth--dark > * { position: relative; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Double thump, like a real pulse — this is a cardiac company. */
@keyframes beat {
  0%, 34%, 100% { transform: scale(1); }
  8%  { transform: scale(1.14); }
  17% { transform: scale(1); }
  25% { transform: scale(1.09); }
}

/* Draws an SVG stroke on. Pair with a stroke-dasharray on the path. */
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Grows a bar to whatever width it was given. */
@keyframes grow { from { width: 0; } }

/* accessibility -------------------------------------------- */
:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; inset-inline-start: var(--sp-4); top: -3rem;
  background: var(--c-brand); color: #fff; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm); z-index: 999; transition: top .15s;
}
.skip-link:focus { top: var(--sp-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
