/* Audit request pages: /audit/ and /<rep>/digital/audit/.
   Every rule sits under body.audit-v2, so nothing else on the site is touched. Brand tokens only.
   The navy hero carries data-theme="dark" and the white sample card inside it data-theme="light"
   (both scopes come from the brand CSS), so text, focus rings and the card's shadow pick up the
   right tokens on each ground. */

/* ---------- Hero ---------- */
/* Inside data-theme="dark", --surface is Navy Ink. */
.audit-v2 .av-hero { background: var(--surface); color: var(--on-deep); padding: var(--space-8) 0; }
.audit-v2 .av-hero__grid { display: grid; gap: var(--space-7); align-items: center; }
.audit-v2 .av-hero__copy { min-width: 0; }
.audit-v2 .av-hero .cs-eyebrow { color: var(--sea-mist); }
.audit-v2 .av-hero h1.cs-heading { font-size: 44px; line-height: 50px; letter-spacing: -0.005em; color: var(--on-deep); }
.audit-v2 .av-hero h1.cs-heading em { color: var(--accent-on-deep); }
.audit-v2 .av-hero .cs-lead { color: var(--on-deep); }
.audit-v2 .av-hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-5); margin-top: var(--space-6); }
.audit-v2 .av-hero__note { margin: 0; color: var(--sea-mist); }
@media (min-width: 1000px) {
  .audit-v2 .av-hero { padding: var(--space-9) 0; }
  .audit-v2 .av-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); }
}
@media (min-width: 1200px) {
  .audit-v2 .av-hero h1.cs-heading { font-size: 64px; line-height: 68px; letter-spacing: -0.01em; }
}

/* ---------- Sample report card ---------- */
.audit-v2 .av-sample { min-width: 0; box-shadow: var(--shadow-print); }
.audit-v2 .av-card { background: var(--surface-raised); color: var(--ink-body); }
.audit-v2 .av-card p, .audit-v2 .av-card ul, .audit-v2 .av-card h2, .audit-v2 .av-card h3 { margin: 0; }
.audit-v2 .av-card ul { padding: 0; list-style: none; }
.audit-v2 .av-card .label { color: var(--ink-muted); }
.audit-v2 .av-card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); padding: var(--space-4); border-bottom: 1px solid var(--line); }
.audit-v2 .av-tabs { display: none; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4) var(--space-4) 0; }
.audit-v2 .av-sample.is-live .av-tabs { display: flex; }
.audit-v2 .av-tab { min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--ink-muted); border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink);
  font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; }
.audit-v2 .av-tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.audit-v2 .av-views { padding: var(--space-5) var(--space-4); }
.audit-v2 .av-view { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.audit-v2 .av-view > p:not([class]) { color: var(--ink); }
/* Without the script all four views show, stacked, each under its name. */
.audit-v2 .av-view + .av-view { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--line); }
/* With the script the views share one grid cell, so the card keeps the height of the tallest view. */
.audit-v2 .av-sample.is-live .av-views { display: grid; }
.audit-v2 .av-sample.is-live .av-view { grid-area: 1 / 1; margin-top: 0; padding-top: 0; border-top: 0; visibility: hidden; }
.audit-v2 .av-sample.is-live .av-view.is-active { visibility: visible; }
.audit-v2 .av-sample.is-live .av-view__name { display: none; }
.audit-v2 .av-card__foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
@media (min-width: 600px) {
  .audit-v2 .av-card__head { padding: var(--space-4) var(--space-5); }
  .audit-v2 .av-tabs { padding: var(--space-4) var(--space-5) 0; }
  .audit-v2 .av-views { padding: var(--space-5); }
  .audit-v2 .av-card__foot { padding: var(--space-3) var(--space-5); }
}

/* Google Maps view. Dot, ring and bar sizes are the graphic's own, taken from the approved design. */
.audit-v2 .av-maps__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.audit-v2 .av-maps__grid { display: grid; grid-template-columns: repeat(5, 34px); gap: var(--space-2); padding: var(--space-4); background: var(--cloud-blue); }
.audit-v2 .av-dot { display: grid; place-items: center; height: 34px; border: 1px solid var(--ink-muted); border-radius: var(--radius-full); background: var(--surface-raised); color: var(--ink-body); font-size: 12px; line-height: 16px; font-weight: 600; }
.audit-v2 .av-dot--top { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.audit-v2 .av-dot--mid { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.audit-v2 .av-maps__key { flex: 1 1 150px; display: grid; gap: var(--space-2); color: var(--ink-body); }
.audit-v2 .av-maps__key li { display: flex; align-items: center; gap: var(--space-3); }
.audit-v2 .av-swatch { flex: none; width: var(--space-4); height: var(--space-4); border: 1px solid var(--ink-muted); border-radius: var(--radius-full); background: var(--surface-raised); }
.audit-v2 .av-swatch--top { border-color: var(--ink); background: var(--ink); }
.audit-v2 .av-swatch--mid { border-color: var(--accent); background: var(--accent); }

/* AI answers view */
.audit-v2 .av-ai__ask { align-self: flex-end; max-width: 86%; padding: var(--space-3) var(--space-4); background: var(--ink); color: var(--surface); font-size: 15px; line-height: 24px; }
.audit-v2 .av-ai__answer { display: grid; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--line); }
.audit-v2 .av-ai__answer ul { display: grid; gap: var(--space-2); }
.audit-v2 .av-ai__answer li, .audit-v2 .av-ai__you { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); color: var(--ink); }
.audit-v2 .av-ai__you { padding: var(--space-3) var(--space-4); background: var(--surface-mist); }
.audit-v2 .av-ai__you strong { font-weight: 600; }

/* Website view */
.audit-v2 .av-site__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.audit-v2 .av-ring { position: relative; flex: none; width: 132px; height: 132px; }
.audit-v2 .av-ring svg { display: block; }
.audit-v2 .av-ring__track { stroke: var(--line); }
.audit-v2 .av-ring__value { stroke: var(--ink); }
.audit-v2 .av-ring__label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.audit-v2 .av-ring__of { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.audit-v2 .av-site__notes { flex: 1 1 200px; display: grid; gap: var(--space-3); }
.audit-v2 .av-site__notes > p { color: var(--ink); }
.audit-v2 .av-site__notes ul { display: grid; gap: var(--space-3); }
.audit-v2 .av-site__notes li { display: flex; align-items: center; gap: var(--space-3); }
.audit-v2 .av-icon { flex: none; color: var(--accent-text); }
.audit-v2 .av-icon--flat { color: var(--ink-muted); }

/* Reviews view */
.audit-v2 .av-bar { display: grid; gap: var(--space-2); }
.audit-v2 .av-bar__meta { display: flex; justify-content: space-between; gap: var(--space-3); }
.audit-v2 .av-bar__track { height: var(--space-3); background: var(--line); }
.audit-v2 .av-bar__fill { height: 100%; transform-origin: left; }
.audit-v2 .av-bar__fill--you { width: 34%; background: var(--ink); }
.audit-v2 .av-bar__fill--them { width: 100%; background: var(--accent); }

/* The card only moves when the visitor hasn't asked for reduced motion (the script checks too). */
@media (prefers-reduced-motion: no-preference) {
  .audit-v2 .av-sample.is-live .av-view.is-active { animation: av-rise .4s ease both; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-dot { animation: av-rise .4s ease both; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-dot:nth-child(n+6) { animation-delay: .15s; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-dot:nth-child(n+11) { animation-delay: .3s; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-dot:nth-child(n+16) { animation-delay: .45s; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-dot:nth-child(n+21) { animation-delay: .6s; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-ring__value { animation: av-draw 1s ease both; }
  .audit-v2 .av-sample.is-live .av-view.is-active .av-bar__fill { animation: av-grow .8s ease both; }
}
@keyframes av-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes av-draw { from { stroke-dashoffset: 302; } to { stroke-dashoffset: 85; } }
@keyframes av-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Sections under the hero ---------- */
.audit-v2 .av-section { padding: var(--space-8) 0; }
@media (min-width: 900px) { .audit-v2 .av-section { padding: var(--space-9) 0; } }
.audit-v2 .av-section .cs-eyebrow { color: var(--ink-muted); }

/* What the audit shows */
.audit-v2 .av-shows__grid { display: grid; gap: var(--space-6); margin-top: var(--space-7); }
.audit-v2 .av-shows__item { display: grid; align-content: start; justify-items: start; gap: var(--space-3); min-width: 0; }
.audit-v2 .av-shows__item h3, .audit-v2 .av-shows__item p { margin: 0; }
@media (min-width: 640px) and (max-width: 999px) {
  .audit-v2 .av-shows__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-v2 .av-shows__item:nth-child(odd) { padding-right: var(--space-5); border-right: 1px solid var(--line); }
}
@media (min-width: 1000px) {
  .audit-v2 .av-shows__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .audit-v2 .av-shows__item:not(:last-child) { padding-right: var(--space-5); border-right: 1px solid var(--line); }
}
.audit-v2 .av-plan { max-width: none; margin: var(--space-7) 0 0; padding: var(--space-5) var(--space-4); background: var(--surface-mist); color: var(--ink); }
@media (min-width: 640px) { .audit-v2 .av-plan { padding: var(--space-5) var(--space-6); } }

/* How it works */
.audit-v2 .av-how { background: var(--surface-sand); }
.audit-v2 .av-how .cs-eyebrow { color: var(--ink-body); }
.audit-v2 .av-how .cs-rule { background: var(--ink); }
.audit-v2 .av-steps { display: grid; gap: var(--space-5); margin: var(--space-7) 0 0; padding: 0; list-style: none; }
.audit-v2 .av-step { display: grid; align-content: start; gap: var(--space-3); min-width: 0; padding: var(--space-6); background: var(--surface-raised); }
.audit-v2 .av-step h3, .audit-v2 .av-step p { margin: 0; }
.audit-v2 .av-step__num { color: var(--accent-text); }
@media (min-width: 900px) { .audit-v2 .av-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Request form ---------- */
.audit-v2 .av-request__grid { display: grid; gap: var(--space-7); align-items: start; }
.audit-v2 .av-request__intro { min-width: 0; }
@media (min-width: 1000px) {
  .audit-v2 .av-request__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto 1fr; gap: var(--space-6) var(--space-8); }
  /* The rep block follows the form in the source so a phone reaches the fields first; on desktop it sits under the reassurances. */
  .audit-v2 .av-request__grid > .audit__panel { grid-column: 2; grid-row: 1 / span 2; }
  .audit-v2 .av-request__grid > .av-rep { grid-column: 1; grid-row: 2; }
}
/* On a phone the hero button lands on the eyebrow, not on the section's top padding. */
@media (max-width: 599px) { .audit-v2 .av-request { scroll-margin-top: calc(-1 * var(--space-6)); } }
.audit-v2 .av-reassure { display: grid; gap: var(--space-3); margin: var(--space-6) 0 0; padding: 0; list-style: none; }
.audit-v2 .av-reassure li { display: flex; align-items: flex-start; gap: var(--space-3); }
.audit-v2 .av-reassure strong { font-weight: 600; color: var(--ink); }

/* Who you'll hear from (rep pages) */
.audit-v2 .av-rep { padding-top: var(--space-5); border-top: 1px solid var(--line); }
.audit-v2 .av-rep h3, .audit-v2 .av-rep p { margin: 0; }
.audit-v2 .av-rep h3 { color: var(--ink-muted); }
.audit-v2 .av-rep__row { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-3); }
.audit-v2 .av-rep__photo { flex: none; display: block; width: 80px; height: 80px; border-radius: var(--radius-full); object-fit: cover; }
.audit-v2 .av-rep__tel { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent-text); }

/* The form itself is the same markup as before; only its layout and sizes change here. */
.audit-v2 .audit-form > * { grid-column: 1 / -1; }
.audit-v2 .audit-form .field { align-content: start; }
.audit-v2 .audit-form .field__label { font-size: 13px; line-height: 20px; }
.audit-v2 .audit-form .field__input { border-radius: var(--radius-sm); }
.audit-v2 .audit-form .field--choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.audit-v2 .audit-form .field--choices > legend { margin-bottom: var(--space-2); }
.audit-v2 .audit-form .field--choices > .field__error { flex: 0 0 100%; }
.audit-v2 .audit-form .field__choice { display: inline-flex; padding: 0 var(--space-4) 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.audit-v2 .audit-form__submit { width: auto; justify-self: start; }
@media (min-width: 600px) {
  .audit-v2 .audit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-v2 .audit-form > div.field { grid-column: auto; }
  /* Full-width rows: competitors on both forms, and Website on the house form (the rep form pairs it with Town). */
  .audit-v2 .audit-form > div.field:has(> #audit-competitor),
  .audit-v2 .audit-form:not([data-audit-source]) > div.field:has(> #audit-website) { grid-column: 1 / -1; }
}
