/*
 * VinHaus design tokens and base styles.
 *
 * One palette, one type scale, one radius and spacing scale, shared by every
 * page (the app shell, the marketing pages, the garage portal and the public
 * pages). Pages use the variables below rather than typing colours, so both
 * themes work everywhere. See the vinhaus-design skill and CLAUDE.md.
 *
 * Colour rules (the same as the Ring Guide app):
 * - Neutrals carry the interface. Headings use --white, body text --text.
 * - Red is the brand and means "act here": the one primary button in a view,
 *   the active nav item, errors. It is not decoration.
 * - --good / --warn / --bad / --info only describe a status (MOT valid, due
 *   soon, overdue), always with a word as well as the colour.
 * - Every text colour passes WCAG AA (4.5:1) on every surface in its theme.
 *
 * Dark is the default. Light applies with html[data-theme="light"] (the app)
 * or html.light (the marketing pages); _head.html sets both from the saved
 * choice before the page paints.
 */

/* ── Fonts (self-hosted, SIL Open Font Licence, see static/fonts) ── */
@font-face {
  font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/bebas-neue-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/bebas-neue-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url('../fonts/dm-sans-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url('../fonts/dm-sans-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans'; font-style: italic; font-weight: 100 1000; font-display: swap;
  src: url('../fonts/dm-sans-latin-wght-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ── Tokens: dark (default) ── */
:root {
  color-scheme: dark;

  /* Surfaces, darkest to lightest */
  --bg:        #0a0a0a;
  --black:     var(--bg);   /* older name, used by the marketing pages */
  --surface:   #111113;
  --surface2:  #18181b;
  --surface3:  #232327;
  --border:    #2e2e33;
  --border-strong: #3f3f46;
  --nav-bg:    rgba(10, 10, 10, 0.92);
  --overlay:   rgba(0, 0, 0, 0.6);
  --shadow:    0 10px 30px rgba(0, 0, 0, 0.45);

  /* Brand red. --red is a fill (white text on it is 4.8:1). --red-text is
     for red words, eyebrows and icons: the same brand red, by Ash's call
     (a lighter red read as pink). It is 4.3-4.5:1 on the dark surfaces, so
     keep red words to labels, links and large text, not paragraphs. */
  --red:       #dc2626;
  --red-dark:  #b91c1c;     /* hover / pressed fill */
  --red2:      #ef4444;     /* older name for the marketing hover */
  --red-text:  var(--red);
  --red-tint:  color-mix(in srgb, var(--red) 14%, transparent);
  --red-line:  color-mix(in srgb, var(--red) 35%, transparent);
  --on-accent: #ffffff;     /* text on a red (or status) fill, both themes */

  /* Text */
  --white:     #fafafa;     /* headings and key values */
  --text:      #e4e4e7;     /* body */
  --muted:     #a1a1aa;     /* secondary, 6.1:1 or better */
  --subtle:    #8e8e96;     /* captions, 4.8:1 or better */

  /* Status (with a word, never colour alone) */
  --good:      #4ade80;
  --warn:      #fbbf24;
  --bad:       #f87171;
  --info:      #93c5fd;
  --violet:    #c4b5fd;
  --good-tint: color-mix(in srgb, var(--good) 14%, transparent);
  --warn-tint: color-mix(in srgb, var(--warn) 14%, transparent);
  --bad-tint:  color-mix(in srgb, var(--bad) 14%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 14%, transparent);

  /* UK number plate */
  --plate:     #f5c518;
  --plate-ink: #111111;

  /* Type */
  --font-head: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-xs:   0.75rem;   /* captions, labels */
  --text-sm:   0.875rem;  /* secondary text, table cells */
  --text-md:   1rem;      /* body */
  --text-lg:   1.25rem;   /* card titles */
  --text-xl:   1.75rem;   /* page titles */
  --display:   clamp(2.6rem, 8vw, 5.5rem);

  /* Radius: pills for chips, sm for inputs and buttons, md for cards,
     lg for sheets and hero panels. */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Spacing (4px grid) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Minimum tap target (Apple 44pt, Android 48dp) */
  --touch: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ── Tokens: light ── */
html[data-theme="light"],
html.light {
  color-scheme: light;
  --bg:        #f4f4f5;
  --surface:   #ffffff;
  --surface2:  #f7f7f8;
  --surface3:  #ececef;
  --border:    #dcdce1;
  --border-strong: #c4c4cc;
  --nav-bg:    rgba(244, 244, 245, 0.94);
  --overlay:   rgba(24, 24, 27, 0.45);
  --shadow:    0 10px 30px rgba(24, 24, 27, 0.12);

  --red-text:  var(--red);
  --red-tint:  color-mix(in srgb, var(--red) 9%, transparent);

  --white:     #18181b;
  --text:      #27272a;
  --muted:     #52525b;
  --subtle:    #63636b;

  --good:      #15703a;
  --warn:      #92580a;
  --bad:       #b91c1c;
  --info:      #1d4ed8;
  --violet:    #6d28d9;
  --good-tint: color-mix(in srgb, var(--good) 11%, transparent);
  --warn-tint: color-mix(in srgb, var(--warn) 11%, transparent);
  --bad-tint:  color-mix(in srgb, var(--bad) 9%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 9%, transparent);
}

/* Printing always uses the light palette, whatever the screen theme. */
@media print {
  :root, html[data-theme], html.light {
  color-scheme: light;
  --bg:        #f4f4f5;
  --surface:   #ffffff;
  --surface2:  #f7f7f8;
  --surface3:  #ececef;
  --border:    #dcdce1;
  --border-strong: #c4c4cc;
  --nav-bg:    rgba(244, 244, 245, 0.94);
  --overlay:   rgba(24, 24, 27, 0.45);
  --shadow:    0 10px 30px rgba(24, 24, 27, 0.12);

  --red-text:  var(--red);
  --red-tint:  color-mix(in srgb, var(--red) 9%, transparent);

  --white:     #18181b;
  --text:      #27272a;
  --muted:     #52525b;
  --subtle:    #63636b;

  --good:      #15703a;
  --warn:      #92580a;
  --bad:       #b91c1c;
  --info:      #1d4ed8;
  --violet:    #6d28d9;
  --good-tint: color-mix(in srgb, var(--good) 11%, transparent);
  --warn-tint: color-mix(in srgb, var(--warn) 11%, transparent);
  --bad-tint:  color-mix(in srgb, var(--bad) 9%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 9%, transparent);
}
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; }
::selection { background: var(--red); color: var(--on-accent); }

/* Keyboard focus is always visible; mouse clicks don't draw a ring. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--red-text);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Numbers that line up (mileage, money, dates) */
.tnum, td, .card-value, .stat-num { font-variant-numeric: tabular-nums; }

/* Screen-reader only */
.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;
}

/* ── Shared pieces any page can use ── */

/* Wordmark: VIN in --white, HAUS in red */
.wordmark { font-family: var(--font-head); letter-spacing: 5px; color: var(--white); line-height: 1; }
.wordmark span { color: var(--red); }

/* Eyebrow above a section title */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 3px; text-transform: uppercase;
  color: var(--red-text);
}
.eyebrow::before { content: ''; width: 24px; height: 1px; background: currentColor; }

/* UK number plate */
.plate {
  display: inline-block; background: var(--plate); color: var(--plate-ink);
  font-family: var(--font-head); letter-spacing: 2px; line-height: 1;
  padding: 4px 10px; border-radius: 4px; white-space: nowrap;
}

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--surface3); color: var(--muted);
}
.pill-good { background: var(--good-tint); color: var(--good); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-bad  { background: var(--bad-tint);  color: var(--bad); }
.pill-info { background: var(--info-tint); color: var(--info); }
.pill-red  { background: var(--red-tint);  color: var(--red-text); }

/* Text colour helpers, used instead of inline colours */
.c-white  { color: var(--white); }
.c-text   { color: var(--text); }
.c-muted  { color: var(--muted); }
.c-subtle { color: var(--subtle); }
.c-red    { color: var(--red-text); }
.c-good   { color: var(--good); }
.c-warn   { color: var(--warn); }
.c-bad    { color: var(--bad); }
.c-info   { color: var(--info); }

@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;
  }
}

/* ── Cookie consent banner (static/js/consent.js) ── */
.vh-consent {
  position: fixed; z-index: 1000;
  left: var(--s-4); right: var(--s-4); bottom: var(--s-4);
  max-width: 560px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4);
  padding: var(--s-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-family: 'DM Sans', sans-serif; font-size: 0.875rem; line-height: 1.5;
}
.vh-consent[hidden] { display: none; }
.vh-consent-text { flex: 1 1 260px; margin: 0; }
.vh-consent-text a { color: var(--muted); text-decoration: underline; }
.vh-consent-actions { display: flex; gap: var(--s-2); margin-left: auto; }
.vh-consent-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.vh-consent-no { background: var(--surface2); color: var(--text); }
.vh-consent-no:hover { background: var(--surface3); }
.vh-consent-yes { background: var(--red); color: var(--on-accent); border-color: var(--red); }
.vh-consent-yes:hover { background: var(--red-dark); border-color: var(--red-dark); }
@media print { .vh-consent { display: none; } }

/* ── Policy pages (templates/_privacy_body.html) ── */
.policy { max-width: 760px; line-height: 1.75; }
.policy .card { margin-bottom: var(--s-4); }
.policy .card-title { font-weight: 700; color: var(--white); margin-bottom: var(--s-3); font-size: 0.95rem; text-transform: none; letter-spacing: 0; }
.policy p, .policy li { color: var(--muted); font-size: 0.88rem; line-height: 1.75; }
.policy ul { padding-left: 20px; }
.policy li { margin-bottom: 6px; }
.policy strong { color: var(--white); }
.policy code { color: var(--white); background: var(--surface2); padding: 1px 5px; border-radius: 3px; }
.policy a { color: var(--muted); text-decoration: underline; }
.policy .page-date { color: var(--muted); font-size: 0.82rem; }
.policy-in-app .page-date { margin-bottom: var(--s-5); }
.policy-intro { margin-bottom: var(--s-5); }
.policy-lead { margin-bottom: var(--s-2); }
.policy-after { margin-top: var(--s-2); }
.policy [id] { scroll-margin-top: 80px; }
.policy * + .policy-lead { margin-top: var(--s-3); }

/* ── Atmosphere: the "workshop spec sheet" look (Nov 2026 refresh) ──
   Public pages share one backdrop: a faint engineering grid, a low red
   glow and a film grain, all built from the tokens so both themes work.
   .vh-atmos goes on a hero or full-page wrapper; its children sit above. */
:root {
  --grid-line: color-mix(in srgb, var(--white) 4%, transparent);
  --grid-size: 56px;
  --glow:      color-mix(in srgb, var(--red) 10%, transparent);
  --grain-opacity: 0.07;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="light"], html.light {
  --grid-line: color-mix(in srgb, var(--white) 5%, transparent);
  --glow:      color-mix(in srgb, var(--red) 7%, transparent);
  --grain-opacity: 0.05;
}
.vh-atmos { position: relative; isolation: isolate; }
.vh-atmos::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 72% 38%, var(--glow), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
          mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.vh-atmos::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); opacity: var(--grain-opacity); mix-blend-mode: overlay;
}
html.light .vh-atmos::after, html[data-theme="light"] .vh-atmos::after { mix-blend-mode: multiply; }

/* Corner marks, like the crop marks on a drawing. Put .vh-marks on a panel;
   it draws two short red corners just outside it (top left, bottom right). */
.vh-marks { position: relative; }
.vh-marks::before, .vh-marks::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 0 solid var(--red);
}
.vh-marks::before { top: -7px; left: -7px; border-top-width: 2px; border-left-width: 2px; }
.vh-marks::after  { bottom: -7px; right: -7px; border-bottom-width: 2px; border-right-width: 2px; }

/* Section index: a small "01" before an eyebrow, in tabular figures. */
.vh-index {
  font-family: var(--font-head); font-size: 0.95rem; letter-spacing: 2px;
  color: var(--subtle); font-variant-numeric: tabular-nums;
}

/* One staggered load-in per page: add .vh-rise and .d1 to .d6 to the hero's
   pieces. Content is visible without it (reduced motion shortens it to nothing). */
@keyframes vh-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.vh-rise { animation: vh-rise .8s var(--ease) both; }
.vh-rise.d1 { animation-delay: .05s; } .vh-rise.d2 { animation-delay: .15s; }
.vh-rise.d3 { animation-delay: .25s; } .vh-rise.d4 { animation-delay: .35s; }
.vh-rise.d5 { animation-delay: .45s; } .vh-rise.d6 { animation-delay: .55s; }

/* Scroll reveals: static/js/reveal.js adds .vh-js to <html> and .is-in to
   each .vh-reveal as it scrolls into view. Without JS nothing is hidden. */
.vh-js .vh-reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.vh-js .vh-reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .vh-js .vh-reveal { opacity: 1; transform: none; }
}

/* Cards that answer a hover with a red rule drawn across the top. */
.vh-rule { position: relative; overflow: hidden; }
.vh-rule::before {
  content: ''; position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: var(--red); transform: scaleX(0); transform-origin: left;
  transition: transform .45s var(--ease);
}
.vh-rule:hover::before, .vh-rule:focus-within::before { transform: scaleX(1); }

/* Printing shows everything at once and drops the backdrop. */
@media print {
  .vh-js .vh-reveal { opacity: 1 !important; transform: none !important; }
  .vh-rise { animation: none !important; }
  .vh-atmos::before, .vh-atmos::after { display: none; }
}
