/* ============================================================
   MKLab tech talk deck
   Full-page snap-scrolling presentation on top of the Living
   Canvas. Ember brand: near-black ink, one accent, hairlines.
   Shared by every talk under /talks/; per-talk particle scenes
   live in /assets/js/talks/<slug>.js.
   ============================================================ */

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

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  background: var(--ink-950);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: var(--weight-light);
  overflow-x: hidden;
}
body.mk-idle { cursor: none; }

::selection { background: var(--accent-quiet); color: var(--ink-000); }

/* ---------- Canvas behind everything ---------- */
.mk-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

/* ---------- Slides ---------- */
.deck { position: relative; z-index: 1; }

.slide {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  align-items: center;
  padding: 0 7vw;
}

.slide__copy {
  max-width: 480px;
  position: relative;
}

/* soft dark pillow so copy stays readable over the lights */
.slide__copy::before {
  content: "";
  position: absolute;
  inset: -12% -18%;
  background: radial-gradient(ellipse at center,
    rgba(5, 5, 5, 0.72) 0%,
    rgba(5, 5, 5, 0.38) 55%,
    rgba(5, 5, 5, 0) 78%);
  z-index: -1;
  pointer-events: none;
}

.slide--bottom { align-items: end; }
.slide--bottom .slide__copy { margin-bottom: 11vh; max-width: 640px; }

.slide--center { justify-items: center; text-align: center; }
.slide--center .slide__copy { max-width: 720px; }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}
.eyebrow .num { color: var(--ember-500); }

.slide h1 {
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: clamp(56px, 8.5vw, 118px);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--ink-050);
}

.slide h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: clamp(38px, 4.8vw, 60px);
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  color: var(--ink-050);
  margin-bottom: var(--space-6);
}

.lead {
  font-size: clamp(15px, 1.35vw, 19px);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--ink-200);
  max-width: 52ch;
}
.lead strong {
  color: var(--ink-100);
  font-weight: var(--weight-medium);
}
.lead em {
  font-style: normal;
  color: var(--ember-300);
}
.slide--center .lead { margin-inline: auto; }
/* a story runs to two paragraphs; they must not read as one block */
.lead + .lead { margin-top: var(--space-5); }

/* Every defense slide ends with the sentence to say when the fix is not
   yours to make. Same shape every time, so the audience learns to look
   for it: this is the part you can act on tomorrow without permission. */
.deck-raise {
  margin-top: var(--space-5);
  padding-left: var(--space-4);
  border-left: 1px solid var(--candle-500, #f5a623);
  max-width: 52ch;
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: var(--leading-relaxed);
  color: var(--ink-100);
}
.deck-raise b {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--candle-500, #f5a623);
  margin-bottom: var(--space-2);
}

.title-sub {
  margin-top: var(--space-8);
}

/* ---------- Reveal on activation ---------- */
.slide__copy > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slower) var(--ease-out),
              transform var(--dur-slower) var(--ease-out);
}
.slide__copy > *:nth-child(2) { transition-delay: 120ms; }
.slide__copy > *:nth-child(3) { transition-delay: 240ms; }
.slide__copy > *:nth-child(4) { transition-delay: 360ms; }

.slide.is-active .slide__copy > * {
  opacity: 1;
  transform: translateY(0);
}

/* during the logo intro the title copy holds back */
body.mk-intro-running .slide.is-active .slide__copy > * {
  opacity: 0;
  transform: translateY(14px);
}

/* ---------- Chrome: counter, progress, hint, logo ---------- */
.deck-counter {
  position: fixed;
  right: var(--space-8);
  bottom: var(--space-6);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}
.deck-counter .cur { color: var(--ink-100); }

/* beat ticks: how many steps this slide still has in it */
.deck-beats {
  position: fixed;
  right: var(--space-8);
  bottom: calc(var(--space-6) + 20px);
  z-index: 2;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}
.deck-beats i {
  display: block;
  width: 10px;
  height: 1px;
  background: var(--ink-600, #4a4a52);
  transition: background var(--dur-slow) var(--ease-out);
}
.deck-beats i.on { background: var(--ember-500); }

.deck-progress {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 2;
  height: 1px;
  width: 0%;
  background: var(--ember-500);
  box-shadow: 0 0 8px 0 var(--accent-glow);
  transition: width var(--dur-slow) var(--ease-out);
}

.deck-logo {
  position: fixed;
  left: var(--space-8);
  top: var(--space-6);
  z-index: 2;
  opacity: 0.8;
}
.deck-logo img { height: 30px; display: block; }

.deck-hint {
  position: absolute;
  bottom: 7vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  animation: hint-breathe 3.2s var(--ease-in-out) infinite;
}
@keyframes hint-breathe {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

/* ---------- Outro actions ---------- */
.deck-actions { margin-top: var(--space-8); }

.deck-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-100);
  padding: 15px 30px;
  border: var(--border-hairline) solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.deck-link:hover {
  color: var(--ink-000);
  border-color: var(--ember-500);
  box-shadow: var(--glow-ember-sm);
}

/* ---------- Language switch (decks that declare a twin) ---------- */
.deck-lang {
  position: fixed;
  right: var(--space-8);
  top: var(--space-6);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
}
.deck-lang .cur { color: var(--ink-100); }
.deck-lang .sep { margin: 0 var(--space-2); }
.deck-lang a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--dur-base) var(--ease-out);
}
.deck-lang a:hover { color: var(--ember-300); }

/* ---------- Password gate (protected decks) ---------- */
body.mk-gated, html.mk-gated { overflow: hidden; }

.deck-gate {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background:
    radial-gradient(ellipse at center,
      rgba(5, 5, 5, 0.94) 0%, rgba(5, 5, 5, 0.995) 75%);
}
.deck-gate__card {
  max-width: 520px;
  text-align: center;
}
.deck-gate__card h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: clamp(30px, 3.8vw, 46px);
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  color: var(--ink-050);
  margin-bottom: var(--space-6);
}
.deck-gate__card .lead { margin-inline: auto; }
.deck-gate__card form {
  margin-top: var(--space-8);
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}
.deck-gate__card input {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  color: var(--ink-050);
  background: var(--surface-inset);
  border: var(--border-hairline) solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 13px 22px;
  min-width: 220px;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.deck-gate__card input:focus {
  border-color: var(--ember-500);
  box-shadow: var(--glow-ember-sm);
}
.deck-gate__card button.deck-link {
  background: transparent;
  cursor: pointer;
}
.deck-gate__error {
  display: none;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.12em;
  color: var(--ember-300);
}
.deck-gate__error.is-visible { display: block; }
.deck-gate .deck-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Sources list (decks that cite their numbers) ---------- */
.deck-sources {
  list-style: none;
  margin-top: var(--space-8);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-8);
  text-align: left;
}
.deck-sources li {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  line-height: var(--leading-relaxed);
}
.deck-sources a {
  color: var(--ink-200);
  text-decoration: none;
  border-bottom: 1px solid var(--border-default);
  transition: color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.deck-sources a:hover {
  color: var(--ember-300);
  border-color: var(--ember-500);
}
.deck-sources .src-org { color: var(--text-secondary); }
@media (max-width: 720px) {
  .deck-sources { grid-template-columns: 1fr; }
}

/* ---------- Blackout: "." fades the whole deck to black ---------- */
.deck-blackout {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms var(--ease-in-out);
}
body.mk-blackout .deck-blackout {
  opacity: 1;
  pointer-events: auto;
}
body.mk-blackout { cursor: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide__copy > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .deck-hint { animation: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .slide { padding: 0 8vw; }
  .slide__copy { max-width: 100%; }
  .slide--bottom .slide__copy { margin-bottom: 14vh; }
  .deck-logo { display: none; }
}
