/*! TechTruth LectureDeck v0.6.0 · uses techtruth_content design tokens */
/* Aspal + Cyrillic drawn from its own strokes (0.6.0). Letters only; digits and punctuation come from the serif fallback. */
@font-face {
  font-family: "TTS Display";
  /* Aspal letters only, re-based: the original draws every glyph 0.25em above the baseline,
     so fallback punctuation (, : ; — « ») and Cyrillic dropped below the Latin letters. */
  src: url("../fonts/tts-display.woff2") format("woff2");
  unicode-range: U+0041-005A, U+0061-007A, U+0400-045F, U+0490-0491; /* Latin + Cyrillic letters only: Aspal digits read like letters (10 → IO) */
  font-display: swap;
}

/* Theme: dark glass over marble, as in techtruth_content (body.dark-marble). Light theme: add class "tts-light" to <body>. */
tts-lecture, .tts-deck, .tts-toolbar, .tts-toast, .tts-toc, .tts-resume {
  --ld-gold: var(--gold, #C9A84C);
  --ld-gold-lt: var(--gold-lt, #E8C97A);
  --ld-gold-dk: var(--gold-dk, #A07830);
  --ld-dark: var(--dark, #0E0C09);
  --ld-display: var(--display-cyr, "TTS Display", Georgia, "Times New Roman", serif);
  --ld-body: var(--body, "Montserrat", system-ui, sans-serif);
  --ld-gradient: linear-gradient(135deg, var(--ld-gold-lt), var(--ld-gold) 45%, var(--ld-gold-dk));

  --ld-ink: #FAF8F3;                       /* headings, slide text */
  --ld-ink-2: #E8E4DC;                     /* body text */
  --ld-muted: rgba(240, 236, 228, .45);
  --ld-accent: var(--ld-gold-lt);          /* small gold text */
  --ld-line: rgba(201, 168, 76, .28);
  --ld-surface:
    radial-gradient(120% 90% at 15% 0%, rgba(232, 201, 122, .10), transparent 60%),
    radial-gradient(90% 70% at 100% 100%, rgba(160, 120, 48, .08), transparent 70%),
    rgba(10, 9, 7, .55);
  --ld-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
  --ld-field: rgba(0, 0, 0, .35);
  --ld-btn: rgba(14, 12, 9, .72);
  --ld-btn-ink: #FAF8F3;
  --ld-stage:
    radial-gradient(70% 60% at 20% 10%, rgba(232, 201, 122, .10), transparent 60%),
    radial-gradient(60% 50% at 90% 90%, rgba(160, 120, 48, .10), transparent 70%),
    var(--ld-dark);
  --ld-notes: #000;
  --ld-floor-ink: var(--ld-gold-lt);
  --ld-ground: rgba(240, 236, 228, .55);
}
tts-lecture { display: block; }
/* v0.3.2: Page Class "lecture" in techtruth_content reserves a 240px TOC column (.lecture .content-grid).
   Without a .lecture-toc the article shifts left — collapse to one centered column. */
.content-grid:has(tts-lecture):not(:has(.lecture-toc)) { grid-template-columns: minmax(0, 1fr); }
.tts-light :is(tts-lecture, .tts-deck, .tts-toolbar, .tts-toast, .tts-toc, .tts-resume) {
  --ld-ink: var(--dark, #0E0C09);
  --ld-ink-2: var(--text, #2A2520);
  --ld-muted: rgba(42, 37, 32, .55);
  --ld-accent: var(--ld-gold-dk);
  --ld-line: rgba(201, 168, 76, .35);
  --ld-surface:
    radial-gradient(120% 90% at 15% 0%, rgba(232, 201, 122, .10), transparent 60%),
    var(--white, #FDFBF6);
  --ld-shadow: 0 24px 48px -28px rgba(14, 12, 9, .35);
  --ld-field: var(--cream, #F8F5EE);
  --ld-btn: var(--white, #FDFBF6);
  --ld-btn-ink: var(--dark, #0E0C09);
  --ld-stage:
    radial-gradient(70% 60% at 20% 10%, rgba(232, 201, 122, .14), transparent 60%),
    var(--cream, #F8F5EE);
  --ld-notes: var(--dark, #0E0C09);
  --ld-floor-ink: var(--ld-gold-dk);
  --ld-ground: var(--dark, #0E0C09);
}

/* ---------- Slide (read mode) ---------- */
tts-slide {
  display: block;
  position: relative;
  margin: clamp(2.5rem, 7vw, 5rem) 0;
  padding: clamp(1.75rem, 5vw, 3.25rem) clamp(1.25rem, 4vw, 3rem);
  background: var(--ld-surface);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--ld-line);
  border-radius: var(--radius, 4px);
  box-shadow: var(--ld-shadow);
  text-align: center;
  color: var(--ld-ink-2);
  isolation: isolate;
  scroll-margin-block: calc(var(--header-h, 72px) + 1.5rem);
  view-timeline-name: --tts-slide;
}
tts-slide::before { /* gold rule that "draws" itself */
  content: "";
  position: absolute;
  inset-block-start: -1px;
  inset-inline: 50% auto;
  width: min(180px, 45%);
  height: 2px;
  translate: -50% 0;
  background: var(--ld-gradient);
}
tts-slide p { margin: 0; max-width: none; color: inherit; }
tts-slide :where(p + p) { margin-block-start: .75em; }

.tts-slide__body { font-family: var(--ld-display); font-size: clamp(1.3rem, 2.8vw, 1.95rem); line-height: 1.3; color: var(--ld-ink); text-wrap: balance; }
tts-slide[type="quote"] .tts-slide__body { font-size: clamp(1.7rem, 4.2vw, 2.9rem); line-height: 1.15; }
tts-slide[type="quote"] .tts-slide__body::before { content: "“"; display: block; font-size: 2.4em; line-height: .6; color: var(--ld-gold); }
tts-slide[type="quote"] .tts-kicker { margin-bottom: 1.6rem; } /* keep the label clear of the big quote mark */

/* Stat */
tts-stat { display: grid; justify-items: center; gap: .35rem; }
.tts-stat__figure { display: inline-flex; align-items: baseline; gap: .1em; font-family: var(--ld-display); font-size: clamp(3.5rem, 11vw, 7rem); line-height: 1.15; }
.tts-stat__value, .tts-stat__unit { padding-block: .08em; /* background-clip:text clips glyphs taller than the box */ background: var(--ld-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tts-stat__value { font-variant-numeric: tabular-nums; display: inline-block; text-align: end; }
.tts-stat__unit { font-size: .5em; }
.tts-stat__label { font-family: var(--ld-body); font-size: clamp(1rem, 2vw, 1.2rem); color: var(--ld-ink-2); max-width: 32ch; text-wrap: balance; }
.tts-stat__source { font-family: var(--ld-body); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ld-accent); }

/* Building */
tts-building { display: block; width: min(320px, 80%); margin-inline: auto; }
tts-building svg { display: block; width: 100%; height: auto; overflow: visible; }
.tts-floor rect { fill: transparent; stroke: var(--ld-gold); stroke-width: 1.5; stroke-dasharray: 5 5; }
.tts-floor.is-built rect { fill: var(--ld-gold); fill-opacity: .9; stroke-dasharray: none; }
.tts-floor text { font: 600 12px/1 var(--ld-body); letter-spacing: .06em; text-transform: uppercase; fill: var(--ld-floor-ink); }
.tts-floor.is-built text { fill: var(--ld-dark); }
.tts-roof { fill: transparent; stroke: var(--ld-gold); stroke-width: 1.5; }
.tts-roof.is-built { fill: var(--ld-gold-lt); }
.tts-ground { stroke: var(--ld-ground); stroke-width: 2; }
.tts-caption { margin-block-start: 1rem; font-family: var(--ld-display); font-size: clamp(1.15rem, 2.4vw, 1.5rem); color: var(--ld-ink); text-wrap: balance; }

/* Compare: old frame → new frame */
.tts-compare { display: grid; gap: .5rem; justify-items: center; font-family: var(--ld-display); font-size: clamp(1.4rem, 3.4vw, 2.3rem); line-height: 1.2; }
.tts-compare__before { color: var(--ld-muted); text-decoration: line-through; text-decoration-color: var(--ld-gold); text-decoration-thickness: 2px; }
.tts-compare__arrow { color: var(--ld-gold); font-size: .8em; }
.tts-compare__after { color: var(--ld-ink); }

/* Image */
.tts-figure { margin: 0; }
.tts-figure img { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: 2px; }
.tts-figure figcaption { margin-block-start: .75rem; font-size: .9rem; color: var(--ld-ink-2); }

/* Reflect */
.tts-reflect__prompt { font-family: var(--ld-display); font-size: clamp(1.25rem, 2.6vw, 1.75rem); color: var(--ld-ink); text-wrap: balance; }
.tts-reflect__input {
  display: block; width: 100%; margin-block-start: 1.25rem; padding: .9rem 1rem;
  font: inherit; font-family: var(--ld-body); color: var(--ld-ink-2);
  background: var(--ld-field); border: 1px solid rgba(201, 168, 76, .45); border-radius: 3px; resize: vertical;
}
.tts-reflect__input:focus-visible { outline: 2px solid var(--ld-gold); outline-offset: 2px; }

/* ---------- Structure slides: title, section, list, steps, stats, contrast ---------- */
tts-lecture tts-slide[data-only="deck"] { display: none; } /* presentation-only (title, plan, section dividers) */
.tts-kicker { margin: 0 0 .9rem; font: 600 .78rem/1.3 var(--ld-body); letter-spacing: .16em; text-transform: uppercase; color: var(--ld-accent); }
.tts-heading { margin: 0 auto 1.4rem; max-width: 32ch; font-family: var(--ld-display); font-size: clamp(1.25rem, 2.6vw, 1.8rem); line-height: 1.25; color: var(--ld-ink); text-wrap: balance; }
.tts-cite { margin-block-start: 1rem; font: 500 .85rem/1.4 var(--ld-body); letter-spacing: .06em; color: var(--ld-accent); }
.tts-cite::before { content: "— "; }

.tts-title__main { font-family: var(--ld-display); font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1.08; color: var(--ld-ink); text-wrap: balance; }
.tts-title__sub { margin: 1.25rem auto 0; max-width: 40ch; font: 400 clamp(1rem, 2vw, 1.3rem)/1.5 var(--ld-body); color: var(--ld-ink-2); text-wrap: balance; }
.tts-title .tts-kicker::after, .tts-section .tts-kicker::after { content: none; }

.tts-section__n { font-family: var(--ld-display); font-size: clamp(4rem, 12vw, 8rem); line-height: 1.1; padding-block: .05em;
  background: var(--ld-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tts-section__title { font-family: var(--ld-display); font-size: clamp(1.7rem, 4vw, 3rem); line-height: 1.15; color: var(--ld-ink); text-wrap: balance; }

tts-slide :is(ul, ol) { margin: 0; padding: 0; list-style: none; }
tts-slide li { margin: 0; color: inherit; }
tts-slide li::marker { content: none; }

.tts-list { display: flex; justify-content: center; }
.tts-list :is(ul, ol) { display: grid; gap: .85rem; text-align: start; max-width: 40ch; }
.tts-list li { position: relative; padding-inline-start: 1.6rem; font: 400 clamp(1.02rem, 2vw, 1.3rem)/1.45 var(--ld-body); color: var(--ld-ink-2); }
.tts-list li::before { content: ""; position: absolute; inset-inline-start: 0; inset-block-start: .62em; width: .7rem; height: 2px; background: var(--ld-gradient); }
/* v0.3.2: no bold emphasis in lectures — <strong>/<b> render as plain text (only stats numbers and step labels keep their look) */
tts-lecture :is(strong, b), .tts-list li :is(strong, b) { font-weight: inherit; color: inherit; }

.tts-steps :is(ul, ol), .tts-stats :is(ul, ol) { margin-inline: auto; padding: 0; list-style: none; max-width: none; }
.tts-steps :is(ul, ol) { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: .6rem 1.9rem; counter-reset: tts-step; }
.tts-steps li { position: relative; counter-increment: tts-step; display: grid; align-content: center; gap: .35rem; min-width: 8.5rem; max-width: 15rem; padding: .9rem 1rem;
  font: 500 clamp(.9rem, 1.6vw, 1.05rem)/1.35 var(--ld-body); color: var(--ld-ink); border: 1px solid var(--ld-line); border-radius: var(--radius, 6px); background: rgba(201, 168, 76, .05); }
.tts-steps li::before { content: counter(tts-step); font-family: var(--ld-display); font-size: 1.5rem; line-height: 1; color: var(--ld-gold-lt); }
.tts-steps li:not(:last-child)::after { content: "→"; position: absolute; inset-inline-end: -1.45rem; inset-block-start: 50%; translate: 0 -50%; color: var(--ld-gold); font-size: 1.1rem; }
.tts-steps[data-loop] li:last-child::after, .tts-steps .is-loop::after { content: "↺"; position: absolute; inset-inline-end: -1.45rem; inset-block-start: 50%; translate: 0 -50%; color: var(--ld-gold); }
.tts-steps li strong, .tts-steps li b { color: var(--ld-gold-lt); font-weight: inherit; }

.tts-stats :is(ul, ol) { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.75rem 2.75rem; }
.tts-stats li { flex: 0 1 15rem; }
.tts-stats li { display: grid; gap: .45rem; align-content: start; font: 400 clamp(.88rem, 1.5vw, 1rem)/1.45 var(--ld-body); color: var(--ld-ink-2); text-wrap: balance; }
.tts-stats li :is(strong, b) { display: block; font-family: var(--ld-display); font-weight: 400; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.15; padding-block: .06em;
  background: var(--ld-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.tts-stats li em, .tts-stats li small { font-style: normal; font-size: .78em; letter-spacing: .04em; color: var(--ld-muted); }

.tts-contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; text-align: start; }
.tts-contrast__side { padding: 1.25rem 1.3rem; border: 1px solid var(--ld-line); border-radius: var(--radius, 6px); }
.tts-contrast__side--b { border-color: rgba(201, 168, 76, .55); background: rgba(201, 168, 76, .06); }
.tts-contrast__title { margin-bottom: .55rem; font: 600 .74rem/1.3 var(--ld-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ld-accent); }
.tts-contrast__text { font-family: var(--ld-display); font-size: clamp(1.1rem, 2.2vw, 1.45rem); line-height: 1.3; color: var(--ld-ink); }
.tts-contrast__side--a .tts-contrast__text { color: var(--ld-ink-2); }
@media (max-width: 560px) {
  .tts-contrast { grid-template-columns: 1fr; }
  .tts-steps :is(ul, ol) { flex-direction: column; align-items: center; gap: 1.6rem; }
  .tts-steps li { max-width: none; width: min(18rem, 100%); }
  .tts-steps li:not(:last-child)::after, .tts-steps[data-loop] li:last-child::after { content: "↓"; inset-inline-end: auto; inset-inline-start: 50%; inset-block-start: auto; inset-block-end: -1.45rem; translate: -50% 0; }
}

/* Presentation sizes */
.tts-deck .tts-title__main { font-size: clamp(2.6rem, 7vw, 6rem); }
.tts-deck .tts-section__n { font-size: clamp(5rem, 16vw, 11rem); }
.tts-deck .tts-section__title { font-size: clamp(2rem, 5vw, 4rem); }
.tts-deck .tts-heading { font-size: clamp(1.5rem, 3.4vw, 2.6rem); max-width: min(30ch, 100%); }
.tts-deck .tts-list :is(ul, ol) { font-size: clamp(1.2rem, 2.6vw, 1.9rem); max-width: min(100%, 32ch); gap: 1.1rem; }
.tts-deck .tts-list :is(ul, ol):has(> li:nth-child(6)) { font-size: clamp(1.05rem, 2.1vw, 1.5rem); gap: .75rem; }
.tts-deck .tts-list li { font-size: 1em; }
.tts-deck .tts-steps li { font-size: clamp(1rem, 1.7vw, 1.3rem); }
@media (min-width: 561px) {
  .tts-deck .tts-steps :is(ul, ol) { width: 100%; max-width: none; }
  .tts-deck .tts-steps li { max-width: 15rem; flex: 0 1 15rem; }
}
@media (min-width: 900px) { .tts-deck .tts-steps :is(ul, ol) { flex-wrap: nowrap; } }
.tts-deck .tts-stats li { font-size: clamp(1rem, 1.7vw, 1.25rem); }
.tts-deck .tts-stats li { flex-basis: 18rem; }
.tts-deck .tts-stats li :is(strong, b) { font-size: clamp(2.3rem, 4.6vw, 4rem); }
.tts-deck .tts-contrast__text { font-size: clamp(1.3rem, 2.8vw, 2.2rem); }
.tts-deck .tts-contrast { gap: 1.5rem; }
@media (prefers-reduced-motion: no-preference) {
  .tts-deck :is(.tts-list, .tts-steps, .tts-stats) li, .tts-deck .tts-contrast__side { animation: tts-rise .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.2s + var(--k, 0) * .14s); }
  .tts-deck :is(li, .tts-contrast__side):nth-child(2) { --k: 1; }
  .tts-deck :is(li, .tts-contrast__side):nth-child(3) { --k: 2; }
  .tts-deck li:nth-child(4) { --k: 3; }
  .tts-deck li:nth-child(5) { --k: 4; }
  .tts-deck li:nth-child(6) { --k: 5; }
  .tts-deck li:nth-child(n+7) { --k: 6; }
}

/* ---------- Per-slide actions ---------- */
.tts-slide__actions { position: absolute; inset-block-start: .6rem; inset-inline-end: .6rem; display: flex; gap: .35rem; opacity: 0; transition: opacity .2s; }
tts-slide:hover .tts-slide__actions, tts-slide:focus-within .tts-slide__actions { opacity: 1; }
@media (hover: none) { .tts-slide__actions { opacity: .75; } }

/* ---------- Buttons ---------- */
.tts-btn, .tts-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font: 600 .8rem/1 var(--ld-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ld-btn-ink); background: var(--ld-btn);
  border: 1px solid var(--ld-gold); border-radius: 999px; cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s;
}
.tts-btn { padding: .7em 1.15em; }
.tts-icon-btn { width: 2.25rem; height: 2.25rem; font-size: .95rem; }
.tts-btn:hover, .tts-icon-btn:hover { background: var(--ld-gold); color: var(--ld-dark); }
.tts-btn:focus-visible, .tts-icon-btn:focus-visible { outline: 2px solid var(--ld-gold-lt); outline-offset: 2px; }
.tts-btn:disabled, .tts-icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.tts-btn kbd { font: inherit; font-size: .7em; opacity: .6; padding: .15em .4em; border: 1px solid currentColor; border-radius: 3px; }
@media (hover: none) { .tts-btn kbd { display: none; } }

.tts-toolbar { position: fixed; inset-block-end: clamp(.75rem, 3vw, 1.5rem); inset-inline-end: clamp(.75rem, 3vw, 1.5rem); z-index: 50; }
.tts-toolbar .tts-btn { background: var(--ld-btn); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .7); }

.tts-toast {
  position: fixed; inset-block-end: 5rem; inset-inline-start: 50%; translate: -50% 0; z-index: 60;
  padding: .7rem 1.1rem; font: 500 .85rem/1 var(--ld-body); color: #F8F5EE; background: var(--ld-dark);
  border: 1px solid var(--ld-gold); border-radius: 999px;
}

/* ---------- Deck (presentation mode) ---------- */
.tts-deck {
  position: fixed; inset: 0; z-index: auto; /* templates may set body > * { position: relative } */
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  color: var(--ld-ink-2);
  background: var(--ld-stage);
}
.tts-deck[open] { display: grid; grid-template-rows: auto 1fr auto auto; }
.tts-deck::backdrop { background: var(--ld-dark); }
.tts-deck__progress { height: 3px; background: rgba(201, 168, 76, .18); }
.tts-deck__progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--ld-gradient); transition: width .4s ease; }
.tts-deck__stage { display: grid; place-items: center; padding: clamp(1.25rem, 5vw, 5rem); overflow: auto; touch-action: pan-y; }
.tts-deck__stage > tts-slide { width: min(1100px, 100%); margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none; }
.tts-deck__stage > tts-slide::before { inset-block-start: -2.5rem; animation: tts-draw .8s .15s cubic-bezier(.2, .7, .2, 1) both; }
.tts-deck .tts-slide__body { font-size: clamp(1.8rem, 4.4vw, 3.6rem); }
.tts-deck tts-slide[type="quote"] .tts-slide__body { font-size: clamp(2.2rem, 6vw, 5rem); }
.tts-deck tts-slide[data-long] .tts-slide__body { font-size: clamp(1.45rem, 3.3vw, 2.7rem); line-height: 1.25; max-width: 30ch; margin-inline: auto; }
tts-lecture tts-slide[data-long] .tts-slide__body { font-size: clamp(1.25rem, 2.6vw, 1.75rem); }
.tts-deck .tts-stat__figure { font-size: clamp(5rem, 16vw, 12rem); }
.tts-deck .tts-stat__label { font-size: clamp(1.2rem, 2.6vw, 1.8rem); }
.tts-deck tts-building { width: min(420px, 70vw); }
.tts-deck .tts-compare { font-size: clamp(2rem, 5vw, 4rem); }
.tts-deck .tts-compare__after { animation: tts-rise .7s .5s cubic-bezier(.2, .7, .2, 1) both; }
.tts-deck__notes {
  max-height: 30dvh; overflow: auto; padding: 1rem clamp(1rem, 4vw, 3rem);
  font: 400 1rem/1.6 var(--ld-body); color: #F0ECE4; background: var(--ld-notes); border-block-start: 1px solid var(--ld-gold);
}
.tts-deck__bar { display: flex; align-items: center; gap: .5rem; padding: .75rem clamp(.75rem, 3vw, 1.5rem); border-block-start: 1px solid var(--ld-line); }
.tts-deck__count { min-width: 4.5ch; text-align: center; font: 600 .85rem/1 var(--ld-body); font-variant-numeric: tabular-nums; color: var(--ld-accent); }
.tts-deck__spacer { flex: 1; }
.tts-btn--ghost { background: transparent; }
.tts-btn--gold { background: var(--ld-gradient); border-color: var(--ld-gold-dk); color: var(--ld-dark); }
.tts-btn--gold:hover { background: var(--ld-gold-lt); }
a.tts-btn { text-decoration: none; }

/* Final card: calls to action */
.tts-end { display: grid; justify-items: center; gap: 1.25rem; width: min(900px, 100%); text-align: center; }
.tts-end__kicker { margin: 0; font: 600 .8rem/1 var(--ld-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ld-accent); }
.tts-end__kicker::after { content: ""; display: block; width: 120px; height: 2px; margin: 1rem auto 0; background: var(--ld-gradient); animation: tts-draw .8s .1s cubic-bezier(.2, .7, .2, 1) both; }
.tts-end__title { margin: 0; font-family: var(--ld-display); font-size: clamp(1.8rem, 4.5vw, 3.4rem); line-height: 1.15; color: var(--ld-ink); text-wrap: balance; }
.tts-end__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-block-start: .5rem; }
.tts-end__actions .tts-btn { padding: 1em 1.5em; font-size: .85rem; }
.tts-btn[aria-pressed="true"] { background: var(--ld-gold); color: var(--ld-dark); }
@media (max-width: 560px) {
  .tts-deck__bar [data-act="fullscreen"], .tts-deck__bar [data-act="notes"], .tts-deck__bar [data-act="presenter"], .tts-deck__notes { display: none; }
  .tts-deck__bar [data-act="talk"] { display: none; } /* the short talk is for the speaker on a laptop */
}
html.tts-deck-open { overflow: hidden; }
.tts-btn[hidden] { display: none; }

/* ---------- Reader: contents, reading time, resume (0.5.0) ---------- */
tts-lecture :is(h2, h3) { scroll-margin-top: calc(var(--header-h, 72px) + 1.5rem); }
.tts-toc {
  position: fixed; z-index: 49; display: none; box-sizing: border-box;
  inset-inline-end: clamp(.75rem, 3vw, 1.5rem); inset-block-end: calc(clamp(.75rem, 3vw, 1.5rem) + 3.4rem);
  width: min(22rem, calc(100vw - 1.5rem)); max-height: min(70vh, 34rem); overflow: auto; padding: 1rem 1.1rem;
  font: 400 .84rem/1.4 var(--body, "Montserrat", system-ui, sans-serif); color: #E8E4DC;
  background: rgba(14, 12, 9, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--ld-line); border-radius: var(--radius, 6px); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
}
.tts-toc.is-open { display: block; }
.tts-toc__title { margin: 0; font: 600 .7rem/1.2 var(--body, "Montserrat", sans-serif); letter-spacing: .16em; text-transform: uppercase; color: var(--ld-gold-lt); }
.tts-toc__time { margin: .3rem 0 .8rem; font-size: .74rem; color: rgba(240, 236, 228, .5); }
.tts-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .1rem; }
.tts-toc li { margin: 0; }
.tts-toc a { display: block; padding: .32rem .7rem; border-inline-start: 2px solid rgba(201, 168, 76, .15); color: rgba(240, 236, 228, .62); text-decoration: none;
  transition: color .2s, border-color .2s, background-color .2s; }
.tts-toc a > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tts-toc a:hover { color: #FAF8F3; background: rgba(201, 168, 76, .06); }
.tts-toc a.is-done { color: rgba(240, 236, 228, .45); border-inline-start-color: rgba(201, 168, 76, .5); }
.tts-toc a.is-active { color: var(--ld-gold-lt); border-inline-start-color: var(--ld-gold); background: rgba(201, 168, 76, .07); }
.tts-toc a:focus-visible { outline: 2px solid var(--ld-gold); outline-offset: 1px; }
html.tts-toc-side .tts-toc { display: block; inset-inline-end: auto; inset-block: calc(var(--header-h, 72px) + 2rem) auto; max-height: calc(100vh - var(--header-h, 72px) - 7rem);
  padding: .9rem .9rem .8rem; background: rgba(10, 9, 7, .62); box-shadow: none;
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
html.tts-toc-side .tts-toc.is-visible { opacity: 1; visibility: visible; }
html.tts-toc-side .tts-toc-btn { display: none; }
html.tts-deck-open .tts-toc { visibility: hidden; }
.tts-toolbar { display: flex; gap: .5rem; }

.tts-resume {
  position: fixed; z-index: 50; inset-block-end: clamp(.75rem, 3vw, 1.5rem); inset-inline-start: clamp(.75rem, 3vw, 1.5rem);
  display: flex; align-items: center; gap: .6rem; max-width: min(34rem, calc(100vw - 1.5rem)); padding: .55rem .6rem .55rem 1rem; box-sizing: border-box;
  font: 400 .85rem/1.35 var(--body, "Montserrat", system-ui, sans-serif); color: #E8E4DC;
  background: rgba(14, 12, 9, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--gold, #C9A84C); border-radius: 999px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .7);
  animation: tts-rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.tts-resume__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-resume__where { color: var(--gold-lt, #E8C97A); }
.tts-resume .tts-btn { flex: none; padding: .55em .95em; }
.tts-resume .tts-icon-btn { flex: none; width: 1.9rem; height: 1.9rem; }
@media (max-width: 560px) {
  .tts-resume { inset-block-end: calc(clamp(.75rem, 3vw, 1.5rem) + 3.4rem); inset-inline-end: clamp(.75rem, 3vw, 1.5rem); border-radius: 14px; }
  .tts-toc-btn kbd { display: none; }
}

/* ---------- Speaker view (second window, 0.4.0) ---------- */
.tts-pres-body { margin: 0; overflow: hidden; background: #0E0C09; }
.tts-pres-body > *:not(.tts-pres) { display: none !important; }
.tts-pres {
  --ld-gold: var(--gold, #C9A84C); --ld-gold-lt: var(--gold-lt, #E8C97A); --ld-gold-dk: var(--gold-dk, #A07830); --ld-dark: var(--dark, #0E0C09);
  --ld-body: var(--body, "Montserrat", system-ui, sans-serif); --ld-line: rgba(201, 168, 76, .28); --ld-accent: var(--ld-gold-lt);
  --ld-btn: rgba(14, 12, 9, .72); --ld-btn-ink: #FAF8F3; --ld-ink: #FAF8F3; --ld-ink-2: #E8E4DC;
  --ld-gradient: linear-gradient(135deg, var(--ld-gold-lt), var(--ld-gold) 45%, var(--ld-gold-dk));
  position: fixed; inset: 0; z-index: 10; display: grid; gap: 1rem 1.25rem; padding: 1rem 1.25rem;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "bar bar" "now next" "now notes" "hint hint";
  color: var(--ld-ink-2); background: radial-gradient(70% 60% at 20% 10%, rgba(232, 201, 122, .08), transparent 60%), #0E0C09;
  font-family: var(--ld-body);
}
.tts-pres__bar { grid-area: bar; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-bottom: .9rem; border-bottom: 1px solid var(--ld-line); }
.tts-pres__count { min-width: 6ch; text-align: center; font: 600 1rem/1 var(--ld-body); font-variant-numeric: tabular-nums; color: var(--ld-accent); }
.tts-pres__timer { margin-inline-start: 1rem; font: 300 2.1rem/1 var(--ld-body); font-variant-numeric: tabular-nums; color: var(--ld-muted, rgba(240, 236, 228, .5)); }
.tts-pres__timer.is-running { color: var(--ld-ink); }
.tts-pres__pace { font: 500 .9rem/1.3 var(--ld-body); color: rgba(240, 236, 228, .6); }
.tts-pres__pace[data-state="behind"] { color: #F0A35E; }
.tts-pres__pace[data-state="ahead"] { color: #9CCB8A; }
.tts-pres__clock { margin-inline-start: .75rem; font: 500 1.1rem/1 var(--ld-body); font-variant-numeric: tabular-nums; color: var(--ld-accent); }
.tts-pres__now { grid-area: now; } .tts-pres__next { grid-area: next; } .tts-pres__notes { grid-area: notes; }
.tts-pres__now, .tts-pres__next { min-width: 0; }
.tts-pres__label { margin: 0 0 .5rem; font: 600 .72rem/1 var(--ld-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ld-accent); }
.tts-pres__frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--ld-line); border-radius: 6px; background: #0E0C09; }
.tts-pres__next .tts-pres__frame { opacity: .85; }
.tts-pres__notes { min-height: 0; overflow: auto; padding-inline-end: .5rem; }
.tts-pres__text { font: 400 var(--pres-notes, 1.35rem)/1.6 var(--ld-body); color: #F0ECE4; white-space: pre-line; }
.tts-pres__hint { grid-area: hint; margin: 0; font-size: .75rem; color: rgba(240, 236, 228, .4); }
.tts-deck.tts-pv { position: absolute; inset: 0 auto auto 0; width: 1280px; height: 720px; display: grid; transform: scale(var(--s, .5)); transform-origin: 0 0; background: var(--ld-stage); }
.tts-pv .tts-deck__stage { overflow: hidden; padding: 4rem; }
.tts-pv .tts-deck__stage > tts-slide { display: block; }
.tts-pv *, .tts-pv *::before, .tts-pv *::after { animation: none !important; transition: none !important; }
.tts-pv .tts-reflect__input { display: none; }
@media (max-width: 900px) {
  .tts-pres { grid-template-columns: 1fr; grid-template-rows: auto auto auto minmax(0, 1fr) auto; grid-template-areas: "bar" "now" "next" "notes" "hint"; overflow: auto; }
  .tts-pres__next { display: none; }
}

/* ---------- Motion ---------- */
@keyframes tts-rise { from { opacity: 0; translate: 0 28px; } to { opacity: 1; translate: 0 0; } }
@keyframes tts-draw { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes tts-out-left { to { opacity: 0; translate: -6vw 0; } }
@keyframes tts-in-right { from { opacity: 0; translate: 6vw 0; } }
@keyframes tts-out-right { to { opacity: 0; translate: 6vw 0; } }
@keyframes tts-in-left { from { opacity: 0; translate: -6vw 0; } }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    tts-lecture tts-slide { animation: tts-rise linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
    tts-lecture tts-slide::before { animation: tts-draw linear both; animation-timeline: --tts-slide; animation-range: entry 40% cover 40%; }
    tts-lecture .tts-floor { animation: tts-rise linear both; animation-timeline: --tts-slide; animation-range: entry calc(30% + var(--i) * 10%) cover calc(35% + var(--i) * 6%); }
  }
  html.tts-io tts-lecture tts-slide:not(.is-visible) { opacity: 0; translate: 0 28px; }
  html.tts-io tts-lecture tts-slide { transition: opacity .7s ease, translate .7s cubic-bezier(.2, .7, .2, 1); }

  ::view-transition-group(tts-active) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
  html[data-tts-dir="next"]::view-transition-old(tts-active) { animation: tts-out-left .3s ease-in both; }
  html[data-tts-dir="next"]::view-transition-new(tts-active) { animation: tts-in-right .35s .05s ease-out both; }
  html[data-tts-dir="prev"]::view-transition-old(tts-active) { animation: tts-out-right .3s ease-in both; }
  html[data-tts-dir="prev"]::view-transition-new(tts-active) { animation: tts-in-left .35s .05s ease-out both; }
}

/* ---------- {more}: details the reader unfolds (0.6.0) ---------- */
.tts-more { margin: 1.1rem 0 1.5rem; }
.tts-more__sum {
  display: inline-flex; align-items: center; gap: .6em; list-style: none; cursor: pointer; user-select: none;
  padding: .6em 1.1em; border: 1px solid var(--ld-line); border-radius: 999px;
  font: 600 .74rem/1.2 var(--ld-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ld-accent);
  transition: border-color .2s, background-color .2s;
}
.tts-more__sum::-webkit-details-marker { display: none; }
.tts-more__sum::after {
  content: ""; inline-size: .45em; block-size: .45em; margin-block-start: -.2em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .25s;
}
.tts-more[open] > .tts-more__sum::after { transform: translateY(.2em) rotate(-135deg); }
.tts-more__sum:hover, .tts-more__sum:focus-visible { border-color: var(--ld-gold); background: rgba(201, 168, 76, .08); }
.tts-more__sum:focus-visible { outline: 2px solid var(--ld-gold); outline-offset: 3px; }
.tts-more__body { margin-block-start: 1.1rem; padding-inline-start: 1.2rem; border-inline-start: 2px solid var(--ld-line); }
.tts-more__body > :first-child { margin-block-start: 0; }
.tts-more__close { margin-block: .4rem .2rem; font-size: .7rem; }
@supports (interpolate-size: allow-keywords) {
  .tts-more { interpolate-size: allow-keywords; }
  .tts-more::details-content { block-size: 0; overflow: clip; transition: block-size .35s ease, content-visibility .35s allow-discrete; }
  .tts-more[open]::details-content { block-size: auto; }
  @media (prefers-reduced-motion: reduce) { .tts-more::details-content { transition: none; } }
}

@media print {
  .tts-more::details-content { content-visibility: visible; block-size: auto; }
  .tts-more__sum, .tts-more__close { display: none; }
  .tts-toolbar, .tts-slide__actions, .tts-deck { display: none !important; }
  tts-slide { break-inside: avoid; box-shadow: none; }
}
