/* ==========================================================================
   Accessible Font Size Scaling & Header Toggle for Dyslexia
   ========================================================================== */

/* Font Size Scaling on Root */
html.font-size-large {
  font-size: 115% !important;
}
html.font-size-large body {
  line-height: 1.72;
}

html.font-size-xlarge {
  font-size: 130% !important;
}
html.font-size-xlarge body {
  line-height: 1.78;
}

/* Scaling adjustments for comparison widget and components */
html.font-size-large .cw-chip,
html.font-size-large .cw-row-label,
html.font-size-large .cw-wopt,
html.font-size-large .cw-wr-why li {
  font-size: 1.15em;
}

html.font-size-xlarge .cw-chip,
html.font-size-xlarge .cw-row-label,
html.font-size-xlarge .cw-wopt,
html.font-size-xlarge .cw-wr-why li {
  font-size: 1.3em;
}

/* Header container responsiveness */
.nav {
  min-height: 64px;
  height: auto !important;
  padding: 8px 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Font Size Segmented Control */
.font-size-ctrl {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid var(--line, #dfe7e4);
  border-radius: 99px;
  padding: 2px;
  gap: 1px;
  box-shadow: 0 1px 3px rgba(23, 33, 43, 0.05);
  user-select: none;
  vertical-align: middle;
}

.font-size-ctrl .fs-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 8px;
  color: var(--muted, #5a6875);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1;
}

.font-size-ctrl .fs-indicator svg {
  flex-shrink: 0;
}

.fs-opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 99px;
  color: var(--muted, #5a6875);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.fs-opt-btn:hover {
  color: var(--ink, #17212b);
  background: var(--soft, #f3f7f5);
}

.fs-opt-btn.active {
  background: var(--fill, #2f6f8f);
  color: #ffffff;
  border-color: var(--fill, #2f6f8f);
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(47, 111, 143, 0.28);
}

.fs-opt-btn .fs-plus {
  font-size: 0.7em;
  font-weight: 800;
  vertical-align: super;
  margin-left: 1px;
}

.fs-opt-btn:focus-visible {
  outline: 2px solid var(--accent, #2f6f8f);
  outline-offset: 1px;
}

/* Screen reader utility */
.fs-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;
}

/* Responsive adjustments */
@media (max-width: 760px) {
  .nav-right {
    gap: 8px;
  }
  .font-size-ctrl {
    padding: 1px;
  }
  .font-size-ctrl .fs-indicator {
    padding: 0 4px 0 6px;
    font-size: 0.68rem;
  }
  .fs-opt-btn {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    font-size: 0.76rem;
  }
}

@media (max-width: 440px) {
  .font-size-ctrl .fs-indicator span {
    display: none;
  }
  .font-size-ctrl .fs-indicator {
    padding: 0 2px 0 5px;
  }
}
