/* ═══════════════════════════════════════════════════════════════════════════
   style.css — OneXP GEO Audit Tool
   Architecture: custom properties → reset → layout → components → responsive
   ═══════════════════════════════════════════════════════════════════════════ */


/* ───────────────────────────────────────────────────────────────────────────
   @font-face — Söhne typeface (Klim Type Foundry)
   Files present in assets/fonts/:
     Sohne-Buch.woff2          (weight 400, normal)
     Sohne-BuchKursiv.woff2    (weight 400, italic)
     Sohne-Halbfett.woff2      (weight 600, normal)
     Sohne-HalbfettKursiv.woff2 (weight 600, italic)
     SohneBreit-Kraftig.woff2  (wide display, weight 700)
   ─────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'IfThenFont';
  src: url('assets/fonts/Sohne-Buch.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IfThenFont';
  src: url('assets/fonts/Sohne-BuchKursiv.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'IfThenFont';
  src: url('assets/fonts/Sohne-Halbfett.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IfThenFont';
  src: url('assets/fonts/Sohne-HalbfettKursiv.woff2') format('woff2');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'IfThenFontBreit';
  src: url('assets/fonts/SohneBreit-Kraftig.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


/* ───────────────────────────────────────────────────────────────────────────
   Custom Properties
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  /* Brand colors */
  --color-text-primary: #ffffff;
  --color-text-secondary: #D1D1D1;
  --color-bg-primary: #000000;

  /* Derived colors */
  --color-bg-elevated: #111111;
  --color-bg-hover: #1a1a1a;
  --color-border: rgba(153, 153, 153, 0.25);
  --color-border-strong: rgba(153, 153, 153, 0.5);
  --color-disabled: rgba(153, 153, 153, 0.4);
  --color-progress-track: #1a1a1a;
  --color-progress-fill: #ffffff;
  --color-info-bg: #0d0d0d;
  --color-info-border: rgba(153, 153, 153, 0.3);
  --color-checkbox-border: rgba(153, 153, 153, 0.6);
  --color-checkbox-checked: #ffffff;
  --color-active-accent: #ffffff;

  /* Typography */
  --font-primary: 'IfThenFont', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Code block */
  --color-code-bg: #141414;

  /* Layout */
  --header-height:     64px;
  --nav-bar-height:    52px;
  --outline-width:     220px;
  --checklist-width:   300px;
  --max-content-width: 1280px;
  --border-radius:     6px;
}


/* ───────────────────────────────────────────────────────────────────────────
   Global Reset & Base
   ─────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md) 0;
  line-height: 1.25;
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-md) 0;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-text-secondary);
}

ul, ol {
  margin: 0 0 var(--space-md) 0;
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-xs);
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

/* ───────────────────────────────────────────────────────────────────────────
   Accessibility: Skip Link
   ─────────────────────────────────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-md);
  z-index: 9999;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: var(--space-md);
}

/* ───────────────────────────────────────────────────────────────────────────
   Utility
   ─────────────────────────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* PDF view is screen-hidden; shown only by @media print below */
#pdf-view {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view {
  min-height: 100vh;
}


/* ═══════════════════════════════════════════════════════════════════════════
   WELCOME SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

#welcome-screen {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-3xl) var(--space-lg);
  min-height: 100vh;
}

.welcome-card {
  width: 100%;
  max-width: 560px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-2xl);
}

.welcome-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-xl);
}

.welcome-logo {
  height: 28px;
  width: auto;
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 var(--space-sm) 0;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-2xl) 0;
  line-height: 1.5;
}

/* Form groups */

.form-group {
  margin-bottom: var(--space-xl);
}

.form-group label,
.form-group > label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

/* Page Name and Page URL labels — sentence case to match question labels */
#welcome-screen label[for="page-name"],
#welcome-screen label[for="page-url"] {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--color-text-primary);
}

.form-group input[type="text"],
.form-group input[type="url"] {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--border-radius);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: border-color 0.15s;
  outline: none;
}

.form-group input[type="text"]::placeholder,
.form-group input[type="url"]::placeholder {
  color: rgba(153, 153, 153, 0.5);
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus {
  border-color: var(--color-text-primary);
}

/* Page Type fieldset — question-style legend (sentence case, conversational) */

.page-type-fieldset legend {
  display: block;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--color-text-primary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: var(--space-md);
}

.page-type-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Radio-row style — replaces the old card grid.
   Selector is label.page-type-card (0-1-1) to beat .form-group label (0-1-1)
   by source order, overriding its display:block and text-transform:uppercase. */
label.page-type-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  min-height: 48px;
  /* Override .form-group label uppercase/tracking */
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--color-text-primary);
  margin-bottom: 0;
}

/* Radio circle indicator */
.page-type-card::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-checkbox-border);
  border-radius: 50%;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.page-type-card:hover {
  border-color: var(--color-text-secondary);
  background: var(--color-bg-hover);
}

.page-type-card:hover::before {
  border-color: var(--color-text-secondary);
}

.page-type-card.active {
  border-color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.04);
}

/* Selected radio circle — white outer ring with dark gap and white center dot */
.page-type-card.active::before {
  border-color: var(--color-text-primary);
  background: radial-gradient(
    circle,
    var(--color-text-primary) 38%,
    transparent 38%
  );
}

.page-type-label {
  font-size: 0.9375rem;
  line-height: 1.4;
  pointer-events: none;
}

/* PLP sub-type follow-up question — animated slide-down / fade-in */

.plp-subtype-question {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.plp-subtype-question.visible {
  max-height: 400px; /* generous ceiling — actual content is ~200px */
  opacity: 1;
}


/* Example links inside PLP sub-type cards — underline only, inherit card color */
.plp-example-link {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
  pointer-events: auto;
}

/* Welcome screen begin button */

#welcome-screen .btn-primary {
  width: 100%;
  margin-top: var(--space-xs);
}


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-xl);
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: filter 0.15s, background-color 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
  min-height: 44px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--color-text-primary);
  color: var(--color-bg-primary);
  border: 2px solid var(--color-text-primary);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.88);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-primary);
  border: 2px solid var(--color-border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-bg-hover);
  border-color: var(--color-text-secondary);
}

/* Tertiary / ghost — used for prev & next nav buttons */
.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  border: none;
  padding: var(--space-xs) var(--space-sm);
  position: relative;
}

/* Animated underline on hover */
.btn-ghost::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: var(--space-sm);
  right: var(--space-sm);
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

/* Previous: underline sweeps right → left */
#btn-prev.btn-ghost::after {
  transform-origin: right;
}

/* Next: underline sweeps left → right */
#btn-next.btn-ghost::after {
  transform-origin: left;
}

.btn-ghost:hover:not(:disabled)::after {
  transform: scaleX(1);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT FLOW — HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.audit-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: var(--header-height);
  gap: var(--space-lg);
}

.header-tool-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 120px;
}

.header-center {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.header-page-name {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.header-page-url {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-page-url:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.header-logo {
  height: 25px;
  width: auto;
  flex-shrink: 0;
}

/* Progress bar */

.progress-bar-track {
  width: 100%;
  height: 3px;
  background: var(--color-progress-track);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-progress-fill);
  width: 0%;
  transition: width 0.35s ease;
}


/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT FLOW — THREE-COLUMN LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.audit-layout {
  display: grid;
  grid-template-columns: var(--outline-width) 1fr var(--checklist-width);
  gap: var(--space-lg);
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-lg);
  padding-top: calc(var(--space-xl));
  /* Note: no overflow on this container — required for sticky children */
}


/* ───────────────────────────────────────────────────────────────────────────
   LEFT COLUMN: Audit Outline
   ─────────────────────────────────────────────────────────────────────────── */

.audit-outline {
  /* Sticky handled in media query below */
}

.audit-outline ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.audit-outline li {
  margin: 0;
}

.outline-btn {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.outline-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.outline-btn.active {
  color: var(--color-text-primary);
  border-left-color: var(--color-active-accent);
  font-weight: 600;
}

.outline-btn:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: -2px;
}

.outline-check {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.outline-check.visited {
  color: var(--color-text-primary);
}

.outline-check.current {
  color: var(--color-text-primary);
}


/* ───────────────────────────────────────────────────────────────────────────
   CENTER COLUMN: Section Content
   ─────────────────────────────────────────────────────────────────────────── */

.audit-content {
  min-width: 0;
  outline: none; /* focus target for keyboard nav — managed via JS */
}

.section-heading {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.2;
}

.section-body {
  font-size: 1rem;  /* 16px — item 2 */
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.section-body p {
  margin: 0 0 var(--space-md) 0;
  color: var(--color-text-secondary);
}

.section-body ul {
  margin: 0 0 var(--space-md) 0;
  padding-left: var(--space-xl);
}

.section-body li {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

/* Sub-section headlines — reuse the existing h3 / checklist-heading style.
   Only margin overrides for spacing within body copy. */
.section-body .sub-headline {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem 0;
  color: var(--color-text-primary);
}

/* Body lists */
.section-body .body-list {
  padding-left: 1.25rem;
  margin: 0.75rem 0;
}
.section-body .body-list li {
  margin-bottom: 0.5rem;
}

/* External link icon */
.ext-link::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.2em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}

/* Code block containers */
.section-body .code-block {
  background: var(--color-code-bg, #141414);
  border: 1px solid var(--color-border, rgba(153, 153, 153, 0.25));
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.section-body .code-block-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
}
.section-body .code-block pre {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre;
  margin: 0;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* Future: image assets */
/* .body-img, .img-compare — styles will be added when image content is introduced */

/* ───────────────────────────────────────────────────────────────────────────
   RIGHT COLUMN: Checklist
   ─────────────────────────────────────────────────────────────────────────── */

.audit-checklist {
  /* Sticky handled in media query below */
}

.checklist-heading {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 var(--space-md) 0;
}

.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Individual checklist item */

.checklist-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Hide native checkbox, keep it accessible */
.checklist-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  z-index: 1;
  flex-shrink: 0;
}

/* Custom visible checkbox box (::before) and checkmark (::after) on label */
.checklist-item label {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding-left: 26px; /* room for the pseudo-element */
  transition: color 0.15s;
}

.checklist-item label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-checkbox-border);
  border-radius: 3px;
  background: transparent;
  transition: background-color 0.15s, border-color 0.15s;
}

.checklist-item label::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 5px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--color-bg-primary);
  border-bottom: 2px solid var(--color-bg-primary);
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity 0.1s;
}

.checklist-item input[type="checkbox"]:checked + label::before {
  background: var(--color-checkbox-checked);
  border-color: var(--color-checkbox-checked);
}

.checklist-item input[type="checkbox"]:checked + label::after {
  opacity: 1;
}

.checklist-item input[type="checkbox"]:checked + label {
  color: var(--color-text-primary);
}

/* Focus ring on the custom visible box */
.checklist-item input[type="checkbox"]:focus-visible + label::before {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

.checklist-item:hover label {
  color: var(--color-text-primary);
}

/* Notes textarea */

.notes-wrapper {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.notes-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.notes-textarea {
  width: 100%;
  min-height: 96px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--border-radius);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s;
  outline: none;
}

.notes-textarea::placeholder {
  color: rgba(153, 153, 153, 0.5);
}

.notes-textarea:focus {
  border-color: var(--color-text-primary);
}


/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT FLOW — NAVIGATION BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.audit-nav {
  display: flex;
  align-items: center;
  /* Dynamic side padding: matches the content area's left/right edge at any viewport width.
     When viewport > max-content-width, padding grows to (viewport - max-width) / 2 + space-lg.
     When viewport <= max-content-width, max() clamps it to space-lg (the standard gutter). */
  padding: var(--space-xs) max(var(--space-lg), calc((100% - var(--max-content-width)) / 2 + var(--space-lg)));
  gap: var(--space-md);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border);
}

/* Keep Next always right-aligned, even when Previous is visibility:hidden */
#btn-next {
  margin-left: auto;
}

/* Prevent content from being hidden behind the sticky nav bar */
.audit-layout {
  padding-bottom: var(--nav-bar-height);
}


/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT FLOW — EXPORT AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.export-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-lg);
  padding-top: 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.export-message {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin: var(--space-lg) 0 0 0;
}

#btn-export {
  min-width: 220px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — DESKTOP STICKY COLUMNS (≥ 900px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
  .audit-outline {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
    align-self: start;
    max-height: calc(100vh - var(--header-height) - var(--nav-bar-height) - var(--space-2xl));
    overflow-y: auto;
    /* Subtle scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
  }

  .audit-outline::-webkit-scrollbar {
    width: 4px;
  }
  .audit-outline::-webkit-scrollbar-track {
    background: transparent;
  }
  .audit-outline::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 2px;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (< 900px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 899px) {

  /* Collapse to single column, hide outline */
  .audit-layout {
    grid-template-columns: 1fr;
    padding: var(--space-md);
    padding-top: var(--space-lg);
    gap: var(--space-lg);
  }

  .audit-outline {
    display: none;
  }

  /* Mobile header: stack vertically */
  .header-content {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-sm) var(--space-md);
    row-gap: var(--space-xs);
  }

  .header-tool-label {
    min-width: auto;
    order: 1;
    font-size: 0.75rem;
  }

  .header-logo {
    height: 20px;
    order: 2;
  }

  .header-center {
    order: 3;
    flex: 0 0 100%;
    text-align: left;
    padding-bottom: var(--space-xs);
  }

  .header-page-name {
    font-size: 0.9375rem;
  }

  /* Stack nav buttons full-width, Next on top — sticky at bottom */
  .audit-nav {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: var(--space-xs) var(--space-md);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
  }

  .audit-nav .btn {
    width: 100%;
    justify-content: center;
    margin-left: 0; /* override the desktop margin-left: auto on #btn-next */
  }

  /* Welcome card tighter padding on mobile */
  .welcome-card {
    padding: var(--space-xl) var(--space-md);
  }

  #welcome-screen {
    padding: var(--space-xl) var(--space-md);
    align-items: flex-start;
  }

  /* Summary screen — reduce section name width on narrow screens */
  .score-section-name {
    width: 130px;
  }

}


/* ═══════════════════════════════════════════════════════════════════════════
   SUMMARY SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.summary-screen {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--nav-bar-height) + var(--space-lg));
}

.summary-inner {
  max-width: 720px;
  margin: 0 auto;
}


/* ─── Overall Score Hero ─────────────────────────────────────────────────── */

.summary-score-hero {
  text-align: center;
  padding: var(--space-md) 0 var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.score-circle-pct {
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.score-hero-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-xs);
}

.score-hero-points {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0;
}


/* ─── Per-Section Score Breakdown ───────────────────────────────────────── */

.summary-sections {
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

.summary-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-lg);
}

.score-section-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.score-section-name {
  flex-shrink: 0;
  width: 190px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.score-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.score-bar-track {
  flex: 1;
  height: 8px;
  background: var(--color-bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.score-bar-pct {
  flex-shrink: 0;
  width: 38px;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}


/* ─── Prioritized Fix List ──────────────────────────────────────────────── */

.summary-fixes {
  padding-bottom: var(--space-xl);
}

/* Export button lives in the nav bar on the summary screen — hide the in-content version */
.summary-export {
  display: none;
}

.summary-fixes-heading {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-xs);
}

.summary-fixes-count {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-lg);
}

.summary-tier-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: var(--space-lg) 0 var(--space-sm);
}

.summary-fix-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.summary-fix-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.summary-fix-item:last-child {
  border-bottom: none;
}

.fix-item-text {
  font-size: 0.875rem;
  color: var(--color-text-primary);
  line-height: 1.5;
}

.fix-item-section {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.summary-congrats {
  font-size: 1rem;
  color: #38A169;
  font-weight: 600;
  text-align: center;
  padding: var(--space-2xl) 0;
  margin: 0;
}

/* ─── Action Plan Items ────────────────────────────────────────────────── */

.action-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.action-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.action-item:last-child {
  border-bottom: none;
}

.action-item-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.action-item-number {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  min-width: 24px;
  flex-shrink: 0;
}

.action-item-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.action-item-body {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin: 0 0 0 32px;
}

.action-item-section {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-left: 32px;
  font-style: italic;
}


/* ─── Export Button ─────────────────────────────────────────────────────── */

.summary-export {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xs);
}


/* ═══════════════════════════════════════════════════════════════════════════
   PDF / PRINT STYLES
   Triggered by window.print(). Implements a light-mode version of the design
   system by overriding CSS custom properties. All existing component classes
   (score-circle, score-bar-fill, summary-fix-item, etc.) are reused directly
   in #pdf-view — style changes to those classes carry through automatically.
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {

  /* ── Page setup ──────────────────────────────────────────────────────────── */

  @page {
    size: A4 portrait;
    margin: 18mm 20mm;
  }

  /* ── Light-mode token overrides ──────────────────────────────────────────── */

  :root {
    --color-text-primary:    #111111;
    --color-text-secondary:  #555555;
    --color-bg-primary:      #ffffff;
    --color-bg-elevated:     #f5f5f4;
    --color-bg-hover:        #e8e8e7;
    --color-border:          rgba(0, 0, 0, 0.10);
    --color-border-strong:   rgba(0, 0, 0, 0.20);
    --color-checkbox-border: rgba(0, 0, 0, 0.30);
    --color-checkbox-checked:#111111;
    --color-info-bg:         #f5f5f4;
    --color-code-bg:         #f0f0ef;
    --color-progress-fill:   #111111;
    --color-progress-track:  #e0e0e0;
  }

  /* ── Show only #pdf-view; hide the live app ──────────────────────────────── */

  #welcome-screen,
  #audit-flow {
    display: none !important;
  }

  #pdf-view {
    display: block;
    background: #ffffff;
    color: #111111;
    font-family: var(--font-primary);
    font-size: 10pt;
    line-height: 1.55;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* ── Cover block ─────────────────────────────────────────────────────────── */

  .pdf-cover {
    padding-bottom: 1.75rem;
    border-bottom: 2px solid #111111;
    margin-bottom: 2rem;
  }

  .pdf-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
  }

  /* Invert white logo SVG paths to black for the light PDF */
  .pdf-logo {
    filter: invert(1);
    height: 20px;
    width: auto;
  }

  .pdf-date {
    font-size: 8.5pt;
    color: #777777;
  }

  .pdf-report-title {
    font-size: 22pt;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #111111;
    margin: 0 0 1.25rem;
    line-height: 1.15;
  }

  .pdf-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .pdf-meta-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 9.5pt;
  }

  .pdf-meta-label {
    flex-shrink: 0;
    width: 36px;
    font-size: 7.5pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #888888;
  }

  .pdf-meta-value {
    color: #111111;
    word-break: break-all;
  }

  /* ── Score hero (reuses .summary-score-hero + .score-circle etc.) ────────── */

  .pdf-score-hero {
    margin-bottom: 2rem;
  }

  /* ── Score breakdown (reuses .summary-sections, .score-bar-* etc.) ───────── */

  .pdf-breakdown {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
  }

  /* ── Items to address (reuses .summary-fixes-* classes) ─────────────────── */

  .pdf-fixes {
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    margin-bottom: 0;
  }

  /* ── Action Plan items (print overrides) ──────────────────────────────────── */

  .action-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    break-inside: avoid;
  }

  .action-item-number {
    color: #111111;
  }

  .action-item-title {
    color: #111111;
    font-size: 9.5pt;
  }

  .action-item-body {
    color: #333333;
    font-size: 8.5pt;
  }

  .action-item-section {
    color: #666666;
    font-size: 8pt;
  }

  /* ── Full Audit Results — starts on a new page ───────────────────────────── */

  .pdf-results-heading {
    font-size: 13pt;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #111111;
    margin: 0 0 1.5rem;
    break-before: page;
  }

  /* ── Individual section blocks ───────────────────────────────────────────── */

  .pdf-section-block {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    break-inside: avoid;
  }

  .pdf-section-block:last-child {
    border-bottom: none;
  }

  .pdf-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  }

  .pdf-section-title {
    font-size: 10.5pt;
    font-weight: 600;
    color: #111111;
    margin: 0;
  }

  .pdf-section-pct {
    font-size: 10.5pt;
    font-weight: 600;
    flex-shrink: 0;
  }

  /* ── Checklist items ─────────────────────────────────────────────────────── */

  .pdf-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .pdf-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.055);
  }

  .pdf-checklist-item:last-child {
    border-bottom: none;
  }

  .pdf-item-indicator {
    flex-shrink: 0;
    width: 13px;
    font-size: 9pt;
    line-height: 1.6;
  }

  .pdf-item-text {
    flex: 1;
    font-size: 9pt;
    line-height: 1.55;
    color: #111111;
  }

  .pdf-item-checked .pdf-item-text {
    color: #666666;
  }

  .pdf-tier-badge {
    flex-shrink: 0;
    font-size: 7pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 1px 4px;
    margin-top: 2px;
    white-space: nowrap;
    line-height: 1.4;
  }

  /* ── Notes block ─────────────────────────────────────────────────────────── */

  .pdf-notes {
    margin-top: 0.65rem;
    padding: 0.6rem 0.75rem;
    background: #f5f5f4;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.07);
  }

  .pdf-notes-label {
    display: block;
    font-size: 7.5pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #888888;
    margin-bottom: 0.2rem;
  }

  .pdf-notes-text {
    font-size: 9pt;
    color: #333333;
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.5;
  }

  .pdf-info-note {
    font-size: 9pt;
    color: #888888;
    font-style: italic;
    margin: 0;
  }

  /* ── Footer ──────────────────────────────────────────────────────────────── */

  .pdf-footer {
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    font-size: 8pt;
    color: #999999;
    text-align: center;
  }

}
