/* Shared chrome — header, nav, cards, fields, timeline, tables.
   Loaded on every section page alongside tokens.css. */

.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .logo {
  display: inline-flex;
  align-items: center;
}
.site-header .logo img {
  height: 44px;
  width: auto;
  display: block;
}
.site-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
}
.nav-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
}
.site-nav a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.site-nav a:hover, .site-nav a.active {
  background: var(--color-bg);
  color: var(--color-rose);
}

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-8);
}
.page-intro h1 {
  font-size: var(--text-2xl);
}
.page-intro p {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.card h2 {
  font-size: var(--text-xl);
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--color-surface-raised);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}
.field-textarea {
  min-height: 5rem;
  resize: vertical;
}
.field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: calc(-1 * var(--space-2));
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-coral);
  color: var(--color-coral-dark);
  padding: calc(var(--space-3) - 1.5px) calc(var(--space-6) - 1.5px);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin: 0 var(--space-2) var(--space-3) 0;
}
.btn-secondary:hover { background: var(--color-bg); }

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--color-border);
}
.timeline-item {
  position: relative;
  padding: 0 0 var(--space-8) var(--space-6);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-coral);
  border: 2px solid var(--color-surface);
}
.timeline-item .week-label {
  font-size: var(--text-xs);
  color: var(--color-coral);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.timeline-item .date-label {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin: var(--space-1) 0;
}
.timeline-item ul {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
}
table {
  width: auto;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-bottom: 0;
}
th, td {
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  width: 150px;
}
th { color: var(--color-text-muted); font-weight: 600; }
td input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
}
td input:focus { border-bottom-color: var(--color-coral); outline: none; }

/* Result / summary panels */
.result-panel {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-4) 0;
}
.result-figure {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-rose);
}
.result-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-3);
  margin-top: var(--space-4);
}
.ineligible-notice {
  background: #FDF6E9;
  border: 1px solid var(--color-amber);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-sm);
}

.printable-header { margin-bottom: var(--space-6); }

/* Letter preview - shared by Toolkit, ND, and any generator producing full letters */
.letter-preview {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  white-space: pre-wrap;
  font-family: var(--font-body);
  line-height: 1.7;
  margin-top: var(--space-4);
}

/* Branded print/download header — injected by printSection() into
   whichever section is being printed. Invisible on screen, only
   appears in the printed/downloaded output. */
.print-only { display: none; }
@media print {
  .print-only.brand-block {
    display: block;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-coral);
  }
  .brand-block .brand-logo {
    height: 60px;
    width: auto;
    display: block;
    margin-bottom: var(--space-2);
  }
  .brand-block .brand-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--color-text);
  }
  .brand-block .brand-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
  }
  .brand-block .brand-legal {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 6px;
  }
}

/* Sync widget — self-injected into every page's header */
.sync-widget {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.sync-toggle {
  background: none;
  border: none;
  color: var(--color-rose);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-2);
}
.sync-form { display: flex; gap: var(--space-2); align-items: center; }
.sync-status { color: var(--color-text-muted); font-size: var(--text-sm); }

/* Footer — self-injected on every page via js/footer.js */
.site-footer {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-8);
}
.footer-logo {
  height: 56px;
  width: auto;
  margin: 0 auto var(--space-2);
  display: block;
}
.footer-url {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}
.footer-legal {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin: var(--space-3) auto 0;
  line-height: 1.6;
}
.footer-legal a {
  color: var(--color-rose);
}

/* Info tips — small "?" buttons that reveal a short explanation.
   Used sparingly: only where a label alone is genuinely ambiguous,
   not on every field (that clutters more than it clarifies). */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  margin-left: var(--space-2);
  vertical-align: middle;
  flex-shrink: 0;
}
.info-tip:hover, .info-tip[aria-expanded="true"] { background: var(--color-coral); color: #fff; }
.info-tip-popover {
  display: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: var(--space-2) 0 var(--space-3);
  max-width: 480px;
}
.info-tip-popover.open { display: block; }


/
/* Mobile: nav scrolls sideways in one line instead of wrapping into
   many rows. Explicit widths + overflow-x:hidden on body stop the
   whole page from scrolling sideways too. */
body {
  overflow-x: hidden;
}
@media (max-width: 640px) {
  .site-header {
    padding: var(--space-3) var(--space-4);
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .site-header .logo img {
    height: 36px;
  }
  .site-nav {
    width: 100%;
    max-width: 100%;
  }
  .nav-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    width: 100%;
    max-width: 100%;
  }
  .site-nav a {
    white-space: nowrap;
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }
  .sync-widget {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    font-size: var(--text-xs);
  }
}