/* ============================================================
   Waypoint Framework — Design System
   css/main.css — Single source of truth for all pages.
   Do not add styles per-page. Add here, apply everywhere.
   ============================================================ */

/* === CUSTOM PROPERTIES === */
:root {
  /* Background / Surface */
  --bg:               #fafaf9;
  --surface:          #ffffff;
  --surface-alt:      #f8fafc;

  /* Sidebar */
  --sidebar-bg:       #1e2d3d;
  --sidebar-hover:    #2d3f52;
  --sidebar-active-bg:#1a3561;
  --sidebar-border:   #2d3f52;
  --sidebar-text:     #e2e8f0;
  --sidebar-muted:    #94a3b8;
  --sidebar-width:    270px;

  /* Text */
  --text:             #1a1a2e;
  --text-secondary:   #374151;
  --text-muted:       #6b7280;

  /* Accent / Action */
  --accent:           #2563eb;
  --accent-dark:      #1d4ed8;
  --accent-light:     #eff6ff;

  /* Amber (callouts, highlights) */
  --amber:            #92400e;
  --amber-bg:         #fffbeb;
  --amber-border:     #fbbf24;

  /* Borders */
  --border:           #e5e7eb;
  --border-dark:      #d1d5db;

  /* Tables */
  --table-header-bg:  #1e2d3d;
  --table-header-text:#f1f5f9;
  --table-alt:        #f8fafc;
  --table-border:     #e5e7eb;

  /* Step badges */
  --badge-bg:         #2563eb;
  --badge-text:       #ffffff;

  /* Discipline tags */
  --tag-bg:           #f1f5f9;
  --tag-text:         #374151;
  --tag-border:       #cbd5e1;

  /* Layout */
  --content-max:      860px;
  --content-pad:      48px;
  --header-height:    60px;

  /* Typography */
  --font:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --size-base:        18px;
  --size-sm:          15px;
  --size-xs:          13px;
  --size-nav:         14px;
  --line-height:      1.85;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* === BASE === */
body {
  font-family: var(--font);
  font-size: var(--size-base);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.sidebar-subtitle {
  font-size: var(--size-xs);
  color: var(--sidebar-muted);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 20px;
  right: 16px;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-close:hover {
  color: var(--sidebar-text);
  border-color: var(--sidebar-muted);
}

.nav-section {
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--sidebar-border);
}

.nav-section:last-child {
  border-bottom: none;
  padding-bottom: 24px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-muted);
  padding: 0 20px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: var(--size-nav);
  font-weight: 400;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: #ffffff;
  font-weight: 600;
  border-left-color: var(--accent);
}

.step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-muted);
  min-width: 20px;
  font-variant-numeric: tabular-nums;
}

.nav-link.active .step-num {
  color: #93c5fd;
}

/* === MOBILE HEADER === */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  height: var(--header-height);
  padding: 0 20px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-btn {
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-btn:hover {
  background: var(--sidebar-hover);
}

.mobile-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

/* === OVERLAY (mobile) === */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

.overlay.visible {
  display: block;
}

/* === MAIN LAYOUT === */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px var(--content-pad) 0;
  font-size: var(--size-xs);
  color: var(--text-muted);
  max-width: calc(var(--content-max) + var(--content-pad) * 2);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--border-dark);
}

.breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* === CONTENT AREA === */
.content {
  flex: 1;
  max-width: calc(var(--content-max) + var(--content-pad) * 2);
  width: 100%;
  padding: 36px var(--content-pad) 60px;
}

/* === TYPOGRAPHY === */
.content h1 {
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.content h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-top: 32px;
  margin-bottom: 12px;
}

.content h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 24px;
  margin-bottom: 8px;
}

.content p {
  margin-bottom: 20px;
  color: var(--text);
}

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

.content ul,
.content ol {
  margin: 0 0 20px 24px;
  color: var(--text);
}

.content li {
  margin-bottom: 8px;
}

.content strong {
  font-weight: 600;
  color: var(--text);
}

.content em {
  font-style: italic;
  color: var(--text-secondary);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 24px 0;
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* === PAGE META (step badge + in-brief) === */
.page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.section-tag {
  font-size: var(--size-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === IN BRIEF BOX === */
.in-brief {
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 18px 22px;
  margin: 20px 0 36px;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.in-brief strong {
  color: var(--accent-dark);
  font-weight: 600;
}

/* === CALLOUT BOXES === */
.callout {
  border-radius: 8px;
  padding: 18px 22px;
  margin: 24px 0;
  font-size: 16px;
  line-height: 1.75;
}

.callout-amber {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber-border);
  color: var(--amber);
}

.callout-key {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 4px solid #22c55e;
  color: #14532d;
}

/* === DISCIPLINE TAGS === */
.discipline-block {
  margin: 12px 0;
  padding: 14px 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.discipline-label {
  font-size: var(--size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* === TABLES === */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border: 1px solid var(--table-border);
  border-radius: 8px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.content table th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
}

.content table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text);
  vertical-align: top;
}

.content table tr:last-child td {
  border-bottom: none;
}

.content table tr:nth-child(even) td {
  background: var(--table-alt);
}

.content table tr:hover td {
  background: #f0f7ff;
}

/* === TEMPLATE SECTION === */
.template-section {
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  margin: 36px 0;
  overflow: hidden;
}

.template-header {
  background: var(--accent);
  color: #ffffff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.template-title {
  font-size: 17px;
  font-weight: 600;
}

.template-step-ref {
  font-size: var(--size-xs);
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

.template-header em {
  color: rgba(255,255,255,0.65);
}

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--size-xs);
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.print-btn:hover {
  color: #ffffff;
  border-color: #ffffff;
}

.template-body {
  padding: 24px 22px;
  background: var(--surface);
}

.template-body h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.template-body h4:first-child {
  margin-top: 0;
}

.response-field {
  background: var(--surface-alt);
  border: 1px dashed var(--border-dark);
  border-radius: 4px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 15px;
  margin: 8px 0;
}

/* === PAGE NAVIGATION (Prev/Next) === */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  padding: 32px var(--content-pad) 48px;
  max-width: calc(var(--content-max) + var(--content-pad) * 2);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.page-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  min-width: 160px;
  max-width: 280px;
}

.page-nav-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}

.page-nav-btn.prev {
  text-align: left;
}

.page-nav-btn.next {
  text-align: right;
  margin-left: auto;
}

.page-nav-label {
  font-size: var(--size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.page-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

/* === PLACEHOLDER CONTENT (Sprint 0 shells) === */
.shell-placeholder {
  background: var(--surface-alt);
  border: 2px dashed var(--border-dark);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  margin: 24px 0;
}

.shell-placeholder p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 0;
}

/* === LANDING PAGE SPECIFIC === */
.hero {
  padding: 52px var(--content-pad) 40px;
  max-width: calc(var(--content-max) + var(--content-pad) * 2);
}

.hero-eyebrow {
  font-size: var(--size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 20px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 620px;
  margin-bottom: 32px;
}

.author-block {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 520px;
  margin-bottom: 48px;
}

.author-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.author-creds {
  font-size: var(--size-sm);
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}

.author-link {
  font-size: var(--size-xs);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.author-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-muted);
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  color: #e2e8f0;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 var(--content-pad);
}

.index-section {
  padding: 40px var(--content-pad);
  max-width: calc(var(--content-max) + var(--content-pad) * 2);
}

.index-section-label {
  font-size: var(--size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.index-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.index-section p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 600px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.entry-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
  transform: translateY(-1px);
}

.entry-card-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.entry-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   ACCORDIONS — Step pages (h2 sections collapse/expand)
   ============================================================ */

.accordion-controls {
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 1.25rem;
}

.acc-toggle-all {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.acc-toggle-all:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.accordion-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface-alt);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.accordion-btn:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.accordion-section.open > .accordion-btn {
  background: var(--sidebar-bg);
  color: #ffffff;
}

/* +/− icon */
.accordion-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  position: relative;
}

.accordion-icon::before,
.accordion-icon::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* horizontal bar — always visible */
.accordion-icon::before {
  width: 12px;
  height: 2px;
  top: 9px;
  left: 4px;
}

/* vertical bar — disappears when open */
.accordion-icon::after {
  width: 2px;
  height: 12px;
  top: 4px;
  left: 9px;
}

.accordion-section.open > .accordion-btn .accordion-icon::after {
  transform: scaleY(0);
  opacity: 0;
}

.accordion-body {
  padding: 1.1rem 1.25rem 0.5rem;
}

/* ============================================================
   TEMPLATE TOGGLES — templates pages (collapse individual templates)
   ============================================================ */

.template-header {
  cursor: pointer;
  user-select: none;
}

.template-toggle-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  position: relative;
  margin-left: 0.5rem;
  opacity: 0.8;
}

.template-toggle-icon::before,
.template-toggle-icon::after {
  content: '';
  position: absolute;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.template-toggle-icon::before {
  width: 12px;
  height: 2px;
  top: 9px;
  left: 4px;
}

.template-toggle-icon::after {
  width: 2px;
  height: 12px;
  top: 4px;
  left: 9px;
}

.template-toggle-icon.collapsed::after {
  transform: scaleY(0);
  opacity: 0;
}

.template-body.collapsed {
  display: none;
}

.entry-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.entry-card:hover .entry-card-title {
  color: var(--accent-dark);
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
  font-family: var(--font);
  border: none;
  cursor: pointer;
}

.cta-btn:hover {
  background: var(--accent-dark);
  color: #ffffff;
  text-decoration: none;
}

/* === 404 PAGE === */
.not-found {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}

.not-found-inner {
  text-align: center;
  max-width: 480px;
}

.not-found-code {
  font-size: 80px;
  font-weight: 700;
  color: var(--border-dark);
  line-height: 1;
  margin-bottom: 16px;
}

.not-found h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.not-found p {
  font-size: 16px;
  color: var(--text-seco