/* ===== Header ===== */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 100;
  height: var(--header-h);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  border-bottom: 1px solid transparent;
  background: transparent;
}
.site-header.is-scrolled {
  background: var(--overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-2);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
  z-index: 2;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  line-height: 1;
}
.logo span:first-child {
  color: var(--accent);
  flex-shrink: 0;
}
.logo-text {
  white-space: nowrap;
  display: inline-block;
}
@media (min-width: 768px) {
  .site-header__inner {
    gap: var(--space-4);
  }
  .logo {
    font-size: 1.35rem;
    gap: var(--space-2);
  }
}
.desktop-nav {
  display: none;
  align-items: center;
  gap: var(--space-6);
}
.desktop-nav a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  position: relative;
  padding-block: var(--space-2);
  transition: color 0.2s;
}
.desktop-nav a:hover,
.desktop-nav a.is-active {
  color: var(--text);
}
.desktop-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.desktop-nav a:hover::after,
.desktop-nav a.is-active::after {
  width: 100%;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-left: auto;
}
@media (min-width: 768px) {
  .header-actions {
    gap: var(--space-2);
  }
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text);
  position: relative;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--accent);
}
.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn .badge[hidden] {
  display: none !important;
}
/* Beat .btn { display:inline-flex } so BOOK stays off on small screens */
.header-actions .header-cta.btn {
  display: none;
}
@media (min-width: 768px) {
  .header-actions .header-cta.btn {
    display: inline-flex;
  }
}
@media (max-width: 379px) {
  .header-actions a[aria-label="Wishlist"] {
    display: none;
  }
}
@media (min-width: 1024px) {
  .desktop-nav {
    display: flex;
  }
  .menu-toggle {
    display: none;
  }
}

/* ===== Mobile drawer ===== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}
.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: 120;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease);
  padding: var(--space-6);
  padding-top: calc(var(--header-h) + var(--space-4));
  overflow-y: auto;
}
.drawer.is-open {
  transform: translateX(0);
}
.drawer nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.drawer nav a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.drawer nav a.is-active,
.drawer nav a:hover {
  color: var(--accent);
  background: var(--surface);
}
.drawer__meta {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ===== Bottom nav ===== */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 90;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-block-end: env(safe-area-inset-bottom, 0px);
  background: var(--bottom-nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dim);
  min-height: 44px;
  transition: color 0.2s;
}
.bottom-nav a svg {
  width: 22px;
  height: 22px;
}
.bottom-nav a.is-active,
.bottom-nav a:hover {
  color: var(--accent);
}
@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-top: var(--space-16);
  padding-bottom: calc(var(--space-10) + var(--bottom-nav-h));
  margin-top: var(--space-16);
}
@media (min-width: 1024px) {
  .site-footer {
    padding-bottom: var(--space-10);
  }
}
.footer-grid {
  display: grid;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}
@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}
@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
  }
}
.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: var(--space-4);
  max-width: 28rem;
  line-height: 1.6;
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: var(--space-4);
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-col a:hover {
  color: var(--accent);
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  justify-content: space-between;
}
@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
  }
}
.footer-bottom p {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}
.footer-credit a {
  color: var(--accent);
  font-weight: 500;
}
.footer-credit a:hover {
  text-decoration: underline;
}

/* ===== Toast / back to top ===== */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 12px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(90vw, 320px);
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  animation: fadeUp 0.35s var(--ease);
}
.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--danger); }

.back-top {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
  z-index: 80;
  box-shadow: var(--glow);
}
.back-top.is-visible {
  opacity: 1;
  visibility: visible;
}
@media (min-width: 1024px) {
  .back-top {
    bottom: 24px;
  }
}
