/* ============================================================================
   HomeOS Dubai — design tokens and primitives
   ----------------------------------------------------------------------------
   One source of truth for colour, type, space, radius, elevation and motion.
   Every page links this file first; page-level sheets only compose.

   LOCKS (do not violate without a documented reason):
     - one accent colour (--accent, teal) for every interactive affordance;
       brand navy is the surface/identity colour; gold is MATERIAL ONLY
       (the hexagon mark and one rule) and never a button or link colour.
     - one radius system: pills for anything interactive, 22px for cards,
       14px for inner tiles, 12px for inputs-in-cards (concentric).
     - one theme per page: public pages are light, the ops console is dark.
     - no em-dashes anywhere in visible copy. Plain hyphens only.
   ============================================================================ */

/* ---------- fonts (self-hosted, no external requests, no CDN) ---------- */
@font-face {
  font-family: "Geist Variable";
  src: url("fonts/geist-latin.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono Variable";
  src: url("fonts/geist-mono-latin.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- colour: cool luxury. Deliberately NOT cream + brass. ---- */
  --ink-900: #061319;
  --ink-800: #0a2029;
  --ink-700: #10313d;
  --ink-600: #17414f;
  --ink-500: #2c6478;
  /* Muted tones are calibrated so EVERY one of them clears WCAG AA (4.5:1)
     against the darkest light surface they can land on (--paper-2). The first
     pass used #5b8394 / #8ba4b0, which measured 3.41 and 2.17 and shipped
     unreadable secondary text. Do not lighten these without re-measuring. */
  --ink-400: #44626f;   /* muted body on light: 5.42:1 on paper-2 */
  --ink-300: #4d6d7c;   /* dim labels: 4.55:1 on paper-2, 5.06:1 on paper-2 white card */
  --ink-200: #a9bfc9;

  --brand: #0b3d5c;      /* identity navy, from the mark */
  --brand-700: #072c44;
  --brand-tint: rgba(11, 61, 92, 0.06);

  --accent: #0f766e;     /* the ONLY interactive accent (teal-700) */
  --accent-700: #0b5f59;
  --accent-tint: rgba(15, 118, 110, 0.09);

  --gold: #a87f2e;       /* material only: mark, one rule, rating stars. Never text or buttons */

  --ok: #20693f;
  --warn: #8a5a08;
  --err: #a3312a;
  --ok-tint: rgba(32, 105, 63, 0.10);
  --warn-tint: rgba(138, 90, 8, 0.12);
  --err-tint: rgba(163, 49, 42, 0.10);

  --paper: #eff3f6;      /* canvas: cool light grey-blue */
  --paper-2: #e5ebef;    /* tint band */
  --paper-3: #dbe3e8;
  --card: #ffffff;
  --line: rgba(6, 25, 35, 0.10);
  --line-2: rgba(6, 25, 35, 0.16);

  /* ---- dark surface set (ops console) ---- */
  --d-canvas: #071720;
  --d-surface: #0b2129;
  --d-surface-2: #103039;
  --d-line: rgba(255, 255, 255, 0.10);
  --d-line-2: rgba(255, 255, 255, 0.18);
  --d-text: #e8f1f4;
  --d-muted: #9db8c2;
  --d-dim: #6f8b96;
  --d-accent: #4fd1c0;
  --d-gold: #d8b46a;

  /* ---- type ---- */
  --font-sans: "Geist Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-display: clamp(2.45rem, 5vw, 4.35rem);
  --t-h1: clamp(2rem, 3.4vw, 3rem);
  --t-h2: clamp(1.55rem, 2.3vw, 2.1rem);
  --t-h3: clamp(1.075rem, 1.25vw, 1.22rem);
  --t-body: 1rem;
  --t-small: 0.9375rem;
  --t-micro: 0.8125rem;
  --lh-display: 0.98;
  --lh-tight: 1.14;
  --lh-body: 1.62;
  --tr-display: -0.035em;
  --tr-tight: -0.02em;
  --tr-label: 0.08em;

  /* ---- space: 4px base, generous macro rhythm ---- */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem; --s7: 2.75rem; --s8: 3.5rem;
  --s9: 4.5rem; --s10: 6rem; --s11: 7.5rem; --s12: 9rem;
  --section-y: clamp(4.5rem, 8.5vw, 8rem);

  /* ---- layout ---- */
  --wrap: 1240px;
  --wrap-narrow: 940px;
  --wrap-wide: 1440px;

  /* ---- radius lock ---- */
  --r-pill: 999px;
  --r-card: 22px;
  --r-tile: 14px;
  --r-input: 12px;

  /* ---- elevation: tinted to the canvas hue, never pure black ---- */
  --sh-1: 0 1px 2px rgba(6, 25, 35, 0.05), 0 8px 22px -10px rgba(6, 25, 35, 0.12);
  --sh-2: 0 2px 4px rgba(6, 25, 35, 0.04), 0 22px 48px -18px rgba(6, 25, 35, 0.20);
  --sh-3: 0 32px 70px -24px rgba(6, 25, 35, 0.30);
  --sh-inner: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  --sh-d: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 46px -20px rgba(0, 0, 0, 0.65);
  --sh-focus: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);

  /* ---- motion: real curves, never linear ---- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.42, 0.44, 1);
  --dur-1: 160ms;
  --dur-2: 300ms;
  --dur-3: 620ms;
  --dur-4: 900ms;

  /* ---- z-index scale ---- */
  --z-base: 0;
  --z-lift: 10;
  --z-nav: 30;
  --z-overlay: 60;
  --z-grain: 70;
  --z-skip: 90;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--ink-800);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-700); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-tint); }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* film grain: fixed, never on a scrolling container */
.grain {
  position: fixed; inset: 0; z-index: var(--z-grain);
  pointer-events: none; opacity: 0.5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
}
@media (prefers-reduced-transparency: reduce) { .grain { display: none; } }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: var(--z-skip);
  background: var(--ink-900); color: #fff; padding: 10px 16px; border-radius: var(--r-pill);
}
.skip:focus { left: 16px; top: 16px; }

/* --------------------------------------------------------- typography */
h1, h2, h3, h4 { margin: 0; font-weight: 620; line-height: var(--lh-tight); letter-spacing: var(--tr-tight); }
h1 { font-size: var(--t-h1); letter-spacing: var(--tr-display); font-weight: 660; }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); font-weight: 600; }
h4 { font-size: var(--t-micro); font-weight: 620; letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-400); }
p { margin: 0 0 var(--s4); max-width: 65ch; }
p:last-child { margin-bottom: 0; }
.display {
  font-size: var(--t-display); line-height: var(--lh-display);
  letter-spacing: var(--tr-display); font-weight: 680; color: var(--ink-900);
  text-wrap: balance;
}
.lede { font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.55; color: var(--ink-400); max-width: 56ch; }
.muted { color: var(--ink-400); }
.dim { color: var(--ink-300); }
.mono { font-family: var(--font-mono); font-variant-ligatures: none; }
.small { font-size: var(--t-small); }
.micro { font-size: var(--t-micro); }
strong, b { font-weight: 620; color: var(--ink-900); }
.nowrap { white-space: nowrap; }

/* The ONE label style. Use sparingly: at most one per three sections. */
.eyebrow {
  display: inline-block; font-size: var(--t-micro); font-weight: 600;
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--accent);
  margin-bottom: var(--s3);
}

/* ------------------------------------------------------------ layout */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s5); }
.wrap-narrow { max-width: var(--wrap-narrow); }
section { position: relative; }
.sec { padding-block: var(--section-y); }
.sec--tint { background: var(--paper-2); }
.sec--card { background: var(--card); }
.sec-head { display: grid; gap: var(--s4); max-width: 62ch; margin-bottom: var(--s7); }
.sec-head h2 { text-wrap: balance; }
.stack { display: grid; gap: var(--s4); }
.stack-lg { display: grid; gap: var(--s6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s5); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.hairline { border-top: 1px solid var(--line); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* -------------------------------------------------------- surfaces */
/* Double-bezel: an outer shell with padding + hairline, an inner core. */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--s5); box-shadow: var(--sh-1);
}
.bezel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.65));
  border: 1px solid var(--line); border-radius: var(--r-card); padding: 6px;
  box-shadow: var(--sh-1);
}
.bezel > * {
  background: var(--card); border-radius: calc(var(--r-card) - 8px);
  padding: var(--s5); box-shadow: var(--sh-inner); border: 1px solid rgba(6, 25, 35, 0.05);
}
.tile { background: var(--card); border-radius: var(--r-tile); border: 1px solid var(--line); padding: var(--s4); }
.card--dark { background: var(--ink-900); border-color: transparent; color: var(--d-text); }
.card--dark h3, .card--dark b, .card--dark strong { color: #fff; }
.card--accent { background: var(--accent-tint); border-color: rgba(15, 118, 110, 0.20); }
.rule { height: 2px; width: 44px; background: var(--gold); border-radius: 2px; }

/* ---------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill); padding: 0.72rem 1.35rem; font-size: var(--t-small); font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.btn:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn-primary { --btn-bg: var(--brand); }
.btn-accent { --btn-bg: var(--accent); }
.btn-accent:hover { background: var(--accent-700); }
.btn-ghost {
  --btn-bg: transparent; --btn-fg: var(--ink-700); --btn-bd: var(--line-2);
}
.btn-ghost:hover { background: var(--card); color: var(--ink-900); box-shadow: var(--sh-1); }
.btn-quiet { --btn-bg: transparent; --btn-fg: var(--accent); padding-inline: 0; }
.btn-quiet:hover { background: transparent; color: var(--accent-700); box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
.btn-lg { padding: 0.95rem 1.7rem; font-size: var(--t-body); }
.btn-sm { padding: 0.5rem 0.95rem; font-size: var(--t-micro); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
/* button-in-button trailing glyph */
.btn .ico {
  width: 1.55em; height: 1.55em; flex: 0 0 auto; margin-right: -0.35em;
  display: inline-grid; place-items: center; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16); font-size: 0.82em; line-height: 1;
  transition: transform var(--dur-2) var(--ease-spring);
}
.btn-ghost .ico, .btn-quiet .ico { background: rgba(6, 25, 35, 0.06); }
.btn:hover .ico { transform: translateX(2px) scale(1.05); }

/* ------------------------------------------------------------- chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.42rem 0.85rem;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--card);
  font-size: var(--t-micro); font-weight: 550; color: var(--ink-600); cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 620; letter-spacing: 0.01em;
  background: var(--paper-3); color: var(--ink-600); border: 1px solid transparent;
}
.st-received { background: var(--brand-tint); color: var(--brand); }
.st-quoted { background: var(--warn-tint); color: var(--warn); }
.st-scheduled { background: var(--accent-tint); color: var(--accent-700); }
.st-progress { background: var(--accent); color: #fff; }
.st-done { background: var(--ok-tint); color: var(--ok); }
.st-cancelled { background: var(--err-tint); color: var(--err); }

/* ------------------------------------------------------------ notices */
.notice {
  border: 1px solid var(--line-2); background: var(--card); border-left: 3px solid var(--brand);
  border-radius: var(--r-tile); padding: var(--s4); font-size: var(--t-small); margin-bottom: var(--s4);
}
.notice.ok { border-left-color: var(--ok); background: var(--ok-tint); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-tint); }
.notice.err { border-left-color: var(--err); background: var(--err-tint); }

/* ------------------------------------------------------------- forms */
.field { display: grid; gap: 7px; margin-bottom: var(--s4); }
.field > label { font-size: var(--t-micro); font-weight: 600; color: var(--ink-600); letter-spacing: 0.01em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.72rem 0.9rem; border: 1px solid var(--line-2); border-radius: var(--r-input);
  background: var(--card); color: var(--ink-900); font-size: var(--t-small);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-300); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--err); }
.field .hint { font-size: var(--t-micro); color: var(--ink-400); }
.field .err { font-size: var(--t-micro); color: var(--err); font-weight: 550; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
.check-row { display: flex; gap: 9px; align-items: flex-start; font-size: var(--t-micro); color: var(--ink-400); }
.check-row input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.kv { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 8px var(--s4); margin: 0; font-size: var(--t-small); }
.kv dt { color: var(--ink-400); }
.kv dd { margin: 0; color: var(--ink-800); text-align: right; font-weight: 550; }

/* ------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.tbl th, .tbl td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2; background: var(--paper-2);
  font-size: 11.5px; font-weight: 650; letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-400);
  border-bottom: 1px solid var(--line-2);
}
.tbl tbody tr { transition: background var(--dur-1) var(--ease); }
.tbl tbody tr:hover { background: var(--brand-tint); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl td .sub { font-size: var(--t-micro); color: var(--ink-400); font-weight: 450; }

/* -------------------------------------------- loading / empty / error */
.skeleton { border-radius: var(--r-tile); background: linear-gradient(100deg, var(--paper-2) 30%, var(--paper-3) 50%, var(--paper-2) 70%); background-size: 220% 100%; animation: shimmer 1.5s infinite linear; }
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }
.empty { text-align: center; padding: var(--s7) var(--s4); color: var(--ink-400); }
.empty b { display: block; color: var(--ink-700); font-size: var(--t-h3); margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ------------------------------------------------------- scroll reveal */
[data-reveal] {
  opacity: 0; transform: translateY(18px); filter: blur(6px);
  transition: opacity var(--dur-4) var(--ease-out), transform var(--dur-4) var(--ease-out), filter var(--dur-4) var(--ease-out);
  transition-delay: var(--d, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ------------------------------------------------------------- footer */
.site-foot { background: var(--ink-900); color: var(--d-muted); padding-block: var(--s8) var(--s6); }
.site-foot a { color: var(--d-muted); }
.site-foot a:hover { color: #fff; }
.site-foot h4 { color: var(--d-dim); }
.site-foot .fgrid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--s6); }
@media (max-width: 900px) { .site-foot .fgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .site-foot .fgrid { grid-template-columns: 1fr; } }
.site-foot .legal {
  margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--d-line);
  display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-micro);
}
