/* =====================================================================
   PulseDrivers static-page shell + site-review fixes (2.0.183, pd183sitereviewfe).
   Loaded by templates/main.html on every page, after pd-theme-light.css.
   Needs pd-theme.css tokens (:root). Every page rule is scoped under .pd-page
   (About, Catalog Statistics, Notifications, 404); 500.html is standalone and
   does not use this file.

   Light theme: the tokens flip in pd-theme-light.css. The hero band carries
   .pd-pulse-band, which pd-theme-light.css keeps dark, so the hero looks the
   same in both themes and the body follows the member's theme.

   Sections:
     1. Page ground + footer gap
     2. Hero band
     3. Body, panels, buttons
     4. About
     5. Catalog Statistics
     6. Notifications
     7. Error page (404)
     8. Site-wide fixes (footer, car page empty brand grid)
   ===================================================================== */

/* ---------- 1. Page ground + footer gap ---------- */
/* main.css has `body, .bg-light { background-color: #eee !important; }` */
body:has(.pd-page),
#content:has(.pd-page) { background-color: var(--pd-bg) !important; }
/* same rule as the main.css dark-page list (use ~, AdSense can sit between #content and footer) */
#content:has(.pd-page) ~ footer { margin-top: 0 !important; }

.pd-page {
  background: var(--pd-bg);
  color: var(--pd-text);
  font-family: var(--pd-font-body);
  padding-bottom: 3rem;
}
:where(.pd-page) a { color: var(--pd-accent-text); text-decoration: none; }
:where(.pd-page) a:hover,
:where(.pd-page) a:focus-visible { color: var(--pd-text); text-decoration: underline; }

/* ---------- 2. Hero band ---------- */
.pd-page-hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    var(--pd-dusk-glow),
    var(--pd-red-glow),
    var(--pd-carbon),
    var(--pd-bg);
  background-size: auto, auto, var(--pd-carbon-size), var(--pd-carbon-size), auto;
  background-position: 0 0, 0 0, var(--pd-carbon-pos), 0 0;
  border-bottom: 1px solid var(--pd-line);
  color: var(--pd-text);
  padding: 1.6rem 0 1.4rem;
}
.pd-page-hero.pd-pulse-band::before,
.pd-page-hero.pd-pulse-band::after { width: min(52%, 700px); }
@media (max-width: 575.98px) {
  .pd-page-hero.pd-pulse-band::before,
  .pd-page-hero.pd-pulse-band::after { width: 100%; }
}
.pd-page-eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  margin: 0 0 .25rem;
  color: var(--pd-silver);
  font-family: var(--pd-font-display);
  font-size: .95rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.pd-page-eyebrow::before {
  content: ""; flex: 0 0 auto; width: 2.15rem; height: 1em;
  background: var(--pd-accent);
  -webkit-mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
          mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
}
.pd-page-title {
  margin: 0;
  color: #fff;
  font-family: var(--pd-font-display); font-style: italic; font-weight: 800;
  text-transform: uppercase; letter-spacing: .01em; line-height: 1;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  max-width: 80%;
  overflow-wrap: break-word;
}
@media (max-width: 575.98px) { .pd-page-title { max-width: 100%; } }
.pd-page-lead {
  margin: .55rem 0 0; max-width: 46rem;
  color: var(--pd-text-2);
  font-size: clamp(.98rem, 2.2vw, 1.08rem); line-height: 1.5;
}
.pd-page-crumbs { margin: .7rem 0 0; }
.pd-page-crumbs ol {
  display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none;
  font-size: .9rem;
}
.pd-page-crumbs li { color: var(--pd-text-2); }
.pd-page-crumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--pd-muted); }
.pd-page-crumbs a { color: var(--pd-accent-text); font-weight: 600; }
.pd-page-crumbs a:hover, .pd-page-crumbs a:focus-visible { color: #fff; }
.pd-page-crumbs [aria-current="page"] { color: var(--pd-text); }

/* ---------- 3. Body, panels, buttons ---------- */
.pd-page-body { padding-top: 1.75rem; }
.pd-page-section { margin: 0 0 2rem; max-width: 52rem; }
.pd-page-section--wide { max-width: none; }
.pd-page-h2 {
  margin: 0 0 .6rem;
  color: var(--pd-text);
  font-family: var(--pd-font-display); font-style: italic; font-weight: 800;
  text-transform: uppercase; letter-spacing: .01em; line-height: 1.05;
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
}
.pd-page-section p { color: var(--pd-text-2); line-height: 1.65; margin: 0 0 .9rem; }
.pd-page-panel {
  background: var(--pd-surface-2);
  border: 1px solid var(--pd-line);
  border-top: 3px solid var(--pd-accent);
  border-radius: var(--pd-radius);
  padding: 1.1rem 1.2rem;
  color: var(--pd-text);
}
.pd-page-actions { display: flex; flex-wrap: wrap; gap: .9rem 1.4rem; align-items: center; margin: 1rem 0 0; padding-left: .4rem; }
/* .pd-btn-race (pd-theme.css) is the red slanted CTA; keep its label white on links inside the page */
.pd-page a.pd-btn-race,
.pd-page a.pd-btn-race:hover,
.pd-page a.pd-btn-race:focus-visible { color: var(--pd-accent-contrast); text-decoration: none; }
.pd-page-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 2.25rem; padding: .3rem .8rem;
  border: 1px solid var(--pd-line-2); border-radius: 999px;
  background: transparent;
  color: var(--pd-text) !important;
  font-size: .9rem; font-weight: 600; text-decoration: none !important;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.pd-page-chip:hover, .pd-page-chip:focus-visible {
  border-color: var(--pd-accent); background: var(--pd-accent-soft); color: var(--pd-text) !important;
}
.pd-page-chip:focus-visible { outline: 2px solid var(--pd-accent-text); outline-offset: 2px; }

/* ---------- 4. About ---------- */
.pd-about-grid {
  display: grid; gap: .9rem;
  grid-template-columns: 1fr;
  margin: 0; padding: 0; list-style: none;
}
@media (min-width: 576px) { .pd-about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .pd-about-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-about-person { display: flex; flex-direction: column; gap: .2rem; height: 100%; }
.pd-about-person-name {
  margin: 0; color: var(--pd-text);
  font-family: var(--pd-font-display); font-weight: 800; font-style: italic;
  text-transform: uppercase; font-size: 1.3rem; line-height: 1.1;
  overflow-wrap: anywhere;
}
.pd-about-person-role { margin: 0 0 .5rem; color: var(--pd-muted); font-size: .9rem; }
.pd-about-person-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: auto; }

/* ---------- 5. Catalog Statistics ---------- */
.pd-stats-list {
  display: grid; gap: .9rem;
  grid-template-columns: 1fr;
  margin: 0; padding: 0; list-style: none;
}
@media (min-width: 768px) { .pd-stats-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .pd-stats-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-stats-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: .9rem; align-items: start; height: 100%; }
.pd-stats-logo {
  display: flex; align-items: center; justify-content: center;
  width: 88px; height: 64px; padding: .35rem .45rem;
  background: #fff; border-radius: var(--pd-radius-sm);
}
.pd-stats-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pd-stats-name {
  margin: 0 0 .45rem; color: var(--pd-text);
  font-family: var(--pd-font-display); font-weight: 800; font-style: italic;
  text-transform: uppercase; font-size: 1.35rem; line-height: 1.05;
  overflow-wrap: anywhere;
}
.pd-stats-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .8rem; margin: 0; }
.pd-stats-facts > div { min-width: 0; }
.pd-stats-facts dt { color: var(--pd-muted); font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.pd-stats-facts dd { margin: 0; color: var(--pd-text); font-family: var(--pd-font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.1; }
.pd-stats-meter { grid-column: 1 / -1; margin-top: .15rem; }
.pd-stats-meter-label { display: flex; justify-content: space-between; gap: .5rem; color: var(--pd-muted); font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.pd-stats-meter-label strong { color: var(--pd-text); font-family: var(--pd-font-display); font-size: 1rem; letter-spacing: 0; }
.pd-stats-bar { position: relative; height: .55rem; margin-top: .25rem; border-radius: 999px; background: var(--pd-surface-3); overflow: hidden; }
.pd-stats-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--pd-accent); }
.pd-stats-link { display: inline-block; margin-top: .6rem; font-size: .9rem; font-weight: 600; }

/* ---------- 6. Notifications ---------- */
.pd-notes { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; max-width: 52rem; }
.pd-note { padding: .9rem 1.1rem; border-top-width: 1px; }
.pd-note.is-new { border-left: 4px solid var(--pd-accent); }
.pd-note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .35rem; color: var(--pd-muted); font-size: .85rem; }
.pd-note-new {
  display: inline-flex; align-items: center; padding: .05rem .5rem; border-radius: 999px;
  background: var(--pd-accent); color: var(--pd-accent-contrast);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.pd-note-body { color: var(--pd-text); line-height: 1.55; overflow-wrap: anywhere; }
.pd-note-body a { font-weight: 600; }
.pd-page-empty { max-width: 40rem; }
.pd-page-empty-title { margin: 0 0 .35rem; font-family: var(--pd-font-display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 1.35rem; color: var(--pd-text); }
.pd-page-empty p { margin: 0; color: var(--pd-text-2); }

/* ---------- 7. Error page (404) ---------- */
.pd-error-code {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 0 .6rem; padding: .05rem .7rem;
  font-family: var(--pd-font-display); font-style: italic; font-weight: 800; font-size: 1.4rem; line-height: 1.15;
  color: #0e0f11; background: #fff; border-radius: .3rem;
  box-shadow: inset 0 0 0 2px #0e0f11, 0 0 0 1px #fff;
}
.pd-error-path { color: var(--pd-text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; overflow-wrap: anywhere; }
.pd-error-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  .pd-page-chip { transition: none; }
}

/* ---------- 8. Site-wide fixes ---------- */
/* Footer (templates/footer.html): the location line is plain text now (was a dead href="#"),
   and the four social buttons share one size. */
footer .pd-footer-place { color: rgba(255, 255, 255, .75); }
footer .pd-footer-social .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; min-height: 2.25rem; padding: .25rem .5rem; }

/* Car page (cars/car.html) "Who makes it": hide the heading and the grid when no diecast brand makes the car
   (39 of 650 car pages printed the heading over an empty grid). CSS only so the paused Deploy C car.html is
   not touched; Deploy C can move this to an {% if supporting_brands %} later. */
/* :has() cannot nest inside :has(), so the heading test is :has(+grid):not(:has(+grid > *)); two rules so one bad selector never drops both */
.pd-cars-section-head:has(+ .pd-cars-grid):not(:has(+ .pd-cars-grid > *)) { display: none; }
.pd-cars-section-head + .pd-cars-grid:not(:has(> *)) { display: none; }
