/* ═══════════════════════════════════════════════
   Base Element Styles
   ═══════════════════════════════════════════════ */

/* ── Smooth Scroll + Anchor Offset ── */
html {
  scroll-behavior: smooth;
}

/* Account for fixed nav when jumping to anchors */
section[id],
h2[id],
h3[id],
[id].anchor-target {
  scroll-margin-top: 100px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--white);
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.04em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.03em; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  font-size: var(--text-base);
  color: var(--text-dim);
  line-height: 1.7;
  font-weight: 300;
}

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

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

a:hover {
  color: var(--accent);
}

/* ── Prose (blog posts, resource descriptions) ── */
.prose h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.prose h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.prose p {
  margin-bottom: var(--space-md);
}

.prose ul, .prose ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  font-size: var(--text-base);
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: var(--space-xs);
}

.prose blockquote {
  border-left: 2px solid var(--accent-line);
  padding-left: var(--space-lg);
  margin: var(--space-xl) 0;
  font-style: italic;
  color: var(--text-dim);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.prose pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  margin: var(--space-xl) 0;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
}

.prose img {
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
}

/* ── Loading States ── */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.btn-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Result fade-in */
.result-fade-in {
  animation: resultFadeIn 0.4s ease-out;
}

@keyframes resultFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Skeleton loading placeholder */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Skip to content (accessibility) ── */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: top 0.2s ease;
}

.skip-to-content:focus {
  top: 16px;
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ── Focus visible (keyboard nav) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Form Input Focus Glow Pulse ── */
/* Draws attention when user clicks into tool form inputs */
.input:focus,
select.input:focus {
  animation: input-focus-glow-pulse 1.5s ease-out forwards;
}

@keyframes input-focus-glow-pulse {
  0% {
    box-shadow: 0 0 0 2px var(--accent-line);
  }
  30% {
    box-shadow: 0 0 0 4px var(--accent-line), 0 0 16px var(--accent-glow);
  }
  100% {
    box-shadow: 0 0 0 2px var(--accent-line);
  }
}

/* Disable focus animation for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .input:focus,
  select.input:focus {
    animation: none;
  }
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
select:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* ── Form Input Typing Cursor Indicator ── */
/* Subtle blinking cursor in empty inputs hints at expected input */
.input-wrapper {
  position: relative;
}

.input-wrapper .input:placeholder-shown:not(:focus)::placeholder {
  animation: input-cursor-blink 1.2s step-end infinite;
}

.input:placeholder-shown:not(:focus) {
  position: relative;
}

/* Blinking cursor indicator via ::after on wrapper */
.input-wrapper::after {
  content: '|';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-line);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  pointer-events: none;
  opacity: 0;
  animation: input-cursor-blink 1.2s step-end infinite;
}

/* Show cursor only when input is empty and unfocused */
.input-wrapper:has(.input:placeholder-shown:not(:focus))::after {
  opacity: 1;
}

@keyframes input-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Disable cursor indicator for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .input-wrapper::after {
    animation: none;
    opacity: 0;
  }
}

/* Disable on mobile  -  too subtle and potentially distracting */
@media (max-width: 768px) {
  .input-wrapper::after {
    display: none;
  }
}

/* ── Form Input Error States ── */
/* Visual error states for tool form validation */
.input.input-error,
select.input.input-error,
textarea.input.input-error {
  border-color: #ef4444;
  animation: input-shake 0.4s ease;
}

.input.input-error:focus,
select.input.input-error:focus,
textarea.input.input-error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Error message styling */
.input-error-message {
  display: none;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: #ef4444;
  margin-top: var(--space-xs);
}

.input-error-message.visible {
  display: flex;
}

.input-error-message svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* Inline error icon inside input (optional) */
.form-group--error .input-wrapper {
  position: relative;
}

.form-group--error .input-wrapper::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Tool Result Reveal Animation ── */
/* Slide-up fade-in animation when tool calculation completes */
.tool-result-hidden {
  opacity: 0;
  transform: translateY(24px);
}

.tool-result-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger child elements within result for cascading reveal */
.tool-result-visible .tool-result-stagger {
  animation: tool-result-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--stagger-delay, 0s);
  opacity: 0;
  transform: translateY(12px);
}

@keyframes tool-result-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduced motion: instant reveal */
@media (prefers-reduced-motion: reduce) {
  .tool-result-hidden {
    opacity: 1;
    transform: none;
  }
  .tool-result-visible .tool-result-stagger {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ── Tool Calculation Progress Indicator ── */
/* Shows a progress bar skeleton while tool is calculating */
.tool-progress {
  display: none;
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.tool-progress.active {
  display: block;
}

.tool-progress__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: var(--space-sm);
}

.tool-progress__bar {
  width: 100%;
  height: 4px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.tool-progress__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: var(--radius-full);
  animation: progress-slide 1s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Skeleton pulse for result preview */
.tool-skeleton {
  display: none;
  margin-top: var(--space-lg);
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.tool-skeleton.active {
  display: block;
}

.tool-skeleton__line {
  height: 20px;
  background: linear-gradient(
    90deg,
    var(--bg-hover) 0%,
    rgba(45, 122, 232, 0.1) 50%,
    var(--bg-hover) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  margin-bottom: var(--space-md);
}

.tool-skeleton__line:last-child {
  margin-bottom: 0;
}

.tool-skeleton__line--short {
  width: 60%;
}

.tool-skeleton__line--medium {
  width: 80%;
}

.tool-skeleton__line--full {
  width: 100%;
}

.tool-skeleton__value {
  height: 48px;
  background: linear-gradient(
    90deg,
    var(--bg-hover) 0%,
    rgba(45, 122, 232, 0.15) 50%,
    var(--bg-hover) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  margin-bottom: var(--space-md);
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Reduced motion: no animation */
@media (prefers-reduced-motion: reduce) {
  .tool-progress__bar::after {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }

  .tool-skeleton__line,
  .tool-skeleton__value {
    animation: none;
    background: var(--bg-hover);
  }
}

/* ── Tool Card Wave Entrance Animation ── */
/* Cards start hidden and fade/scale in with stagger when section scrolls into view */
.tool-wave-ready {
  opacity: 0;
  transform: translateY(40px) scale(0.92);
}

.tool-wave-animating {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion: instant reveal */
@media (prefers-reduced-motion: reduce) {
  .tool-wave-ready {
    opacity: 1;
    transform: none;
  }
}

/* ── Resource Card Wave Entrance Animation ── */
/* Same pattern as tool cards  -  stagger entrance when section scrolls into view */
.resource-wave-ready {
  opacity: 0;
  transform: translateY(40px) scale(0.92);
}

.resource-wave-animating {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion: instant reveal */
@media (prefers-reduced-motion: reduce) {
  .resource-wave-ready {
    opacity: 1;
    transform: none;
  }
}

/* ── Blog Card Wave Entrance Animation ── */
/* Same pattern as tool/resource cards  -  stagger entrance when section scrolls into view */
.blog-wave-ready {
  opacity: 0;
  transform: translateY(40px) scale(0.92);
}

.blog-wave-animating {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion: instant reveal */
@media (prefers-reduced-motion: reduce) {
  .blog-wave-ready {
    opacity: 1;
    transform: none;
  }
}

/* ── Back to Top Button ── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.3s var(--ease-out),
              visibility 0.3s var(--ease-out),
              transform 0.3s var(--ease-out),
              background 0.2s var(--ease-smooth),
              border-color 0.2s var(--ease-smooth),
              color 0.2s var(--ease-smooth);
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (hover: hover) {
  .back-to-top:hover {
    background: var(--surface-elevated);
    border-color: var(--accent-line);
    color: var(--accent);
  }
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
  }
}


/* ── Mobile Touch Target Audit (44px minimum) ── */
/* WCAG 2.2 Level AAA requires 44x44px minimum touch targets */
@media (max-width: 768px) {
  /* Buttons  -  ensure minimum height */
  .btn {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .btn-sm {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* Navigation toggle */
  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 12px;
  }

  /* Mobile nav links */
  .nav-mobile-link {
    min-height: 44px;
    padding: 12px 0;
    display: flex;
    align-items: center;
  }

  /* Card links  -  add adequate tap area */
  .card-link {
    min-height: 44px;
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
  }

  /* Badges and tags  -  increase tap area */
  .badge,
  .tag,
  .cred-badge {
    min-height: 36px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
  }

  /* FAQ question buttons */
  .faq-question {
    min-height: 56px;
    padding: 16px 20px;
  }

  /* Form inputs  -  iOS zoom prevention + tap target */
  .input,
  select.input {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS auto-zoom */
    padding: 14px 18px;
  }

  /* Footer links  -  adequate tap spacing */
  .footer-link,
  .footer-social-link {
    min-height: 44px;
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
  }

  /* How-step cards (clickable areas) */
  .how-step {
    min-height: 44px;
  }

  /* Tool result tech readout */
  .tech-readout {
    min-height: 40px;
    padding: 10px 16px;
  }

  /* Section header badges */
  .section-header .badge {
    min-height: 36px;
  }

  /* ── Tool Form Mobile Usability (375px) ── */
  /* Form groups  -  ensure adequate spacing */
  .form-group {
    margin-bottom: var(--space-md);
  }

  .form-group label {
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
    display: block;
  }

  /* Select inputs  -  full width, no horizontal scroll */
  select.input {
    width: 100%;
    max-width: 100%;
    text-overflow: ellipsis;
    padding-right: 40px; /* Room for dropdown arrow */
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
  }

  /* Number inputs  -  prevent zoom, adequate size */
  input[type="number"].input {
    width: 100%;
    font-size: 16px;
  }

  /* Tool result grids  -  stack on mobile */
  [style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--space-md) !important;
  }

  /* Tool result text  -  ensure readable */
  .tech-readout {
    font-size: var(--text-sm);
    word-break: break-word;
  }

  /* Tool cards  -  reduce padding on mobile */
  .card.card--schematic {
    padding: var(--space-lg) !important;
  }

  /* Calculate button  -  full width on mobile */
  .btn.btn-full,
  .btn.btn-accent.btn-full {
    width: 100%;
    justify-content: center;
  }
}

/* ── Mobile Animation Performance Optimization ── */
/* Disable heavy animations on mobile devices for battery/CPU savings */
@media (max-width: 768px) {
  /* Disable shimmer effects on cards  -  these are hover-only anyway on touch */
  .card--panel::after,
  .card--document .doc-body::after {
    display: none;
  }

  /* Faster reveal transitions for snappier mobile feel */
  .reveal {
    transition-duration: 0.35s;
  }

  /* Disable wave entrance animations  -  just show cards immediately */
  .tool-wave-ready,
  .resource-wave-ready,
  .blog-wave-ready {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .tool-wave-animating,
  .resource-wave-animating,
  .blog-wave-animating {
    transition: none;
  }

  /* Simplify hero entrance animations  -  faster reveal */
  .hero-entrance {
    animation-duration: 0.4s !important;
  }

  /* Reduce credibility banner glow  -  saves GPU */
  .credibility-banner::before {
    animation: none;
    opacity: 0.1;
  }

  /* Disable hero CTA glow pulse on mobile */
  .hero .btn-accent::before {
    animation: none;
    display: none;
  }

  /* Simplify scroll indicator animation */
  .scroll-indicator__line::after {
    animation-duration: 1.5s;
  }
}

/* ══════════════════════════════════════════════════
   Tool HowTo Accordion  -  visual step-by-step guide
   ══════════════════════════════════════════════════ */

.tool-howto-section {
  margin-bottom: var(--space-lg);
}

.tool-howto-accordion {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tool-howto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-dim);
  transition: background var(--transition-normal), color var(--transition-normal);
  list-style: none;
}

.tool-howto-header::-webkit-details-marker {
  display: none;
}

.tool-howto-header:hover {
  background: rgba(45, 122, 232, 0.04);
  color: var(--text);
}

.tool-howto-header-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.tool-howto-icon {
  color: var(--accent);
}

.tool-howto-step-count {
  padding: 2px 8px;
  background: rgba(45, 122, 232, 0.1);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--accent);
}

.tool-howto-chevron {
  color: var(--text-mute);
  transition: transform var(--transition-normal);
}

.tool-howto-accordion[open] .tool-howto-chevron {
  transform: rotate(180deg);
}

.tool-howto-content {
  padding: 0 var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border);
}

.tool-howto-steps {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tool-howto-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.tool-howto-step-check {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.tool-howto-step-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, rgba(45, 122, 232, 0.7) 100%);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--white);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.tool-howto-step-checkmark {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  padding: 5px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #22c55e;
}

/* Hover state  -  hint at interactivity */
.tool-howto-step-check:hover .tool-howto-step-number,
.tool-howto-step-check:focus-visible .tool-howto-step-number {
  transform: scale(1.08);
}

.tool-howto-step-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-full);
}

/* Completed state  -  show checkmark, hide number */
.tool-howto-step.completed .tool-howto-step-number {
  opacity: 0;
  transform: scale(0.6);
}

.tool-howto-step.completed .tool-howto-step-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* Completed step text gets muted */
.tool-howto-step.completed .tool-howto-step-name {
  color: var(--text-mute);
  text-decoration: line-through;
}

.tool-howto-step.completed .tool-howto-step-text {
  color: var(--text-mute);
  opacity: 0.7;
}

.tool-howto-step-content {
  flex: 1;
  padding-top: 2px;
}

.tool-howto-step-name {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.tool-howto-step-text {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

.tool-howto-footer {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-mute);
}

.tool-howto-footer svg {
  color: var(--accent);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .tool-howto-header {
    padding: var(--space-sm) var(--space-md);
  }

  .tool-howto-content {
    padding: 0 var(--space-md) var(--space-md);
  }

  .tool-howto-step-check {
    width: 24px;
    height: 24px;
  }

  .tool-howto-step-number {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
  }

  .tool-howto-step-checkmark {
    width: 24px;
    height: 24px;
    padding: 4px;
  }

  .tool-howto-step {
    gap: var(--space-sm);
  }
}

/* ══════════════════════════════════════════════════
   Tool HowTo Completion Celebration
   ══════════════════════════════════════════════════ */

.tool-howto-celebration {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  animation: celebrationAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes celebrationAppear {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tool-howto-celebration.fade-out {
  animation: celebrationFade 0.3s ease-out forwards;
}

@keyframes celebrationFade {
  to {
    opacity: 0;
    transform: scale(0.9) translateY(-5px);
  }
}

.tool-howto-celebration-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-full);
  color: #22c55e;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.1);
}

.tool-howto-celebration-badge svg {
  animation: checkmarkDraw 0.5s ease-out forwards;
}

.tool-howto-celebration-badge svg polyline {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: checkmarkStroke 0.5s ease-out 0.1s forwards;
}

@keyframes checkmarkStroke {
  to { stroke-dashoffset: 0; }
}

.tool-howto-confetti {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
}

/* Disable celebration animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tool-howto-celebration {
    animation: none;
  }
  .tool-howto-celebration-badge svg polyline {
    stroke-dashoffset: 0;
    animation: none;
  }
  .tool-howto-confetti {
    display: none;
  }
}

/* ── Tool HowTo Reset Button ── */
.tool-howto-reset {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-mute);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.tool-howto-reset:hover,
.tool-howto-reset:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(45, 122, 232, 0.05);
}

.tool-howto-reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool-howto-reset svg {
  transition: transform var(--transition-fast);
}

.tool-howto-reset:hover svg {
  transform: rotate(-45deg);
}

/* ── Sound Toggle Button ── */
.tool-howto-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.tool-howto-footer-actions .tool-howto-reset {
  margin-top: 0;
}

.tool-howto-sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-mute);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.tool-howto-sound-toggle:hover,
.tool-howto-sound-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(45, 122, 232, 0.05);
}

.tool-howto-sound-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Print Stylesheet ── */
@media print {
  /* Hide non-content elements */
  nav,
  .nav-mobile,
  footer,
  .schematic-grid,
  .cursor-glow,
  .exit-popup,
  .email-capture-form,
  .email-gate,
  .skip-to-content,
  .btn,
  .toc-sidebar,
  .toc-mobile,
  .inline-cta,
  .related-articles,
  .card-link,
  #exit-popup {
    display: none !important;
  }

  /* Reset backgrounds and colors for print */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }

  * {
    color: black !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: #ccc !important;
  }

  /* Ensure content fills page */
  main {
    padding: 0 !important;
    margin: 0 !important;
  }

  .container,
  .container-narrow {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Article layout: single column for print */
  .article-layout {
    display: block !important;
  }

  .article-content {
    max-width: 100% !important;
  }

  /* Card styles for print */
  .card {
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  .card::before,
  .card::after {
    display: none !important;
  }

  .card:hover {
    transform: none !important;
  }

  /* Links show URL */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666 !important;
  }

  /* Don't show URL for nav/internal links */
  a[href^="#"]::after,
  a[href^="/"]::after,
  nav a::after {
    content: "" !important;
  }

  /* Tool results: keep visible, remove interactivity */
  .compliance-card,
  .compliance-section {
    page-break-inside: avoid;
  }

  /* Page breaks */
  h2, h3 {
    page-break-after: avoid;
  }

  /* Reduce spacing */
  section {
    padding: 24pt 0 !important;
  }

  /* Hide animations */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Hide scroll progress */
  .scroll-progress {
    display: none !important;
  }

  /* ── Tool Page Print Optimization ── */
  /* Hide form elements when printing tool results */
  .tool-form,
  .form-group,
  .btn,
  .back-to-top,
  .tool-cta,
  .tool-sidebar,
  .tool-related {
    display: none !important;
  }

  /* Show tool results prominently */
  .tool-result,
  .result-card,
  .compliance-result,
  .cost-result,
  .callback-result {
    display: block !important;
    border: 1px solid #ccc !important;
    padding: 16pt !important;
    margin: 12pt 0 !important;
    page-break-inside: avoid;
  }

  /* Tech readout styling for print */
  .tech-readout {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
    padding: 8pt 12pt !important;
    margin: 4pt 0 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 10pt !important;
  }

  /* Result labels and values */
  .result-label {
    font-weight: bold !important;
    color: black !important;
  }

  .result-value {
    color: black !important;
  }

  /* Cost estimates - high visibility */
  .cost-total,
  .cost-breakdown {
    border: 2px solid black !important;
    padding: 12pt !important;
    font-size: 12pt !important;
  }

  /* Compliance status badges */
  .compliance-status,
  .status-badge {
    border: 1px solid black !important;
    padding: 4pt 8pt !important;
    font-weight: bold !important;
  }

  /* Breadcrumb - show for context */
  .breadcrumb {
    display: block !important;
    margin-bottom: 12pt !important;
    font-size: 9pt !important;
    color: #666 !important;
  }

  /* Add print date/URL footer */
  @page {
    margin: 0.75in;
  }
}

/* ── Scroll Progress Indicator ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--white) 100%);
  z-index: 10001;
  transition: width 0.1s linear;
  pointer-events: none;
  opacity: 0;
}

/* Only visible after scrolling past hero */
.scroll-progress.active {
  opacity: 1;
}

/* ── Breadcrumb Navigation ── */
.breadcrumb {
  margin-bottom: var(--space-lg);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.03em;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  color: var(--text-mute);
}

.breadcrumb-item a {
  color: var(--text-mute);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--accent);
}

.breadcrumb-item:not(:last-child)::after {
  content: '›';
  margin-left: var(--space-xs);
  color: var(--border);
  font-size: 14px;
}

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

@media (max-width: 480px) {
  .breadcrumb-list {
    font-size: 11px;
  }

  .breadcrumb-current {
    /* Truncate long tool names on mobile */
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ── Tool Result Copy Button ── */
.copy-result-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-mute);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-result-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-result-btn.copied {
  color: var(--success);
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.copy-result-btn .check-icon {
  color: var(--success);
}

/* ═══════════════════════════════════════════════
   High Contrast Mode  -  Accessibility Enhancement
   For users who prefer stronger visual distinctions
   ═══════════════════════════════════════════════ */
@media (prefers-contrast: more) {
  :root {
    /* Increase contrast between text and backgrounds */
    --text: #ffffff;
    --text-dim: #cccccc;
    --text-mute: #999999;
    --border: #444444;
    --border-hover: #666666;
    --bg-card: #1a1a1a;
    --bg-raised: #222222;
  }

  /* Stronger focus indicators */
  *:focus-visible {
    outline: 3px solid var(--accent) !important;
    outline-offset: 4px !important;
  }

  /* Higher contrast buttons */
  .btn,
  .btn-accent,
  .btn-outline {
    border-width: 2px;
    font-weight: 600;
  }

  /* Stronger card borders */
  .card--panel,
  .card--document,
  .card--editorial {
    border-width: 2px;
  }

  /* Higher contrast form inputs */
  .input,
  select.input,
  textarea.input {
    border-width: 2px;
    border-color: var(--border-hover);
  }

  /* Tool result sections get stronger borders */
  .tool-result,
  .tech-readout {
    border-width: 2px;
  }

  /* Links get underlines for visibility */
  a:not(.btn):not(.card--panel):not(.card--document):not(.nav-link) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }

  /* Disable background gradient effects for clarity */
  .schematic-grid {
    opacity: 0.08;
  }

  /* Credibility banner stronger contrast */
  .credibility-banner {
    border-width: 2px;
  }

  /* FAQ accordion stronger contrast */
  .faq-question {
    border-width: 2px;
  }
}
