/* =====================================================================
   Dental Authority Sites — Demo Library
   base.css · shared layer for all eight systems ("one codebase, eight skins")
   Pair with exactly ONE file from ./tokens/ — never two, never zero.
   Consumes the token API defined in design-systems/00-foundations.md.
   Structural/component markup ships with the Porcelain reference build;
   this file styles the shared inventory strictly through variables.
   ===================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body, 1.0625rem);
  line-height: var(--lh-body, 1.65);
  color: var(--text-body, var(--ink));
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, picture, video, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
/* NQ-73: --accent-text is the accent printed as text on a light background. A skin
   whose accent is too faint there sets it; --accent stays the fill colour. */
a { color: var(--accent-text, var(--accent)); text-decoration: none; }
/* NQ-76: --accent-hover is also a button fill. A skin whose hovered link would be
   too faint sets --link-hover. */
a:hover { color: var(--link-hover, var(--accent-hover)); }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---------- Foundations defaults ---------- */
:root {
  --radius-pill: 999px;
  --space-section: clamp(4rem, 8vw, 6.5rem);
  --container: 1200px;
  --gutter: 24px;
  --speed: 180ms;           /* systems may slow (Marble/Gilt) or tighten (Quartz) */
  --ease: ease-out;
}
/* Breakpoints (reference — media queries can't read vars): 640 / 768 / 1024 / 1280 */

/* ---------- Layout ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-section); }
.section-alt { background: var(--bg-alt); }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); }
/* Small screens: the 12-col grid collapses to one column; class-based spans
   (span-3/4/6) only apply from 768px up, so no inline style fights this rule. */
@media (max-width: 767px) {
  .grid-12 { grid-template-columns: minmax(0, 1fr); }
  .grid-12 > * { grid-column: 1 / -1; min-width: 0; }
}
@media (min-width: 768px) {
  .grid-12 > .span-1 { grid-column: span 1; }
  .grid-12 > .span-2 { grid-column: span 2; }
  .grid-12 > .span-3 { grid-column: span 3; }
  .grid-12 > .span-4 { grid-column: span 4; }
  .grid-12 > .span-6 { grid-column: span 6; }
  .grid-12 > .span-12 { grid-column: span 12; }
}
.split { display: grid; gap: calc(var(--gutter) * 2); align-items: center; }
@media (min-width: 768px) { .split { grid-template-columns: 1fr 1fr; } }
.prose { max-width: 70ch; }
.prose > * + * { margin-top: 1em; }
/* NQ-38: plain pages. Long words and addresses wrap on a phone; a linked
   heading (/privacy#privacy-choices) stops below the sticky header. */
.das-page { overflow-wrap: break-word; }
.das-page [id] { scroll-margin-top: 5.5rem; }
/* NQ-66: a differentiator whose big line is text (not a short figure) prints at
   heading size so it fits its column. Ink, like a heading: below 24px several
   skins' accent colour would be too faint. A word wider than its column breaks. */
.das-diff-title {
  font-size: var(--fs-h3, 1.25rem);
  font-weight: var(--display-weight, 600);
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* ---------- Typography structure (each system refines in its token file) ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: var(--display-weight, 600);
  line-height: 1.15;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1, clamp(2.5rem, 5vw, 3.5rem)); }
h2 { font-size: var(--fs-h2, clamp(1.875rem, 3.5vw, 2.375rem)); }
h3 { font-size: var(--fs-h3, 1.25rem); }
.eyebrow {
  display: block;
  font-family: var(--font-utility, var(--font-body));
  font-size: var(--fs-eyebrow, 0.8125rem);
  font-weight: var(--eyebrow-weight, 600);
  letter-spacing: var(--eyebrow-tracking, 0.08em);
  text-transform: uppercase;
  color: var(--eyebrow-color, var(--accent-text, var(--accent)));
  margin-bottom: 0.875rem;
}
.lede { font-size: 1.125rem; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--btn-font, var(--font-body));
  font-weight: var(--btn-weight, 600);
  font-size: var(--btn-size, 0.9375rem);
  text-transform: var(--btn-case, none);
  letter-spacing: var(--btn-tracking, 0);
  padding: var(--btn-pad, 0.875rem 1.75rem);
  border: 1px solid transparent;
  border-radius: var(--radius-btn, var(--radius-sm));
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease),
              border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--btn-primary-ink, var(--ink-inverse)); }
.btn-primary:hover { background: var(--accent-hover); color: var(--btn-primary-ink, var(--ink-inverse)); }
.btn-secondary {
  background: transparent;
  color: var(--btn-secondary-ink, var(--ink));
  border-color: var(--btn-secondary-border, var(--line));
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-text, var(--accent)); }
.btn-ghost { background: none; border: none; padding: 0; color: var(--accent-text, var(--accent)); border-radius: 0; }
.btn-ghost::after { content: "\2192"; transition: transform var(--speed) var(--ease); }
.btn-ghost:hover::after { transform: translateX(4px); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow, none);
  padding: var(--card-pad, 1.75rem);
  transition: box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease),
              transform var(--speed) var(--ease);
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.5rem; }
.field label {
  font-family: var(--font-utility, var(--font-body));
  font-size: 0.875rem;
  font-weight: var(--label-weight, 500);
  color: var(--ink);
}
.input, .field input, .field textarea, .field select {
  width: 100%;
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8125rem 1rem;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.field :is(input, textarea, select):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.field .hint { font-size: 0.8125rem; color: var(--muted); }
.field .error { font-size: 0.8125rem; color: #B4231F; }

/* ---------- Shared units ---------- */
.rule { height: 1px; background: var(--line); border: 0; }
.band { background: var(--bg-dark); color: var(--ink-inverse); }
.band h1, .band h2, .band h3 { color: var(--ink-inverse); }
/* NQ-73: --accent-text is mixed for light backgrounds. On the dark band and footer
   an accent link keeps the accent itself. NQ-76: --link-hover is mixed for light
   backgrounds too, so a hovered link there keeps --accent-hover. */
.band, footer { --accent-text: var(--accent); --link-hover: var(--accent-hover); }
.hours-table { width: 100%; border-collapse: collapse; }
.hours-table td { padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.hours-table tr.today { background: var(--accent-tint); }
.logo-strip { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; opacity: 0.75; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { padding: 1.125rem 0; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
.faq-item[open] summary { color: var(--accent-text, var(--accent)); }
.faq-item p { padding-bottom: 1.125rem; }
.testimonial .stars { color: var(--accent-text, var(--accent)); letter-spacing: 0.1em; }
.testimonial cite { font-style: normal; color: var(--muted); font-size: 0.875rem; }

/* ---------- Header & mobile conversion bar ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }

/* Primary nav — desktop shows the inline links, <1024px collapses to the
   hamburger + [data-das-menu] panel. These rules lived in each demo page's
   inline <style> block and never made it into base.css at port time. */
.nav-links {
  display: flex;
  gap: var(--nav-gap, 1.75rem);
  margin-inline-start: auto;
  align-items: center;
}
.nav-phone { font-weight: 600; color: var(--ink); white-space: nowrap; }
.nav-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn, var(--radius-sm));
  padding: 0.5rem 0.625rem;
  color: var(--ink);
  margin-inline-start: auto;
}
@media (max-width: 1023px) {
  .nav-links, .nav-phone { display: none; }
  .nav-menu-btn { display: inline-flex; }
}
@media (min-width: 1024px) {
  [data-das-menu] { display: none; }
}
.mobile-cta-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  padding: 0.625rem calc(var(--gutter) * 0.75);
  padding-bottom: calc(0.625rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
@media (min-width: 768px) { .mobile-cta-bar { display: none; } }
/* Header booking CTA is hidden <=767px only when the mobile bar renders
   (header.blade.php adds .has-mobile-bar under the same option as mobile-bar.blade.php). */
@media (max-width: 767px) { .has-mobile-bar { display: none; } }
/* NQ-31: while the mobile bar renders, nothing may sit on top of it, and it must not
   hide the end of the page. The bar gets one fixed height on every skin so the two
   offsets below are exact. */
@media (max-width: 767px) {
  :root { --das-mobile-bar-h: 4.8125rem; }
  .mobile-cta-bar {
    box-sizing: border-box;
    height: calc(var(--das-mobile-bar-h) + env(safe-area-inset-bottom));
    grid-template-rows: minmax(0, 1fr);
  }
  .mobile-cta-bar .btn { min-height: 0; padding-block: 0; line-height: 1.25; text-align: center; }
  /* Consent notice (Klaro) sits directly above the bar. */
  body:has(.mobile-cta-bar) #das-consent .cookie-notice:not(.cookie-modal-notice) {
    bottom: calc(var(--das-mobile-bar-h) + env(safe-area-inset-bottom));
    max-height: 45vh;
    overflow-y: auto;
  }
  /* Room under the footer so its last row ("Privacy choices") scrolls clear of the bar. */
  body:has(.mobile-cta-bar) footer:has([data-das-consent-open]) {
    padding-bottom: calc(var(--das-mobile-bar-h) + env(safe-area-inset-bottom));
  }
}

/* ---------- Readable pairs (NQ-67) ---------- */
/* Home's insurance band sits on --accent-tint, where five skins' accent or gold
   text was under 4.5 to 1. Heading ink passes on all eight. */
#insurance .eyebrow, #insurance .btn-ghost { color: var(--ink); }
/* Consent notice and its dialog: Klaro's light theme has a green (links, Save)
   and a grey (Decline) under 4.5 to 1. Vendored files stay untouched; the id
   outranks them. #147a5c is 5.1 against #fafafa, #666666 is 5.7 against white. */
/* The notice title would otherwise take the page's h2 size. */
#das-consent .klaro .cookie-notice:not(.cookie-modal-notice) h2 { font-size: 1.0625rem; }
#das-consent .klaro .cookie-notice a, #das-consent .klaro .cookie-modal a { color: #147a5c; }
#das-consent .klaro .cookie-notice .cm-btn.cm-btn-danger, #das-consent .klaro .cookie-modal .cm-btn.cm-btn-danger { background-color: #666666; }
#das-consent .klaro .cookie-notice .cm-btn.cm-btn-success, #das-consent .klaro .cookie-modal .cm-btn.cm-btn-success { background-color: #147a5c; }

/* ---------- Accessibility floor ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--skip-ink, var(--ink-inverse)); padding: 0.75rem 1.25rem;
}
.skip-link:focus { left: 0; }
/* NQ-76: a:hover outranks .skip-link and painted accent text on the accent fill. */
.skip-link:hover { color: var(--skip-ink, var(--ink-inverse)); }
@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;
  }
}
