/* Malleable Accept Studio renderers. Every selector is scoped under .r-root or .r-<kind>. */

/* ------------------------------------------------------------------------- */
/* Shared tokens and primitives                                              */
/* ------------------------------------------------------------------------- */

.r-root {
  --r-ink: var(--ink, #16161d);
  --r-paper: var(--paper, #fbfaf7);
  --r-muted: var(--muted, #5f6070);
  --r-accent: var(--accent, #ff5a36);
  --r-surface: var(--surface, #ffffff);
  --r-border: var(--border, #e3e1da);
  --r-mono: var(--mono, ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace);
  --r-radius: 14px;
  --r-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.08);
  --r-good: #1f9d63;
  --r-warn: #d97706;
  --r-v0: #ff5a36;
  --r-v1: #0f9d9a;
  --r-v2: #7c4dff;
  display: grid;
  gap: 1rem;
  color: var(--r-ink);
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 1rem;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  .r-root {
    --r-ink: var(--ink, #ececf1);
    --r-paper: var(--paper, #121217);
    --r-muted: var(--muted, #a3a3b2);
    --r-accent: var(--accent, #ff7a59);
    --r-surface: var(--surface, #1b1b22);
    --r-border: var(--border, #30303b);
    --r-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 28px rgb(0 0 0 / 0.35);
    --r-good: #34d399;
    --r-warn: #fbbf24;
  }
}

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

.r-root .r-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.r-root .r-head-text {
  min-width: 0;
  flex: 1 1 16rem;
}

.r-root .r-kicker {
  margin: 0 0 0.2rem;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--r-muted);
}

.r-root .r-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.r-root .r-sub {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-root .r-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--r-muted);
}

.r-root .r-empty {
  margin: 0;
  padding: 1.5rem;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius);
  color: var(--r-muted);
  text-align: center;
}

.r-root .r-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--r-border);
  border-radius: 999px;
  background: var(--r-surface);
  color: var(--r-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.r-root .r-btn:hover:not(:disabled) {
  border-color: var(--r-ink);
}

.r-root .r-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.r-root .r-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.r-root .r-btn-primary {
  background: var(--r-ink);
  border-color: var(--r-ink);
  color: var(--r-paper);
}

.r-root .r-btn-primary:hover:not(:disabled) {
  background: var(--r-accent);
  border-color: var(--r-accent);
  color: #fff;
}

.r-root .r-btn-ghost {
  background: transparent;
}

.r-root .r-btn.r-on {
  background: var(--r-accent);
  border-color: var(--r-accent);
  color: #fff;
}

.r-root :focus-visible {
  outline: 3px solid var(--r-accent);
  outline-offset: 2px;
}

.r-root mark.r-mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--r-accent) 26%, transparent);
  color: inherit;
}

/* ------------------------------------------------------------------------- */
/* deck/slides                                                               */
/* ------------------------------------------------------------------------- */

.r-deck .r-deck-stage {
  --s-bg: #fffdf8;
  --s-ink: #15151c;
  --s-muted: #6b6a75;
  --s-accent: var(--r-accent);
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-radius);
  background: var(--s-bg);
  color: var(--s-ink);
  box-shadow: var(--r-shadow);
  border: 1px solid var(--r-border);
  container-type: inline-size;
  cursor: default;
}

.r-deck .r-deck-stage.r-ratio-4x3 {
  aspect-ratio: 4 / 3;
  max-width: 52rem;
  margin-inline: auto;
}

.r-deck .r-deck-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
}

.r-deck .r-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.r-deck .r-slide[hidden] {
  display: none;
}

.r-deck .r-slide.r-active {
  animation: r-slide-in 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.r-deck .r-slide.r-active[data-dir="back"] {
  animation-name: r-slide-in-back;
}

@keyframes r-slide-in {
  from {
    opacity: 0;
    transform: translateX(2.5%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes r-slide-in-back {
  from {
    opacity: 0;
    transform: translateX(-2.5%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.r-deck .r-slide-inner {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.2cqi;
  padding: 5cqi 6cqi 3cqi;
  overflow: hidden;
}

.r-deck .r-slide-kicker {
  margin: 0;
  font-family: var(--r-mono);
  font-size: 1rem;
  font-size: clamp(0.65rem, 1.6cqi, 1.25rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--s-accent);
}

.r-deck .r-slide-title {
  margin: 0;
  font-size: 1.6rem;
  font-size: clamp(1rem, 4.2cqi, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.r-deck .r-slide-foot {
  display: flex;
  justify-content: space-between;
  padding: 0 6cqi 2.4cqi;
  font-family: var(--r-mono);
  font-size: clamp(0.55rem, 1.2cqi, 0.95rem);
  color: var(--s-muted);
}

/* cover */
.r-deck .r-slide-cover {
  --s-bg: #15151c;
  --s-ink: #fffdf8;
  --s-muted: #a9a8b5;
  background: radial-gradient(120% 90% at 85% 10%, color-mix(in srgb, var(--s-accent) 45%, transparent), transparent 60%), #15151c;
  color: var(--s-ink);
}

.r-deck .r-slide-cover .r-slide-title {
  max-width: 80%;
  font-size: clamp(1.4rem, 7cqi, 5.6rem);
  line-height: 0.98;
}

.r-deck .r-slide-cover .r-slide-lede {
  max-width: 62%;
  margin: 0;
  font-size: clamp(0.75rem, 2cqi, 1.6rem);
  line-height: 1.35;
  color: #d9d8e2;
}

.r-deck .r-slide-cover .r-slide-byline {
  margin: 0;
  font-family: var(--r-mono);
  font-size: clamp(0.6rem, 1.4cqi, 1.1rem);
  color: var(--s-muted);
}

.r-deck .r-cover-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.r-deck .r-cover-orb {
  position: absolute;
  border-radius: 50%;
}

.r-deck .r-orb-1 {
  right: 6%;
  bottom: 12%;
  width: 22cqi;
  height: 22cqi;
  background: var(--s-accent);
  mix-blend-mode: screen;
  opacity: 0.9;
}

.r-deck .r-orb-2 {
  right: 18%;
  bottom: 30%;
  width: 12cqi;
  height: 12cqi;
  border: 0.5cqi solid #fffdf8;
  opacity: 0.6;
}

.r-deck .r-cover-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgb(255 255 255 / 0.06) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.06) 1px, transparent 1px);
  background-size: 4cqi 4cqi;
}

.r-deck .r-slide-cover .r-slide-kicker,
.r-deck .r-slide-cover .r-slide-title,
.r-deck .r-slide-cover .r-slide-lede,
.r-deck .r-slide-cover .r-slide-byline {
  position: relative;
}

/* thesis */
.r-deck .r-slide-thesis {
  background: linear-gradient(135deg, #fffdf8 0%, #fff1ea 100%);
}

.r-deck .r-thesis-text {
  margin: 0;
  max-width: 88%;
  font-size: clamp(1.1rem, 5.2cqi, 4.2rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.r-deck .r-slide-thesis .r-slide-inner::before {
  content: "";
  width: 9cqi;
  height: 0.8cqi;
  border-radius: 1cqi;
  background: var(--s-accent);
}

/* visual */
.r-deck .r-slide-visual .r-slide-inner {
  justify-content: flex-start;
}

.r-deck .r-slide-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 4cqi;
  align-items: center;
}

.r-deck .r-slide-grid-solo {
  grid-template-columns: minmax(0, 1fr);
}

.r-deck .r-slide-bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.6cqi;
  font-size: clamp(0.7rem, 1.85cqi, 1.45rem);
  line-height: 1.35;
}

.r-deck .r-slide-bullets li {
  position: relative;
  padding-left: 2.4cqi;
}

.r-deck .r-slide-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 1cqi;
  height: 1cqi;
  border-radius: 50%;
  background: var(--s-accent);
}

.r-deck .r-visual {
  margin: 0;
  min-width: 0;
}

.r-deck .r-visual-cap {
  margin-top: 1cqi;
  font-family: var(--r-mono);
  font-size: clamp(0.55rem, 1.1cqi, 0.85rem);
  color: var(--s-muted);
}

.r-deck .r-flow {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.8cqi;
}

.r-deck .r-flow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.4cqi;
  padding: 1.1cqi 1.6cqi;
  border: 0.2cqi solid var(--s-ink);
  border-radius: 1.2cqi;
  background: #fff;
  font-size: clamp(0.6rem, 1.55cqi, 1.2rem);
  line-height: 1.25;
  box-shadow: 0.5cqi 0.5cqi 0 var(--s-ink);
}

.r-deck .r-flow-step:not(:last-child)::after {
  content: "\2193";
  position: absolute;
  left: 3.1cqi;
  bottom: -1.95cqi;
  font-size: clamp(0.6rem, 1.6cqi, 1.2rem);
  line-height: 1;
  color: var(--s-accent);
  font-weight: 800;
}

.r-deck .r-flow-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 3cqi;
  height: 3cqi;
  border-radius: 50%;
  background: var(--s-accent);
  color: #fff;
  font-weight: 800;
  font-size: clamp(0.55rem, 1.3cqi, 1rem);
}

.r-deck .r-term {
  border-radius: 1.2cqi;
  overflow: hidden;
  background: #101016;
  box-shadow: 0 1.2cqi 3cqi rgb(0 0 0 / 0.25);
}

.r-deck .r-term-bar {
  display: flex;
  gap: 0.7cqi;
  padding: 1cqi 1.4cqi;
  background: #1e1e27;
}

.r-deck .r-term-dot {
  width: 1.1cqi;
  height: 1.1cqi;
  border-radius: 50%;
  background: #ff5f57;
}

.r-deck .r-term-dot:nth-child(2) {
  background: #febc2e;
}

.r-deck .r-term-dot:nth-child(3) {
  background: #28c840;
}

.r-deck .r-term-body {
  margin: 0;
  padding: 1.6cqi 1.8cqi;
  overflow-x: auto;
  color: #e7e6f0;
  font-family: var(--r-mono);
  font-size: clamp(0.55rem, 1.35cqi, 1.05rem);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.r-deck .r-term-gutter {
  display: inline-block;
  width: 2.6cqi;
  margin-right: 1cqi;
  color: #6b6a7c;
  user-select: none;
  text-align: right;
}

.r-deck .r-term-line:first-child {
  color: #7ee0b5;
}

.r-deck .r-contrast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 1.4cqi;
}

.r-deck .r-contrast-side {
  position: relative;
  padding: 2cqi;
  border-radius: 1.4cqi;
  font-size: clamp(0.6rem, 1.6cqi, 1.25rem);
  line-height: 1.3;
}

.r-deck .r-contrast-side p {
  margin: 0.6cqi 0 0;
}

.r-deck .r-contrast-a {
  background: #ececf1;
  color: #4a4a57;
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--s-accent) 70%, transparent);
  text-decoration-thickness: 0.2cqi;
}

.r-deck .r-contrast-b {
  background: var(--s-ink);
  color: #fffdf8;
}

.r-deck .r-contrast-tag {
  font-family: var(--r-mono);
  font-size: clamp(0.5rem, 1.1cqi, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.7;
  text-decoration: none;
  display: inline-block;
}

.r-deck .r-contrast-vs {
  align-self: center;
  display: grid;
  place-items: center;
  width: 5cqi;
  height: 5cqi;
  border-radius: 50%;
  background: var(--s-accent);
  color: #fff;
  font-weight: 800;
  font-size: clamp(0.6rem, 1.5cqi, 1.1rem);
  transform: rotate(-8deg);
}

.r-deck .r-bars {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.5cqi;
}

.r-deck .r-bar {
  display: grid;
  grid-template-columns: minmax(0, 11cqi) minmax(0, 1fr);
  align-items: center;
  gap: 1.4cqi;
  font-size: clamp(0.6rem, 1.45cqi, 1.1rem);
  font-weight: 600;
}

.r-deck .r-bar-label {
  text-align: right;
  font-family: var(--r-mono);
}

.r-deck .r-bar-track {
  height: 3cqi;
  border-radius: 0.8cqi;
  background: #efede6;
  overflow: hidden;
}

.r-deck .r-bar-fill {
  display: block;
  height: 100%;
  width: var(--bar, 50%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--s-accent), color-mix(in srgb, var(--s-accent) 60%, #ffcf5a));
  transform-origin: left center;
}

.r-deck .r-slide.r-active .r-bar-fill {
  animation: r-bar-grow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes r-bar-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* quote */
.r-deck .r-slide-quote {
  --s-bg: var(--s-accent);
  background: var(--s-accent);
  color: #fff;
}

.r-deck .r-slide-quote .r-slide-foot {
  color: rgb(255 255 255 / 0.75);
}

.r-deck .r-quote-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 18cqi, 14rem);
  line-height: 0.6;
  height: 7cqi;
  opacity: 0.35;
}

.r-deck .r-quote-text {
  margin: 0;
  max-width: 90%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 4cqi, 3.2rem);
  font-style: italic;
  line-height: 1.18;
  text-wrap: balance;
}

.r-deck .r-quote-cite {
  margin: 0;
  font-family: var(--r-mono);
  font-size: clamp(0.6rem, 1.4cqi, 1.1rem);
  opacity: 0.85;
}

/* takeaways */
.r-deck .r-takeaways {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.8cqi;
}

.r-deck .r-takeaway {
  display: flex;
  gap: 1.4cqi;
  padding: 1.8cqi;
  border-radius: 1.4cqi;
  background: #fff;
  border: 0.15cqi solid #e7e4da;
  font-size: clamp(0.6rem, 1.55cqi, 1.2rem);
  line-height: 1.3;
}

.r-deck .r-takeaway-num {
  flex: none;
  font-family: var(--r-mono);
  font-weight: 800;
  font-size: clamp(0.8rem, 2.6cqi, 2rem);
  line-height: 1;
  color: var(--s-accent);
}

.r-deck .r-deck-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgb(0 0 0 / 0.08);
}

.r-deck .r-deck-progress-fill {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--s-accent);
  transition: width 0.3s;
}

.r-deck .r-deck-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.r-deck .r-deck-nav,
.r-deck .r-deck-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.r-deck .r-deck-counter {
  min-width: 4.5ch;
  font-family: var(--r-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-weight: 700;
}

.r-deck .r-deck-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.r-deck .r-deck-dot {
  min-height: 0;
  width: 1.6rem;
  height: 0.55rem;
  padding: 0;
  border-radius: 999px;
  background: var(--r-border);
  border: 0;
}

.r-deck .r-deck-dot.r-current {
  width: 2.6rem;
  background: var(--r-accent);
}

.r-deck .r-deck-notes {
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--r-accent);
  border-radius: 0 var(--r-radius) var(--r-radius) 0;
  background: var(--r-surface);
  box-shadow: var(--r-shadow);
}

.r-deck .r-deck-notes[hidden] {
  display: none;
}

.r-deck .r-deck-notes-label {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-deck .r-deck-notes-text {
  margin: 0;
}

@media (max-width: 640px) {
  .r-deck .r-slide-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2cqi;
  }

  .r-deck .r-slide-visual .r-slide-bullets li:nth-child(n + 2) {
    display: none;
  }

  .r-deck .r-deck-stage {
    aspect-ratio: 4 / 3.4;
  }

  .r-deck .r-slide-inner {
    padding: 5cqi 5cqi 2cqi;
  }

  .r-deck .r-slide-title {
    font-size: clamp(1rem, 6cqi, 2rem);
  }

  .r-deck .r-slide-bullets,
  .r-deck .r-flow-step,
  .r-deck .r-term-body,
  .r-deck .r-contrast-side,
  .r-deck .r-bar,
  .r-deck .r-takeaway {
    font-size: 0.75rem;
  }

  .r-deck .r-takeaways {
    grid-template-columns: minmax(0, 1fr);
  }

  .r-deck .r-deck-dots {
    order: 3;
    width: 100%;
  }
}

/* ------------------------------------------------------------------------- */
/* audio/podcast                                                             */
/* ------------------------------------------------------------------------- */

.r-podcast .r-onair {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border: 2px solid var(--r-border);
  border-radius: 6px;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-podcast .r-onair::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.r-podcast.r-playing .r-onair {
  border-color: #e11d48;
  color: #fff;
  background: #e11d48;
  box-shadow: 0 0 0 4px color-mix(in srgb, #e11d48 22%, transparent);
}

.r-podcast.r-playing .r-onair::before {
  animation: r-blink 1s steps(2, start) infinite;
}

@keyframes r-blink {
  to {
    visibility: hidden;
  }
}

.r-podcast .r-hosts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
}

.r-podcast .r-host {
  --hc: var(--r-v0);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.r-podcast .r-host-1 {
  --hc: var(--r-v1);
}

.r-podcast .r-host-2 {
  --hc: var(--r-v2);
}

.r-podcast .r-host.r-speaking {
  border-color: var(--hc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc) 25%, transparent), var(--r-shadow);
  transform: translateY(-2px);
}

.r-podcast .r-host-avatar {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--hc);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
}

.r-podcast .r-host-meta {
  display: grid;
  min-width: 0;
}

.r-podcast .r-host-name {
  font-weight: 700;
}

.r-podcast .r-host-voice {
  font-size: 0.75rem;
  color: var(--r-muted);
}

.r-podcast .r-meter {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 2rem;
}

.r-podcast .r-meter-bar {
  width: 4px;
  height: 20%;
  border-radius: 2px;
  background: color-mix(in srgb, var(--hc) 35%, var(--r-border));
}

.r-podcast .r-host.r-speaking .r-meter-bar {
  background: var(--hc);
  animation: r-meter 0.9s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -0.13s);
}

.r-podcast .r-host.r-speaking .r-meter-bar:nth-child(2n) {
  animation-duration: 0.62s;
}

.r-podcast .r-host.r-speaking .r-meter-bar:nth-child(3n) {
  animation-duration: 0.77s;
}

@keyframes r-meter {
  0% {
    height: 15%;
  }
  35% {
    height: 85%;
  }
  60% {
    height: 40%;
  }
  100% {
    height: 100%;
  }
}

.r-podcast .r-pod-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
}

.r-podcast .r-pod-play {
  min-height: 2.9rem;
  padding-inline: 1.3rem;
  font-size: 1rem;
}

.r-podcast .r-pod-status {
  flex: 1 1 14rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--r-muted);
}

.r-podcast .r-pod-status.r-warn {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--r-warn) 14%, transparent);
  color: var(--r-ink);
}

.r-podcast .r-pod-body {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.r-podcast .r-chapter-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.25rem;
}

.r-podcast .r-chapter {
  width: 100%;
  justify-content: flex-start;
  gap: 0.6rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
  font-weight: 500;
  text-align: left;
}

.r-podcast .r-chapter.r-current {
  background: var(--r-surface);
  border-color: var(--r-border);
  font-weight: 700;
}

.r-podcast .r-chapter-time {
  flex: none;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  color: var(--r-muted);
  font-variant-numeric: tabular-nums;
}

.r-podcast .r-chapter.r-current .r-chapter-time {
  color: var(--r-accent);
}

.r-podcast .r-transcript {
  position: relative;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  max-height: 28rem;
  overflow-y: auto;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
  scroll-padding: 1rem;
}

.r-podcast .r-turn-chapter {
  position: sticky;
  top: -0.5rem;
  z-index: 1;
  margin: 0.4rem -0.5rem 0.2rem;
  padding: 0.35rem 1rem;
  background: var(--r-surface);
  border-bottom: 1px solid var(--r-border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-podcast .r-turn {
  --hc: var(--r-v0);
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.r-podcast .r-turn.r-voice-1 {
  --hc: var(--r-v1);
}

.r-podcast .r-turn.r-voice-2 {
  --hc: var(--r-v2);
}

.r-podcast .r-turn:hover {
  background: color-mix(in srgb, var(--hc) 7%, transparent);
}

.r-podcast .r-turn.r-active {
  border-left-color: var(--hc);
  background: color-mix(in srgb, var(--hc) 13%, transparent);
}

.r-podcast .r-turn-meta {
  display: grid;
  align-content: start;
}

.r-podcast .r-turn-time {
  font-family: var(--r-mono);
  font-size: 0.72rem;
  color: var(--r-muted);
  font-variant-numeric: tabular-nums;
}

.r-podcast .r-turn-speaker {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--hc);
}

.r-podcast .r-turn-text {
  margin: 0;
}

@media (max-width: 720px) {
  .r-podcast .r-pod-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .r-podcast .r-chapter-list {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .r-podcast .r-chapter {
    width: auto;
    white-space: nowrap;
    border-color: var(--r-border);
  }

  .r-podcast .r-turn {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }

  .r-podcast .r-turn-meta {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
  }

  .r-podcast .r-transcript {
    max-height: 60vh;
  }
}

/* ------------------------------------------------------------------------- */
/* study/flashcards                                                          */
/* ------------------------------------------------------------------------- */

.r-flashcards .r-tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
}

.r-flashcards .r-tally-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.r-flashcards .r-tally-counts > span {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.r-flashcards .r-tally-know {
  background: color-mix(in srgb, var(--r-good) 16%, transparent);
  color: var(--r-good);
}

.r-flashcards .r-tally-review {
  background: color-mix(in srgb, var(--r-warn) 16%, transparent);
  color: var(--r-warn);
}

.r-flashcards .r-tally-left {
  background: color-mix(in srgb, var(--r-muted) 14%, transparent);
  color: var(--r-muted);
}

.r-flashcards .r-tally-meter {
  flex: 1 1 8rem;
  display: flex;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--r-border);
  overflow: hidden;
}

.r-flashcards .r-tally-meter > span {
  width: var(--w, 0%);
  transition: width 0.3s;
}

.r-flashcards .r-tally-meter-know {
  background: var(--r-good);
}

.r-flashcards .r-tally-meter-review {
  background: var(--r-warn);
}

.r-flashcards .r-cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.1rem;
}

.r-flashcards .r-card-item {
  --kc: var(--r-accent);
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.r-flashcards .r-kind-definition {
  --kc: #2563eb;
}

.r-flashcards .r-kind-contrast {
  --kc: #c026d3;
}

.r-flashcards .r-kind-code {
  --kc: #0f9d9a;
}

.r-flashcards .r-card-scene {
  perspective: 1200px;
}

.r-flashcards .r-card {
  position: relative;
  display: grid;
  min-height: 14rem;
  border-radius: var(--r-radius);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.r-flashcards .r-card.r-flipped {
  transform: rotateY(180deg);
}

.r-flashcards .r-card-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--r-border);
  border-top: 5px solid var(--kc);
  border-radius: var(--r-radius);
  background: var(--r-surface);
  box-shadow: var(--r-shadow);
  backface-visibility: hidden;
  min-width: 0;
}

.r-flashcards .r-card-back {
  transform: rotateY(180deg);
  background: color-mix(in srgb, var(--kc) 9%, var(--r-surface));
}

.r-flashcards .r-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--r-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-flashcards .r-card-kind {
  color: var(--kc);
  font-weight: 800;
}

.r-flashcards .r-card-q {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
}

.r-flashcards .r-card-a {
  margin: 0;
  line-height: 1.45;
}

.r-flashcards .r-card-code {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: #101016;
  color: #e7e6f0;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-height: 8rem;
  overflow: auto;
}

.r-flashcards .r-card-cta {
  margin-top: auto;
  align-self: flex-end;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--r-muted);
}

.r-flashcards .r-card:hover .r-card-cta {
  color: var(--kc);
}

/* Reduced motion: swap faces without the 3D rotation. */
.r-flashcards .r-card.r-no-motion {
  transform: none;
  transition: none;
}

.r-flashcards .r-card.r-no-motion .r-card-face {
  backface-visibility: visible;
}

.r-flashcards .r-card.r-no-motion .r-card-back {
  transform: none;
  visibility: hidden;
}

.r-flashcards .r-card.r-no-motion.r-flipped .r-card-back {
  visibility: visible;
}

.r-flashcards .r-card.r-no-motion.r-flipped .r-card-front {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .r-flashcards .r-card,
  .r-flashcards .r-card.r-flipped {
    transform: none;
    transition: none;
  }

  .r-flashcards .r-card .r-card-face {
    backface-visibility: visible;
  }

  .r-flashcards .r-card .r-card-back {
    transform: none;
    visibility: hidden;
  }

  .r-flashcards .r-card.r-flipped .r-card-back {
    visibility: visible;
  }

  .r-flashcards .r-card.r-flipped .r-card-front {
    visibility: hidden;
  }
}

.r-flashcards .r-card-item.r-is-know .r-card-face {
  outline: 2px solid var(--r-good);
  outline-offset: -1px;
}

.r-flashcards .r-card-item.r-is-review .r-card-face {
  outline: 2px dashed var(--r-warn);
  outline-offset: -1px;
}

.r-flashcards .r-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.r-flashcards .r-card-actions .r-btn {
  min-height: 2.2rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

.r-flashcards .r-card-know[aria-pressed="true"] {
  background: var(--r-good);
  border-color: var(--r-good);
  color: #fff;
}

.r-flashcards .r-card-review[aria-pressed="true"] {
  background: var(--r-warn);
  border-color: var(--r-warn);
  color: #1b1200;
}

.r-flashcards .r-card-hint {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--kc) 10%, transparent);
  font-size: 0.85rem;
}

.r-flashcards .r-card-anchor {
  font-family: var(--r-mono);
  font-size: 0.75rem;
  color: var(--r-muted);
  text-decoration: underline;
  text-decoration-color: var(--r-border);
  text-underline-offset: 3px;
}

.r-flashcards .r-card-anchor:hover {
  color: var(--kc);
}

/* ------------------------------------------------------------------------- */
/* visual/zine                                                               */
/* ------------------------------------------------------------------------- */

.r-zine {
  --zk: var(--zine-key, #0078bf);
  --za: var(--zine-accent, #ff665e);
  --zp: var(--zine-paper, #f4ecd8);
}

.r-zine .r-zine-inks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
}

.r-zine .r-zine-ink {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 0.4rem;
  align-items: center;
}

.r-zine .r-swatch {
  grid-row: span 2;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 0.15);
}

.r-zine .r-zine-ink-key .r-swatch {
  background: var(--zk);
}

.r-zine .r-zine-ink-accent .r-swatch {
  background: var(--za);
}

.r-zine .r-zine-ink-paper .r-swatch {
  background: var(--zp);
}

.r-zine .r-ink-name {
  font-weight: 700;
}

.r-zine .r-ink-approx {
  font-family: var(--r-mono);
  font-size: 0.68rem;
  color: var(--r-muted);
}

.r-zine .r-zine-stage {
  padding: clamp(1rem, 4vw, 2.5rem);
  border-radius: var(--r-radius);
  background:
    radial-gradient(circle at 20% 20%, rgb(255 255 255 / 0.06), transparent 50%),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.03) 0 2px, transparent 2px 9px),
    #3b3a36;
  overflow: hidden;
}

.r-zine .r-zine-desk {
  display: grid;
  place-items: center;
}

.r-zine .r-zine-spread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr);
  width: min(100%, 44rem);
  filter: drop-shadow(0 18px 24px rgb(0 0 0 / 0.45));
}

.r-zine .r-zine-spread[hidden] {
  display: none;
}

.r-zine .r-zine-single {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 22rem);
}

.r-zine .r-zine-spread.r-active {
  animation: r-zine-turn 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes r-zine-turn {
  from {
    opacity: 0;
    transform: perspective(1200px) rotateY(-12deg) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.r-zine .r-zine-page {
  --ht-ink: var(--za);
  --main-ink: var(--zk);
  --mis-x: 0px;
  --mis-y: 0px;
  position: relative;
  aspect-ratio: 74 / 105;
  overflow: hidden;
  padding: 9% 9% 12%;
  background:
    radial-gradient(circle at 30% 20%, rgb(255 255 255 / 0.5), transparent 60%),
    radial-gradient(circle at 80% 90%, rgb(120 90 40 / 0.08), transparent 55%),
    var(--zp);
  color: var(--zk);
  container-type: inline-size;
  isolation: isolate;
}

.r-zine .r-zine-double .r-zine-page:first-child {
  box-shadow: inset -18px 0 24px -18px rgb(60 40 10 / 0.35);
}

.r-zine .r-zine-double .r-zine-page:last-child {
  box-shadow: inset 18px 0 24px -18px rgb(60 40 10 / 0.35);
}

.r-zine .r-layer-accent {
  --ht-ink: var(--zk);
  --main-ink: var(--za);
}

.r-zine .r-zine-fold {
  position: relative;
  z-index: 3;
  width: 0;
  border-left: 1px dashed rgb(60 40 10 / 0.45);
}

.r-zine .r-zine-fold::before,
.r-zine .r-zine-fold::after {
  content: "";
  position: absolute;
  left: -6px;
  width: 11px;
  height: 0;
  border-top: 1px solid rgb(60 40 10 / 0.7);
}

.r-zine .r-zine-fold::before {
  top: 6px;
}

.r-zine .r-zine-fold::after {
  bottom: 6px;
}

/* Halftone shape behind the type, printed in the second ink. */
.r-zine .r-zine-tone {
  position: absolute;
  z-index: -1;
  inset: 34% -8% 18% 28%;
  border-radius: 50%;
  mix-blend-mode: multiply;
  opacity: 0.9;
  transform: translate(var(--mis-x), var(--mis-y)) rotate(-6deg);
}

.r-zine .r-ht-dots .r-zine-tone {
  background-image: radial-gradient(circle, var(--ht-ink) 0 38%, transparent 42%);
  background-size: 7px 7px;
}

.r-zine .r-ht-lines .r-zine-tone {
  border-radius: 0;
  inset: 40% -10% 22% -10%;
  background-image: repeating-linear-gradient(-35deg, var(--ht-ink) 0 2px, transparent 2px 6px);
  transform: translate(var(--mis-x), var(--mis-y)) rotate(-4deg);
}

.r-zine .r-ht-grain .r-zine-tone {
  border-radius: 46% 54% 40% 60% / 55% 40% 60% 45%;
  background-image:
    radial-gradient(circle at 20% 30%, var(--ht-ink) 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 60%, var(--ht-ink) 0 1px, transparent 1.8px),
    radial-gradient(circle at 40% 80%, var(--ht-ink) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 90% 10%, var(--ht-ink) 0 1.2px, transparent 2px);
  background-size: 5px 5px, 7px 7px, 3px 3px, 11px 11px;
}

.r-zine .r-zine-role-front-cover .r-zine-tone {
  inset: 18% -20% 6% 12%;
}

.r-zine .r-zine-role-pull-quote .r-zine-tone {
  inset: 10% 10% 30% -20%;
}

/* Big overprinted word: key ink plus a misregistered second-ink copy. */
.r-zine .r-zine-big {
  position: absolute;
  z-index: 0;
  left: -3%;
  right: -3%;
  bottom: 6%;
  font-family: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  font-size: clamp(1.2rem, 30cqi, 8rem);
  line-height: 0.82;
  letter-spacing: -0.04em;
  color: var(--main-ink);
  mix-blend-mode: multiply;
  opacity: 0.92;
  overflow-wrap: break-word;
  hyphens: auto;
  pointer-events: none;
}

.r-zine .r-layer-overprint .r-zine-big::after {
  content: attr(data-word);
  position: absolute;
  inset: 0;
  color: var(--za);
  mix-blend-mode: multiply;
  transform: translate(calc(var(--mis-x) + 3px), calc(var(--mis-y) - 2px));
}

.r-zine .r-zine-role-pull-quote .r-zine-big {
  top: -6%;
  bottom: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 90cqi, 22rem);
}

.r-zine .r-zine-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.5rem;
}

.r-zine .r-zine-headline {
  margin: 0;
  font-family: "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  font-size: 1.1rem;
  font-size: clamp(0.85rem, 9cqi, 2rem);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--zk);
  mix-blend-mode: multiply;
}

.r-zine .r-layer-accent .r-zine-headline {
  color: var(--za);
}

.r-zine .r-zine-body {
  margin: 0;
  max-width: 92%;
  font-family: "Courier New", Courier, var(--r-mono);
  font-size: 0.75rem;
  font-size: clamp(0.6rem, 4.4cqi, 0.95rem);
  line-height: 1.35;
  color: var(--zk);
  mix-blend-mode: multiply;
}

.r-zine .r-zine-role-front-cover .r-zine-headline {
  font-size: clamp(1rem, 14cqi, 3rem);
}

.r-zine .r-zine-role-pull-quote .r-zine-body {
  margin-top: 30%;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(0.7rem, 6cqi, 1.2rem);
}

.r-zine .r-zine-folio {
  position: absolute;
  z-index: 1;
  right: 7%;
  bottom: 4%;
  font-family: var(--r-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--za);
}

.r-zine .r-zine-meta {
  position: absolute;
  z-index: 1;
  left: 9%;
  bottom: 4%;
  font-family: var(--r-mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--zk);
  opacity: 0.55;
}

.r-zine .r-crop {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.r-zine .r-crop::before,
.r-zine .r-crop::after {
  content: "";
  position: absolute;
  background: rgb(30 30 30 / 0.6);
}

.r-zine .r-crop::before {
  width: 12px;
  height: 1px;
}

.r-zine .r-crop::after {
  width: 1px;
  height: 12px;
}

.r-zine .r-crop-tl {
  top: 4px;
  left: 4px;
}

.r-zine .r-crop-tr {
  top: 4px;
  right: 4px;
}

.r-zine .r-crop-tr::before {
  right: 0;
}

.r-zine .r-crop-tr::after {
  right: 0;
}

.r-zine .r-crop-bl {
  bottom: 4px;
  left: 4px;
}

.r-zine .r-crop-bl::before {
  bottom: 0;
}

.r-zine .r-crop-bl::after {
  bottom: 0;
}

.r-zine .r-crop-br {
  bottom: 4px;
  right: 4px;
}

.r-zine .r-crop-br::before {
  right: 0;
  bottom: 0;
}

.r-zine .r-crop-br::after {
  right: 0;
  bottom: 0;
}

.r-zine .r-zine-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.r-zine .r-zine-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
}

.r-zine .r-zine-tab {
  min-height: 2.2rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
}

.r-zine .r-zine-tab.r-current {
  background: var(--zk);
  border-color: var(--zk);
  color: var(--zp);
}

.r-zine .r-zine-prev,
.r-zine .r-zine-next {
  width: 2.5rem;
  padding: 0;
}

.r-zine .r-zine-lower {
  display: grid;
}

.r-zine .r-zine-imposition {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
}

.r-zine .r-imp-sheet {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr));
  aspect-ratio: 297 / 210;
  border: 1px solid rgb(0 0 0 / 0.35);
  background: var(--zp);
}

.r-zine .r-imp-cell {
  grid-row: var(--row);
  grid-column: var(--col);
  display: grid;
  place-items: center;
  border: 1px dashed rgb(0 0 0 / 0.25);
  font-family: var(--r-mono);
  font-weight: 800;
  color: var(--zk);
  transition: background-color 0.2s;
}

.r-zine .r-imp-cell.r-current {
  background: color-mix(in srgb, var(--za) 40%, transparent);
}

.r-zine .r-imp-num {
  display: inline-block;
}

.r-zine .r-imp-rot .r-imp-num {
  transform: rotate(180deg);
}

.r-zine .r-imp-slit {
  position: absolute;
  left: 25%;
  right: 25%;
  top: 50%;
  height: 0;
  border-top: 2px solid var(--za);
}

.r-zine .r-imp-cap {
  display: grid;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--r-muted);
}

.r-zine .r-imp-cap strong {
  color: var(--r-ink);
}

@media (max-width: 560px) {
  .r-zine .r-zine-spread.r-zine-double {
    grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr);
  }

  .r-zine .r-zine-page {
    padding: 8% 7% 14%;
  }

  .r-zine .r-zine-meta {
    display: none;
  }

  .r-zine .r-zine-imposition {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Printed paper stays cream in dark mode; only the surrounding UI changes. */
@media (prefers-color-scheme: dark) {
  .r-zine .r-zine-stage {
    background:
      repeating-linear-gradient(90deg, rgb(255 255 255 / 0.02) 0 2px, transparent 2px 9px),
      #0c0c0f;
  }
}

/* ------------------------------------------------------------------------- */
/* code/spec-tree                                                            */
/* ------------------------------------------------------------------------- */

.r-spec-tree .r-spec-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.r-spec-tree .r-graph-wrap {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
}

.r-spec-tree .r-graph {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--r-mono);
}

.r-spec-tree .r-graph-bg {
  opacity: 1;
}

.r-spec-tree .r-grid-line {
  stroke: var(--r-border);
  stroke-width: 0.6;
}

.r-spec-tree .r-edge {
  stroke: var(--r-muted);
  stroke-width: 1.4;
  opacity: 0.7;
  transition: opacity 0.15s, stroke-width 0.15s;
}

.r-spec-tree .r-edge.r-rel-mentions {
  stroke-dasharray: 5 4;
  stroke: var(--r-v1);
}

.r-spec-tree .r-arrowhead {
  fill: var(--r-muted);
}

.r-spec-tree .r-edge-label {
  font-size: 10px;
  fill: var(--r-muted);
  paint-order: stroke;
  stroke: var(--r-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.r-spec-tree .r-edge-label.r-rel-mentions {
  fill: var(--r-v1);
}

.r-spec-tree .r-node {
  cursor: pointer;
  transition: opacity 0.15s;
  outline: none;
}

.r-spec-tree .r-node-box {
  stroke-width: 1.6;
  transition: stroke-width 0.15s;
}

.r-spec-tree .r-node-label {
  font-size: 12.5px;
  fill: var(--r-ink);
}

.r-spec-tree .r-node-resource .r-node-box {
  fill: var(--r-ink);
  stroke: var(--r-ink);
}

.r-spec-tree .r-node-resource .r-node-label {
  fill: var(--r-paper);
  font-size: 14px;
  font-weight: 700;
}

.r-spec-tree .r-node-kicker {
  font-size: 9px;
  letter-spacing: 0.14em;
  fill: var(--r-accent);
  font-weight: 700;
}

.r-spec-tree .r-node-section .r-node-box {
  fill: var(--r-surface);
  stroke: var(--r-accent);
}

.r-spec-tree .r-node-section .r-node-label {
  font-weight: 600;
}

.r-spec-tree .r-node-concept .r-node-box {
  fill: color-mix(in srgb, var(--r-v1) 14%, var(--r-surface));
  stroke: var(--r-v1);
  stroke-dasharray: 3 2;
}

.r-spec-tree .r-node-concept .r-node-label {
  font-size: 11.5px;
}

.r-spec-tree .r-node:focus-visible .r-node-box,
.r-spec-tree .r-node.r-lit .r-node-box {
  stroke-width: 3;
}

.r-spec-tree .r-node:focus-visible .r-node-box {
  stroke: var(--r-accent);
}

.r-spec-tree .r-graph.r-focusing .r-node:not(.r-lit),
.r-spec-tree .r-graph.r-focusing .r-edge:not(.r-lit),
.r-spec-tree .r-graph.r-focusing .r-edge-label:not(.r-lit) {
  opacity: 0.15;
}

.r-spec-tree .r-graph.r-focusing .r-edge.r-lit {
  opacity: 1;
  stroke-width: 2.4;
}

.r-spec-tree .r-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0 0.5rem 0.25rem;
  list-style: none;
  font-size: 0.75rem;
  color: var(--r-muted);
}

.r-spec-tree .r-graph-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.r-spec-tree .r-legend-key {
  display: inline-block;
  width: 1rem;
  height: 0.7rem;
  border-radius: 3px;
}

.r-spec-tree .r-legend-resource .r-legend-key {
  background: var(--r-ink);
}

.r-spec-tree .r-legend-section .r-legend-key {
  border: 2px solid var(--r-accent);
}

.r-spec-tree .r-legend-concept .r-legend-key {
  border: 2px dashed var(--r-v1);
  border-radius: 999px;
}

.r-spec-tree .r-legend-contains .r-legend-key {
  height: 0;
  border-top: 2px solid var(--r-muted);
  border-radius: 0;
}

.r-spec-tree .r-legend-mentions .r-legend-key {
  height: 0;
  border-top: 2px dashed var(--r-v1);
  border-radius: 0;
}

.r-spec-tree .r-assertions {
  display: grid;
  gap: 0.6rem;
}

.r-spec-tree .r-assertions-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.r-spec-tree .r-assertions-head .r-sub {
  margin: 0;
}

.r-spec-tree .r-assertions-progress {
  font-family: var(--r-mono);
  font-size: 0.78rem;
  color: var(--r-muted);
}

.r-spec-tree .r-copy {
  margin-left: auto;
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
}

.r-spec-tree .r-assertion-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.r-spec-tree .r-assertion {
  --lc: var(--r-accent);
  border: 1px solid var(--r-border);
  border-left: 4px solid var(--lc);
  border-radius: 10px;
  background: var(--r-surface);
  transition: opacity 0.2s, background-color 0.2s;
}

.r-spec-tree .r-level-should {
  --lc: var(--r-warn);
}

.r-spec-tree .r-level-must-not {
  --lc: #e11d48;
}

.r-spec-tree .r-assertion.r-checked {
  background: color-mix(in srgb, var(--r-good) 8%, var(--r-surface));
}

.r-spec-tree .r-assertion.r-checked .r-assertion-text {
  text-decoration: line-through;
  text-decoration-color: var(--r-good);
  color: var(--r-muted);
}

.r-spec-tree .r-assertion-label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}

.r-spec-tree .r-assertion-box {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--r-good);
}

.r-spec-tree .r-assertion-main {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.r-spec-tree .r-assertion-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
}

.r-spec-tree .r-assertion-id {
  font-family: var(--r-mono);
  font-weight: 700;
  color: var(--r-muted);
}

.r-spec-tree .r-badge {
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  background: var(--lc);
  color: #fff;
  font-family: var(--r-mono);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.r-spec-tree .r-badge-should {
  color: #1b1200;
}

.r-spec-tree .r-assertion-section {
  color: var(--r-muted);
}

.r-spec-tree .r-assertion-text {
  font-size: 0.92rem;
}

.r-spec-tree .r-assertion-test {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--r-muted);
}

.r-spec-tree .r-assertion-test-label {
  flex: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
}

.r-spec-tree .r-assertion-test code {
  font-family: var(--r-mono);
  overflow-wrap: break-word;
  min-width: 0;
}

@media (max-width: 900px) {
  .r-spec-tree .r-spec-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------------- */
/* Custom type/subtype                                                       */
/* ------------------------------------------------------------------------- */

.r-custom .r-shape-badge {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--r-border);
  border-radius: 999px;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  color: var(--r-muted);
}

.r-custom .r-custom-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1rem;
  border: 1px dashed color-mix(in srgb, var(--r-accent) 60%, var(--r-border));
  border-radius: var(--r-radius);
  background: color-mix(in srgb, var(--r-accent) 7%, var(--r-surface));
}

.r-custom .r-custom-note p {
  flex: 1 1 18rem;
  margin: 0;
  font-size: 0.9rem;
}

.r-custom .r-ai-btn {
  min-height: 2.9rem;
  padding-inline: 1.3rem;
  font-size: 1rem;
  background: linear-gradient(120deg, #6d28d9, var(--r-accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, #6d28d9 35%, transparent);
}

.r-custom .r-ai-btn:hover:not(:disabled) {
  background: linear-gradient(120deg, #7c3aed, #ff7a59);
  border-color: transparent;
}

.r-custom .r-custom-page {
  padding: clamp(1rem, 4vw, 2.5rem);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
  box-shadow: var(--r-shadow);
}

.r-custom .r-block {
  margin-bottom: 1.2rem;
}

.r-custom .r-block-label {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.r-custom .r-block-text {
  margin: 0 0 0.4rem;
}

.r-custom .r-block-items {
  margin: 0;
  padding-left: 1.2rem;
}

.r-custom .r-block-line {
  margin: 0.2rem 0;
}

/* stage-play */
.r-custom .r-page-stage-play {
  max-width: 44rem;
  margin-inline: auto;
  font-family: "Courier Prime", "Courier New", Courier, var(--r-mono);
  font-size: 0.95rem;
  line-height: 1.55;
}

.r-custom .r-play-title {
  margin-bottom: 2rem;
  text-align: center;
}

.r-custom .r-play-title h3 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-underline-offset: 6px;
}

.r-custom .r-play-scene {
  margin: 1.8rem 0 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.r-custom .r-play-direction {
  margin: 0 0 1rem;
  font-style: italic;
  color: var(--r-muted);
}

.r-custom .r-play-cast ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.r-custom .r-play-who {
  font-weight: 700;
  margin-right: 0.5rem;
}

.r-custom .r-play-role {
  font-style: italic;
  color: var(--r-muted);
}

.r-custom .r-play-line {
  margin: 0 auto 1rem;
  max-width: 30rem;
}

.r-custom .r-play-speaker {
  margin: 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.r-custom .r-play-dialogue {
  margin: 0;
  padding-inline: clamp(0rem, 6vw, 3rem);
}

.r-custom .r-play-end {
  text-align: center;
}

/* man-page */
.r-custom .r-page-man-page {
  background: #0f1012;
  color: #d6d6d6;
  font-family: var(--r-mono);
  font-size: 0.86rem;
  line-height: 1.55;
  border-color: #23252a;
}

.r-custom .r-man-header,
.r-custom .r-man-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: #9a9a9a;
}

.r-custom .r-man-header {
  margin-bottom: 1.2rem;
}

.r-custom .r-man-footer {
  margin-top: 1.5rem;
}

.r-custom .r-man-section {
  margin-bottom: 1rem;
}

.r-custom .r-man-label {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: #ffffff;
}

.r-custom .r-man-indent {
  padding-left: clamp(1rem, 5vw, 3.5rem);
}

.r-custom .r-man-indent p {
  margin: 0.2rem 0;
}

.r-custom .r-man-indent b {
  color: #ffffff;
}

.r-custom .r-man-code {
  margin: 0.2rem 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: #7ee0b5;
  font: inherit;
}

.r-custom .r-man-options {
  margin: 0.2rem 0;
}

.r-custom .r-man-options dt {
  font-weight: 800;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.r-custom .r-man-options dd {
  margin: 0 0 0.5rem 2rem;
}

.r-custom .r-man-list {
  margin: 0.2rem 0;
  padding: 0;
  list-style: none;
}

.r-custom .r-man-list li {
  text-decoration: underline;
  text-decoration-color: #555;
  text-underline-offset: 3px;
}

/* recipe */
.r-custom .r-page-recipe {
  background: #fffaf0;
  color: #2b2118;
  border-color: #eadfca;
}

.r-custom .r-recipe-title h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.r-custom .r-recipe-title p {
  margin: 0.3rem 0 1.2rem;
  font-style: italic;
  color: #7a6650;
}

.r-custom .r-recipe-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem;
}

.r-custom .r-recipe-ingredients ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.r-custom .r-recipe-ingredients label {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  cursor: pointer;
}

.r-custom .r-recipe-ingredients input {
  accent-color: #c2410c;
}

.r-custom .r-recipe-ingredients input:checked + span {
  text-decoration: line-through;
  color: #a08a70;
}

.r-custom .r-recipe-method ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: r-step;
  display: grid;
  gap: 0.8rem;
}

.r-custom .r-recipe-method li {
  position: relative;
  padding-left: 2.6rem;
  counter-increment: r-step;
}

.r-custom .r-recipe-method li::before {
  content: counter(r-step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: #c2410c;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.r-custom .r-recipe-method strong {
  display: block;
}

.r-custom .r-recipe-note {
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid #c2410c;
  background: #fdf0dc;
  font-style: italic;
}

.r-custom .r-recipe-note .r-block-label {
  font-style: normal;
}

.r-custom .r-recipe-note p {
  margin: 0;
}

/* noir */
.r-custom .r-page-noir-narration {
  background:
    repeating-linear-gradient(100deg, rgb(255 255 255 / 0.035) 0 18px, transparent 18px 46px),
    #121212;
  color: #e7e2d6;
  border-color: #222;
  font-family: "Courier New", Courier, var(--r-mono);
}

.r-custom .r-noir-title h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-style: italic;
  text-transform: capitalize;
}

.r-custom .r-noir-title p {
  margin: 0.3rem 0 1.5rem;
  color: #9d968a;
}

.r-custom .r-noir-block {
  margin-bottom: 1.3rem;
}

.r-custom .r-noir-label {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c9a227;
}

.r-custom .r-noir-text {
  margin: 0;
  line-height: 1.7;
}

/* verse */
.r-custom .r-page-verse {
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
}

.r-custom .r-verse-stanza {
  margin-bottom: 1.8rem;
}

.r-custom .r-verse-label {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-family: var(--r-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--r-muted);
}

.r-custom .r-verse-line {
  margin: 0;
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.7;
}

/* thread */
.r-custom .r-page-thread {
  display: grid;
  gap: 0.75rem;
  max-width: 38rem;
  margin-inline: auto;
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.r-custom .r-thread-post {
  position: relative;
  padding: 0.9rem 1rem;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
}

.r-custom .r-thread-post:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 2.05rem;
  bottom: -0.8rem;
  width: 2px;
  height: 0.8rem;
  background: var(--r-border);
}

.r-custom .r-thread-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.r-custom .r-thread-avatar {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--r-accent);
  color: #fff;
  font-weight: 800;
}

.r-custom .r-thread-handle {
  font-weight: 700;
}

.r-custom .r-thread-count {
  margin-left: auto;
  font-family: var(--r-mono);
  font-size: 0.75rem;
  color: var(--r-muted);
}

.r-custom .r-thread-text {
  margin: 0;
}

/* timeline */
.r-custom .r-timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 1.6rem;
  list-style: none;
  display: grid;
  gap: 1rem;
}

.r-custom .r-timeline::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 2px;
  background: var(--r-border);
}

.r-custom .r-timeline-event {
  position: relative;
}

.r-custom .r-timeline-event::before {
  content: "";
  position: absolute;
  left: -1.45rem;
  top: 0.3rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--r-surface);
  border: 3px solid var(--r-accent);
}

.r-custom .r-timeline-label {
  font-family: var(--r-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--r-accent);
}

.r-custom .r-timeline-text {
  margin: 0.1rem 0 0;
}

/* outline */
.r-custom .r-outline-title h3 {
  margin: 0;
  font-size: 1.4rem;
}

.r-custom .r-outline-title p {
  margin: 0.3rem 0 1.2rem;
  color: var(--r-muted);
}

.r-custom .r-prompt {
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  background: var(--r-surface);
}

.r-custom .r-prompt summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--r-muted);
}

.r-custom .r-prompt-text {
  margin: 0;
  padding: 0 1rem 1rem;
  font-family: var(--r-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@media (max-width: 600px) {
  .r-custom .r-recipe-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .r-custom .r-ai-btn {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .r-deck .r-deck-stage {
    border-color: var(--r-border);
  }

  .r-custom .r-page-recipe {
    background: #241d15;
    color: #f1e6d4;
    border-color: #3a2f22;
  }

  .r-custom .r-recipe-title p {
    color: #c4ad8f;
  }

  .r-custom .r-recipe-note {
    background: #2f2519;
  }
}

/* ------------------------------------------------------------------------- */
/* Reduced motion                                                            */
/* ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .r-root *,
  .r-root *::before,
  .r-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .r-podcast .r-host.r-speaking .r-meter-bar {
    height: 70%;
  }

  .r-podcast .r-host.r-speaking .r-meter-bar:nth-child(odd) {
    height: 40%;
  }
}
