*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.22);
  --text: #f0f0f5;
  --muted: rgba(240, 240, 245, 0.55);
  --accent: #7c6bff;
  --accent-2: #ff6bcb;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: #0a0a0f;
  min-height: 100vh;
  overflow-x: hidden;
}

body.is-leaving {
  pointer-events: none;
}

body.is-leaving .page-content {
  animation: pageOut 0.3s ease forwards;
}

body.is-entering .page-content {
  animation: pageIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.is-entering .liquid-bg {
  animation: bgIn 0.7s ease forwards;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes pageOut {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    filter: blur(8px);
  }
}

@keyframes bgIn {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.is-entering .page-content,
  body.is-leaving .page-content,
  body.is-entering .liquid-bg {
    animation: none;
  }
}

/* background */
.liquid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 0%, #12121f 0%, #0a0a0f 60%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite;
}

.blob-1 {
  width: 55vw;
  height: 55vw;
  max-width: 600px;
  max-height: 600px;
  background: #4a3aff;
  top: -10%;
  left: -10%;
}

.blob-2 {
  width: 45vw;
  height: 45vw;
  max-width: 500px;
  max-height: 500px;
  background: #ff3d9a;
  bottom: 10%;
  right: -5%;
  animation-delay: -6s;
  animation-duration: 22s;
}

.blob-3 {
  width: 35vw;
  height: 35vw;
  max-width: 400px;
  max-height: 400px;
  background: #00d4aa;
  top: 40%;
  left: 35%;
  animation-delay: -12s;
  animation-duration: 26s;
  opacity: 0.3;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4%, 6%) scale(1.06); }
  66% { transform: translate(-3%, 4%) scale(0.96); }
}

/* glass */
.glass-nav,
.glass-card,
.hero-glass,
.page-hero,
.glass-footer,
.coder-frame,
.photo-frame,
.back-btn {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 var(--glass-highlight);
}

.glass-nav {
  padding: 0.7rem 2rem;
  border-radius: 100px;
}

/* top bar */
.top-bar {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.top-bar--center {
  grid-template-columns: 1fr;
  justify-items: center;
}

.top-bar .glass-nav {
  justify-self: center;
  grid-column: 2;
  max-width: 100%;
}

.top-bar--center .glass-nav {
  grid-column: 1;
}

.top-bar--back-only {
  grid-template-columns: auto;
}

.top-bar-spacer {
  visibility: hidden;
  pointer-events: none;
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  white-space: nowrap;
  grid-column: 3;
}

.logo {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--accent-2);
}

/* main */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 6.5rem 1.25rem 3rem;
}

.hero-glass {
  padding: 2rem 2rem 2rem;
  border-radius: 36px;
}

.hero-kub {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.hero-kub img {
  width: 100%;
  max-width: 340px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.hero-kub img:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 24px 56px rgba(124, 107, 255, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

/* coder page */
.coder-only {
  min-height: 100vh;
}

/* back button */
.back-btn {
  padding: 0.65rem 1.25rem;
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
  grid-column: 1;
  justify-self: start;
  white-space: nowrap;
}

.back-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateX(-2px);
}

/* simple subpages */
.simple-page,
.coder-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 5.5rem 1.25rem 2rem;
  max-width: 720px;
  margin: 0 auto;
}

.photo-frame,
.coder-frame {
  max-width: 420px;
  width: 100%;
  padding: 0.65rem;
  border-radius: 32px;
  overflow: hidden;
}

.photo-frame img,
.coder-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.coder-frame img {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(0, 212, 170, 0.12);
}

.page-quote {
  font-family: "Syne", sans-serif;
  font-weight: 600;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  text-align: center;
  color: var(--muted);
  font-style: italic;
  max-width: 28ch;
  line-height: 1.5;
  padding: 0 0.5rem;
}

.page-quote::before {
  content: "«";
  color: var(--accent);
  margin-right: 0.15em;
}

.page-quote::after {
  content: "»";
  color: var(--accent);
  margin-left: 0.15em;
}

.btn-download {
  display: block;
  width: 100%;
  max-width: 420px;
  padding: 1.1rem 2rem;
  border-radius: 100px;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #f0b90b, #fcd535);
  box-shadow: 0 8px 32px rgba(240, 185, 11, 0.35);
  transition: transform 0.25s, box-shadow 0.25s;
}

.btn-download:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(240, 185, 11, 0.45);
}

.section-card.no-label .card-arrow {
  margin-left: auto;
}

/* section cards */
.section-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.section-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.section-card:hover {
  transform: translateX(6px);
  border-color: rgba(255, 255, 255, 0.22);
}

.card-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card-purple .card-glow { background: linear-gradient(90deg, rgba(124, 107, 255, 0.15), transparent 60%); }
.card-blue .card-glow { background: linear-gradient(90deg, rgba(0, 212, 170, 0.12), transparent 60%); }
.card-pink .card-glow { background: linear-gradient(90deg, rgba(255, 107, 203, 0.15), transparent 60%); }

.section-card:hover .card-glow { opacity: 1; }

.card-purple:hover { box-shadow: 0 8px 40px rgba(124, 107, 255, 0.2); }
.card-blue:hover { box-shadow: 0 8px 40px rgba(0, 212, 170, 0.15); }
.card-pink:hover { box-shadow: 0 8px 40px rgba(255, 107, 203, 0.2); }

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  color: var(--text);
}

.icon-svg {
  width: 22px;
  height: 22px;
}

.card-title {
  flex: 1;
  font-family: "Syne", sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
}

.card-arrow {
  font-size: 1.25rem;
  color: var(--muted);
  transition: transform 0.3s, color 0.3s;
}

.section-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--text);
}

/* inner pages */
.page {
  max-width: 720px;
}

.page-hero {
  padding: 2.5rem 2rem;
  border-radius: 32px;
  margin-bottom: 1.25rem;
  text-align: center;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

.page-hero h1 {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 2.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.page-lead {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 40ch;
  margin: 0 auto;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.glass-card {
  padding: 1.5rem;
  border-radius: 22px;
  transition: border-color 0.25s, transform 0.25s;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

.glass-card.wide {
  grid-column: 1 / -1;
}

.glass-card h3 {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.glass-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.code-block {
  background: rgba(0, 0, 0, 0.25);
}

.code-block pre {
  overflow-x: auto;
}

.code-block code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.88rem;
  color: #a8d4ff;
  line-height: 1.6;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lesson {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.lesson-num {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
}

/* footer */
.glass-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 720px;
  margin: 0 auto 2rem;
  padding: 1rem 1.5rem;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-tag {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  color: var(--accent-2);
}

@media (max-width: 480px) {
  .top-bar .glass-nav {
    padding: 0.6rem 1rem;
  }

  .top-bar .logo {
    font-size: 0.82rem;
  }

  .back-btn,
  .top-bar-spacer {
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .hero-glass {
    padding: 2rem 1.25rem 1.5rem;
  }

  .page-grid {
    grid-template-columns: 1fr;
  }

  .glass-card.wide {
    grid-column: auto;
  }
}
