/* Auto Tag theme tokens — "Gilded Showroom": warm black stage, ivory day mode, champagne-gold hairlines,
   the logo's chevron + triangle as the one recurring motif, sharp small corners. Layered over the Modernist sheet. */
html { scrollbar-gutter: stable; }
:root, [data-theme] {
  /* One corner scale for every box (cards, fields, chips, buttons): sharp, showroom-precise. Circles use 50%. */
  --r-xs: 2px; --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-pill: 4px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --as-red: #e5484d; --as-green: #30a46c;
  --as-red-badge: #c62f2f;
  --as-brand: #c8952a; /* neutral default — the dealer colour comes from dealers.json → brand.colors */
  --as-brand-btn: var(--as-brand);
  --as-gold: var(--as-brand); --as-gold-soft: color-mix(in srgb, var(--as-brand) 72%, #ffffff); --as-gold-deep: color-mix(in srgb, var(--as-brand) 75%, #000000);
  --as-on-brand: #14120f;
  /* Spacing rhythm and type scale shared by the redesigned sections */
  --tg-sec: clamp(40px, 6vw, 84px);
  --tg-gap: clamp(14px, 1.6vw, 20px);
  --tg-kick: 12px; --tg-h2: clamp(28px, 3.4vw, 42px);
  --tg-slats: repeating-linear-gradient(90deg, color-mix(in srgb, var(--as-brand) 6%, transparent) 0 1px, transparent 1px 14px);
}
:root, [data-theme="light"] {
  --color-bg: #f6f3ec; --color-surface: #ffffff; --as-surface-2: #eee8dc;
  --color-text: #15130f; --as-muted: #5b5549;
  --color-divider: rgba(21, 19, 15, .11); --as-line-strong: rgba(21, 19, 15, .22);
  --as-ink: var(--as-brand-btn); --as-on-ink: #14120f; --as-logo-plate: #14120f;
  --color-accent: color-mix(in srgb, var(--as-brand) 55%, #000000); --color-accent-100: color-mix(in srgb, var(--as-brand) 14%, #ffffff); --color-accent-800: color-mix(in srgb, var(--as-brand) 50%, #000000);
  --as-gold-text: color-mix(in srgb, var(--as-brand) 50%, #000000); /* gold as text on ivory/white: about 6:1 */
  --as-hair: rgba(184, 129, 26, .38);
  --as-stripe: rgba(21, 19, 15, .05);
  --shadow-sm: 0 1px 2px rgba(21, 19, 15, .06);
  --shadow-md: 0 10px 28px rgba(21, 19, 15, .09);
  --shadow-lg: 0 26px 60px rgba(21, 19, 15, .16);
}
[data-theme="dark"] {
  --color-bg: #0b0a08; --color-surface: #15130f; --as-surface-2: #201c15;
  --color-text: #f4efe4; --as-muted: #b0a898;
  --color-divider: rgba(244, 239, 228, .09); --as-line-strong: rgba(244, 239, 228, .2);
  --as-ink: var(--as-brand-btn); --as-on-ink: #14120f; --as-logo-plate: transparent;
  --color-accent: var(--as-brand); --color-accent-100: color-mix(in srgb, var(--as-brand) 14%, #0b0a08); --color-accent-800: var(--as-gold-soft);
  --as-gold-text: var(--as-gold-soft);
  --as-hair: color-mix(in srgb, var(--as-brand) 30%, transparent);
  --as-stripe: rgba(244, 239, 228, .04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-lg: 0 0 0 1px color-mix(in srgb, var(--as-brand) 10%, transparent), 0 30px 70px rgba(0, 0, 0, .6);
}

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

[data-skip-link] { position: fixed; left: 12px; top: 12px; z-index: 4000; transform: translateY(-160%); padding: 12px 16px; border-radius: var(--r-sm); background: var(--as-ink); color: var(--as-on-ink); font: 700 14px/1 var(--font-body); text-decoration: none; transition: transform .18s var(--ease); }
[data-skip-link]:focus { transform: translateY(0); outline: 3px solid var(--color-text); outline-offset: 3px; }

::view-transition-old(root) { animation: as-vt-out .28s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(root) { animation: as-vt-in .42s cubic-bezier(.16,1,.3,1) both; }
@keyframes as-vt-out { to { opacity: 0; transform: translateY(-10px) scale(.995); } }
@keyframes as-vt-in { from { opacity: 0; transform: translateY(16px); } }
header, [data-site-header] { view-transition-name: as-header; }
::view-transition-group(as-header) { animation-duration: 0s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }
html { background: var(--color-bg); }

:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
select option, select optgroup { background-color: var(--color-surface); color: var(--color-text); }

/* ───────── Gilded Showroom layer ───────── */

/* Header and footer are the showroom's black stage in BOTH themes (the wordmark's white "TAG" needs it). */
header[data-keep], footer[data-tg-foot] {
  --color-bg: #0b0a08; --color-surface: #16140f; --as-surface-2: #231f17;
  --color-text: #f4efe4; --as-muted: #b3ab9d;
  --color-divider: rgba(244, 239, 228, .10); --as-line-strong: rgba(244, 239, 228, .22);
  --as-logo-plate: transparent; --as-gold-text: var(--as-gold-soft);
  --shadow-lg: 0 0 0 1px color-mix(in srgb, var(--as-brand) 14%, transparent), 0 30px 70px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
/* The gold hairline belongs to the full-width bar behind the header / footer (frame "bars"), drawn once at the window width */
header[data-keep] { border-bottom: 0; }
header[data-keep]::before { border-bottom: 1px solid color-mix(in srgb, var(--as-brand) 32%, transparent) !important; }
footer[data-tg-foot] { border-top: 0 !important; }
footer[data-tg-foot]::before { border-top: 1px solid color-mix(in srgb, var(--as-brand) 32%, transparent) !important; }
/* Active page in the menu: a gold underline with the logo's small triangle */
[data-tg-nav] { position: relative; }
[data-tg-nav][data-on="1"]::after { content: ''; position: absolute; left: 50%; bottom: -1px; width: 10px; height: 6px; margin-left: -5px; background: var(--as-gold); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
[data-tg-nav][data-on="1"] { box-shadow: inset 0 -2px 0 var(--as-gold); }
[data-tg-fin="1"] { color: var(--as-gold) !important; }

/* Kicker: uppercase, wide tracking, the chevron mark before it */
[data-tg-k] { display: inline-flex; align-items: center; gap: 10px; font-size: var(--tg-kick); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--as-gold-text); }
[data-tg-k]::before { content: ''; width: 14px; height: 9px; flex: none; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 76% 100%, 50% 46%, 24% 100%, 0 100%); }
/* Gold hairline under a section heading */
[data-tg-rule] { height: 1px; border: 0; margin: 0; background: linear-gradient(90deg, var(--as-hair), transparent 70%); }

/* Cards and panels: a fine gold edge on top, lifting on hover */
[data-tg-card] { position: relative; }
[data-tg-card]::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; border-top: 2px solid var(--as-gold); pointer-events: none; z-index: 1; -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 55%, rgba(0,0,0,.25) 100%); mask-image: linear-gradient(90deg, #000 0%, #000 55%, rgba(0,0,0,.25) 100%); }

/* The wood-slat wall of the showroom, as a quiet texture on dark bands */
[data-tg-slats] { background-image: var(--tg-slats); }

/* Finance band: black + gold in both themes */
[data-tg-band] { background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--as-brand) 18%, transparent) 0%, color-mix(in srgb, var(--as-brand) 0%, transparent) 55%), var(--tg-slats), #0f0d0a !important; color: #f4efe4 !important; border: 1px solid color-mix(in srgb, var(--as-brand) 28%, transparent); }

/* Focus: a clear gold ring everywhere */
[data-site] a:focus-visible, [data-site] button:focus-visible, [data-site] select:focus-visible, [data-site] input:focus-visible, [data-site] textarea:focus-visible { outline: 2px solid var(--as-gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { [data-tg-card] { transition: none !important; } }

/* One side gutter for header, sections and footer: 20 px, 12 px on phones (the header's own breakpoint) */
:root { --tg-side: 20px; --font-heading-weight: 700; }
@media (max-width: 819.98px) { :root { --tg-side: 12px; } }

/* Home action tiles: the number and the arrow share one colour (gold), and both turn dark on the gold hover so they stay readable */
[data-tg-tile] [data-tg-num], [data-tg-tile] [data-tg-ico] { color: var(--as-gold-text); transition: color .3s var(--ease), background .3s var(--ease); }
[data-tg-tile] [data-tg-ico] { background: color-mix(in srgb, var(--as-brand) 12%, transparent); border: 1px solid color-mix(in srgb, var(--as-brand) 30%, transparent); box-sizing: border-box; }
[data-tg-tile]:hover [data-tg-num], [data-tg-tile]:focus-visible [data-tg-num], [data-tg-tile]:hover [data-tg-ico], [data-tg-tile]:focus-visible [data-tg-ico] { color: var(--as-on-ink); }
[data-tg-tile]:hover [data-tg-ico], [data-tg-tile]:focus-visible [data-tg-ico] { background: color-mix(in srgb, var(--as-on-ink) 12%, transparent); border-color: color-mix(in srgb, var(--as-on-ink) 30%, transparent); }

/* Hero: the logo's chevron as a solid gold piece in 3D — layered depth, a light sweep across the metal, a slow turn and a gentle float */
[data-tg-prism] { display: block; perspective: 1100px; filter: drop-shadow(0 18px 38px rgba(0, 0, 0, .55)) drop-shadow(0 0 26px color-mix(in srgb, var(--as-brand) 26%, transparent)); animation: tg-float 7s ease-in-out infinite alternate; }
[data-tg-prism-spin] { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(8deg) rotateY(-22deg); animation: tg-spin 24s linear infinite; }
[data-tg-prism-spin] > span { position: absolute; inset: 0; backface-visibility: visible; clip-path: polygon(50% 0, 100% 100%, 76% 100%, 50% 48%, 24% 100%, 0 100%); }
[data-tg-pl] { background: linear-gradient(180deg, var(--as-gold-deep), color-mix(in srgb, var(--as-brand) 45%, #000000)); }
[data-tg-pl="0"], [data-tg-pl="5"] { background: linear-gradient(135deg, var(--as-gold-soft) 0%, var(--as-brand) 28%, var(--as-gold-deep) 52%, var(--as-brand) 74%, var(--as-gold-soft) 100%); }
[data-tg-pl="0"] { transform: translateZ(0); }
[data-tg-pl="1"] { transform: translateZ(-2px); } [data-tg-pl="2"] { transform: translateZ(-4px); }
[data-tg-pl="3"] { transform: translateZ(-6px); } [data-tg-pl="4"] { transform: translateZ(-8px); }
[data-tg-pl="5"] { transform: translateZ(-10px); }
[data-tg-pl="0"]::after, [data-tg-pl="5"]::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .6) 50%, transparent 62%); background-size: 260% 100%; background-position: 160% 0; animation: tg-sheen 6s ease-in-out infinite; }
[data-tg-prism-spin] > [data-tg-tri] { clip-path: polygon(36% 100%, 50% 72%, 64% 100%); transform: translateZ(4px); background: linear-gradient(180deg, var(--as-gold-soft), var(--as-gold-deep)); }
@keyframes tg-spin { from { transform: rotateX(8deg) rotateY(0deg); } to { transform: rotateX(8deg) rotateY(360deg); } }
@keyframes tg-float { from { transform: translateY(0); } to { transform: translateY(-14px); } }
@keyframes tg-sheen { 0% { background-position: 160% 0; } 55%, 100% { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) {
  [data-tg-prism], [data-tg-prism-spin], [data-tg-pl]::after { animation: none !important; }
  [data-tg-prism-spin] { transform: rotateX(8deg) rotateY(-22deg); }
}
