:root {
  --bg: #e7eefc;
  --panel: rgba(255, 255, 255, 0.84);
  --text: #111b2d;
  --muted: #405170;
  --accent: #0f72b8;
  --border: rgba(17, 27, 45, 0.17);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Karla", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, #d5e6ff 0%, transparent 36%),
    radial-gradient(circle at 89% 12%, #d6f0ff 0%, transparent 30%),
    linear-gradient(150deg, #e7eefc, #dce6f7);
}

h1,
h2,
h3 {
  font-family: "Rubik Mono One", sans-serif;
  margin-top: 0;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(231, 238, 252, 0.88);
  backdrop-filter: blur(8px);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 0.36rem 0.66rem;
  font: inherit;
}

.hero,
main,
footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero {
  padding-top: 2.3rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

.glitch {
  position: relative;
  font-size: clamp(1.9rem, 5vw, 3.3rem);
  margin: 0.5rem 0 0.85rem;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}

.glitch::before {
  text-shadow: -2px 0 #ff2a6f;
  transform: translate(2px, 0);
  animation: glitchTop 1.8s infinite linear alternate-reverse;
}

.glitch::after {
  text-shadow: 2px 0 #39e2ff;
  transform: translate(-2px, 0);
  animation: glitchBottom 1.6s infinite linear alternate-reverse;
}

.subtitle {
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  margin: 1rem 0;
  box-shadow: 0 16px 24px -20px rgba(17, 27, 45, 0.65);
  backdrop-filter: blur(6px);
}

.section-head p,
.section-note,
.book-card p,
ul,
footer {
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0;
}

.primary-btn,
.secondary-btn,
.filter-btn {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  padding: 0.68rem 1.2rem;
}

.secondary-btn {
  background: transparent;
  color: var(--text);
  padding: 0.56rem 1rem;
}

.filter-btn {
  background: #fff;
  color: var(--text);
  padding: 0.44rem 0.85rem;
}

.filter-btn.active {
  background: #111b2d;
  color: #fff;
  border-color: #111b2d;
}

.primary-btn:hover,
.secondary-btn:hover,
.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px -14px rgba(17, 27, 45, 0.9);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.book-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.book-card span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

.tip-card {
  background: linear-gradient(145deg, #edf4ff, #dfeeff);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.comment-form {
  display: grid;
  gap: 0.62rem;
  margin-bottom: 1rem;
}

.comment-form input,
.comment-form textarea {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.68rem 0.74rem;
  background: #fff;
}

.comment-list {
  display: grid;
  gap: 0.65rem;
}

.comment-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
}

.comment-item h4 {
  margin: 0;
  font-size: 1rem;
}

.comment-item p {
  margin: 0.4rem 0 0;
  line-height: 1.5;
  color: var(--muted);
}

.popup-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 14, 30, 0.58);
  z-index: 30;
  padding: 1rem;
}

.popup-overlay.hidden {
  display: none;
}

.popup-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 16px 30px -18px rgba(0, 0, 0, 0.6);
}

.bounce-fast {
  animation: bounceFast 1.8s infinite;
}

.bounce-soft {
  animation: bounceSoft 3.2s infinite;
}

.bounce-slow {
  animation: bounceSlow 4.6s infinite;
}

@keyframes glitchTop {
  0% { clip-path: inset(0 0 88% 0); }
  25% { clip-path: inset(10% 0 68% 0); }
  50% { clip-path: inset(32% 0 42% 0); }
  75% { clip-path: inset(60% 0 15% 0); }
  100% { clip-path: inset(84% 0 5% 0); }
}

@keyframes glitchBottom {
  0% { clip-path: inset(85% 0 4% 0); }
  25% { clip-path: inset(60% 0 18% 0); }
  50% { clip-path: inset(38% 0 44% 0); }
  75% { clip-path: inset(16% 0 66% 0); }
  100% { clip-path: inset(2% 0 88% 0); }
}

@keyframes bounceFast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@media (max-width: 820px) {
  .split {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline-block;
  }

  .nav-links {
    position: absolute;
    top: 56px;
    right: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-direction: column;
    min-width: 150px;
    padding: 0.7rem;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }
}
