/*
 * The home page (/): a navy hero that carries on from the site header, then the course,
 * the tools and the YouTube channel on the theme's page colours, light and dark.
 */
:root {
  --bg: var(--at-bg);
  --bg-alt: var(--at-surface-2);
  --card: var(--at-surface);
  --line: var(--at-border);
  --text: var(--at-text);
  --muted: var(--at-text-2);
  --accent: var(--at-accent);
}
:root[data-theme="dark"] {
  --bg: var(--at-navy);
  --bg-alt: var(--at-navy-2);
  --card: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--at-font);
}
main {
  flex: 1;
}
h1,
h2 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.02em;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--at-focus, var(--accent));
  outline-offset: 2px;
}

.home-wrap {
  width: min(1120px, 100% - 40px);
  margin: 0 auto;
}
.home-eyebrow {
  margin: 0 0 10px;
  color: var(--at-accent-text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */
.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--at-border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.home-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.home-btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--at-accent-ink);
}
.home-btn-primary:hover {
  border-color: transparent;
  background: var(--at-accent-hover);
}
.home-btn-yt {
  border-color: transparent;
  background: var(--at-youtube);
  color: var(--at-on-color);
}
.home-btn-yt:hover {
  border-color: transparent;
  background: var(--at-youtube-hover);
}

/* ---------- Hero: navy in both themes ---------- */
.home-hero {
  --hero-ink: var(--at-header-ink);
  --hero-dim: var(--at-header-dim);
  padding: 76px 0;
  background:
    radial-gradient(900px 480px at 85% 10%, color-mix(in srgb, var(--at-cyan) 16%, transparent), transparent 70%),
    radial-gradient(700px 380px at 0% 60%, color-mix(in srgb, var(--at-indigo) 35%, transparent), transparent 70%),
    linear-gradient(180deg, var(--at-navy), var(--at-navy-2));
  color: var(--hero-ink);
}
:root[data-theme="dark"] .home-hero {
  background:
    radial-gradient(900px 480px at 85% 10%, color-mix(in srgb, var(--at-cyan) 13%, transparent), transparent 70%),
    radial-gradient(700px 380px at 0% 60%, color-mix(in srgb, var(--at-indigo) 30%, transparent), transparent 70%),
    linear-gradient(180deg, var(--at-navy-3), var(--at-navy));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.home-hero .home-eyebrow {
  color: var(--at-cyan);
}
.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 48px;
}
.home-hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.6rem);
  text-wrap: balance;
}
.home-lead {
  text-wrap: pretty;
  max-width: 560px;
  margin: 0 0 30px;
  color: var(--hero-dim);
  font-size: 1.15rem;
}
.home-hero .home-btn-primary {
  background: var(--at-cyan);
  color: var(--at-cyan-ink);
}
.home-hero .home-btn-primary:hover {
  background: var(--at-cyan-hover);
}
.home-hero .home-btn:not(.home-btn-primary) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: var(--hero-ink);
}
.home-hero .home-btn:not(.home-btn-primary):hover {
  border-color: rgba(255, 255, 255, 0.45);
}
.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 36px 0 0;
  padding: 0;
  color: var(--hero-dim);
  font-size: 0.95rem;
  list-style: none;
}
.home-stats strong {
  color: var(--hero-ink);
  font-size: 1.15rem;
}

.home-art {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.home-art svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.art-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}
.art-payoff {
  stroke: var(--at-cyan);
  stroke-width: 2.5;
  opacity: 0.55;
}
.art-payoff-2 {
  stroke: var(--at-on-navy-line);
  stroke-dasharray: 6 6;
}
.art-candles path {
  stroke-width: 2;
}
.art-candles .up {
  stroke: var(--at-on-navy-up);
}
.art-candles rect.up {
  fill: var(--at-on-navy-up);
  stroke: none;
}
.art-candles .down {
  stroke: var(--at-on-navy-down);
}
.art-candles rect.down {
  fill: var(--at-on-navy-down);
  stroke: none;
}

/* ---------- Sections ---------- */
.home-section {
  padding: 72px 0;
}
.home-section-alt {
  border-block: 1px solid var(--line);
  background: var(--bg-alt);
}
.home-head {
  max-width: 700px;
  margin-bottom: 32px;
}
.home-head h2,
.home-yt h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
}
.home-head p:last-child,
.home-yt-text p:last-child {
  text-wrap: pretty;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Course modules */
.home-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.home-modules a {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--at-radius-sm);
  background: var(--card);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.home-modules a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.home-module-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--at-accent-soft);
  color: var(--at-accent-text);
  font-size: 0.9rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

/* Tools */
/* Flex, not grid: an unfilled last row sits centred instead of leaving a hole on the right. */
.home-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.home-tools > li {
  flex: 0 1 calc((100% - 36px) / 3);
  min-width: 300px;
}
.home-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--at-radius);
  background: var(--card);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.home-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  transform: translateY(-2px);
}
.home-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--at-accent-soft);
}
.home-icon svg,
.home-yt-logo svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-tag {
  color: var(--at-accent-text);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.home-card-name {
  margin: 4px 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}
.home-card-desc {
  flex: 1;
  color: var(--muted);
  font-size: 0.95rem;
}
.home-open {
  margin-top: 16px;
  color: var(--at-accent-text);
  font-weight: 650;
}

/* Light: white cards lifted off the grey page by a soft shadow. */
:root:not([data-theme="dark"]) .home-card,
:root:not([data-theme="dark"]) .home-modules a,
:root:not([data-theme="dark"]) .home-yt {
  box-shadow: var(--at-shadow);
}

/* YouTube */
.home-yt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 32px 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}
.home-yt-logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--at-youtube) 12%, transparent);
}
.home-yt-logo svg {
  width: 40px;
  height: 40px;
  stroke: var(--at-youtube);
}
.home-yt .home-eyebrow {
  color: var(--at-youtube);
}
:root[data-theme="dark"] .home-yt .home-eyebrow {
  color: color-mix(in srgb, var(--at-youtube) 60%, white);
}

/* ---------- Footer ---------- */
.home-foot {
  padding: 32px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.home-foot p {
  margin: 0 0 4px;
}
.home-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 16px;
  font-weight: 600;
}
.home-foot-links a {
  color: var(--text);
  text-decoration: none;
}
.home-foot-links a:hover,
.home-foot p a:hover {
  color: var(--at-accent-text);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .home-hero {
    padding: 48px 0 56px;
  }
  .home-hero-grid {
    grid-template-columns: 1fr;
  }
  /* Decorative only: on a phone it would push the course below the fold. */
  .home-art {
    display: none;
  }
  .home-tools > li {
    flex-basis: calc((100% - 18px) / 2);
  }
  .home-yt {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 26px 22px;
  }
  .home-yt .home-btn {
    justify-self: start;
  }
}
@media (max-width: 520px) {
  .home-wrap {
    width: calc(100% - 32px);
  }
  .home-section {
    padding: 52px 0;
  }
  .home-modules {
    grid-template-columns: 1fr;
  }
  .home-tools > li {
    flex-basis: 100%;
    min-width: 0;
  }
  .home-hero .home-btn,
  .home-section .home-actions .home-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-btn,
  .home-card,
  .home-modules a {
    transition: none;
  }
}
