/* ==================== Custom Styles ==================== */
/* Supplements Tailwind CDN — matches Stitch design system */

/* ---- Reduced Motion ---- */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Focus Styles ---- */
:focus-visible {
  outline: 2px solid #212529;
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #212529;
  outline-offset: 2px;
}

/* ---- FAQ Accordion ---- */
[data-faq-content] {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

[data-faq-content].faq-open {
  opacity: 1;
}

/* First FAQ item open by default */
[data-faq-item]:first-child [data-faq-content] {
  max-height: 200px;
  opacity: 1;
}

/* ---- Regenerate spin ---- */
.regen-spin {
  animation: regenSpin 0.3s ease;
}

@keyframes regenSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---- Generate button loading ---- */
.gen-loading .gen-icon {
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Empty state fade in ---- */
.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

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

/* ---- Row stagger ---- */
.result-row {
  animation: slideUp 0.25s ease forwards;
  opacity: 0;
}

.result-row:nth-child(1) { animation-delay: 0.02s; }
.result-row:nth-child(2) { animation-delay: 0.04s; }
.result-row:nth-child(3) { animation-delay: 0.06s; }
.result-row:nth-child(4) { animation-delay: 0.08s; }
.result-row:nth-child(5) { animation-delay: 0.10s; }
.result-row:nth-child(6) { animation-delay: 0.12s; }
.result-row:nth-child(7) { animation-delay: 0.14s; }
.result-row:nth-child(8) { animation-delay: 0.16s; }
.result-row:nth-child(9) { animation-delay: 0.18s; }
.result-row:nth-child(10) { animation-delay: 0.20s; }
.result-row:nth-child(n+11) { animation-delay: 0.22s; }

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

/* ---- Skeleton loading ---- */
.skeleton {
  background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 8px;
}

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

/* ---- Mobile nav ---- */
.mobile-nav-enter {
  animation: slideDown 0.2s ease forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Copy feedback state ---- */
.copy-success {
  background-color: #212529 !important;
  color: #f8f9fa !important;
  border-color: #212529 !important;
}

/* ---- Touch targets (apply only to interactive action buttons and form controls) ---- */
button:not(.inline-btn),
select,
input[type="text"],
input[type="email"],
textarea {
  min-height: 44px;
}

/* Exceptions for inline small elements */
.inline-btn {
  min-height: 32px;
  min-width: 32px;
}

/* Ensure links and text elements have natural height and flow */
a {
  min-height: auto;
  min-width: auto;
}

/* Header navigation link styling: tight underline close to text */
.nav-link {
  display: inline-flex;
  align-items: center;
  position: relative;
  line-height: 1.2;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-link.active {
  color: #212529 !important;
  border-bottom-color: #212529 !important;
  font-weight: 600;
}

.nav-link:not(.active) {
  color: #495057;
}

.nav-link:not(.active):hover {
  color: #212529;
  border-bottom-color: #adb5bd;
}

/* Footer link styling: clean typographic rhythm without unnatural gaps */
.footer-link {
  display: inline-block;
  color: #495057;
  font-size: 13px;
  line-height: 18px;
  padding: 1px 0;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: #212529;
}

/* ---- Select arrow custom ---- */
select {
  background-image: none;
}

/* ---- Page content for sub-pages ---- */
.page-content {
  min-height: calc(100vh - 72px - 200px);
}

.page-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.page-content p {
  margin-bottom: 1rem;
}

.page-content ul, .page-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.page-content li {
  margin-bottom: 0.25rem;
}

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f8f9fa;
}

::-webkit-scrollbar-thumb {
  background: #adb5bd;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6c757d;
}
