/*
 * AutoFeed homepage design tokens.
 *
 * The approved AutoFeed palette, type scale, spacing, radius, motion and
 * layout primitives, together with the element defaults the homepage is drawn
 * on. Loaded only by the homepage: the stock listing and vehicle detail views
 * keep their own visual system in `styles.css`.
 *
 * Values are the supplied design system's values. Nothing here invents one.
 */

:root {
  /* Core backgrounds */
  --af-black: #111315;
  --af-graphite: #181B1E;
  --af-surface: #202428;
  --af-surface-raised: #292E33;

  /* Typography */
  --af-white: #F4F5F6;
  --af-text-secondary: #A7ADB3;
  --af-text-muted: #727980;

  /* Structure */
  --af-border: #343A40;
  --af-border-strong: #4A5158;

  /* Brand accent. Burnt orange is an action and accent colour only. */
  --af-orange: #C65A22;
  --af-orange-hover: #DF6A2B;
  --af-orange-active: #9F4519;
  --af-orange-dark: #6F2E11;

  /* Functional. Used as a rule, never as text on a dark ground. */
  --af-danger: #C94B45;

  /* Semantic aliases */
  --surface-section: var(--af-graphite);
  --surface-panel: var(--af-surface);
  --text-heading: var(--af-white);
  --text-body: var(--af-text-secondary);
  --text-muted: var(--af-text-muted);
  --border-default: var(--af-border);
  --border-strong: var(--af-border-strong);
  --action-bg: var(--af-orange);
  --action-bg-hover: var(--af-orange-hover);
  --action-bg-active: var(--af-orange-active);
  --action-fg: #FFFFFF;

  /* Type */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-text: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;

  --display-sm: clamp(2.25rem, 4vw, 4rem);
  --display-md: clamp(3rem, 6vw, 6.5rem);

  --weight-medium: 500;
  --weight-semibold: 600;

  --leading-display: 0.92;
  --leading-tight: 1.1;
  --leading-body: 1.6;

  --tracking-display: -0.03em;
  --tracking-tight: -0.015em;
  --tracking-label: 0.12em;

  --measure: 66ch;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* Motion */
  --motion-fast: 150ms;
  --motion-slow: 600ms;
  --ease-default: cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-control:
    color var(--motion-fast) var(--ease-default),
    background-color var(--motion-fast) var(--ease-default),
    border-color var(--motion-fast) var(--ease-default);

  /* Layout */
  --page-max: 1440px;
  --page-gutter: clamp(20px, 5vw, 80px);
  --header-height: 64px;
}

@media (min-width: 900px) { :root { --header-height: 72px } }

@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-slow: 0ms }
}

/* --- element defaults --- */
html { color-scheme: dark }
body { margin: 0; background: var(--af-black); color: var(--af-text-secondary); font-family: var(--font-text); font-size: var(--text-base); line-height: var(--leading-body); -webkit-font-smoothing: antialiased }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--af-white); margin: 0; letter-spacing: var(--tracking-display); line-height: var(--leading-display) }
p { margin: 0; max-width: var(--measure); text-wrap: pretty }
img { display: block; max-width: 100% }
a { color: var(--af-white); text-decoration: none; border-bottom: 1px solid var(--af-border-strong); transition: var(--transition-control) }
a:hover { color: var(--af-orange-hover); border-bottom-color: var(--af-orange-hover) }
:focus-visible { outline: 2px solid var(--af-orange); outline-offset: 2px; border-radius: var(--radius-sm) }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important }
}

/* --- layout primitives --- */
.af-container { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-gutter) }

/* Scene rhythm. Mobile scenes breathe less than desktop chapters. */
.af-scene { padding-block: var(--space-8) }
@media (min-width: 600px) { .af-scene { padding-block: var(--space-9) } }
@media (min-width: 900px) { .af-scene { padding-block: var(--space-10) } }

/* Header nav: a disclosure panel on mobile, an inline row from the md step. */
.af-nav { display: none; flex-direction: column; align-items: stretch; gap: var(--space-1); position: absolute; top: 100%; left: 0; right: 0; padding: var(--space-4) var(--page-gutter) var(--space-5); background: var(--af-graphite); border-block: 1px solid var(--af-border) }
.af-nav[data-open="true"] { display: flex }
.af-nav-toggle { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 44px; min-width: 44px; padding: 0 var(--space-4); font-family: var(--font-text); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--af-white); background: transparent; border: 1px solid var(--af-border-strong); border-radius: var(--radius-sm); cursor: pointer }
@media (min-width: 900px) {
  .af-nav { display: flex; flex-direction: row; align-items: center; gap: var(--space-7); position: static; padding: 0; background: none; border: 0 }
  .af-nav-toggle { display: none }
}
