/*
 * home.css — The Lab platform home
 * Scoped under body.platform-home. Reuses :root tokens from style.css.
 */

/* ── Body ─────────────────────────────────────────────────────── */
body.platform-home {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Top nav ──────────────────────────────────────────────────── */
.h-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 3.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.h-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.h-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}

.h-nav-brand:hover {
  opacity: 0.75;
}

.h-nav-logo {
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  object-fit: cover;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.h-hero {
  position: relative;
  padding: 6rem 1.5rem 5.5rem;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(48, 54, 61, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.2) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--bg);
}

.h-hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 50%;
  height: 130%;
  background: radial-gradient(ellipse at center, rgba(255, 59, 59, 0.05) 0%, transparent 65%);
  pointer-events: none;
}

.h-hero-inner {
  position: relative;
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: 4rem;
  row-gap: 2.5rem;
  align-items: start;
}

/* ── Hero copy ────────────────────────────────────────────────── */
.h-copy-top {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.h-copy-bottom {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.h-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.38em;
  color: var(--muted);
  opacity: 0.6;
  margin: 0;
}

.h-title {
  font-family: 'Syne', var(--font);
  font-size: clamp(3.4rem, 7vw, 5.8rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

.h-title-accent {
  color: var(--accent);
}

.h-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 38rem;
}

.h-body p {
  margin: 0;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--muted);
}

/* ── CTA ──────────────────────────────────────────────────────── */
.h-actions {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-top: 0.5rem;
}

.h-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--accent);
  text-decoration: none;
  transition: transform 0.3s ease;
}

.h-cta-primary:hover {
  transform: translateX(5px);
}

.h-cta-rule {
  width: 3.75rem;
  height: 2px;
  background: var(--accent);
  transition: width 0.45s ease;
  flex-shrink: 0;
}

.h-cta-primary:hover .h-cta-rule {
  width: 5.25rem;
}

/* ── Visual / Orb panel ───────────────────────────────────────── */
.h-visual {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  position: relative;
}

.h-status-chip {
  position: absolute;
  top: -1.75rem;
  right: -0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  animation: h-chip-float 6s ease-in-out infinite;
}

.h-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3fb950;
  animation: h-status-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.h-status-text {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap;
}

.h-orb-panel {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 460px;
  margin: 0 auto;
  background: rgba(22, 27, 34, 0.55);
  border: 1px solid var(--border);
  border-radius: 2rem;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.h-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(48, 54, 61, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.3) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.h-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.h-orb--1 {
  width: 55%;
  height: 55%;
  background: rgba(255, 59, 59, 0.18);
  top: 10%;
  left: 10%;
  animation: h-orb-drift 8s ease-in-out infinite;
}

.h-orb--2 {
  width: 45%;
  height: 45%;
  background: rgba(59, 130, 246, 0.14);
  bottom: 10%;
  right: 10%;
  animation: h-orb-drift 10s ease-in-out infinite reverse;
}

.h-orb--3 {
  width: 35%;
  height: 35%;
  background: rgba(16, 185, 129, 0.1);
  top: 40%;
  left: 40%;
  animation: h-orb-drift 6s ease-in-out infinite 2s;
}

.h-orb-label {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.6rem;
  max-width: 90%;
  text-align: center;
}

.h-orb-label-line {
  font-family: var(--mono);
  font-size: clamp(0.7rem, 2vw, 1rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  opacity: 0.7;
}

.h-orb-label-accent {
  color: var(--accent);
  opacity: 1;
}

.h-orb-label-sep {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--border);
  opacity: 0.8;
}

/* ── Labs section (catalog) ───────────────────────────────────── */
.h-courses {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 5rem 1.5rem 6rem;
}

.h-container {
  max-width: 1160px;
  margin: 0 auto;
}

.h-section-header {
  margin-bottom: 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.h-section-title {
  font-family: 'Syne', var(--font);
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 0;
}

.h-section-sub {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
  max-width: 44rem;
  margin: 0;
}

/* ── Lab cards ────────────────────────────────────────────────── */
.h-course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.h-course-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.75rem 1.5rem 1.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.h-course-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: 1rem 0 0 1rem;
}

.h-course-card--live:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

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

.h-course-card--soon {
  opacity: 0.5;
  cursor: default;
  border-style: dashed;
}

.h-course-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.h-course-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.h-course-tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  width: fit-content;
}

.h-course-tag--live {
  background: rgba(63, 185, 80, 0.12);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.h-course-tag--soon {
  background: rgba(139, 148, 158, 0.1);
  color: var(--muted);
  border: 1px solid var(--border);
}

.h-course-lang {
  font-size: 0.6rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  opacity: 0.7;
  letter-spacing: 0.05em;
}

.h-course-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.h-course-card--live:hover .h-course-icon {
  opacity: 1;
}

.h-course-icon--muted {
  color: var(--muted);
  opacity: 0.3;
}

.h-course-title {
  font-family: 'Syne', var(--font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.15;
}

.h-course-title--muted {
  color: var(--muted);
}

.h-course-desc {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  flex-grow: 1;
}

.h-course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(48, 54, 61, 0.6);
  margin-top: auto;
}

.h-course-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.62rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.h-course-stats--muted {
  opacity: 0.4;
}

.h-course-stat-sep {
  opacity: 0.4;
}

.h-course-cta {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.25s ease;
  display: inline-block;
  white-space: nowrap;
}

.h-course-card--live:hover .h-course-cta {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes h-orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(8%, -6%) scale(1.05); }
  66% { transform: translate(-5%, 8%) scale(0.97); }
}

@keyframes h-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.88); }
}

@keyframes h-chip-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

@media (max-width: 860px) {
  .h-hero-inner {
    grid-template-columns: 1fr;
    row-gap: 2.5rem;
  }

  /* Reset explicit grid placement so elements stack in DOM order:
     h-copy-top → h-visual → h-copy-bottom */
  .h-copy-top,
  .h-copy-bottom,
  .h-visual {
    grid-column: 1;
    grid-row: auto;
  }

  .h-visual {
    align-self: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
  }

  /* Move chip out of absolute flow so it doesn't overflow */
  .h-status-chip {
    position: relative;
    top: auto;
    right: auto;
    align-self: flex-end;
  }

  .h-title {
    font-size: clamp(3rem, 11vw, 4.5rem);
  }
}

@media (max-width: 580px) {
  .h-hero {
    padding: 3.5rem 1.25rem 4rem;
  }

  .h-courses {
    padding: 3.5rem 1.25rem 4.5rem;
  }

  .h-course-grid {
    grid-template-columns: 1fr;
  }

  .h-nav {
    padding: 0 1.25rem;
  }

  /* Cap the orb panel height on small phones */
  .h-orb-panel {
    aspect-ratio: unset;
    height: 200px;
  }
}
