/* ============================================================
   Homepage for the Advanced AI Agents Course.
   Builds on the design tokens in base.css (dark navy + the four
   agent-loop accents: perceive / plan / act / reflect).
   ============================================================ */

#bg { position: fixed; inset: 0; z-index: -2; }
.page-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 48vh at 78% -8%, rgba(255, 181, 71, 0.10), transparent 60%),
    radial-gradient(52vw 42vh at 6% 8%, rgba(139, 155, 255, 0.10), transparent 60%);
}

.wrap { width: min(1140px, 92vw); margin-inline: auto; }

/* Anchor targets sit below the sticky nav (≈58px) so nav-link jumps never hide
   a section's eyebrow + heading underneath the header. */
#top { scroll-margin-top: 72px; }
section[id] { scroll-margin-top: 84px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0.85rem 0; width: min(1140px, 92vw); margin-inline: auto;
  transition: padding 0.25s ease;
}
.nav::before {
  content: ""; position: absolute; inset: 0 -50vw; z-index: -1;
  background: rgba(10, 16, 36, 0); border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.nav.scrolled::before { background: rgba(10, 16, 36, 0.78); backdrop-filter: blur(14px); border-bottom-color: var(--line-soft); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; }
.brand-mark { width: 30px; height: 30px; color: var(--perceive); }
.nav-links { display: flex; gap: 1.4rem; margin-left: 1rem; }
.nav-links a { color: var(--muted); font-weight: 500; font-size: 0.92rem; position: relative; padding: 0.2rem 0; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0; background: var(--act); transition: width 0.25s ease; }
.nav-links a:hover, .nav-links a.on { color: var(--text); }
.nav-links a:hover::after, .nav-links a.on::after { width: 100%; }
.nav-cta { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.burger { display: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.burger span { width: 18px; height: 2px; background: var(--text); transition: transform 0.25s, opacity 0.2s; }

/* ---------- Scroll progress + cursor glow ---------- */
.scroll-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.scroll-bar i { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--perceive), var(--plan), var(--act)); }
.cursor-glow { position: fixed; top: 0; left: 0; width: 460px; height: 460px; margin: -230px 0 0 -230px; border-radius: 50%; pointer-events: none; z-index: -1; background: radial-gradient(circle, rgba(139, 155, 255, 0.08), transparent 62%); }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 3rem; align-items: center; padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.badge { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--act); box-shadow: 0 0 0 0 rgba(255, 181, 71, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0.5); } 70% { box-shadow: 0 0 0 10px rgba(255, 181, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0); } }
.hero h1 { font-size: clamp(2.3rem, 5.6vw, 4rem); line-height: 1.02; margin: 1.1rem 0 0; font-weight: 600; }
.hero h1 .k { color: var(--act); }
.hero .lead { color: var(--text); font-size: clamp(1.05rem, 2vw, 1.3rem); margin-top: 1.1rem; max-width: 36ch; }
.hero .sub { color: var(--muted); margin-top: 1rem; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem 1.3rem; margin: 1.7rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.9rem; }
.chips li { display: inline-flex; align-items: center; gap: 0.5rem; }
.chips .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--perceive)); }

/* Hero auth card: sign-in / create-account, the hero's main call to action */
.hero-auth {
  position: relative; isolation: isolate; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), var(--ink-2));
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.8);
  padding: 1.6rem 1.5rem 1.7rem;
}
/* slow drifting accent glow behind the card */
.hero-auth::before {
  content: ""; position: absolute; z-index: -1; inset: -45% -20% auto -20%; height: 75%;
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(255, 181, 71, 0.16), transparent 70%),
    radial-gradient(50% 55% at 82% 18%, rgba(139, 155, 255, 0.16), transparent 70%);
  animation: haGlow 9s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes haGlow { from { transform: translate(-6%, -4%) scale(1); } to { transform: translate(9%, 5%) scale(1.15); } }
/* one-time light sweep when the card reveals */
.ha-shine { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(233, 237, 255, 0.07) 50%, transparent 68%);
  transform: translateX(-120%); }
.hero-auth.in .ha-shine { animation: haShine 1.15s ease 0.5s 1 both; }
@keyframes haShine { to { transform: translateX(120%); } }

.ha-head { margin-bottom: 1.1rem; }
.ha-badge { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.32rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.ha-title { font-size: 1.5rem; margin-top: 0.7rem; }
.ha-sub { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; }

.ha-tabs { position: relative; display: flex; gap: 0.3rem; background: var(--ink-2); padding: 0.3rem; border-radius: 12px; margin-bottom: 1.2rem; }
.ha-tabs button { position: relative; z-index: 1; flex: 1; padding: 0.6rem; border-radius: 9px; border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; transition: color 0.25s ease; }
.ha-tabs button.active { color: var(--text); }
.ha-ind { position: absolute; z-index: 0; top: 0.3rem; bottom: 0.3rem; left: 0; width: 0; border-radius: 9px; background: var(--surface-2); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.6); transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }

.ha-form { display: grid; gap: 0.8rem; }
.ha-form .hint { color: #5f6b9c; font-size: 0.78rem; }
.ha-form .news-check { font-size: 0.84rem; color: var(--muted); align-items: flex-start; }
.ha-form .btn-primary { margin-top: 0.2rem; }
.ha-form .alt { text-align: center; font-size: 0.88rem; color: var(--muted); margin-top: 0.1rem; }
.ha-form .alt a { color: var(--perceive); font-weight: 600; }

/* animate panes in when switching tabs, with a light per-field stagger */
.ha-enter { animation: haPane 0.34s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes haPane { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ha-enter > * { animation: haField 0.42s both; }
.ha-enter > *:nth-child(1) { animation-delay: 0.04s; }
.ha-enter > *:nth-child(2) { animation-delay: 0.09s; }
.ha-enter > *:nth-child(3) { animation-delay: 0.14s; }
.ha-enter > *:nth-child(4) { animation-delay: 0.19s; }
.ha-enter > *:nth-child(5) { animation-delay: 0.24s; }
.ha-enter > *:nth-child(6) { animation-delay: 0.29s; }
@keyframes haField { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* the "already signed in" state that replaces the card */
.hero-auth.ha-signedin { display: grid; gap: 0.6rem; }

/* ---------- Section frame ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-head { max-width: 60ch; margin-bottom: 2.4rem; }
.eyebrow { display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--act); margin-bottom: 0.7rem; }
.section h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); }
.section-head p { color: var(--muted); margin-top: 0.8rem; font-size: 1.05rem; }

/* ---------- Build grid ---------- */
.build-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 1rem; }
.build { position: relative; padding: 1.5rem 1.4rem; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.build::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--perceive)); }
.build .bi { font-size: 1.5rem; margin-bottom: 0.7rem; }
.build h3 { font-size: 1.12rem; }
.build p { color: var(--muted); margin-top: 0.5rem; font-size: 0.95rem; }

/* ---------- Curriculum ---------- */
.modules { display: grid; gap: 0.7rem; counter-reset: mod; }
.module { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.1rem; padding: 1.15rem 1.3rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color 0.2s ease, transform 0.2s ease; }
.module:hover { border-color: var(--perceive); transform: translateX(3px); }
.module .mn { counter-increment: mod; font-family: var(--font-mono); font-size: 0.9rem; color: var(--act); width: 2.3rem; }
.module .mn::before { content: counter(mod, decimal-leading-zero); }
.module h3 { font-size: 1.05rem; font-weight: 600; }
.module p { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }
.module .tag { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); padding: 0.25rem 0.6rem; border-radius: 999px; white-space: nowrap; }

/* ---------- How it works (3 steps) ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; counter-reset: st; }
.step { padding: 1.6rem 1.4rem; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, var(--surface), var(--ink-2)); }
.step .sn { counter-increment: st; font-family: var(--font-display); font-size: 2rem; color: var(--c, var(--plan)); line-height: 1; }
.step .sn::before { content: counter(st); }
.step h3 { margin-top: 0.7rem; font-size: 1.1rem; }
.step p { color: var(--muted); margin-top: 0.4rem; font-size: 0.95rem; }

/* ---------- Teacher ---------- */
.teacher { display: grid; grid-template-columns: auto 1fr; gap: 1.6rem; align-items: center; padding: 1.8rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.teacher .ava { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; font-family: var(--font-display); font-size: 2rem; color: var(--ink); background: linear-gradient(135deg, var(--act), var(--reflect)); }
.teacher h3 { font-size: 1.3rem; }
.teacher p { color: var(--muted); margin-top: 0.5rem; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0.7rem; max-width: 820px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 1.3rem; overflow: hidden; }
.faq summary { list-style: none; cursor: pointer; padding: 1.15rem 0; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--act); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding: 0 0 1.2rem; max-width: 70ch; }

/* ---------- Enroll ---------- */
.enroll { padding: clamp(3rem, 7vw, 5rem) 0; }
.enroll-box { display: grid; grid-template-columns: 1fr 0.9fr; gap: 2.6rem; align-items: center; padding: clamp(1.6rem, 4vw, 2.8rem); border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, var(--surface-2), var(--ink-2)); box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.9); }
.enroll-copy h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.enroll-copy p { color: var(--muted); margin-top: 0.9rem; }
.enroll-copy ul { list-style: none; padding: 0; margin: 1.3rem 0 0; display: grid; gap: 0.6rem; }
.enroll-copy li { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--text); font-size: 0.96rem; }
.enroll-copy li svg { flex: none; width: 20px; height: 20px; color: var(--plan); margin-top: 1px; }
.enroll-form { background: var(--ink-2); border: 1px solid var(--line); border-radius: 18px; padding: 1.6rem; display: grid; gap: 0.9rem; }
.enroll-form h3 { font-size: 1.2rem; }
.enroll-form .hint { color: #5f6b9c; font-size: 0.8rem; }
.enroll-form .news-check { font-size: 0.86rem; color: var(--muted); align-items: flex-start; }
.enroll-form .alt { text-align: center; font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.enroll-form .alt a { color: var(--perceive); font-weight: 600; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-soft); margin-top: 2rem; padding: 2.4rem 0 calc(2.4rem + var(--safe-b)); display: grid; gap: 0.7rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.footer .brand { justify-content: center; color: var(--text); }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Auth dialog ---------- */
.auth { width: min(440px, 94vw); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); padding: 1.8rem; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8); }
.auth::backdrop { background: rgba(5, 8, 20, 0.72); backdrop-filter: blur(6px); }
.auth-x { position: absolute; top: 0.9rem; right: 1rem; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.3rem; line-height: 1; }
.auth-tabs { display: flex; gap: 0.4rem; background: var(--ink-2); padding: 0.35rem; border-radius: 12px; margin-bottom: 1.3rem; }
.auth-tabs button { flex: 1; padding: 0.6rem; border-radius: 9px; border: none; background: transparent; color: var(--muted); font-weight: 600; }
.auth-tabs button.active { background: var(--surface-2); color: var(--text); }
.auth-pane { display: grid; gap: 0.9rem; }
.auth-pane h2 { font-size: 1.35rem; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin-top: -0.4rem; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .nav-links { position: fixed; inset: 64px 4vw auto; flex-direction: column; gap: 0.2rem; padding: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8); display: none; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.7rem 0.6rem; }
  .burger { display: flex; }
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .steps { grid-template-columns: 1fr; }
  .enroll-box { grid-template-columns: 1fr; gap: 1.8rem; }
  .teacher { grid-template-columns: 1fr; text-align: center; }
  .teacher .ava { margin-inline: auto; }
}
@media (max-width: 520px) {
  .module { grid-template-columns: auto 1fr; }
  .module .tag { display: none; }
  .nav-cta .btn:not(.btn-primary):not(#navSignin) { display: none; }
}

/* ---------- "Pending confirmation" notice (after sign-up / early sign-in) ---------- */
.pending-box { text-align: center; padding: 1.6rem 1.2rem; border: 1px solid rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); border-radius: 16px; }
.pending-box .pending-ico { width: 52px; height: 52px; margin: 0 auto .8rem; display: grid; place-items: center; font-size: 1.5rem; border-radius: 50%; background: rgba(255, 181, 71, .16); }
.pending-box h3 { margin: 0 0 .5rem; font-size: 1.25rem; }
.pending-box p { margin: 0 0 .8rem; line-height: 1.55; opacity: .92; }
.pending-box .pending-hint { font-size: .9rem; opacity: .75; }
.pending-box.is-rejected { border-color: rgba(255, 122, 147, .4); background: rgba(255, 122, 147, .08); }
.pending-box.is-rejected .pending-ico { background: rgba(255, 122, 147, .18); }

/* ---------- Full-screen request-pending screen ---------- */
.req-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1.2rem;
  background: radial-gradient(120% 120% at 50% 0%, rgba(24,34,74,.96), rgba(10,16,36,.98)); backdrop-filter: blur(6px);
  animation: reqFade .3s ease; overflow-y: auto; }
@keyframes reqFade { from { opacity: 0; } to { opacity: 1; } }
.req-card { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 2.2rem 1.8rem; text-align: center; box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); }
.req-card h2 { font-size: clamp(1.4rem, 5vw, 1.9rem); margin-bottom: .6rem; }
.req-sub { color: var(--text); opacity: .95; margin-bottom: .5rem; }
.req-mail { color: var(--muted); font-size: .95rem; margin-bottom: 1.1rem; }
.req-keep { color: var(--muted); font-size: .82rem; margin: 1rem 0 1.2rem; opacity: .8; }
.req-poll { color: var(--muted); font-size: .8rem; margin-top: .9rem; min-height: 1em; }
.req-actions { display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.req-actions .btn { min-width: 200px; }
/* pulsing ring while waiting */
.req-ring { width: 84px; height: 84px; margin: 0 auto 1.2rem; border-radius: 50%; position: relative;
  border: 3px solid var(--line); border-top-color: var(--act); animation: reqSpin 1.1s linear infinite; }
.req-ring span { position: absolute; inset: -3px; border-radius: 50%; border: 3px solid transparent; border-top-color: rgba(255,181,71,.35); animation: reqSpin 2.2s linear infinite reverse; }
@keyframes reqSpin { to { transform: rotate(360deg); } }
.req-ico { width: 84px; height: 84px; margin: 0 auto 1.1rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.4rem; font-weight: 700; animation: reqPop .5s cubic-bezier(.2,1.4,.4,1); }
.req-ico.ok { background: rgba(61,220,196,.16); color: var(--plan); box-shadow: 0 0 0 6px rgba(61,220,196,.08); }
.req-ico.no { background: rgba(255,122,147,.16); color: var(--reflect); box-shadow: 0 0 0 6px rgba(255,122,147,.08); }
@keyframes reqPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.req-steps { list-style: none; margin: 0 0 .4rem; padding: 0; text-align: left; display: grid; gap: .55rem; max-width: 320px; margin-inline: auto; }
.req-steps li { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .92rem; }
.req-steps li i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; position: relative; }
.req-steps li.done i { border-color: var(--plan); background: var(--plan); }
.req-steps li.done i::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-size: .7rem; font-weight: 700; }
.req-steps li.done { color: var(--text); }
.req-steps li.now i { border-color: var(--act); animation: reqBlink 1.4s ease-in-out infinite; }
.req-steps li.now { color: var(--text); }
@keyframes reqBlink { 0%,100% { box-shadow: 0 0 0 0 rgba(255,181,71,.5); } 50% { box-shadow: 0 0 0 5px rgba(255,181,71,0); } }
