/* ============================================================
   Just Web Academy — slide deck engine
   Full-viewport slides, hop-node rail, keyboard driven.
   ============================================================ */

.deck-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  /* A definite height plus minmax(0,...) keeps the rail pinned: a tall slide
     scrolls inside itself instead of growing the page. */
  grid-template-rows: auto minmax(0, 1fr) auto;
}

/* ---------- Deck chrome ---------- */

.deck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem clamp(1.1rem, 3.2vw, 2.6rem);
  border-bottom: 1px solid var(--hairline-soft);
}
.deck-bar__id { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.deck-bar__logo { height: 26px; width: auto; opacity: 0.95; }
.deck-bar__sep { width: 1px; height: 22px; background: var(--hairline); flex: none; }
.deck-bar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-lo);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deck-bar__back {
  color: var(--text-lo);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.4em 0.2em;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.deck-bar__back:hover { color: var(--text-hi); transform: translateX(-3px); }

/* ---------- Stage ---------- */

.stage {
  position: relative;
  display: grid;
  overflow: hidden;
}

.slide {
  grid-area: 1 / 1;
  width: 100%;
  padding: clamp(1.5rem, 3.2vw, 3.2rem) clamp(1.1rem, 3.2vw, 2.6rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 14px, 0);
  transition: opacity 0.42s var(--ease), transform 0.52s var(--ease), visibility 0.42s;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.slide[data-active] {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.slide__inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
}

/* Staggered entrance of each slide's own blocks */
.slide[data-active] .reveal {
  animation: rise 0.62s var(--ease) backwards;
  animation-delay: calc(120ms + var(--i, 0) * 85ms);
}
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Slide headings ---------- */

.slide__head { margin-bottom: clamp(1.3rem, 2.4vw, 2.2rem); }
.slide__title {
  font-size: clamp(1.65rem, 2.9vw, 2.7rem);
  margin-top: 0.75rem;
  max-width: 24ch;
}
.slide__title--wide { max-width: 36ch; }
.slide__lede {
  margin-top: 1rem;
  max-width: 62ch;
  color: var(--text-md);
  font-size: 1.04rem;
  line-height: 1.55;
}

/* ---------- Rail: the deck nav is drawn as a resolution chain ---------- */

.rail {
  display: flex;
  align-items: stretch;
  padding: 0 clamp(1.1rem, 3.2vw, 2.6rem) 1.15rem;
  border-top: 1px solid var(--hairline-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail button {
  appearance: none;
  background: none;
  border: 0;
  border-top: 2px solid oklch(100% 0 0 / 0.09);
  padding: 1rem 1.15rem 0.3rem;
  margin-top: -1px;
  cursor: pointer;
  text-align: left;
  color: var(--text-lo);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  transition: color 0.24s var(--ease), border-color 0.24s var(--ease);
}
/* the hop node */
.rail button::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 1.15rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-800);
  border: 1px solid var(--hairline);
  transition: transform 0.28s var(--ease), background-color 0.28s var(--ease), border-color 0.28s var(--ease);
}
.rail button:hover { color: var(--text-md); }
.rail button:hover::before { background: var(--text-lo); }
.rail button[aria-current="true"] {
  color: var(--text-hi);
  border-top-color: var(--signal);
}
.rail button[aria-current="true"]::before {
  background: var(--signal);
  border-color: var(--signal);
  transform: scale(1.35);
  box-shadow: 0 0 0 5px oklch(80% 0.135 216 / 0.16);
}
.rail button[data-passed] { border-top-color: oklch(80% 0.135 216 / 0.35); }
.rail button[data-passed]::before { background: oklch(80% 0.135 216 / 0.5); border-color: transparent; }

.rail__hop { display: block; font-size: 0.62rem; opacity: 0.6; letter-spacing: 0.16em; margin-bottom: 0.26rem; }

/* ---------- Prev / next ---------- */

.deck-nav { display: flex; align-items: center; gap: 0.6rem; flex: none; }
.deck-nav__count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--text-lo);
  font-variant-numeric: tabular-nums;
  min-width: 4.6ch;
  text-align: center;
}
.deck-nav__count b { color: var(--text-hi); }
.icon-btn {
  appearance: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: oklch(100% 0 0 / 0.04);
  color: var(--text-md);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.icon-btn:hover:not(:disabled) { background: oklch(100% 0 0 / 0.1); color: var(--text-hi); transform: translateY(-1px); }
.icon-btn:active:not(:disabled) { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.28; cursor: not-allowed; }

.kbd-hint {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-md);
  opacity: 0.85;
}
.kbd-hint kbd {
  font-family: var(--font-display);
  font-size: 0.9em;
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  margin: 0 0.1em;
}

/* ---------- Shared slide furniture ---------- */

.panel {
  background: linear-gradient(168deg, oklch(100% 0 0 / 0.055), oklch(100% 0 0 / 0.018));
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  padding: clamp(1.05rem, 1.6vw, 1.45rem);
  box-shadow: var(--lift-1);
}

.takeaway {
  margin-top: clamp(1.3rem, 2.2vw, 2rem);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, oklch(80% 0.135 216 / 0.13), oklch(80% 0.135 216 / 0.02));
  border: 1px solid oklch(80% 0.135 216 / 0.26);
  border-left: 3px solid var(--signal);
}
.takeaway__label {
  color: var(--signal);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  flex: none;
  padding-top: 0.4em;
}
.takeaway p { color: var(--text-hi); font-size: 1.02rem; line-height: 1.55; }

.grid { display: grid; gap: clamp(0.75rem, 1.2vw, 1.1rem); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }

/* four cards, one shared set of rows */
.grid--rows { grid-template-rows: auto auto auto 1fr; }
.grid--rows > * { grid-row: span 4; grid-template-rows: subgrid; }

@media (max-width: 1000px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  /* no keyboard to hint at, and the bar has no room for it */
  .kbd-hint { display: none; }
  .deck-bar__title { display: none; }
}
@media (max-width: 700px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .grid--rows > * { grid-row: auto; grid-template-rows: none; }
  .takeaway { flex-direction: column; gap: 0.5rem; }
  .deck-bar__logo, .deck-bar__sep { display: none; }
  .deck-bar { padding-block: 0.8rem; }
  .icon-btn { width: 34px; height: 34px; }
}

/* ---------- Print: one slide per page ---------- */

@media print {
  .ground, .rail, .deck-nav, .kbd-hint { display: none !important; }
  .deck-shell { height: auto; overflow: visible; display: block; }
  body { background: #fff; color: #111; }
  .slide {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    grid-area: auto;
    break-after: page;
  }
  .stage { display: block; overflow: visible; }
  h1, h2, h3, .slide__title { color: #03035B; }
}
