/* 3 Pedals Auto KE — Consolidated Glassmorphism & Responsive Performance Layer */
:root {
  color-scheme: dark;
  --bg: #08090b;
  --surface: #141518;
  --surface-2: #191a1e;
  --surface2: #191a1e;
  --card: rgba(20, 22, 25, .64);
  --panel: rgba(20, 22, 25, .64);
  --ink: #f5f1e8;
  --text: #f5f1e8;
  --mute: #b6b1a6;
  --muted: #b6b1a6;
  --line: rgba(225, 203, 153, .18);
  --gold: #d7bd83;
  --blue: #d7bd83;
  --gold-ink: #171512;
  --alt: #111214;
  --alt-ink: #f5f1e8;
  --p3-graphite: #111417;
  --p3-graphite-soft: #191d21;
  --p3-glass: rgba(13, 17, 21, .48);
  --p3-glass-strong: rgba(10, 13, 16, .64);
  --p3-glass-soft: rgba(255, 255, 255, .035);
  --p3-champagne: #c9b784;
  --p3-champagne-bright: #dfc995;
  --p3-ivory: #f4f0e8;
  --p3-muted: rgba(244, 240, 232, .70);
  --p3-edge: rgba(255, 255, 255, .12);
  --p3-edge-gold: rgba(201, 183, 132, .26);
  --p3-shadow: 0 16px 42px rgba(0, 0, 0, .24);
  --p3-radius: 18px;
  --p3-radius-small: 12px;
  --p3-ease: cubic-bezier(.22, 1, .36, 1);
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overscroll-behavior-x: none;
}

body {
  min-height: 100vh;
  max-width: 100%;
  overscroll-behavior-x: none;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html:not([data-theme="light"]) {
  color-scheme: dark;
  background: #08090b;
}

html:not([data-theme="light"]) body {
  color: var(--p3-ivory);
  background-color: transparent;
}

html:not([data-theme="light"]) body::before {
  content: "";
  display: block;
  position: fixed;
  inset: -10px;
  z-index: -1;
  pointer-events: none;
  background: url("/public/assets/hero-backdrop-mobile.webp") center center / cover no-repeat;
  filter: blur(4px);
  transform: scale(1.025);
}

html:not([data-theme="light"]) body::after {
  content: "";
  display: block;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(8, 9, 11, .40);
}

@media (max-width: 760px) {
  html:not([data-theme="light"]) body::before {
    background-image: url("/public/assets/hero-backdrop-mobile.webp");
  }
}

main {
  flex: 1 0 auto;
  min-width: 0;
}

main.wrap {
  width: 100%;
  padding-bottom: clamp(28px, 5vw, 64px);
}

/* Official Typography */
html body :is(h1, h2, h3, h4, h5, h6) {
  font-family: "Sora", "Manrope", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.18;
  text-wrap: balance;
}

html body h1 {
  font-weight: 700;
  letter-spacing: -.045em;
}

html body :is(p, li, label, small, .description, .muted, .meta, .subtitle, .section-subtitle, .eyebrow, .lead) {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  text-wrap: pretty;
}

html body :is(.brand, .logo, .brand-name, .site-brand, .wordmark, header .brand, header .logo) {
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -.035em;
}

html body :is(.price, .amount, .vehicle-price, [data-price], .stat-value, .metric-value) {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

html body :is(.journal-title, .article-title, .editorial-title, .article-head h2) {
  font-family: "Sora", "Manrope", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -.025em;
}

/* Storefront Dark Glass Surfaces (Flat frosted glass with subtle top-edge highlight) */
html:not([data-theme="light"]) body :is(
  .card, .dealer, .stat, .state, .empty, .error, .panel, .seller-card,
  .info, .gallery, .seller, .spec, .note, .listing, .article-item,
  .project-item, .vehicle-card, .story-card, .contact-card, .promotion-package,
  .auto-quote-rail, .authbox, .editor, .contact-form, .modal-content, .dialog-card,
  .settings-card, .package, .featured-panel, .filter-panel, .search-panel,
  .vehicle-detail-card, .article-card, .dashboard-card, .tile, .featured-section,
  .journal-card, .profile-card, .feature-card, .service-card, .booking-card,
  .garage-card, .attention-panel, .account-overview-panel
):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
  color: var(--p3-ivory);
  background-color: rgba(18, 22, 28, 0.44);
  background-image: none;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .16), inset 0 1px 0 0 rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
  backdrop-filter: blur(24px) saturate(125%);
  transition: transform .24s var(--p3-ease), background-color .24s ease, box-shadow .24s ease;
}

@media (hover: hover) and (pointer: fine) {
  html:not([data-theme="light"]) body :is(
    .card, .dealer, .listing, .vehicle-card, .story-card, .contact-card,
    .promotion-package, .article-item, .project-item, .tile, .profile-card,
    .feature-card, .service-card, .booking-card, .garage-card, .journal-card,
    .seller-card, .dashboard-card
  ):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *):hover {
    background-color: rgba(22, 27, 35, 0.54);
    background-image: none;
    box-shadow: 0 22px 48px rgba(0, 0, 0, .24), inset 0 1px 0 0 rgba(229, 185, 111, .34);
    transform: translateY(-2px);
  }
}

/* Chrome & Headers */
html:not([data-theme="light"]) :is(body > header, .head, .top, .site-header, .main-header, .navbar, .nav-shell, .nav-wrap) {
  color: var(--p3-ivory);
  background: rgba(13, 13, 16, .70);
  border: 0;
  -webkit-backdrop-filter: blur(24px) saturate(135%);
  backdrop-filter: blur(24px) saturate(135%);
}

html body :is(body > header, .top, .site-header, .main-header, .navbar) :is(a, button) {
  -webkit-tap-highlight-color: transparent;
}

html:not([data-theme="light"]) body :is(.eyebrow, .section-kicker, .overline, .label-kicker):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
  color: rgba(255, 255, 255, .90);
}

html:not([data-theme="light"]) body :is(.price, .vehicle-price, .amount, .brand, .logo, .arrow, .gold-text):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
  color: var(--p3-champagne);
}

html:not([data-theme="light"]) body a:not(.btn):not(.button):not(.gold-button):not(.primary):not(.btn-primary):not(.button-primary):not(.showroom-secondary) {
  color: #e0c37f;
}

/* Interactive Controls & Forms */
html body :is(button, .btn, a.button, .primary, .btn-primary, .button-primary, .gold-button, .back, nav a, nav button):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

html body :is(button, .btn, a.button):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *):focus-visible,
html body a:focus-visible {
  outline: 2px solid rgba(201, 183, 132, .78);
  outline-offset: 3px;
}

html:not([data-theme="light"]) :is(input, select, textarea, .input):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
  color: var(--p3-ivory);
  background: rgba(12, 15, 18, .54);
  border-color: rgba(255, 255, 255, .15);
  border-radius: var(--p3-radius-small);
}

html:not([data-theme="light"]) :is(input, select, textarea, .input)::placeholder {
  color: rgba(244, 240, 232, .52);
}

html:not([data-theme="light"]) :is(input, select, textarea, .input):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *):focus {
  border-color: rgba(201, 183, 132, .60);
  background: rgba(18, 22, 28, .70);
  box-shadow: inset 0 2px 0 rgba(201, 183, 132, .42);
  outline: none;
}

html:not([data-theme="light"]) select option {
  color: #f4f0e8;
  background: #171b1f;
}

/* Modals (excluding isolated Account Workspace dialogs) */
html:not([data-theme="light"]) :is(.journal-share-dialog, .modal:not(#accDlg), .dialog:not(#accDlg):not(#accActionDlg):not(#sellerEditListingDialog), .popover-content) {
  color: var(--p3-ivory);
  background: rgba(16, 17, 19, .92);
  border-color: rgba(211, 185, 125, .28);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}

html body img,
html body video {
  max-width: 100%;
}

html body :is(.vehicle-card, .listing, .dealer, .story-card, .journal-card) img {
  backface-visibility: hidden;
}

html body :is(footer, .site-footer) {
  margin-top: auto;
  color: rgba(244, 240, 232, .68);
  border: 0;
  border-top: 0;
}

/* Admin Workspace Glass Layer */
html:not([data-theme="light"]) body:has(#app) .wrap {
  max-width: 1480px;
}

html:not([data-theme="light"]) body:has(#app) :is(
  .top, .stat, .listing, .notice, .empty, .attention-panel,
  .editor, .contact-form, .article-item, .project-item, .field, .panel, .card
) {
  background-color: rgba(14, 18, 22, .64);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 13px 34px rgba(0, 0, 0, .20);
}

/* Mobile Phone Performance Layer (<= 760px) */
@media (max-width: 760px) {
  html {
    scroll-behavior: auto !important;
  }
  body {
    overflow-x: clip;
    background-attachment: scroll !important;
  }
  html body::before {
    top: -12px !important;
    left: -12px !important;
    right: auto !important;
    bottom: auto !important;
    width: calc(100vw + 24px) !important;
    height: calc(100vh + 24px) !important;
    height: calc(100lvh + 24px) !important;
    filter: none !important;
    transform: translate3d(0, 0, 0) !important;
    background-attachment: scroll !important;
    background-position: center center !important;
    background-size: cover !important;
  }
  html:not([data-theme="light"]) body :is(
    .card, .dealer, .stat, .state, .empty, .error, .panel, .seller-card,
    .info, .gallery, .seller, .spec, .note, .listing, .article-item, .project-item,
    .vehicle-card, .story-card, .contact-card, .promotion-package, .tile, .profile-card,
    .feature-card, .service-card, .booking-card, .garage-card, .featured-panel,
    .filter-panel, .search-panel, .vehicle-detail-card, .article-card, .journal-card,
    .dashboard-card, .authbox, .editor, .contact-form, .modal-content, .dialog-card,
    .settings-card, .package
  ):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
    -webkit-backdrop-filter: blur(18px) saturate(125%) !important;
    backdrop-filter: blur(18px) saturate(125%) !important;
    background-color: rgba(18, 22, 28, 0.46) !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .16), inset 0 1px 0 0 rgba(255, 255, 255, .15) !important;
  }
  html[data-theme="light"] body :is(
    .card, .dealer, .stat, .state, .empty, .error, .panel, .seller-card,
    .info, .gallery, .seller, .spec, .note, .listing, .article-item, .project-item,
    .vehicle-card, .story-card, .contact-card, .promotion-package, .tile, .profile-card,
    .feature-card, .service-card, .booking-card, .garage-card, .featured-panel,
    .filter-panel, .search-panel, .vehicle-detail-card, .article-card, .journal-card,
    .dashboard-card, .authbox, .editor, .contact-form, .modal-content, .dialog-card,
    .settings-card, .package
  ):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
    -webkit-backdrop-filter: blur(14px) saturate(130%) !important;
    backdrop-filter: blur(14px) saturate(130%) !important;
    background-color: rgba(252, 247, 238, .72) !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: 0 12px 28px rgba(48, 38, 18, .09), inset 0 1px 0 0 rgba(255, 255, 255, .92) !important;
  }
  html:not([data-theme="light"]) body :is(.ghost, .btn.ghost, .btn.dark, .alt, .back, .icon-btn, button.secondary, .btn-secondary):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *):not(#bBtn):not(#roadSubmit) {
    -webkit-backdrop-filter: blur(12px) saturate(125%) !important;
    backdrop-filter: blur(12px) saturate(125%) !important;
    background-color: rgba(255, 255, 255, .085) !important;
    background-image: none !important;
    border-color: rgba(255, 255, 255, .22) !important;
    color: #f5f1e8 !important;
  }
  html:not([data-theme="light"]) body :is(input, select, textarea):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *):not(#uxChatDrawer *) {
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    background: rgba(18, 20, 24, .56) !important;
    font-size: 16px !important;
  }
  html body :is(button, .btn, a.button):not(#accDlg *):not(#accActionDlg *):not(#sellerEditListingDialog *) {
    min-height: 40px;
  }
  main.wrap {
    padding-bottom: 72px;
  }
}

@media (hover: none) {
  html body :is(.card, .dealer, .listing, .article-item, .project-item, .vehicle-card, .story-card, .contact-card, .promotion-package):hover {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  html body *,
  html body *::before,
  html body *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
