/* ==========================================================================
   Haisham design system: tokens
   Extracted from haisham.design. Dark is the default theme; light is opt-in
   with <html data-theme="light">. Import this first, then components.css.
   ========================================================================== */

/* Fonts: add to <head> (or self-host):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
*/

:root {
  /* ---- Colour: dark theme (default) ---- */
  --bg: #07070b;                       /* page: near-black with a blue cast, never pure #000 */
  --fg: #f2f2f5;                       /* primary text */
  --muted: #b9b9c4;                    /* body copy, secondary text */
  --dim: #9a9aa8;                      /* labels, captions, metadata */
  --accent: #8d86ff;                   /* soft violet: links, highlights, focus, small marks (readable on dark) */
  --card: #15151c;                     /* raised surface */
  --line: rgba(255, 255, 255, 0.12);   /* hairlines, dividers */
  --line-strong: rgba(255, 255, 255, 0.3); /* outlines on buttons, chips, glass */
  --chip: rgba(255, 255, 255, 0.06);   /* resting fill of a pill or chip */
  --chip-hover: rgba(255, 255, 255, 0.1);
  --chip-strong: rgba(255, 255, 255, 0.2);
  --glow: rgba(48, 28, 233, 0.22);     /* soft brand halo behind hero objects */

  /* ---- Colour: brand (same in both themes) ---- */
  --brand: #301ce9;                    /* electric blue: FILLS only (buttons, selection). White text on it is 8.5:1 */
  --brand-hover: #4330ff;
  --on-brand: #ffffff;

  /* ---- Colour: status ---- */
  --ok: #22c55e;                       /* "available" dot */
  --warn: #f59e0b;                     /* "booked" dot */

  /* ---- Colour: a case study's own accent (set per page as --pa) ---- */
  --pa: var(--accent);

  /* ---- Type ---- */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-rtl: 'Noto Sans Thaana', system-ui, sans-serif; /* Dhivehi */

  /* Scale: size / line-height / tracking come as a set (see DESIGN.md) */
  --fs-hero: clamp(52px, 6.6vw, 128px);    /* h1 on a landing page */
  --fs-display: clamp(64px, 13vw, 220px);  /* title over a full-bleed image */
  --fs-section: clamp(48px, 8vw, 128px);   /* section headings ("Selected Works") */
  --fs-chapter: clamp(34px, 4.4vw, 64px);  /* heading inside a section/chapter */
  --fs-lead: clamp(28px, 3.6vw, 54px);     /* one big statement paragraph */
  --fs-card-title: 28px;
  --fs-body: 17px;
  --fs-small: 15px;
  --fs-caption: 14px;
  --fs-label: 12px;                         /* uppercase, tracked */
  --fs-eyebrow: 13px;                       /* uppercase, tracked, display font */

  /* ---- Layout ---- */
  --max: 1760px;                            /* content never gets wider than this */
  --pad: max(24px, calc((100vw - var(--max)) / 2)); /* page gutter; also the centring margin on huge screens */
  --section-y: 96px;                        /* vertical section padding */
  --bp-phone: 760px;                        /* below this: phone layout */

  /* ---- Space (4px base) ---- */
  --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: 96px;

  /* ---- Radius ---- */
  --r-xs: 7px;      /* small buttons inside tools */
  --r-sm: 10px;     /* tool chips */
  --r-md: 16px;     /* browser frame, inner image of a card */
  --r-lg: 24px;     /* media frames */
  --r-xl: 28px;     /* big cards, stage panels */
  --r-pill: 999px;  /* every button, chip and tag */

  /* ---- Elevation ---- */
  --shadow-glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --shadow-frame: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
  --shadow-window: 0 60px 120px -30px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* ---- Motion ---- */
  --ease-page: cubic-bezier(0.76, 0, 0.24, 1);   /* big transitions between pages or states */
  --ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);   /* entrances, reveals */
  --ease-pop: cubic-bezier(0.16, 1, 0.3, 1);     /* small hover movements */
  --t-fast: 150ms;                                /* colour and background changes */
  --t-base: 200ms;                                /* hover lift, outline */
  --t-slow: 900ms;                                /* image zoom on hover */

  color-scheme: dark;
}

/* ---- Light theme ---- */
html[data-theme='light'] {
  --bg: #f5f4f0;                       /* warm off-white, never pure #fff */
  --fg: #111114;
  --muted: #4a4a55;
  --dim: #6b6b78;                      /* 4.8:1 on the page, 4.2:1 on cards: use for large text and labels, not small body copy on cards */
  --accent: #301ce9;                   /* in light, the accent IS the brand blue */
  --card: #e7e6e1;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.25);
  --chip: rgba(0, 0, 0, 0.05);
  --chip-hover: #f3f4f6;
  --chip-strong: #e5e7eb;
  --glow: rgba(48, 28, 233, 0.12);
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  overflow-x: clip;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

/* Slim scrollbar: grey thumb that turns brand blue on hover */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #525252;
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand); border: 2px solid transparent; background-clip: content-box; }

/* Keyboard focus: always visible, in the accent colour */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Honour the visitor's motion preference everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Visually hidden, still read by screen readers */
.hd-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
