/* Shared components */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}

.site-header.is-scrolled {
  background: var(--bottom-nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.25rem;
  z-index: 70;
}

.brand iconify-icon {
  color: var(--accent);
}

.nav-pill {
  display: none;
  align-items: center;
  gap: 1.5rem;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.nav-pill a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-pill a:hover,
.nav-pill a.active {
  color: var(--text-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-hover);
}

.icon-btn:active {
  transform: scale(0.96);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  min-height: 2.85rem;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-strong);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-strong);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(88vw, 360px);
  height: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 90;
  transform: translateX(105%);
  transition: transform 0.28s ease;
  padding: 5.5rem 1.25rem 2rem;
  overflow-y: auto;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer a {
  display: block;
  padding: 0.9rem 0.75rem;
  border-radius: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.mobile-drawer a:hover,
.mobile-drawer a.active {
  background: var(--surface);
  color: var(--text-strong);
}

.bottom-nav {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  z-index: 70;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  padding: 0.55rem 0.4rem;
  border-radius: 1.25rem;
  background: var(--bottom-nav-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-decoration: none;
  color: var(--muted-2);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.35rem 0.2rem;
  border-radius: 0.85rem;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.app-shell {
  padding-bottom: 6.5rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 4rem 0 2.5rem;
  margin-top: 2rem;
}

.site-footer a {
  color: var(--muted-2);
  text-decoration: none;
}

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

.sonojs-credit {
  color: var(--muted-2);
  font-size: 0.875rem;
}

.sonojs-credit a {
  color: var(--accent);
  font-weight: 600;
}

.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--card-solid);
  border: 1px solid var(--border);
  color: var(--text-strong);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: toast-in 0.25s ease;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.35);
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.35);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-sheet {
  width: min(100%, 480px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 1.5rem 1.5rem 1.1rem 1.1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow: auto;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-strong);
  border-radius: 0.85rem;
  padding: 0.85rem 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.chip.active,
.chip:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.list-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.list-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge-muted {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.sticky-cta {
  position: sticky;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 40;
  padding: 0.75rem 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.page-enter {
  animation: page-enter 0.35s ease;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-wrap {
  position: relative;
}

.search-wrap iconify-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.search-wrap .form-input {
  padding-left: 2.5rem;
}

@media (min-width: 768px) {
  .nav-pill {
    display: flex;
  }

  .mobile-only {
    display: none !important;
  }

  .bottom-nav {
    display: none;
  }

  .app-shell {
    padding-bottom: 2rem;
  }

  .modal-backdrop {
    align-items: center;
  }

  .modal-sheet {
    border-radius: 1.25rem;
  }

  .sticky-cta {
    bottom: 1rem;
  }
}

@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }

  .app-shell {
    padding-bottom: calc(7.25rem + env(safe-area-inset-bottom));
  }

  .sticky-cta {
    bottom: calc(6.25rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .bottom-nav {
    left: 0.5rem;
    right: 0.5rem;
    padding: 0.45rem 0.25rem;
  }

  .bottom-nav a {
    font-size: 0.6rem;
    gap: 0.15rem;
  }

  .page-wide,
  .page-narrow {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Interactive affordances */
.btn,
.chip,
.icon-btn,
.list-card,
.faq-item button,
.pricing-toggle button,
[data-theme-toggle],
a.brand {
  cursor: pointer;
}

.btn:focus-visible,
.chip:focus-visible,
.icon-btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.list-card:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.empty-state {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  text-align: center;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 1.25rem;
  color: var(--muted);
  background: var(--surface);
}

.empty-state iconify-icon {
  color: var(--accent);
  opacity: 0.85;
}

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

.empty-state .btn {
  margin-top: 0.35rem;
}

@media (prefers-reduced-motion: reduce) {
  .animate-blob,
  .animate-float,
  .page-enter,
  .toast {
    animation: none !important;
  }

  body,
  .btn,
  .chip,
  .list-card {
    transition: none !important;
  }
}

html[data-theme="light"] ::selection {
  background: #e84700;
  color: #fff;
}
