/* ── LANDING PAGE STYLES ── */

/* --- Base --- */
.landing-body {
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}
html { scroll-behavior: smooth; }

/* --- Navigation --- */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
  transition: background 0.3s, border-color 0.3s;
}
.landing-nav::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.35), rgba(188, 140, 255, 0.35), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.landing-nav.scrolled {
  background: rgba(13, 17, 23, 0.92);
  border-bottom-color: var(--border);
}
.landing-nav.scrolled::after { opacity: 1; }
.landing-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.landing-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.landing-logo .brand-logo { height: 32px; }
.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.landing-nav-links a {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.landing-nav-links a:hover {
  color: var(--text-primary);
  background: rgba(88, 166, 255, 0.08);
}
.landing-nav-links a::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.landing-nav-links a:hover::after { transform: scaleX(1); }
.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 768px) {
  .landing-nav-links { display: none; }
}

/* --- Hero --- */
.landing-hero {
  position: relative;
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 80px 24px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 60px;
  overflow: hidden;
}
.landing-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 400px at 20% 50%, rgba(88, 166, 255, 0.06), transparent),
    radial-gradient(ellipse 500px 500px at 80% 40%, rgba(188, 140, 255, 0.04), transparent),
    radial-gradient(ellipse 400px 300px at 60% 80%, rgba(63, 185, 80, 0.03), transparent);
}
.hero-flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-flow-line {
  fill: none;
  stroke: url(#heroFlowGrad);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 6 14;
  opacity: 0.35;
  animation: hero-flow-dash 26s linear infinite;
}
.hero-flow-line.line-2 { opacity: 0.22; animation-duration: 34s; animation-direction: reverse; }
.hero-flow-line.line-3 { opacity: 0.16; animation-duration: 42s; }
@keyframes hero-flow-dash {
  to { stroke-dashoffset: -1000; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-flow-line, .cta-flow-line { animation: none; }
}
.landing-hero-content {
  flex: 1;
  max-width: 620px;
  position: relative;
  z-index: 1;
}
.landing-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 24px;
  padding: 6px 14px;
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 20px;
  background: rgba(88, 166, 255, 0.06);
}
.badge-pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 8px rgba(88, 166, 255, 0); }
}
.landing-hero-title {
  font-family: var(--font-read);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.landing-hero-highlight {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.landing-hero-subtitle {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 540px;
}
.landing-hero-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.landing-hero-stats {
  display: flex;
  gap: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-stat-num {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.hero-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Hero editor visual */
.landing-hero-visual {
  flex: 0 0 480px;
  display: none;
  position: relative;
}
@media (min-width: 1024px) { .landing-hero-visual { display: block; } }

.landing-hero-editor {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(88, 166, 255, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(88, 166, 255, 0.07);
  overflow: hidden;
}
.editor-titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(13, 17, 23, 0.8);
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}
.editor-dots {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.editor-dots span {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.editor-dots span:nth-child(1) { background: #f85149; }
.editor-dots span:nth-child(2) { background: #d29922; }
.editor-dots span:nth-child(3) { background: #3fb950; }
.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  background: #0a0e14;
  border: 1px solid rgba(48, 54, 61, 0.5);
  border-bottom-color: #0a0e14;
  border-radius: 6px 6px 0 0;
  padding: 5px 14px;
  margin-bottom: -11px;
}
.editor-tab-icon { font-size: 11px; }
.editor-titlebar-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.editor-code {
  padding: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-primary);
}
.code-line {
  display: flex;
  padding: 0 16px 0 0;
}
.code-line:hover { background: rgba(88, 166, 255, 0.04); }
.code-line .ln {
  flex: 0 0 40px;
  text-align: right;
  padding-right: 12px;
  margin-right: 14px;
  color: #515a65;
  border-right: 1px solid rgba(48, 54, 61, 0.45);
  user-select: none;
}
.code-line .code {
  white-space: pre;
  overflow: hidden;
}
.editor-code .cmt { color: #8b949e; font-style: italic; }
.editor-code .kw { color: #ff7b72; }
.editor-code .fn { color: #d2a8ff; }
.editor-code .typ { color: #79c0ff; }
.editor-code .str { color: #a5d6ff; }
.editor-code .num { color: #79c0ff; }
.editor-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: cursor-blink 1s step-end infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}
.editor-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(13, 17, 23, 0.8);
  border-top: 1px solid rgba(48, 54, 61, 0.5);
}
.status-mode {
  color: #0d1117;
  background: var(--accent);
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.status-right { margin-left: auto; }

/* --- Sections --- */
.landing-section {
  padding: 100px 24px;
}
.landing-section-alt {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.landing-container {
  max-width: 1100px;
  margin: 0 auto;
}
.landing-section-header {
  text-align: center;
  margin-bottom: 60px;
}
.landing-section-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.15);
}
.landing-section-badge.problem { background: rgba(248, 81, 73, 0.1); color: var(--red); border-color: rgba(248, 81, 73, 0.15); }
.landing-section-badge.solution { background: rgba(63, 185, 80, 0.1); color: var(--green); border-color: rgba(63, 185, 80, 0.15); }
.landing-section-header h2 {
  font-family: var(--font-read);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.landing-section-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Problem / Solution Split --- */
.landing-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}
@media (max-width: 768px) { .landing-split { grid-template-columns: 1fr; } }
.landing-split-left h2,
.landing-split-right h2 {
  font-family: var(--font-read);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.landing-split-left p,
.landing-split-right p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}
.landing-checklist {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.check-item {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.check-item:first-letter { color: var(--green); font-weight: 700; }

/* --- Forge Flow (SVG path through the five steps) --- */
.forge-flow {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding: 20px 0;
}
.forge-flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.forge-path-base {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-dasharray: 4 8;
  stroke-linecap: round;
}
.forge-path-draw {
  fill: none;
  stroke: url(#forgeFlowGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: url(#forgeFlowGlow);
}
.forge-flow-dot {
  fill: var(--accent);
  filter: url(#forgeFlowGlow);
  opacity: 0;
  transition: opacity 0.3s;
}
.forge-flow-dot.moving { opacity: 1; }

.flow-step {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: min(420px, 56%);
}
.flow-step:nth-of-type(even) {
  margin-left: auto;
  flex-direction: row-reverse;
  text-align: right;
}
.flow-node {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 16px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s, background 0.3s;
}
.flow-step.active .flow-node {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(88, 166, 255, 0.35);
}
.flow-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  flex: 1;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.flow-step.active .flow-card {
  border-color: rgba(88, 166, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.flow-icon { font-size: 24px; margin-bottom: 8px; }
.flow-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.flow-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
@media (max-width: 640px) {
  .forge-flow { gap: 36px; }
  .flow-step,
  .flow-step:nth-of-type(even) {
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    text-align: left;
  }
}

/* --- Features Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.feature-icon { font-size: 32px; margin-bottom: 16px; }
.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* --- Practice Lab --- */
.practice-split {
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}
@media (max-width: 768px) { .practice-split { grid-template-columns: 1fr; } }

.test-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.test-type {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.test-type-icon { font-size: 20px; margin-bottom: 6px; }
.test-type-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-primary); margin-bottom: 3px; }
.test-type-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* --- Projects Showcase --- */
.projects-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.project-showcase-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.project-showcase-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-color: var(--border-light);
}
.project-showcase-card.premium-card {
  background: linear-gradient(135deg, var(--bg-primary) 70%, rgba(188, 140, 255, 0.04));
  border-color: rgba(188, 140, 255, 0.15);
}
.project-showcase-difficulty {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.project-showcase-difficulty.beginner { background: var(--green-dim); color: var(--green); }
.project-showcase-difficulty.intermediate { background: var(--yellow-dim); color: var(--yellow); }
.project-showcase-difficulty.advanced { background: var(--red-dim); color: var(--red); }
.project-showcase-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.project-showcase-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 14px;
}
.project-showcase-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.project-showcase-meta .dot { color: var(--border); }
.free-badge { color: var(--green); font-weight: 600; }
.premium-badge { color: var(--purple); font-weight: 600; }

/* --- Premium CTA --- */
.practice-premium-cta {
  text-align: center;
  margin-top: 24px;
}
.premium-cta-content {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 48px;
  background: linear-gradient(135deg, rgba(188, 140, 255, 0.06), rgba(88, 166, 255, 0.04));
  border: 1px solid rgba(188, 140, 255, 0.15);
  border-radius: var(--radius-lg);
}
.premium-cta-content h3 {
  font-family: var(--font-read);
  font-size: 22px;
  font-weight: 700;
}
.premium-cta-content p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.6;
}

/* --- Courses Grid --- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.landing-course-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.landing-course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  border-color: var(--border-light);
}
.landing-course-cover {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #1a2a3a, #2a3a4a, #1a3a2a);
}
.landing-course-icon { font-size: 42px; opacity: 0.85; }
.landing-course-lang {
  position: absolute;
  bottom: 10px;
  left: 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.45);
}
.landing-course-body { padding: 18px 20px 22px; }
.landing-course-title {
  font-family: var(--font-read);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.landing-course-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}
.landing-course-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.landing-course-action {
  display: flex;
  gap: 8px;
}

/* Course card skeletons */
.course-card-skeleton {
  height: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

/* --- CTA --- */
.landing-cta {
  position: relative;
  padding: 100px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(188, 140, 255, 0.06));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.cta-flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.cta-flow-line {
  fill: none;
  stroke: url(#heroFlowGrad);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 6 14;
  opacity: 0.3;
  animation: hero-flow-dash 30s linear infinite;
}
.cta-flow-line.delay { opacity: 0.18; animation-duration: 40s; animation-direction: reverse; }
.landing-cta-content {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}
.landing-cta h2 {
  font-family: var(--font-read);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.landing-cta p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

/* --- Footer --- */
.landing-footer {
  position: relative;
  padding: 56px 24px 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 17, 23, 0), rgba(88, 166, 255, 0.03));
}
.landing-footer::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.3), rgba(188, 140, 255, 0.3), transparent);
}
.landing-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
}
@media (max-width: 768px) {
  .landing-footer-inner { grid-template-columns: 1fr; gap: 32px; }
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.footer-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 360px;
}
.footer-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.footer-col a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  width: fit-content;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--accent); }
.landing-footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 0 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-meta { font-family: var(--font-mono); font-size: 11px; }

/* --- Auth Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  min-width: 380px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.auth-modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-modal-header .brand-logo { height: 40px; margin: 0 auto 14px; }
.auth-modal-header h2 {
  font-family: var(--font-read);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-modal-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.auth-modal-error {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--red);
  line-height: 1.5;
}
.auth-modal-error a { color: var(--red); text-decoration: underline; }

/* Expected-outcome message ("check your email"), not an error. */
.auth-modal-notice {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.auth-modal-panel input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.auth-modal-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1); }
.auth-modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-modal-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.auth-modal-switch a:hover { text-decoration: underline; }

/* --- Scroll animations --- */
.landing-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.landing-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Course cards as links to /courses/<language> --- */
.landing-course-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.landing-course-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.landing-course-soon {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--yellow-dim);
  color: var(--yellow);
}

/* --- Public course page (/courses/<language>) --- */
.course-detail { padding: 40px 16px 80px; }
.course-detail .landing-container { max-width: 960px; }
.course-back {
  display: inline-block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 28px;
}
.course-back:hover { color: var(--accent); }

.course-hero {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 56px;
}
.course-hero-cover {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  background: linear-gradient(135deg, #1a2a3a, #2a3a4a, #1a3a2a);
  border: 1px solid var(--border);
}
.course-hero h1 {
  font-family: var(--font-read);
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 0 0 8px;
}
.course-hero-author { color: var(--text-secondary); font-size: 14px; margin: 0 0 14px; }
.course-hero-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 0 16px;
}
.course-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.course-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.course-enroll-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.course-enroll-note { margin: 12px 0 0; font-size: 13px; color: var(--yellow); }

.course-syllabus h2,
.course-enroll-cta h2 {
  font-family: var(--font-read);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px;
}
.course-syllabus-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
}
.course-syllabus-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.course-syllabus-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.course-syllabus-table td {
  padding: 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.course-syllabus-table tbody tr:last-child td { border-bottom: 0; }
.course-syllabus-table .col-num {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.course-syllabus-table th.col-num:first-child,
.course-syllabus-idx { text-align: left; }
.course-syllabus-idx { font-family: var(--font-mono); color: var(--text-muted) !important; }
.course-syllabus-section { font-weight: 600; color: var(--text-primary); }
.course-syllabus-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-top: 4px; }
.course-syllabus-lessons {
  list-style: decimal;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}
.course-syllabus-lessons li { padding: 3px 0; }
.course-syllabus-lessons li span:first-child { color: var(--text-primary); }
.course-syllabus-min {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.course-syllabus-empty { text-align: center; color: var(--text-muted); padding: 32px 16px; }

.course-enroll-cta {
  margin-top: 56px;
  padding: 40px 24px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(188, 140, 255, 0.06));
}
.course-enroll-cta p { color: var(--text-secondary); margin: 0 0 20px; }

@media (max-width: 640px) {
  .course-hero { grid-template-columns: 1fr; gap: 20px; }
  .course-hero-cover { width: 72px; height: 72px; font-size: 34px; }
  .course-hero-actions .btn { flex: 1 1 100%; }
  .course-syllabus-table th, .course-syllabus-table td { padding: 12px 10px; }
  .course-syllabus-table th:nth-child(4), .course-syllabus-table td:nth-child(4) { display: none; }
}

/* --- Public posts (/posts, /posts/<slug>) ---
   Same visual language as the course pages above: landing-container shell,
   section badges, bg-primary cards on the dark canvas, --font-read prose.
   Prose rules deliberately mirror .learn-article in style.css so a post reads
   exactly like a lesson, minus the per-block language label. */

.footer-meta a { color: var(--text-muted); text-decoration: none; }
.footer-meta a:hover { color: var(--accent); }

.posts-page { padding: 64px 16px 80px; }
.posts-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}
.posts-header h1 {
  font-family: var(--font-read);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 12px;
}
.posts-header p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
}
.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.post-card-cover {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  border-color: var(--border-light);
}
.post-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.post-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
}
.post-card-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--yellow-dim);
  color: var(--yellow);
  white-space: nowrap;
}
.post-card-title {
  font-family: var(--font-read);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.3px;
}
.post-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.post-card-tags { color: var(--text-muted); }
.posts-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
}

/* --- Post detail --- */
.post-detail { padding: 40px 16px 80px; }
.post-detail .landing-container { max-width: 800px; }

.post-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px;
}
.post-header h1 {
  font-family: var(--font-read);
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin: 14px 0 16px;
}
.post-header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.post-header-author { color: var(--text-secondary); }
.post-header-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.post-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(88, 166, 255, 0.15);
  padding: 3px 10px;
  border-radius: 20px;
}

.post-article {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--font-read);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-article);
}
.post-article h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 36px 0 16px;
  color: var(--text-primary);
}
.post-article h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text-primary);
}
.post-article h4 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text-primary);
}
.post-article p { margin: 0 0 18px; }
.post-article a { color: var(--accent); text-decoration: none; }
.post-article a:hover { color: var(--accent-hover); text-decoration: underline; }
.post-article ul, .post-article ol { margin: 0 0 18px; padding-left: 24px; }
.post-article li { margin-bottom: 8px; }
.post-article strong { color: var(--text-primary); }
.post-article blockquote {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-article blockquote p:last-child { margin-bottom: 0; }
.post-article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 8px 0;
}
.post-article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.post-article code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.post-article p code, .post-article li code, .post-article td code {
  background: rgba(110, 118, 129, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}
.post-article pre {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.post-article pre code {
  display: block;
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: var(--text-primary);
}
.post-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 16px 0 20px;
}
.post-article th, .post-article td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.post-article th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
}

/* Teaser cut for members-only posts, then the unlock gate. */
.post-teaser { margin-bottom: 8px; }
.post-teaser > :last-child { margin-bottom: 0; }

.post-cover {
  max-width: 760px;
  margin: 0 auto 28px;
}
.post-cover img {
  display: block;
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.post-gate {
  max-width: 640px;
  margin: 28px auto 0;
  padding: 40px 32px;
  text-align: center;
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(188, 140, 255, 0.06));
}
.post-gate-icon { font-size: 34px; margin-bottom: 12px; }
.post-gate h2 {
  font-family: var(--font-read);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
}
.post-gate p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 460px;
  margin: 0 auto 20px;
}
.post-gate-signin {
  margin: 16px auto 0 !important;
  font-size: 13px;
}
.post-gate-signin a { color: var(--accent); text-decoration: none; font-weight: 500; }
.post-gate-signin a:hover { text-decoration: underline; }

.post-cta { margin-top: 56px; }
.post-cta p { margin: 0 0 20px; }

@media (max-width: 640px) {
  .posts-page { padding: 48px 16px 64px; }
  .post-gate { padding: 28px 18px; }
  .post-article { font-size: 15px; }
}

/* --- Posts admin editor (/posts/admin) --- */
.padmin-page { padding: 40px 16px 80px; }
.padmin-note {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.padmin-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) { .padmin-layout { grid-template-columns: 1fr; } }

.padmin-list-panel,
.padmin-editor-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.padmin-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.padmin-list-head h2,
.padmin-editor-head h2 {
  font-family: var(--font-read);
  font-size: 18px;
  font-weight: 700;
}
.padmin-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.padmin-view-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.padmin-view-link:hover { text-decoration: underline; }

.padmin-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.padmin-item:hover { border-color: var(--border-light); }
.padmin-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
.padmin-item-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
}
.padmin-item-delete {
  flex: 0 0 auto;
  align-self: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 8px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.padmin-item-delete:hover { color: var(--red); border-color: rgba(248, 81, 73, 0.4); background: rgba(248, 81, 73, 0.08); }
.padmin-item-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.padmin-item-meta { font-size: 11px; color: var(--yellow); }
.padmin-item-slug { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); }
.padmin-empty { font-size: 13px; color: var(--text-muted); text-align: center; padding: 24px 0; }

.padmin-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.padmin-hint { font-weight: 400; color: var(--text-muted); }
.padmin-panel input, .padmin-panel select, .padmin-panel textarea,
.padmin-label input, .padmin-label select, .padmin-label textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.padmin-label input:focus, .padmin-label select:focus, .padmin-label textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
.padmin-label textarea.padmin-content,
.padmin-label textarea { font-size: 13.5px; line-height: 1.6; resize: vertical; }
.padmin-content { font-family: var(--font-mono); }
.padmin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.padmin-row .padmin-label { flex: 1 1 180px; }
.padmin-check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.padmin-check input {
  width: auto !important;
  margin: 0 !important;
  accent-color: var(--accent);
}
.padmin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.padmin-delete { color: var(--red); }
.padmin-delete:hover { border-color: var(--red); }
.padmin-field { margin-bottom: 12px; }
.padmin-cover-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.padmin-cover-preview {
  max-height: 140px;
  max-width: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.padmin-cover-empty { font-size: 12.5px; color: var(--text-muted); }

.padmin-error {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--red);
  line-height: 1.5;
}
.padmin-notice {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.35);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--green);
  line-height: 1.5;
}
.padmin-preview {
  margin-top: 20px;
  padding: 24px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
}
.padmin-preview h2:first-child { margin-top: 0; }
