/* Design tokens — the single place where colours are written as hex/rgb.
   Everything else consumes these variables (see docs/DESIGN.md and
   design-system/dealestate/MASTER.md). Light by default, dark via
   prefers-color-scheme; component CSS never branches on the theme. */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Surfaces */
  --bg: #f3f6f6; /* page */
  --surface: #ffffff; /* cards, inputs, sheets */
  --surface-2: #eaf0ef; /* sunken areas, hover fills, tracks */
  --surface-3: #dde7e5; /* pressed fills, skeletons */
  --line: #dbe5e3; /* hairlines, card borders */
  --line-strong: #b9c9c6; /* input borders, hover borders */
  --overlay: rgb(8 24 28 / 56%); /* page behind a sheet or dialog */
  --glass: rgb(255 255 255 / 78%); /* frosted bars */

  /* Text */
  --text: #0b1f2a;
  --text-2: #4b5f68; /* secondary: 6.4:1 on --surface */
  --text-3: #6b7e86; /* tertiary: placeholders, captions (>= 4.5:1 on --surface) */

  /* Brand: trust teal */
  --brand: #0f766e;
  --brand-hover: #115e59;
  --brand-2: #0e9384; /* lighter end of the brand gradient */
  --brand-soft: #d8f1ed;
  --brand-text: #0b5a54; /* brand-coloured text on --brand-soft / --surface */
  --on-brand: #ffffff;
  --on-hero: #ffffff; /* text on --grad-hero; stays white in dark mode too */

  /* Accent: warm amber (highlights, key figures, warnings) */
  --accent: #f59e0b;
  --accent-soft: #fef0cc;
  --accent-text: #7a4b00;
  --on-accent: #2b1a00;

  /* Status */
  --info: #0369a1;
  --info-soft: #dff0fb;
  --info-text: #075985;
  --ok: #15803d;
  --ok-soft: #dcf5e4;
  --ok-text: #14602f;
  --bad: #dc2626;
  --bad-soft: #fde5e5;
  --bad-text: #9b1c1c;

  /* Gradients */
  --grad-hero: linear-gradient(135deg, #082f31 0%, #0f766e 62%, #14a394 100%);
  --grad-brand: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --grad-glow:
    radial-gradient(720px 320px at 100% -10%, rgb(20 163 148 / 14%), transparent 70%),
    radial-gradient(560px 280px at 0% -6%, rgb(245 158 11 / 10%), transparent 70%);

  /* Depth */
  --sh-1: 0 1px 2px rgb(11 31 42 / 6%), 0 1px 1px rgb(11 31 42 / 4%);
  --sh-2: 0 2px 6px rgb(11 31 42 / 6%), 0 8px 20px rgb(11 31 42 / 6%);
  --sh-3: 0 4px 10px rgb(11 31 42 / 8%), 0 18px 40px rgb(11 31 42 / 12%);
  --sh-brand: 0 6px 18px rgb(15 118 110 / 30%);
  --sh-sheet: 0 -12px 40px rgb(8 24 28 / 24%);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;

  /* Type (Vazirmatn only; roles by weight and size) */
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 36px;
  --lh-tight: 1.35;
  --lh-body: 1.75;

  /* Interaction */
  --touch: 48px;
  --ring: 0 0 0 3px var(--brand-soft), 0 0 0 5px var(--brand);

  /* Motion: short, purposeful, always answers a user action */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;

  /* Layout */
  --rail: 280px;
  --content: 1200px;
  --appbar-h: 60px;
  --dock-h: 68px;
  --z-bar: 20;
  --z-dock: 30;
  --z-sheet: 60;
  --z-toast: 80;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081318;
    --surface: #0f2128;
    --surface-2: #0b1a20;
    --surface-3: #16303a;
    --line: #1c353f;
    --line-strong: #2d4d59;
    --overlay: rgb(0 0 0 / 66%);
    --glass: rgb(15 33 40 / 78%);

    --text: #e7f1f0;
    --text-2: #a4bcc1;
    --text-3: #86a0a6;

    --brand: #2dd4bf;
    --brand-hover: #5eead4;
    --brand-2: #14b8a6;
    --brand-soft: #103a38;
    --brand-text: #7ee8db;
    --on-brand: #04211e;

    --accent: #fbbf24;
    --accent-soft: #3a2c08;
    --accent-text: #fcd979;
    --on-accent: #2b1a00;

    --info: #38bdf8;
    --info-soft: #0e2f43;
    --info-text: #8fd5fb;
    --ok: #4ade80;
    --ok-soft: #10331f;
    --ok-text: #86e8a8;
    --bad: #f87171;
    --bad-soft: #3d1717;
    --bad-text: #fca5a5;

    --grad-hero: linear-gradient(135deg, #0a2a2c 0%, #0d5a55 62%, #12877b 100%);
    --grad-brand: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 100%);
    --grad-glow:
      radial-gradient(720px 320px at 100% -10%, rgb(45 212 191 / 12%), transparent 70%),
      radial-gradient(560px 280px at 0% -6%, rgb(251 191 36 / 7%), transparent 70%);

    --sh-1: 0 1px 2px rgb(0 0 0 / 40%);
    --sh-2: 0 2px 8px rgb(0 0 0 / 40%), 0 10px 24px rgb(0 0 0 / 30%);
    --sh-3: 0 6px 14px rgb(0 0 0 / 45%), 0 20px 44px rgb(0 0 0 / 40%);
    --sh-brand: 0 6px 18px rgb(45 212 191 / 22%);
    --sh-sheet: 0 -12px 40px rgb(0 0 0 / 55%);
  }
}

/* ---------- Reset ---------- */

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

html {
  direction: rtl;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-block: calc(var(--appbar-h) + var(--sp-4)) calc(var(--dock-h) + var(--sp-8));
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--brand-text);
  text-underline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* Alpine hides these until it has taken over, so nothing flashes on load. */
[x-cloak] {
  display: none !important;
}

/* Figures that must line up in columns (prices, dates, plate numbers). */
.num {
  font-variant-numeric: tabular-nums;
}

/* Motion only answers an action; honour the user's preference globally. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
