/* Clackamas Auto Detailing - shared styles
   Tesla-inspired design language, translated. Not a copy of Tesla assets.
   Single accent: red #E82127. Alternate on file is blue #1E5B8F (swap in :root). */

:root {
  /* Brand constants, never flip with the theme. --dark is the always-dark
     feature-section and footer surface, --white is true-white ink used on those
     dark surfaces and on the accent button. */
  --white: #FFFFFF;
  --dark: #171A20;
  --dark-line: rgba(255, 255, 255, 0.16);
  --accent: #E82127;

  /* Theme tokens (Light Mode defaults). These are the only colors that change
     between Light and Dark Mode. Redefined in the theme blocks below. */
  --bg: #FFFFFF;       /* page background and base sections */
  --fg: #171A20;       /* primary text and ink on the base */
  --body: #5C5E62;     /* secondary / muted text on the base */
  --surface: #FFFFFF;  /* cards, form fields, solid header, mobile menu */
  --line: #E3E3E3;     /* borders on the base */

  --max: 1200px;
  --pad: clamp(20px, 5vw, 64px);
  --radius: 8px;
  --header-h: 64px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Mode palette. Applied on first visit when the OS asks for dark, unless
   the visitor has made an explicit choice (see the [data-theme] rules below,
   which win by specificity). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --fg: #F4F4F6;
    --body: #9E9FA5;
    --surface: #191B1F;
    --line: #2B2C32;
  }
}
/* Explicit visitor choice, saved in localStorage, overrides the OS preference
   in both directions. */
:root[data-theme="light"] {
  --bg: #FFFFFF;
  --fg: #171A20;
  --body: #5C5E62;
  --surface: #FFFFFF;
  --line: #E3E3E3;
}
:root[data-theme="dark"] {
  --bg: #101215;
  --fg: #F4F4F6;
  --body: #9E9FA5;
  --surface: #191B1F;
  --line: #2B2C32;
}

/* Smooth color change when the theme flips (disabled under reduced motion). */
body,
.site-header, .site-header.solid,
.card, form.lead input, form.lead select, form.lead textarea,
.nav.open, .btn-dark {
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); font-weight: 600; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 600; }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 600; }

p { margin: 0 0 1em; }

.label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--body);
  margin: 0 0 1rem;
}

.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease), color 0.3s var(--ease);
  color: var(--white);
}
.site-header .wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
}
.site-header.solid {
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 1px 0 var(--line);
}
.wordmark {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto; /* pushes nav, toggle and hamburger to the right */
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  flex: none;
  transition: background 0.2s var(--ease);
}
.theme-toggle:hover { background: rgba(127, 127, 131, 0.16); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.dark .icon-sun { display: none; }
.theme-toggle.dark .icon-moon { display: block; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a.navlink {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.92;
}
.nav a.navlink:hover { opacity: 1; }
.header-phone {
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s var(--ease);
  white-space: nowrap;
}
.site-header.solid .header-phone { background: rgba(127, 127, 131, 0.14); }
.header-phone:hover { background: var(--accent); color: var(--white); }

.hamburger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
  color: inherit;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: currentColor;
  margin: 4px 0;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 13px 30px;
  border-radius: 24px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
  min-height: 44px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #c81a20; }
.btn-ghost { background: transparent; border-color: currentColor; color: inherit; }
.btn-ghost:hover { background: rgba(127,127,131,0.14); }
.hero .btn-ghost:hover { background: rgba(255,255,255,0.14); }
/* Inverts with the theme: dark button in Light Mode, light button in Dark Mode. */
.btn-dark { background: var(--fg); color: var(--bg); }
.btn-dark:hover { background: var(--accent); color: var(--white); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  color: var(--white);
  background: linear-gradient(160deg, #23272e 0%, #12141a 60%, #0b0d11 100%);
  overflow: hidden;
}
.hero.short { min-height: 78svh; }
.hero-photo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  color: rgba(255,255,255,0.28);
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: calc(var(--header-h) + 20px) 40px 40px;
  background:
    radial-gradient(1200px 600px at 70% 20%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(160deg, #23272e 0%, #12141a 60%, #0b0d11 100%);
}
.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.15) 45%, rgba(0,0,0,0.35) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  padding-bottom: clamp(48px, 9vh, 110px);
  padding-top: calc(var(--header-h) + 40px);
  max-width: 760px;
}
.hero h1 { margin-bottom: 0.35em; }
.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: rgba(255,255,255,0.86);
  max-width: 560px;
  margin-bottom: 1.8em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* photo placeholder generic */
.photo-slot {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0 12px, rgba(0,0,0,0.05) 12px 24px);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--body);
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 24px;
  min-height: 220px;
  border-radius: var(--radius);
}
.dark .photo-slot {
  border-color: var(--dark-line);
  color: rgba(255,255,255,0.5);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0 12px, rgba(255,255,255,0.06) 12px 24px);
}

/* ---------- Sections ---------- */
section { padding: clamp(64px, 10vh, 120px) 0; }
.dark { background: var(--dark); color: var(--white); }
.dark .label, .dark p { color: rgba(255,255,255,0.72); }
.dark h1, .dark h2, .dark h3 { color: var(--white); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* ---------- Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  text-align: center;
}
.stat .num {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat .num.accent { color: var(--accent); }
.stat .cap {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--body);
  margin-top: 12px;
}
.dark .stat .cap { color: rgba(255,255,255,0.6); }

/* ---------- Package cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0,0,0,0.09); }
.card .card-img { min-height: 180px; border: 0; border-radius: 0; border-bottom: 1px dashed var(--line); }
.card-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin-bottom: 6px; }
.card-line { color: var(--body); font-size: 15px; margin-bottom: 18px; flex: 1; }
.card-price { font-weight: 600; font-size: 1.1rem; margin-bottom: 18px; }
.card .btn { align-self: flex-start; }

/* ---------- Before / after ---------- */
.ba {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--dark-line);
  aspect-ratio: 16 / 9;
  user-select: none;
  touch-action: pan-y;
}
.ba .ba-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 20px;
}
.ba .ba-before { background: linear-gradient(160deg, #3a3d44, #23262c); }
.ba .ba-after {
  background: linear-gradient(160deg, #1a1d22, #0c0e12);
  clip-path: inset(0 0 0 50%);
}
.ba .ba-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--white);
  transform: translateX(-1px);
  z-index: 3;
}
.ba .ba-handle::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 40px; height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.ba .ba-tag {
  position: absolute;
  bottom: 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.5);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 4;
}
.ba .tag-before { left: 12px; }
.ba .tag-after { right: 12px; }
.ba input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 5;
}

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.step .step-n {
  font-size: 12px;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--body); }
.dark .step p { color: rgba(255,255,255,0.72); }

/* ---------- Reviews ---------- */
.reviews { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.review {
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  padding: 28px;
  background: rgba(255, 255, 255, 0.03);
}
.review blockquote { margin: 0 0 16px; font-size: 1.05rem; line-height: 1.55; }
.review .who { font-size: 13px; color: rgba(255, 255, 255, 0.6); letter-spacing: 0.02em; }
.review .stars { color: var(--accent); letter-spacing: 2px; margin-bottom: 14px; font-size: 14px; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.dark .faq details { border-color: var(--dark-line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 40px 20px 0;
  font-weight: 500;
  font-size: 1.12rem;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--body);
  transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { content: "\2013"; }
.faq .faq-a { padding: 0 40px 22px 0; color: var(--body); }
.dark .faq .faq-a { color: rgba(255,255,255,0.72); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.pricing {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
  font-size: 15px;
}
table.pricing th, table.pricing td {
  text-align: left;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
table.pricing thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--body);
}
table.pricing td:last-child, table.pricing th:last-child { white-space: nowrap; }

/* ---------- Prose ---------- */
.prose { max-width: 760px; }
.prose p { color: var(--body); }
.prose h2 { color: var(--fg); margin-top: 1.2em; }

/* ---------- Compare (wax vs ceramic) ---------- */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.compare .col { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.compare .col.win { border-color: var(--accent); }
.compare ul { margin: 12px 0 0; padding-left: 18px; color: var(--body); }
.compare li { margin-bottom: 8px; }

/* Keep the always-dark feature sections identical in both themes: pin their
   muted text and borders to fixed on-dark values so the flipping base tokens
   never leak in. Also lifts a few pre-existing low-contrast spots. */
.dark .prose p,
.dark .compare ul { color: rgba(255, 255, 255, 0.72); }
.dark .compare .col { border-color: var(--dark-line); }
.dark table.pricing th, .dark table.pricing td { border-color: var(--dark-line); }
.dark table.pricing thead th { color: rgba(255, 255, 255, 0.6); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.call-block .big-call {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--fg);
  display: inline-block;
  margin: 8px 0 16px;
}
.call-block .big-call:hover { color: var(--accent); }
.hours-list { list-style: none; padding: 0; margin: 20px 0 0; }
.hours-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); max-width: 340px; color: var(--body); }

form.lead { display: grid; gap: 16px; }
form.lead label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 6px; }
form.lead input, form.lead select, form.lead textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}
form.lead input::placeholder, form.lead textarea::placeholder { color: var(--body); }
form.lead input:focus, form.lead select:focus, form.lead textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
form.lead textarea { min-height: 120px; resize: vertical; }
.map-slot { min-height: 260px; margin-top: 20px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: rgba(255,255,255,0.7); padding: 72px 0 40px; }
.site-footer a { color: rgba(255,255,255,0.8); text-decoration: none; }
.site-footer a:hover { color: var(--white); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.site-footer .f-word { color: var(--white); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; font-size: 14px; margin-bottom: 16px; }
.site-footer h4 { color: var(--white); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 16px; font-weight: 600; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 10px; font-size: 14px; }
.footer-bottom { border-top: 1px solid var(--dark-line); padding-top: 24px; font-size: 13px; color: rgba(255,255,255,0.5); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Floating call ---------- */
.floating-call {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  min-height: 44px;
}

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .nav { display: none; }
  .hamburger { display: block; }
  .floating-call { display: inline-flex; }
  /* Make room for the theme toggle next to the hamburger. */
  .site-header .wrap { gap: 10px; }
  .wordmark { font-size: 13px; letter-spacing: 0.08em; }
  .nav.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg);
    color: var(--fg);
    padding: 12px var(--pad) 20px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
  }
  .nav.open a.navlink { padding: 14px 0; font-size: 16px; width: 100%; border-bottom: 1px solid var(--line); opacity: 1; }
  .nav.open .header-phone { margin-top: 12px; background: var(--accent); color: var(--white); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Header + footer logos ---------- */
/* Header logo uses currentColor so it turns white over the hero and ink/white
   when the header is solid; the sparkle stays red. */
.wordmark { display: inline-flex; align-items: center; }
.site-logo { height: 30px; width: auto; display: block; }
.f-word .footer-logo { height: 30px; width: auto; display: block; }
@media (max-width: 720px) { .site-logo { height: 20px; } }

/* Price accent and packages note (to match Silverton). */
.price-accent { color: var(--accent); }
.note { color: var(--body); font-size: 14px; margin-top: 20px; }
