/* Shared parent header, isolated from Bootstrap's navigation styles. */
.ela-site-header { font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; line-height: 1.6; flex-shrink: 0; }
.ela-site-header * { box-sizing: border-box; }
.ela-container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 22px; }
/* LIGHT HEADER */
.ela-site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #f4fff9 !important;
  background-color: #f4fff9 !important;
  background-image: none !important;
  color: #04251c !important;
  border-bottom: 1px solid rgba(4, 78, 59, 0.18);
  box-shadow: 0 8px 22px rgba(2, 44, 34, 0.08);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.ela-header-inner,
.ela-site-header .ela-header-inner,
.ela-site-header .ela-nav,
.ela-site-header .ela-container,
.ela-site-header nav {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
}

.ela-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Keep header content on the same 22px gutter as every body container. */
  padding: 10px 22px;
  gap: 24px;
}

.ela-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #04251c;
  min-width: 150px;
}

.ela-brand-mark {
  width: 150px;
  height: auto;
  object-fit: contain;
  display: block;
}

.ela-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ela-nav a,
.ela-site-header .ela-nav a,
.ela-site-header nav a {
  text-decoration: none;
  color: #064e3b !important;
  background: transparent !important;
  font-size: 18px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.ela-nav a:hover,
.ela-nav a:focus-visible,
.ela-nav a.active,
.ela-nav a[aria-current="page"],
.ela-site-header .ela-nav a:hover,
.ela-site-header .ela-nav a:focus-visible,
.ela-site-header .ela-nav a.active,
.ela-site-header .ela-nav a[aria-current="page"] {
  background: #d9f8e8 !important;
  color: #022c22 !important;
  outline: none;
}

.ela-nav-cta,
.ela-site-header .ela-nav-cta,
header .ela-nav-cta {
  border: 1px solid rgba(4, 120, 87, 0.34) !important;
  background: #ccf4df !important;
  color: #064e3b !important;
}

.ela-nav-cta:hover,
.ela-nav-cta:focus-visible,
.ela-site-header .ela-nav-cta:hover,
.ela-site-header .ela-nav-cta:focus-visible {
  background: #047857 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
}

/* HAMBURGER BUTTON */
.ela-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  flex-shrink: 0;
}

.ela-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #064e3b;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.ela-nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.ela-nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.ela-nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 860px) {
  .ela-header-inner {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .ela-brand-mark {
    width: min(150px, 52vw);
  }

  .ela-nav-toggle {
    display: flex;
  }

  .ela-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 0 12px;
    order: 3;
    justify-content: flex-start;
  }

  .ela-nav.open {
    display: flex;
  }

  .ela-nav a {
    font-size: 16px;
    width: 100%;
    padding: 10px 10px;
  }

}

/* Keep environment preparation visible but visually secondary to the lesson. */
section#setup {
  margin: 1rem 0 2rem;
  padding: 1rem 1.25rem;
  color: #495057;
  background: #f1f3f5;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
}

section#setup h2 {
  margin-top: 0;
  color: inherit;
  font-size: 1.15rem;
}

section#setup p,
section#setup pre,
section#setup code {
  font-size: 0.9rem;
}

section#setup {
  color: #ced4da;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

/* Home page: image-led navigation for the three Math to Code topics. */
.topic-home {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(42px, 6vw, 88px) clamp(18px, 3.4vw, 52px) clamp(52px, 7vw, 96px);
}

.topic-intro {
  width: min(100%, 760px);
  margin: 0 0 clamp(30px, 4vw, 52px);
}

.topic-intro .topic-kicker {
  margin: 0 0 12px;
  color: #d7b56d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topic-intro h1 {
  max-width: 15ch;
  margin: 0;
  color: #f5fbf8;
  font-size: clamp(2.15rem, 5vw, 4.5rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.topic-intro > p:last-child {
  max-width: 620px;
  margin: 22px 0 0;
  color: rgba(242, 251, 247, 0.7);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.65;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
}

.topic-card {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  color: #ffffff !important;
  border: 1px solid rgba(220, 246, 233, 0.18);
  border-radius: clamp(18px, 2vw, 28px);
  background: #07110d;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.3);
  text-decoration: none !important;
  isolation: isolate;
  transform: translateZ(0);
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.topic-card img,
.topic-card__shade,
.topic-card__content {
  grid-area: 1 / 1;
}

.topic-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 260ms ease;
}

.topic-card--power img {
  object-position: 50% center;
}

.topic-card--statistics img {
  object-position: 51% center;
}

.topic-card--learning img {
  object-position: 50% center;
}

.topic-card__shade {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(1, 10, 7, 0.08) 0%, rgba(1, 10, 7, 0.15) 34%, rgba(1, 10, 7, 0.94) 100%),
    linear-gradient(120deg, rgba(2, 34, 25, 0.22), transparent 62%);
  pointer-events: none;
}

.topic-card__content {
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  min-width: 0;
  padding: clamp(20px, 2vw, 30px);
}

.topic-card__eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #efd99f;
  font-size: clamp(0.64rem, 0.72vw, 0.74rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.topic-card__title {
  display: block;
  color: #ffffff;
  font-size: clamp(1.8rem, 2.3vw, 2.55rem);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.45);
}

.topic-card__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 16px;
  padding-top: 12px;
  color: rgba(255, 255, 255, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topic-card__action span {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: background-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.topic-card:hover,
.topic-card:focus-visible {
  color: #ffffff;
  border-color: rgba(215, 181, 109, 0.72);
  box-shadow: 0 30px 72px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(215, 181, 109, 0.14);
  transform: translateY(-7px);
}

.topic-card:hover img,
.topic-card:focus-visible img {
  filter: saturate(1.08) brightness(1.04);
  transform: scale(1.045);
}

.topic-card:hover .topic-card__action span,
.topic-card:focus-visible .topic-card__action span {
  color: #092219;
  background: #d7b56d;
  transform: rotate(5deg);
}

.topic-card:focus-visible {
  outline: 3px solid #72d8ad;
  outline-offset: 5px;
}

.topic-footnote {
  margin: 26px 0 0;
  color: rgba(242, 251, 247, 0.54);
  font-size: 0.9rem;
  text-align: center;
}

#power-engineering,
#probability-statistics,
#machine-learning {
  scroll-margin-top: 230px;
}

@media (max-width: 980px) {
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-card:last-child {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 8;
  }
}

@media (max-width: 640px) {
  .topic-home {
    padding-top: 36px;
  }

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

  .topic-card,
  .topic-card:last-child {
    grid-column: auto;
    aspect-ratio: 5 / 4;
  }

  .topic-card__title {
    font-size: clamp(1.9rem, 10vw, 2.65rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-card,
  .topic-card img,
  .topic-card__action span {
    transition: none;
  }
}
