*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1a4a7a;
  --blue-light: #2563eb;
  --blue-bg: #f0f5fa;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --white: #ffffff;
  --callout: #eff6ff;
  --warning: #fef3c7;
  --ease: 0.18s ease;
}

/* Subtle hover / click transitions (matches reference pills) */
a,
button,
input[type="search"],
.lang-toggle button,
.link-grid a,
.path-list a,
.reference-links a,
.ob-start-btn,
.ob-review-link,
.ob-btn,
.ob-quiz-option,
.ob-sop-link,
details.tips summary,
.related a,
.gt-callout a,
.callout a {
  transition:
    color var(--ease),
    background-color var(--ease),
    background var(--ease),
    border-color var(--ease),
    opacity var(--ease),
    box-shadow var(--ease);
}

button:active:not(:disabled),
.link-grid a:active,
.reference-links a:active,
.ob-start-btn:active,
.ob-btn:active:not(:disabled),
.ob-quiz-option:active {
  opacity: 0.88;
}

a:focus-visible,
button:focus-visible,
input[type="search"]:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 2px;
}

input[type="search"]:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.lang-block[data-lang] {
  animation: avw-fade-in 0.22s ease;
}

@keyframes avw-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
}

/* Header */
.site-header {
  background: var(--blue);
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header a {
  color: var(--white);
  text-decoration: none;
  transition: color var(--ease), opacity var(--ease);
}

.site-header a:hover { text-decoration: underline; opacity: 0.92; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-brand img {
  height: 40px;
  width: auto;
}

.header-brand span {
  font-weight: 600;
  font-size: 1.1rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.lang-toggle {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  overflow: hidden;
}

.lang-toggle button {
  background: none;
  border: none;
  color: var(--white);
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.lang-toggle button.active {
  background: var(--white);
  color: var(--blue);
  transition: background-color var(--ease), color var(--ease);
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.container-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* Typography */
h1 {
  font-size: 1.75rem;
  color: var(--blue);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

h2 {
  font-size: 1.25rem;
  color: var(--blue);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--blue-bg);
}

h3 {
  font-size: 1.05rem;
  color: var(--text);
  margin: 1.25rem 0 0.5rem;
}

p { margin-bottom: 0.75rem; }

.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

ul, ol {
  margin: 0.5rem 0 1rem 1.25rem;
}

li { margin-bottom: 0.4rem; }

a { color: var(--blue-light); }

/* Hub */
.hub-split {
  margin-bottom: 2rem;
}

.path-section {
  margin-bottom: 2rem;
}

.hub-split .path-section:last-child {
  margin-bottom: 0;
}

.path-section h2 {
  margin-top: 0;
  border: none;
  padding: 0;
}

.path-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.path-list li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.path-list a {
  display: block;
  padding: 0.85rem 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.path-list a {
  transition: color var(--ease);
}

.path-list a:hover { color: var(--blue-light); }

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-grid a {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--blue-bg);
  border-radius: 6px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background-color var(--ease), color var(--ease);
}

.link-grid a:hover {
  background: var(--blue);
  color: var(--white);
}

/* Hub — Reference (distinct from install/ops grids) */
.reference-section {
  margin-bottom: 2rem;
  padding: 1.25rem 1.35rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(26, 74, 122, 0.06);
}

.reference-section h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border: none;
  padding: 0;
  margin-bottom: 0.35rem;
}

.reference-section .reference-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.reference-links li {
  margin: 0;
}

.reference-links a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--white);
}

.reference-links a:hover {
  border-color: var(--blue-light);
  color: var(--blue);
  background: var(--blue-bg);
}

/* Hub — Onboarding entry */
.onboarding-section {
  margin-bottom: 2rem;
  padding: 1.5rem 1.35rem;
  background: linear-gradient(135deg, var(--blue) 0%, #2563eb 100%);
  border-radius: 12px;
  color: var(--white);
}

.onboarding-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: var(--white);
  border: none;
  padding: 0;
}

.onboarding-section p {
  margin: 0 0 1.25rem;
  opacity: 0.92;
  font-size: 0.95rem;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.ob-start-btn {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  background: var(--white);
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  font-size: 1rem;
}

.ob-start-btn:hover {
  background: var(--blue-bg);
}

.ob-review-link {
  color: var(--white);
  font-size: 0.9rem;
  opacity: 0.95;
}

.ob-review-link {
  transition: opacity var(--ease), color var(--ease);
}

.ob-review-link:hover {
  color: var(--white);
  text-decoration: underline;
  opacity: 0.85;
}

.onboarding-done-badge {
  display: inline-block;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

/* Onboarding wizard */
.ob-wizard { padding-bottom: 2rem; }

.ob-progress-wrap { margin-bottom: 1.25rem; }

.ob-progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  background: var(--blue-light);
  border-radius: 4px;
  transition: width 0.25s ease;
  width: 0;
}

.ob-progress-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.ob-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.35rem;
  margin-bottom: 1rem;
}

.ob-card h1 {
  margin-top: 0;
  font-size: 1.5rem;
}

.ob-body ul { margin: 0.75rem 0 0 1.25rem; }
.ob-body p { margin-bottom: 0.75rem; }

.ob-sop-row { margin: 1rem 0 0; }
.ob-sop-link { font-weight: 600; font-size: 0.95rem; }

.ob-quiz {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.ob-quiz-heading {
  font-size: 1rem;
  color: var(--blue);
  margin: 0 0 0.75rem;
  border: none;
  padding: 0;
}

.ob-quiz-question {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.ob-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ob-quiz-option {
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
}

.ob-quiz-option:hover { border-color: var(--blue-light); background: var(--blue-bg); }
.ob-quiz-option.selected.correct { border-color: #16a34a; background: #f0fdf4; }
.ob-quiz-option.selected.wrong { border-color: #dc2626; background: #fef2f2; }

.ob-quiz-feedback {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.25rem;
}

.ob-quiz-feedback.ok { color: #16a34a; }
.ob-quiz-feedback.retry { color: var(--text-muted); }

.ob-quiz-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.ob-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
}

.ob-btn {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.ob-btn-back {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
}

.ob-btn-restart {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.ob-btn-next {
  background: var(--blue);
  color: var(--white);
  margin-left: auto;
}

.ob-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ob-btn-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Callouts */
.callout {
  background: var(--callout);
  border-left: 4px solid var(--blue-light);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 6px 6px 0;
  font-size: 0.95rem;
}

.callout strong { color: var(--blue); }

.callout-warning {
  background: var(--warning);
  border-left-color: #d97706;
}

/* Non-negotiable inline callout */
.gt-callout {
  background: var(--blue-bg);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.gt-callout a { font-weight: 500; }

/* Video placeholder */
.video-placeholder {
  background: var(--blue-bg);
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin: 1rem 0;
  font-size: 0.9rem;
}

/* Tips & Tricks */
details.tips {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

details.tips summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-bg);
  border-radius: 6px;
  list-style: none;
  transition: background-color var(--ease), color var(--ease);
}

details.tips summary:hover {
  background: #e2ecf8;
}

details.tips summary::-webkit-details-marker { display: none; }

details.tips[open] summary {
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid var(--border);
}

details.tips .tips-body {
  padding: 1rem 1.25rem;
}

details.tips ul {
  margin-bottom: 0;
}

/* Diagram */
.flow-diagram {
  background: var(--blue-bg);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.25rem 0;
  overflow-x: auto;
}

.flow-diagram svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.flow-legend {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.flow-legend div {
  padding: 0.5rem 0.75rem;
  background: var(--white);
  border-radius: 4px;
}

/* Checklist */
.checklist {
  list-style: none;
  margin-left: 0;
}

.checklist li::before {
  content: "☐ ";
  color: var(--blue);
}

/* Related links */
.related {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.related ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.related li { margin-bottom: 0.35rem; }

/* Footer */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Spanish review badge */
.review-badge {
  display: inline-block;
  font-size: 0.7rem;
  background: #fef3c7;
  color: #92400e;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Print */
@media (prefers-reduced-motion: reduce) {
  *,
  .lang-block[data-lang] {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .site-header, .lang-toggle, details.tips summary { }
  .site-header { position: static; background: #fff; color: #000; }
  .lang-block[data-lang="es"] { display: none !important; }
  .video-placeholder { border: 1px solid #ccc; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .header-brand span { font-size: 1rem; }
}

/* Fullscreen hub — side-by-side panels, same flow; reference pinned low */
@media (min-width: 1400px) {
  .hub-page {
    max-width: min(1180px, calc(100% - 3rem));
    min-height: calc(100vh - 8.5rem);
    display: flex;
    flex-direction: column;
    padding-bottom: 2rem;
  }

  .hub-page > .onboarding-section {
    margin-bottom: 1.5rem;
  }

  .hub-page > .hub-split {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
    min-height: 0;
  }

  .hub-split-panel {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    padding: 1.25rem 1.35rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(26, 74, 122, 0.06);
  }

  .hub-split-panel h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--blue-bg);
  }

  .hub-split-panel .link-grid {
    flex: 1;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    align-content: start;
  }

  .hub-split-panel .link-grid a {
    padding: 0.9rem 1rem;
    font-size: 0.98rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
  }

  .hub-page > .reference-section {
    margin-top: auto;
    margin-bottom: 0;
  }

  .flow-legend {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1800px) {
  .hub-page {
    max-width: min(1280px, calc(100% - 4rem));
  }

  .hub-page > .hub-split {
    gap: 1.5rem;
  }

  .hub-split-panel .link-grid {
    gap: 0.75rem;
  }

  .hub-split-panel .link-grid a {
    padding: 1rem 1.1rem;
    font-size: 1rem;
    min-height: 3.25rem;
  }
}