/* =====================================================================
   MLStation · Home page
   Layout: "Midnight Lab"  ·  Colours: "Aurora" (light) / Midnight (dark)
   Only loaded on index.qmd, so it cannot affect articles.
   ===================================================================== */

/* ---------- tokens: light = Aurora ---------- */
.ms-home {
  --mh-bg: #FAFAFF;
  --mh-surface: #FFFFFF;
  --mh-surface-2: #F3F2FF;
  --mh-border: #E3E1F5;
  --mh-text: #14122B;
  --mh-muted: #5B5878;
  --mh-faint: #8E8BAA;
  --mh-accent: #5B4BF5;
  --mh-accent-2: #C23ABF;
  --mh-accent-3: #0B8F8E;
  --mh-on-accent: #FFFFFF;
  --mh-grad: linear-gradient(100deg, #5B4BF5 0%, #B23CD9 50%, #0EA5A4 100%);
  --mh-hero-bg:
    radial-gradient(1100px 520px at 85% -10%, #E6E1FF 0%, transparent 60%),
    radial-gradient(800px 480px at -5% 30%, #DDF7F4 0%, transparent 60%),
    radial-gradient(700px 400px at 50% 110%, #FCE4F7 0%, transparent 65%);
  --mh-code-bg: #15132B;
  --mh-code-text: #E8E6FF;
  --mh-shadow: 0 1px 2px rgba(20,18,43,.05), 0 18px 40px -18px rgba(60,40,160,.28);
  --mh-ml: #6366F1; --mh-ai: #A855F7; --mh-st: #0D9488;
  --mh-sw: #D97706; --mh-dp: #E11D48; --mh-rs: #0284C7;
  color: var(--mh-text);
}
/* ---------- tokens: dark = Midnight ---------- */
.quarto-dark .ms-home {
  --mh-bg: #0A0F1E;
  --mh-surface: #111831;
  --mh-surface-2: #172042;
  --mh-border: #26305A;
  --mh-text: #E8ECF8;
  --mh-muted: #A3ABC8;
  --mh-faint: #7680A6;
  --mh-accent: #8B93FF;
  --mh-accent-2: #E879F9;
  --mh-accent-3: #2DD4BF;
  --mh-on-accent: #0A0F1E;
  --mh-grad: linear-gradient(100deg, #8B93FF 0%, #C084FC 50%, #2DD4BF 100%);
  --mh-hero-bg:
    radial-gradient(900px 500px at 80% 0%, rgba(167,139,250,.20) 0%, transparent 60%),
    radial-gradient(800px 500px at 10% 20%, rgba(45,212,191,.13) 0%, transparent 60%);
  --mh-code-bg: #070B17;
  --mh-code-text: #E8ECF8;
  --mh-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 24px 60px -24px rgba(0,0,0,.7);
  --mh-ml: #818CF8; --mh-ai: #C084FC; --mh-st: #2DD4BF;
  --mh-sw: #FBBF24; --mh-dp: #FB7185; --mh-rs: #38BDF8;
}

/* ---------- page reset (home only) ---------- */
html { overflow-x: clip; }
main.content { margin-top: 0 !important; }
#title-block-header, main.content > header { display: none !important; }
.ms-home a, .ms-home a:hover { color: inherit !important; text-decoration: none !important; }
.ms-home h1, .ms-home h2, .ms-home h3, .ms-home h4 { font-family: "Satoshi", "Inter", system-ui, sans-serif; letter-spacing: -.025em; line-height: 1.1; margin: 0 !important; color: var(--mh-text); }
.ms-home p { margin: 0; }
.ms-home ol { padding: 0 !important; margin: 0; list-style: none; }
.ms-home li { margin: 0 !important; }
.ms-home :focus-visible { outline: 2px solid var(--mh-accent); outline-offset: 3px; border-radius: 6px; }
.mh-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.mh-grad { background: var(--mh-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mh-eyebrow { font: 700 12px/1 "Inter", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--mh-accent); }

/* ---------- buttons and chips ---------- */
.mh-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.35rem; border-radius: 999px; font: 600 15px "Inter", sans-serif; border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ms-home .mh-btn-primary, .ms-home .mh-btn-primary:hover { background: var(--mh-accent); color: var(--mh-on-accent) !important; box-shadow: 0 10px 24px -10px var(--mh-accent); }
.mh-btn-primary:hover { transform: translateY(-2px); }
.mh-btn-ghost { background: var(--mh-surface); color: var(--mh-text); border-color: var(--mh-border); }
.mh-btn-ghost:hover { border-color: var(--mh-accent); }
.mh-sm { padding: .45rem .9rem; font-size: 13px; }
.mh-chip { font: 600 12.5px "Inter", sans-serif; padding: 5px 12px; border-radius: 999px; background: var(--mh-surface); border: 1px solid var(--mh-border); color: var(--mh-muted); }

/* ---------- hero ---------- */
.mh-hero { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); background: var(--mh-hero-bg); border-bottom: 1px solid var(--mh-border); }
.mh-hero-inner { padding: 64px 24px 72px; text-align: center; }
.mh-audience { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.ms-home .mh-title { font-size: clamp(40px, 5.6vw, 72px); font-weight: 700; letter-spacing: -.035em; margin: 16px auto 20px !important; max-width: 15ch; line-height: 1.04; }
.mh-lead { font-size: 18.5px; line-height: 1.6; color: var(--mh-muted); max-width: 40rem; margin: 0 auto 28px !important; }
.mh-lead strong { color: var(--mh-text); }
.mh-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.mh-trust { display: flex; gap: 36px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.mh-trust div { display: flex; flex-direction: column; }
.mh-trust b { font: 700 26px "Satoshi", sans-serif; font-variant-numeric: tabular-nums; color: var(--mh-text); }
.mh-trust span { font-size: 13px; color: var(--mh-muted); }

/* ---------- lab: math -> code -> output ---------- */
.mh-lab { display: grid; grid-template-columns: .95fr 1.2fr 1.25fr; margin-top: 44px; text-align: left; background: var(--mh-surface); border: 1px solid var(--mh-border); border-radius: 18px; box-shadow: var(--mh-shadow); }
.mh-step { position: relative; padding: 20px 22px; border-right: 1px solid var(--mh-border); min-width: 0; }
.mh-step:last-child { border-right: 0; }
.mh-step-label { display: flex; align-items: center; gap: 8px; font: 700 11px "Inter", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--mh-faint); margin-bottom: 10px; }
.mh-step-label em { font-style: normal; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 11px; letter-spacing: 0; }
.mh-step-label .s1 { background: var(--mh-accent); } .mh-step-label .s2 { background: var(--mh-accent-2); } .mh-step-label .s3 { background: var(--mh-accent-3); }
.mh-live { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--mh-accent-3); }
.mh-live::before, .mh-pulse { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mh-accent-3); animation: mh-pulse 1.6s infinite; display: inline-block; }
@keyframes mh-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mh-accent-3) 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.mh-arrow { position: absolute; right: -13px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--mh-accent); color: var(--mh-on-accent); display: grid; place-items: center; font-size: 14px; z-index: 2; }
.mh-math { overflow-x: auto; color: var(--mh-text); font-size: 15px; }
.mh-math .katex-display { margin: .3em 0 !important; }
.mh-hint { font-size: 12.5px; color: var(--mh-faint); margin-top: 8px !important; }
.ms-home .mh-mini-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--mh-accent) !important; }
.ms-home pre.mh-code { margin: 0; background: var(--mh-code-bg); color: var(--mh-code-text); border: 0; border-radius: 12px; padding: 14px 16px; font: 400 12.8px/1.65 "JetBrains Mono", monospace; overflow-x: auto; white-space: pre; }
.mh-code .k { color: #FF7AB6; } .mh-code .f { color: #9BD1FF; } .mh-code .n { color: #FFD479; } .mh-code .c { color: #8C89A8; }
.mh-out-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mh-out-top label { font-size: 13px; color: var(--mh-muted); display: flex; align-items: center; gap: 8px; margin: 0; }
.mh-out-top input[type=range] { accent-color: var(--mh-accent); width: 90px; }
.mh-plots { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; }
.mh-cv { position: relative; height: 150px; min-width: 0; overflow: hidden; border-radius: 12px; }
.mh-plots canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; background: var(--mh-surface-2); border-radius: 12px; }
.mh-readout { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font: 500 12.5px "JetBrains Mono", monospace; color: var(--mh-muted); }
.mh-readout b { color: var(--mh-text); font-weight: 600; }

/* ---------- section scaffolding ---------- */
.mh-block { padding: 84px 0 0; }
.mh-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.ms-home .mh-head h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 700; margin-top: 10px !important; border: 0; padding: 0; }
.mh-head p:not(.mh-eyebrow) { color: var(--mh-muted); margin-top: 10px !important; max-width: 36rem; }

/* ---------- two paths ---------- */
.mh-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mh-path { border-radius: 20px; padding: 30px; border: 1px solid var(--mh-border); background: var(--mh-surface); position: relative; overflow: hidden; transition: box-shadow .2s; }
.mh-path:hover { box-shadow: var(--mh-shadow); }
.mh-path::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--tint); opacity: .12; pointer-events: none; }
.ms-home .mh-path h3 { font-size: 24px; font-weight: 700; margin: 12px 0 8px !important; }
.mh-path > p { color: var(--mh-muted); margin-bottom: 16px !important; }
.mh-path ol { display: grid; gap: 8px; margin-bottom: 20px !important; }
.mh-path li { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.mh-path li span { width: 24px; height: 24px; border-radius: 8px; background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.ms-home .mh-path li a:hover { color: var(--tint) !important; }
.mh-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); }
.ms-home .mh-go { font-weight: 700; font-size: 15px; color: var(--tint) !important; display: inline-flex; gap: 6px; align-items: center; position: relative; z-index: 1; }

/* ---------- end to end strip ---------- */
.mh-e2e { display: grid; grid-template-columns: repeat(6, 1fr); background: var(--mh-surface); border: 1px solid var(--mh-border); border-radius: 20px; overflow: hidden; }
.mh-e2e a { padding: 22px 18px; border-right: 1px solid var(--mh-border); position: relative; transition: background .2s; }
.mh-e2e a:last-child { border-right: 0; }
.mh-e2e a:hover { background: color-mix(in srgb, var(--tint) 8%, var(--mh-surface)); }
.mh-num { font: 700 12px "JetBrains Mono", monospace; color: var(--tint); }
.ms-home .mh-e2e h4 { margin: 8px 0 4px !important; font-size: 16px; font-weight: 700; }
.mh-e2e p { font-size: 13px; color: var(--mh-muted); line-height: 1.5; }
.mh-bar { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--tint); transform-origin: left; transform: scaleX(0); animation: mh-fill 6s infinite; }
@keyframes mh-fill { 0% { transform: scaleX(0); } 15% { transform: scaleX(1); } 85% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

/* ---------- explore cards ---------- */
.mh-explore { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mh-ex { border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 12px; min-height: 220px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 15%, var(--mh-surface)) 0%, var(--mh-surface) 70%);
  border: 1px solid color-mix(in srgb, var(--tint) 25%, var(--mh-border)); transition: transform .2s, box-shadow .2s; }
.mh-ex:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -22px var(--tint); }
.mh-ex-main { display: flex; flex-direction: column; gap: 10px; }
.mh-ico { width: 46px; height: 46px; border-radius: 14px; background: var(--tint); color: #fff; display: grid; place-items: center; font-size: 20px; }
.ms-home .mh-ex h3 { font-size: 21px; font-weight: 700; }
.mh-ex p { color: var(--mh-muted); font-size: 14.5px; line-height: 1.55; }
.mh-topics { display: flex; gap: 6px; flex-wrap: wrap; }
.mh-topics a { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--tint) 11%, transparent); transition: background .15s; }
.mh-topics a:hover { background: color-mix(in srgb, var(--tint) 22%, transparent); }
.ms-home .mh-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--tint) !important; }

/* ---------- recent articles (listing template) ---------- */
.mh-ticker { display: flex; align-items: center; gap: 10px; margin: -12px 0 18px; font-size: 14px; color: var(--mh-muted); }
#home-recent { padding-top: 0; }
.mh-recent { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.mh-feature { border-radius: 20px; padding: 30px; color: #fff !important; background: var(--mh-grad); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 360px; }
.mh-feature::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 300px at 85% 10%, rgba(255,255,255,.25), transparent 60%); }
.mh-feature > * { position: relative; }
.mh-badge { align-self: flex-start; margin-bottom: auto; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.ms-home .mh-feature h3 { color: #fff; font-size: clamp(26px, 3vw, 36px); font-weight: 700; margin: 16px 0 10px !important; }
.mh-feature p { opacity: .92; max-width: 34rem; margin-bottom: 14px !important; }
.mh-feature .mh-m { font-size: 13px; opacity: .9; }
.quarto-dark .ms-home .mh-feature, .quarto-dark .ms-home .mh-feature h3 { color: #0A0F1E !important; }
.quarto-dark .mh-badge { background: rgba(10,15,30,.12); border-color: rgba(10,15,30,.25); }
.mh-list { display: flex; flex-direction: column; gap: 10px; }
.mh-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--mh-surface); border: 1px solid var(--mh-border); transition: border-color .2s, transform .2s; }
.mh-item:hover { border-color: var(--tint, var(--mh-accent)); transform: translateX(3px); }
.mh-dot { width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--tint, var(--mh-accent)) 16%, transparent); color: var(--tint, var(--mh-accent)); display: grid; place-items: center; font-size: 17px; }
.ms-home .mh-item h4 { font-size: 15px; line-height: 1.35; font-weight: 700; }
.mh-item .mh-m { font-size: 12.5px; color: var(--mh-muted); display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.mh-new { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; background: var(--mh-accent-3); color: #fff; }
.mh-new[hidden] { display: none; }
.quarto-dark .mh-new { color: #0A0F1E; }

/* ---------- call to action ---------- */
.mh-cta { margin: 60px 0 40px; border-radius: 26px; padding: 48px; background: var(--mh-surface-2); border: 1px solid var(--mh-border); display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: center; }
.ms-home .mh-cta h2 { font-size: clamp(26px, 3vw, 38px); font-weight: 700; border: 0; padding: 0; }
.mh-cta p { color: var(--mh-muted); margin-top: 10px !important; }
.mh-cta .mh-actions { justify-content: flex-end; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .mh-lab { grid-template-columns: 1fr; }
  .mh-step { border-right: 0; border-bottom: 1px solid var(--mh-border); }
  .mh-step:last-child { border-bottom: 0; }
  .mh-arrow { display: none; }
  .mh-e2e { grid-template-columns: repeat(2, 1fr); }
  .mh-e2e a { border-bottom: 1px solid var(--mh-border); }
  .mh-explore { grid-template-columns: 1fr 1fr; }
  .mh-paths, .mh-recent { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .mh-wrap { padding: 0 16px; }
  .mh-hero-inner { padding: 44px 16px 52px; }
  .mh-trust { gap: 22px; }
  .mh-explore { grid-template-columns: 1fr; }
  .mh-plots { grid-template-columns: minmax(0, 1fr); }
  .mh-cta { grid-template-columns: 1fr; padding: 30px; }
  .mh-cta .mh-actions { justify-content: flex-start; }
  .mh-feature { min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .ms-home *, .ms-home *::before { animation: none !important; transition: none !important; }
}
