/* layout-a.css — Style A page-level layout (Parent Pat route /)
 * Page-specific class definitions consumed by site/index.html.
 * Loaded LAST in the chain so it can override component base + finishes if needed.
 */

/* === Site header / nav === */
.site-header {
  padding: var(--space-3) 0;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-surface-offset);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header__wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-header__cta {
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-5);
  min-height: 40px;
}

/* === Hero === */
.hero {
  padding: var(--space-16) 0 var(--space-12);
  border-bottom: 1px solid var(--color-surface-offset);
}
.hero h1 {
  margin-bottom: var(--space-5);
  max-width: 22ch;
}
.hero__sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  max-width: 52ch;
  line-height: 1.45;
}
.hero__cta {
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-8);
}
.hero__trust {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* === Sections (generic vertical rhythm) === */
.rule-section,
.calc-section,
.audit-section,
.who-section {
  padding: var(--space-12) 0;
  border-bottom: 1px solid var(--color-surface-offset);
}

/* === 20/4/10 rule grid === */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin: 0 0 var(--space-6);
}
.stat-card-a .stat-body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.45;
  margin: var(--space-3) 0 0;
}
.rule-section__caption {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* === Calculator card === */
.calc-section__intro {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}
.calc-card {
  background: var(--color-surface);
}
.calc-row {
  margin-bottom: var(--space-5);
}
.calc-row label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.calc-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.calc-input-row input[type="range"] {
  flex: 1;
  accent-color: var(--color-cta-active);
}
.calc-input-row output {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  min-width: 5ch;
  text-align: right;
}

/* === Quick/Custom depth toggle + structured inputs (spec §2/§4) === */
.calc-depth {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-full, 9999px);
  background: var(--color-surface-offset);
  box-shadow: var(--neuro-inset, inset 2px 2px 5px #d4cfc7, inset -2px -2px 5px #ffffff);
}
.calc-depth__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.5rem 1rem;
  min-height: 40px;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
}
.calc-depth__btn.is-active {
  background: var(--color-cta);
  color: var(--color-cta-text);
}
.calc-depth__note {
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (min-width: 560px) {
  .calc-grid { grid-template-columns: 1fr 1fr; }
}
.calc-row--field {
  margin-bottom: 0;
}
.calc-row--field input,
.calc-row--field select {
  width: 100%;
  font: inherit;
  font-size: var(--text-base);
  padding: 0.625rem 0.75rem;
  min-height: 44px;
  border: var(--neuro-border, 1px solid #e0dad0);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--color-surface-2, #fff);
  color: var(--color-text);
}
.calc-row--field input:focus-visible,
.calc-row--field select:focus-visible {
  outline: 2px solid var(--color-cta-active);
  outline-offset: 1px;
}
.calc-custom {
  margin-bottom: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-surface-offset);
}
.calc-custom__intro {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.calc-checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.calc-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
}
.calc-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-cta-active);
}

.calc-result {
  margin-top: var(--space-6);
  padding: var(--space-5);
}
.calc-result__line {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  color: var(--color-text);
}
.calc-result__note {
  margin: calc(var(--space-2) * -0.5) 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text-muted, var(--color-text));
  opacity: 0.8;
}
.calc-result__verdict {
  margin: var(--space-3) 0 0;
  font-size: var(--text-base);
  font-weight: 600;
}
.calc-result__verdict[data-state="pass"] { color: var(--color-success); }
.calc-result__verdict[data-state="warn"] { color: var(--color-warning); }
.calc-result__verdict[data-state="fail"] { color: var(--color-error); }
.calc-result__verdict[data-state="unavailable"] { color: var(--color-warning); }

/* Insurance / fuel line items injected by calc.js — separate first-class
   lines (spec §6) each carrying a confidence label (spec §11). */
.calc-line__label { color: var(--color-text-muted); }
.calc-line__value { color: var(--color-text); }
.calc-line__tag {
  display: inline-block;
  margin-left: var(--space-1);
  padding: 0.05em 0.5em;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  color: var(--color-primary);
  background: rgba(92, 143, 153, 0.14);
  vertical-align: middle;
}
.calc-line__tag:empty { display: none; }
/* Brand promise (spec §11) rendered onto the calculator surface. */
.calc-result__promise {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid rgba(35, 21, 21, 0.10);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
}

/* === Audit list === */
.audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.audit-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-surface-offset);
  font-size: var(--text-base);
  color: var(--color-text);
}
.audit-list li:last-child { border-bottom: none; }
.audit-list__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--color-success);
  margin-top: 2px;
}
.audit-section__cta {
  margin: var(--space-8) 0 0;
}
.audit-section__showroom {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
}
.audit-section__showroom a {
  color: var(--color-text-secondary, currentColor);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.audit-section__showroom a:hover,
.audit-section__showroom a:focus-visible {
  color: var(--color-accent);
}

/* === Who-this-is-for === */
.who-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
.who-card h3 {
  margin: 0 0 var(--space-3);
  font-style: italic;
}
.who-card--yes h3 { color: var(--color-success); }
.who-card--no h3 { color: var(--color-error); }
.who-card ul {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.who-card ul li { margin: var(--space-2) 0; line-height: 1.45; }

/* === Footer === */
footer {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-surface-offset);
}
.footer__disclosure {
  padding: var(--space-4);
  border: 1px solid var(--color-surface-offset);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
}
.footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* === Responsive (mobile <=580px) === */
@media (max-width: 580px) {
  .rule-grid { grid-template-columns: 1fr; }
  .who-grid { grid-template-columns: 1fr; }
  .site-header__wrap { gap: var(--space-2); }
  .site-header__cta { font-size: 11px; padding: var(--space-1) var(--space-3); min-height: 36px; }
  .hero { padding: var(--space-10) 0 var(--space-8); }
  .rule-section,
  .calc-section,
  .audit-section,
  .who-section { padding: var(--space-8) 0; }
}

/* === Dealer Markup Watch ticker (Style A static variant) === */
.c-ticker--a .c-ticker__list--static {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) 0;
}
.c-ticker--a .c-ticker__item {
  font-size: var(--text-xs);
  white-space: normal;
}
@media (min-width: 768px) {
  .c-ticker--a .c-ticker__list--static {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
  }
  .c-ticker--a .c-ticker__item {
    white-space: nowrap;
  }
}

/* === Mobile sticky CTA (TRD §12, ISSUE-004 mitigation) === */
@media (max-width: 430px) {
  .hero__cta {
    /* Promote primary CTA to bottom-sticky on mobile */
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    bottom: var(--space-3);
    z-index: 90;
    text-align: center;
    box-shadow: 0 -4px 16px rgba(35, 21, 21, 0.12);
  }
  /* Add bottom padding to body so content isn't hidden behind sticky CTA */
  main { padding-bottom: var(--space-20); }
}

/* Cross-route persona switch link (S1 — TRD v1.5 §7.1)
 * Subtle muted link in header, hides on mobile < 560px in favor of footer link.
 */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.site-header__switch {
  font-size: var(--text-sm);
  color: var(--color-text-muted, #6b4c40);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.site-header__switch:hover,
.site-header__switch:focus-visible {
  color: #231515;
  border-bottom-color: currentColor;
}
@media (max-width: 560px) {
  .site-header__switch { display: none; }
}

/* Mobile-fallback switch link (S1 — TRD v1.5 §7.4)
 * Always visible in footer; header link hides at <=560px so mobile users find it here.
 */
.footer__switch {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
}
.footer__switch a {
  color: var(--color-text-muted, #6b4c40);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}
.footer__switch a:hover,
.footer__switch a:focus-visible {
  color: #231515;
}
