/* OpenField Finance — homepage + about + 404 */

.home-hero {
  padding: 72px 26px;
  margin: 26px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.2), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(34, 197, 94, 0.1), transparent 40%),
    var(--color-surface);
}

.home-hero h1 {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.home-hero .lede {
  font-size: 1.12rem;
  max-width: 620px;
  margin: 0 auto 26px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-section {
  margin: 44px 0;
}

.home-section > h2 {
  text-align: center;
}

.home-section > .section-lede {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 26px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  background: rgba(30, 43, 71, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
}

.feature-card .feature-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.14);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  margin-bottom: 12px;
}

.feature-card h3 { margin-top: 0; }

.course-preview {
  background: rgba(30, 43, 71, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  align-items: center;
  justify-content: space-between;
}

.course-preview .preview-info { flex: 1 1 340px; }
.course-preview .preview-info h3 { font-size: 1.4rem; }

.preview-topics {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px 18px;
}

.preview-topics li {
  padding-left: 1.4em;
  position: relative;
  font-size: 0.95rem;
}

.preview-topics li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--color-primary);
}

.mission-block {
  border-left: 4px solid var(--color-primary);
  background: rgba(56, 189, 248, 0.06);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 26px 30px;
}

.mission-block p { font-size: 1.08rem; }

/* 404 */
.error-page {
  text-align: center;
  padding: 90px 20px;
}

.error-page .error-code {
  font-family: var(--font-heading);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: 0.2em;
}

/* =====================================================================
   Homepage motion & landing-page visuals
   All hidden/animated states are gated behind html.js-anim, which is only
   added when JS runs and prefers-reduced-motion is NOT set. Without it,
   everything below renders fully visible and static.
   ===================================================================== */

/* ---------- Hero layout ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
}

/* Hero card enters first: fade + rise + settle from 98.5% scale */
.js-anim .home-hero {
  animation: hero-card-in 0.75s cubic-bezier(0.22, 0.7, 0.35, 1) both;
}

@keyframes hero-card-in {
  from { opacity: 0; transform: translateY(28px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.home-hero .hero-inner {
  position: relative;
  z-index: 1;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 10px 6px;
  min-height: 44px;
}

.hero-link .arrow,
.preview-cta .arrow {
  display: inline-block;
  transition: transform 0.22s ease;
}

.hero-link:hover .arrow,
.hero-link:focus-visible .arrow { transform: translateX(7px); }

/* ---------- Hero background glow (subtle, GPU-only transform/opacity) ---------- */
.home-hero::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  filter: blur(48px);
  background:
    radial-gradient(circle at 25% 20%, rgba(56, 189, 248, 0.2), transparent 44%),
    radial-gradient(circle at 78% 85%, rgba(34, 197, 94, 0.1), transparent 40%);
}

.js-anim .home-hero::before {
  animation: hero-glow 9s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes hero-glow {
  from { transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 2%, 0) scale(1.07); }
}

/* ---------- Hero entrance (card first, then staggered content) ---------- */
.js-anim .hero-item {
  opacity: 0;
  transform: translateY(22px);
  animation: rise-in 0.65s ease-out forwards;
  animation-delay: calc(0.25s + var(--d, 0) * 0.13s);
}

@keyframes rise-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Learning pathway ---------- */
.pathway {
  position: relative;
  max-width: 560px;
  margin: 38px auto 0;
  padding-top: 8px;
}

.pathway-track {
  position: absolute;
  top: 31px;                 /* centers on the 46px dots + 8px padding */
  left: 12%;
  right: 12%;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.pathway-line {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
  border-radius: 2px;
  transform-origin: left center;
}

.js-anim .pathway-line {
  transform: scaleX(0);
  animation: line-grow 0.9s ease-in-out forwards;
  animation-delay: 1.05s;
}

@keyframes line-grow {
  to { transform: scaleX(1); }
}

.pathway-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  position: relative;
}

.pathway-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex: 1;
}

.stage-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-bg-deep);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: var(--color-text-subtle);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  position: relative;
  z-index: 1;
  transition: border-color 0.22s ease, color 0.22s ease,
              box-shadow 0.22s ease, transform 0.22s ease;
}

.stage-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
  transition: color 0.3s ease;
}

/* Active stage styling — default (no-JS / reduced motion): all stages lit.
   Matches the final frame of stage-in so the animation hand-off is seamless. */
.stage-dot {
  border-color: rgba(56, 189, 248, 0.65);
  color: var(--color-primary);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.22);
}
.stage-label { color: var(--color-text-muted); }

/* With animation enabled, icons fade + scale in one at a time as the line
   passes them. "backwards" fill keeps them hidden during the delay but
   releases the transform afterwards so hover transitions still work. */
.js-anim .pathway-stage .stage-dot {
  animation: stage-in 0.45s ease-out backwards;
  animation-delay: calc(1.25s + var(--s, 0) * 0.18s);
}

.js-anim .pathway-stage .stage-label {
  animation: label-in 0.45s ease-out backwards;
  animation-delay: calc(1.25s + var(--s, 0) * 0.18s);
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: scale(0.75);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--color-text-subtle);
  }
  to {
    opacity: 1;
    transform: scale(1);
    border-color: rgba(56, 189, 248, 0.65);
    color: var(--color-primary);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.22);
  }
}

@keyframes label-in {
  from { opacity: 0; color: var(--color-text-subtle); }
  to   { opacity: 1; color: var(--color-text-muted); }
}

/* Hover: gentle lift + glow on the icon; label stays put */
.pathway-stage:hover .stage-dot,
.pathway-stage:focus-within .stage-dot {
  transform: translateY(-5px) scale(1.05);
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.5), 0 0 16px rgba(56, 189, 248, 0.35);
}

@media (max-width: 480px) {
  .stage-dot { width: 38px; height: 38px; font-size: 0.82rem; }
  .pathway-track { top: 27px; }
  .stage-label { font-size: 0.78rem; }
}

/* ---------- Scroll reveals (Intersection Observer adds .in-view) ---------- */
.js-anim .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}

.js-anim .reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.js-anim .stagger .reveal-child {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out, border-color 0.4s ease;
  transition-delay: calc(var(--i, 0) * 0.09s);
}

.js-anim .reveal.in-view .reveal-child {
  opacity: 1;
  transform: translateY(0);
}

/* Soft border highlight as cards settle */
.js-anim .reveal.in-view .feature-card,
.js-anim .reveal.in-view .preview-card {
  border-color: rgba(56, 189, 248, 0.22);
}

/* ---------- Lesson preview cards ---------- */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.preview-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(30, 43, 71, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.preview-card h3 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--color-text);
}

.preview-card p {
  margin: 0;
  font-size: 0.92rem;
  flex-grow: 1;
}

.preview-num {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.85rem;
}

.preview-duration { color: var(--color-text-subtle); }

.preview-cta {
  color: var(--color-primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.preview-card:hover,
.preview-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 12px 26px rgba(2, 6, 23, 0.45);
}

.preview-card:hover .preview-cta .arrow { transform: translateX(3px); }

.preview-all { text-align: center; margin-top: 22px; }

/* ---------- Progress demonstration ---------- */
.demo-panel {
  background: rgba(30, 43, 71, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  max-width: 720px;
  margin: 0 auto;
}

.demo-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.demo-top h3 { margin: 0; font-size: 1.15rem; }

.demo-badge {
  color: var(--color-warning);
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.demo-badge.is-real {
  color: var(--color-success);
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
}

/* Demo bar uses cyan (active progress); completed milestones use green */
.demo-track .progress-fill {
  background: linear-gradient(90deg, var(--color-primary-active), var(--color-primary));
  transition: width 1.1s ease-in-out;
}

.milestones {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.milestone {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: var(--color-text-subtle);
  margin: 0;
}

.milestone-dot {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--color-bg-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: transparent;
  transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}

.milestone.is-complete { color: var(--color-text-muted); }
.milestone.is-complete .milestone-dot {
  border-color: var(--color-success);
  background: rgba(34, 197, 94, 0.14);
  color: var(--color-success);
}

.milestone.is-active { color: var(--color-text-muted); }
.milestone.is-active .milestone-dot {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* ---------- Reduced motion: kill continuous + entrance motion outright ---------- */
@media (prefers-reduced-motion: reduce) {
  .home-hero::before { animation: none !important; }
  .home-hero, .hero-item, .pathway-line,
  .pathway-stage .stage-dot, .pathway-stage .stage-label {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .reveal, .reveal-child {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .preview-card:hover, .preview-card:focus-visible { transform: none; }
  .pathway-stage:hover .stage-dot, .pathway-stage:focus-within .stage-dot { transform: none; }
  .demo-track .progress-fill { transition: none; }
}
