/* ============================================================
   AP Study Hub Landing Page — Styles
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --color-bg-start: #0f0b2e;
  --color-bg-mid: #1a1145;
  --color-bg-end: #0c1929;
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-secondary: #8b5cf6;
  --color-green: #22c55e;
  --color-amber: #f59e0b;
  --color-pink: #ec4899;
  --color-cyan: #06b6d4;
  --color-teal: #14b8a6;
  --color-text: rgba(255, 255, 255, 0.87);
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-text-dim: rgba(255, 255, 255, 0.4);
  --color-surface: rgba(255, 255, 255, 0.03);
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-hover: rgba(255, 255, 255, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 5rem;
  --space-3xl: 6rem;
  --transition: 0.25s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.2);
  --shadow-btn: 0 4px 16px rgba(99, 102, 241, 0.3);
  --shadow-btn-hover: 0 8px 32px rgba(99, 102, 241, 0.45);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-mid) 40%, var(--color-bg-end) 100%);
  background-attachment: fixed;
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* --- Container --- */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Scroll anchor offset for sticky nav --- */
[id] {
  scroll-margin-top: 64px;
}

/* --- Typography --- */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--color-text-muted);
  text-align: center;
  max-width: 560px;
  margin: 0 auto var(--space-xl);
  line-height: 1.7;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  padding: 0.7em 1.6em;
  box-shadow: var(--shadow-btn);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--lg {
  font-size: 1.05rem;
  padding: 0.85em 2em;
  border-radius: var(--radius-md);
}

/* --- Fade-in animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-sm) 0;
  transition: background var(--transition), backdrop-filter var(--transition);
}

.navbar.is-scrolled {
  background: rgba(15, 11, 46, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.navbar__logo-icon {
  font-size: 1.4rem;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-left: auto;
}

.navbar__link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition);
  position: relative;
}

.navbar__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: width var(--transition);
}

.navbar__link:hover {
  color: #fff;
}

.navbar__link:hover::after {
  width: 100%;
}

.navbar__cta {
  margin-left: var(--space-md);
  flex-shrink: 0;
}

.navbar__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}

.navbar__hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  padding: 60px 0 0;
  text-align: center;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero__bg-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: orbFloat 12s ease-in-out infinite alternate;
}

.hero__orb--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--color-primary), transparent 70%);
  top: -10%;
  left: -10%;
  animation-duration: 14s;
}

.hero__orb--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--color-secondary), transparent 70%);
  top: 30%;
  right: -8%;
  animation-duration: 10s;
  animation-delay: -3s;
}

.hero__orb--3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--color-cyan), transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-duration: 16s;
  animation-delay: -7s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.08); }
}

.hero__content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero__headline {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, #fff 30%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__subheadline {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--color-text-muted);
  max-width: 620px;
  margin: 0 auto var(--space-lg);
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.hero__secondary-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.hero__secondary-link:hover {
  color: var(--color-primary-light);
}

.hero__pills {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5em 1.2em;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.pill--indigo {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--color-primary-light);
}

.pill--green {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--color-green);
}

.hero__screenshot-area {
  max-width: 800px;
  margin: 0 auto;
  min-height: 0;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats {
  padding: var(--space-md) 0;
  margin-top: auto;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--color-border);
}

.stats__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  text-align: center;
}

.stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.stats__icon {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

.stats__number {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stats__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ============================================================
   FEATURES
   ============================================================ */
.features {
  padding: var(--space-xl) 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.features__grid .card:nth-child(n+5) {
  /* Last 3 cards center in bottom row */
}

/* Center the bottom row of 3 cards under 4-column grid */
.features__grid {
  justify-items: center;
}

.features__grid .card {
  width: 100%;
}

/* --- Glassmorphism Card --- */
.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--card-accent) 12%, transparent);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.card__desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  flex: 1;
}

.card__stat {
  display: inline-block;
  padding: 0.3em 0.8em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--card-accent) 12%, transparent);
  color: var(--card-accent);
  border: 1px solid color-mix(in srgb, var(--card-accent) 20%, transparent);
}

/* ============================================================
   COURSES
   ============================================================ */
.courses {
  padding: var(--space-xl) 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.courses > .container {
  width: 100%;
}

.courses__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--course-accent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.course-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.course-card:hover::before {
  opacity: 1;
}

.course-card__icon {
  font-size: 2.2rem;
  margin-bottom: var(--space-sm);
}

.course-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.course-card__desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
}

.course-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-light);
  transition: color var(--transition), gap var(--transition);
}

.course-card__link:hover {
  color: #a5b4fc;
  gap: 0.5em;
}

/* Coming Soon cards */
.course-card--soon {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.coming-soon-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  padding: 3px 10px;
  border-radius: 10px;
  margin-top: 6px;
}

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how-it-works {
  padding: var(--space-xl) 0 var(--space-md);
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  padding: 0 var(--space-sm);
}

.step__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  flex-shrink: 0;
  box-shadow: var(--shadow-btn);
}

.step__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.step__desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.step__connector {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 1px;
  flex-shrink: 0;
  opacity: 0.4;
  align-self: flex-start;
  margin-top: 28px;
}

/* ============================================================
   CTA BANNER
   ============================================================ */
.cta-banner {
  padding: var(--space-md) 0 var(--space-xl);
}

.cta-banner__card {
  position: relative;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  border-radius: var(--radius-xl);
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  overflow: hidden;
}

.cta-banner__card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(99,102,241,0.4), transparent 50%, rgba(139,92,246,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.cta-banner__card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(99,102,241,0.08), transparent 50%);
  pointer-events: none;
}

.cta-banner__title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 1;
}

.cta-banner__desc {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  position: relative;
  z-index: 1;
}

.cta-banner .btn {
  position: relative;
  z-index: 1;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer__logo {
  font-size: 1.1rem;
  font-weight: 700;
}

.footer__tagline {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  margin-top: 0.25rem;
}

.footer__meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.footer__copy {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

.footer__links {
  display: flex;
  gap: var(--space-sm);
}

.footer__link {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  transition: color var(--transition);
}

.footer__link:hover {
  color: var(--color-text-muted);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

/* Large tablet */
@media (max-width: 1200px) {
  .features__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .features__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .features, .courses {
    min-height: auto;
  }

  .courses__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .navbar__links,
  .navbar__cta {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
  }

  /* Mobile nav open */
  .navbar.is-open .navbar__links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 11, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--space-md);
    gap: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
  }

  .navbar.is-open .navbar__cta {
    display: inline-flex;
    position: absolute;
    top: calc(100% + 140px);
    left: var(--space-md);
    right: var(--space-md);
    justify-content: center;
  }

  .navbar.is-open .navbar__links .navbar__link {
    font-size: 1.05rem;
    padding: 0.5em 0;
  }

  /* Hamburger X transform */
  .navbar.is-open .navbar__hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .navbar.is-open .navbar__hamburger-line:nth-child(2) {
    opacity: 0;
  }
  .navbar.is-open .navbar__hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    height: auto;
    min-height: auto;
    padding-top: calc(var(--space-lg) + 56px);
    padding-bottom: 0;
  }

  .hero__headline {
    font-size: clamp(1.8rem, 8vw, 3rem);
    margin-bottom: var(--space-sm);
  }

  .hero__subheadline {
    font-size: 0.95rem;
    margin-bottom: var(--space-sm);
  }

  .hero__actions {
    margin-bottom: var(--space-sm);
  }

  .hero__pills {
    margin-bottom: var(--space-sm);
    gap: 0.5rem;
  }

  .hero__pills span {
    font-size: 0.8rem;
    padding: 0.4em 0.9em;
  }

  .stats {
    padding: var(--space-sm) 0;
  }

  .stats__inner {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xs);
  }

  .stats__icon {
    font-size: 1.2rem;
    margin-bottom: 0.1rem;
  }

  .stats__number {
    font-size: 1rem;
  }

  .stats__label {
    font-size: 0.65rem;
  }

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

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

  .steps {
    flex-direction: column;
    gap: 0;
  }

  .step__connector {
    width: 2px;
    height: 40px;
    margin-top: 0;
    align-self: center;
  }

  .step {
    padding: var(--space-sm) 0;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .footer__meta {
    align-items: center;
    text-align: center;
  }

  .cta-banner__card {
    padding: var(--space-xl) var(--space-md);
  }
}

/* Small mobile */
@media (max-width: 400px) {
  .hero__pills {
    flex-direction: column;
    align-items: center;
  }

  .hero__actions {
    flex-direction: column;
    gap: var(--space-sm);
  }
}
