/* ==========================================================================
   Verso Page-Specific Styles — Home, Install, Guide & Unified Roadmap
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HOME PAGE
   -------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(2.8rem, 6vw, 5rem) clamp(3rem, 6vw, 5.2rem);
  overflow-x: clip;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2.5rem, 5.5vw, 4.75rem);
  align-items: center;
}

@media (max-width: 880px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }
}

.hero__title {
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

.hero__accent {
  position: relative;
  isolation: isolate;
  font-style: italic;
  color: var(--accent);
}

/* Highlighter stroke, swept once after the title has landed (heroEnter) */
.hero__accent::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 46% -0.05em 11% -0.08em;
  border-radius: 0.14em 0.07em 0.12em 0.06em;
  background: var(--highlight);
  transform: rotate(-1.2deg);
  animation: highlightSweep var(--dur-slow) var(--ease-out) calc(var(--dur-slow) + 60ms) backwards;
}

@keyframes highlightSweep {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__accent::before {
    animation: none;
  }
}

.hero__lead {
  font-size: var(--text-md);
  color: var(--ink-secondary);
  max-width: 46ch;
  margin-bottom: var(--space-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-3);
}

.hero__meta {
  margin-bottom: var(--space-5);
}

.hero__beta {
  max-width: 48ch;
}

/* Frameless Floating Screenshot Deck */
.deck-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.deck {
  position: relative;
  width: min(350px, 84vw);
  height: clamp(380px, 48vw, 450px);
  display: grid;
  place-items: center;
  touch-action: pan-y pinch-zoom; /* sideways drags move the front sheet */
}

.deck-sheet {
  position: absolute;
  width: min(286px, 72vw);
  aspect-ratio: 636 / 848;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--sheet-border);
  background: var(--sheet-bg);
  overflow: hidden;
  cursor: pointer;
  transform-origin: 50% 80%;
  transition:
    transform var(--dur-slow) var(--ease-spring),
    box-shadow var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out),
    filter var(--dur-base) var(--ease-out);
  will-change: transform;
}

.deck-sheet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.deck-sheet[data-pos="0"] {
  z-index: 3;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  box-shadow: var(--sheet-shadow);
  cursor: zoom-in;
}

.deck-sheet[data-pos="0"]:hover {
  transform: translate3d(0, -4px, 0) rotate(0deg) scale(1.01);
}

.deck-sheet[data-pos="1"] {
  z-index: 2;
  transform: translate3d(42px, 12px, 0) rotate(6.5deg) scale(0.92);
  box-shadow: var(--sheet-shadow-back);
  opacity: 0.92;
  filter: brightness(0.97);
}

.deck-sheet[data-pos="1"]:hover {
  transform: translate3d(52px, 6px, 0) rotate(8deg) scale(0.94);
  opacity: 1;
}

.deck-sheet[data-pos="2"] {
  z-index: 1;
  transform: translate3d(-40px, 18px, 0) rotate(-6.5deg) scale(0.90);
  box-shadow: var(--sheet-shadow-back);
  opacity: 0.86;
  filter: brightness(0.95);
}

.deck-sheet[data-pos="2"]:hover {
  transform: translate3d(-50px, 10px, 0) rotate(-8deg) scale(0.92);
  opacity: 1;
}

/* Squared up beneath the front sheet during a dictionary lookup */
.deck-sheet[data-pos="under"] {
  z-index: 2;
  transition-timing-function: var(--ease-out); /* a spring would peek out again */
}

/* Follows the finger (see initDeck) */
.deck-sheet.is-dragging {
  transition: none;
}

/* The sheets behind start squared up with the front one and fan out once.
   Selected by data-sheet, which never changes, so switching can't replay it. */
@media (prefers-reduced-motion: no-preference) {
  .deck-sheet:not([data-sheet="0"]) {
    animation: deckFan var(--dur-slow) var(--ease-spring) 480ms backwards;
  }

  .deck-sheet[data-sheet="2"] {
    animation-delay: 540ms;
  }
}

@keyframes deckFan {
  from {
    transform: none;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .deck {
    width: 100%;
    height: 375px;
  }
  .deck-sheet {
    width: min(252px, 68vw);
  }
  .deck-sheet[data-pos="1"] {
    transform: translate3d(26px, 10px, 0) rotate(5.5deg) scale(0.92);
  }
  .deck-sheet[data-pos="2"] {
    transform: translate3d(-26px, 14px, 0) rotate(-5.5deg) scale(0.90);
  }
}

/* Its screenshot is in the lightbox; the lightbox image returns here on closing */
.deck-sheet.is-lifted {
  visibility: hidden;
}

/* Dictionary lookup: the Reading page, with the selection and the card cut out
   of the Dictionary screenshot (see lookUp in initDeck). Both screenshots are
   636 x 848 and the card starts at y 457. */
.deck-lookup,
.deck-lookup img {
  position: absolute;
  inset: 0;
}

.deck-lookup__card {
  clip-path: inset(53.8% 0 0);
}

.deck-sheet__zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: rgba(20, 23, 34, 0.72);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--dur-fast), transform var(--dur-base) var(--ease-spring);
  pointer-events: none;
}

.deck-sheet[data-pos="0"]:hover .deck-sheet__zoom-hint,
.deck-sheet[data-pos="0"]:focus-visible .deck-sheet__zoom-hint {
  opacity: 1;
  transform: scale(1);
}

/* Sliding Pill Control (reused for Screenshot Deck, Install Tabs, Roadmap Filters) */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.28rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.segmented__indicator {
  position: absolute;
  top: 0.28rem;
  left: 0;
  height: calc(100% - 0.56rem);
  border-radius: var(--radius-pill);
  background: var(--accent);
  transition: transform var(--dur-base) var(--ease-spring), width var(--dur-base) var(--ease-spring);
  z-index: 0;
}

.segmented__btn {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.44rem 0.95rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast);
}

.segmented__btn:hover {
  color: var(--ink);
}

.segmented__btn[aria-pressed="true"],
.segmented__btn[aria-selected="true"] {
  color: var(--accent-ink);
}

.deck-caption {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-align: center;
  max-width: 38ch;
  min-height: 3.25em; /* two lines, so a longer caption doesn't move the deck */
  transition: opacity var(--dur-fast);
}

/* Text fades out, is replaced, then fades in (see swapText) */
.is-swapping {
  opacity: 0;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  pointer-events: none;
}

.lightbox.is-open {
  pointer-events: auto;
}

/* The backdrop and bar fade; the image grows out of its sheet (see initDeck) */
.lightbox::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.lightbox::before,
.lightbox__bar {
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}

.lightbox.is-open::before,
.lightbox.is-open .lightbox__bar {
  opacity: 1;
}

.lightbox__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* Last value keeps the 3:4 screenshot within 80vh */
  width: min(560px, calc(100vw - 2 * var(--space-5)), 60vh);
}

.lightbox__img {
  width: 100%;
  aspect-ratio: 636 / 848;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-lg);
  background: #FFFFFF;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 3.3em; /* two caption lines, so browsing doesn't move the image */
  color: #F3F0E9;
  font-size: var(--text-sm);
}

.lightbox__caption {
  transition: opacity var(--dur-fast);
}

.lightbox__close {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Highlights Section (Home Below the Fold) */
.highlights {
  padding-block: clamp(2.5rem, 5vw, 4rem) var(--space-6);
}

.section-heading {
  margin-bottom: var(--space-6);
}

.section-heading h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.section-heading p {
  color: var(--ink-secondary);
  max-width: 56ch;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-fast);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.feature-card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
}

/* Icons act out their meaning once per hover. `is-acting` stays until the
   pointer has left and everything has finished (see initFeatureIcons). */
.feature-card__icon svg {
  overflow: visible;
}

/* Text size steps down, then up */
.is-acting .icon-type {
  transform-origin: 12px 21px;
  animation: iconType 720ms var(--ease-out);
}

@keyframes iconType {
  30% { transform: scale(0.68); }
  68% { transform: scale(1.14); }
}

/* Pen writes its line */
.is-acting .icon-pen {
  transform-origin: 3px 21px;
  animation: iconPen 760ms ease-in-out;
}

@keyframes iconPen {
  20% { transform: translate(-1px, 0) rotate(-5deg); }
  70% { transform: translate(4px, 0) rotate(4deg); }
}

.is-acting .icon-pen-line {
  stroke-dasharray: 1;
  animation: iconPenLine 460ms ease-in-out 150ms backwards;
}

@keyframes iconPenLine {
  from { stroke-dashoffset: 1; }
}

/* Wi-Fi signal goes out, then lights from the dot outwards */
.is-acting .icon-signal {
  animation:
    iconDim 120ms ease-out forwards,
    iconLight 260ms ease-out var(--delay, 0ms) forwards;
}

@keyframes iconDim {
  to { opacity: 0.18; }
}

@keyframes iconLight {
  from { opacity: 0.18; }
  to { opacity: 1; }
}

/* Folder front tips open. The one-piece folder stands in while closed, as
   overlapping strokes look heavier. */
.icon-folder-closed {
  transition: visibility 0s var(--dur-base);
}

.icon-folder-open {
  visibility: hidden;
  transition: visibility 0s var(--dur-base);
}

.is-acting .icon-folder-closed {
  visibility: hidden;
  transition: none;
}

.is-acting .icon-folder-open {
  visibility: visible;
  transition: none;
}

.icon-folder-front {
  transform-origin: 2px 20px;
  transition: transform var(--dur-base) var(--ease-spring);
}

.is-acting .icon-folder-front {
  transform: skewX(-17deg) scaleY(0.82);
}

.icon-folder-edge {
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.is-acting .icon-folder-edge {
  opacity: 1;
}

.feature-card h3 {
  font-size: 1.08rem;
  margin-bottom: var(--space-2);
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.58;
}

/* Honest Scope Note */
.scope-strip {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 720px) {
  .scope-strip {
    grid-template-columns: 1fr;
  }
}

.scope-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.scope-card h3 {
  font-size: 1rem;
  margin-bottom: var(--space-2);
}

.scope-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.scope-card a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   2. INSTALL & LAUNCH PAGE
   -------------------------------------------------------------------------- */
.install-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.install-meta {
  margin-top: var(--space-3);
}

.download-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--space-5);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--status-done-bg);
  border: 1px solid var(--status-done-border);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.5;
  animation: fadeUp var(--dur-base) var(--ease-out);
}

.download-banner[hidden] {
  display: none;
}

.download-banner--fallback {
  background: var(--beta-bg);
  border-color: var(--beta-border);
}

.download-banner__icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--status-done);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
}

.download-banner--fallback .download-banner__icon {
  background: var(--beta);
}

/* The arrow drops into its tray once, when a download has started */
.download-banner__icon {
  overflow: hidden;
}

.download-banner__icon svg {
  overflow: visible;
}

.download-banner:not(.download-banner--fallback) .download-banner__arrow {
  animation: arrowDrop var(--dur-slow) var(--ease-spring) 200ms backwards;
}

@keyframes arrowDrop {
  from { transform: translateY(-24px); }
}

.download-banner__text {
  flex: 1;
}

.download-banner__text strong {
  color: var(--ink);
}

.download-banner__text a {
  margin-left: 0.35rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.download-banner__close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--dur-fast), background-color var(--dur-fast);
}

.download-banner__close:hover {
  color: var(--ink);
  background: var(--border);
}

.step-card a,
.alt-steps a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.asset-size {
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

.req-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.req-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.req-chip strong {
  color: var(--ink);
  font-weight: 600;
}

.req-chip--link {
  text-decoration: none;
  border-color: var(--border-accent);
  color: var(--accent);
  transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}

.req-chip--link strong {
  color: inherit;
}

.req-chip__arrow {
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-spring);
}

.req-chip--link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.req-chip--link:hover .req-chip__arrow {
  transform: translateY(2px);
}

/* Primary Recommended Method Card */
.method-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-7);
}

.method-hero__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.method-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.72rem;
  border-radius: var(--radius-pill);
  background: var(--status-done-bg);
  color: var(--status-done);
  border: 1px solid var(--status-done-border);
  font-size: var(--text-xs);
  font-weight: 600;
}

.method-hero h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.method-hero__sub {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* Numbered Step Grid */
.steps-grid {
  --step-gap: var(--space-5);
  --step-num: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--step-gap);
  margin-bottom: var(--space-6);
}

@media (max-width: 820px) {
  .steps-grid {
    --step-gap: var(--space-4);
    grid-template-columns: 1fr;
  }
}

.step-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

/* Line from the previous step's number to this one (the cards are equally wide) */
.step-card + .step-card::before {
  content: "";
  position: absolute;
  top: calc(var(--space-5) + var(--step-num) / 2 - 1px);
  left: calc(-100% - 2px - var(--step-gap) + var(--space-5) + var(--step-num) + 10px);
  right: calc(100% - var(--space-5) + 10px);
  height: 2px;
  border-radius: 1px;
  background: var(--border-accent);
  transform-origin: left;
}

/* Stacked: from the previous card's edge, so the line stays clear of the text */
@media (max-width: 820px) {
  .step-card + .step-card::before {
    top: calc(-1px - var(--step-gap));
    bottom: auto;
    left: calc(var(--space-5) + var(--step-num) / 2 - 1px);
    right: auto;
    width: 2px;
    height: calc(1px + var(--step-gap) + var(--space-5) - 7px);
    transform-origin: top;
  }
}

/* The lines draw one after the other once their step is in view (initReveals) */
@media (prefers-reduced-motion: no-preference) {
  .step-card + .step-card::before {
    transition: transform var(--dur-slow) var(--ease-out) var(--line-delay, 420ms);
  }

  html:not(.no-js) .step-card:not(.is-visible)::before {
    transform: scaleX(0);
  }

  .step-card:nth-child(3) {
    --line-delay: 820ms;
  }

  @media (max-width: 820px) {
    html:not(.no-js) .step-card:not(.is-visible)::before {
      transform: scaleY(0);
    }

    .step-card:nth-child(3) {
      --line-delay: 420ms;
    }
  }
}

.step-card__num {
  width: var(--step-num);
  height: var(--step-num);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-3);
}

/* Step 1 ticks itself when the download has started (startAutoDownload) */
.step-card__num > * {
  grid-area: 1 / 1;
}

.step-card__num,
.step-card__digit {
  --delay: 320ms;
  transition: background-color var(--dur-base), opacity var(--dur-fast);
  transition-delay: var(--delay);
}

.step-card__num .icon-draw {
  --delay: 400ms;
}

.step-card.is-done.is-visible .step-card__num {
  background: var(--status-done);
}

.step-card.is-done.is-visible .step-card__digit {
  opacity: 0;
}

.step-card h3 {
  font-size: 1.08rem;
  margin-bottom: var(--space-2);
}

.step-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

/* Visual Folder Tree */
.tree-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}

.tree-box__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
}

.tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.tree-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border);
}

.tree-row--primary {
  border-color: var(--border-accent);
  background: var(--accent-soft);
}

/* Rows land one after another, like files being unzipped (initReveals) */
@media (prefers-reduced-motion: no-preference) {
  .tree-row {
    transition: opacity var(--dur-fast) ease-out, transform var(--dur-base) var(--ease-spring);
    transition-delay: calc(200ms + var(--row, 0) * 130ms);
  }

  .tree-row:nth-child(2) { --row: 1; }
  .tree-row:nth-child(3) { --row: 2; }

  html:not(.no-js) .tree-list:not(.is-visible) .tree-row {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.tree-row__path {
  font-weight: 600;
  color: var(--ink);
}

.tree-row__desc {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--ink-secondary);
}

.first-launch-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.first-launch-note strong {
  color: var(--ink);
}

@media (max-width: 680px) {
  .first-launch-note {
    grid-template-columns: 1fr;
  }
}

/* Secondary Launch Options (KPM & KUAL) */
.alt-methods {
  margin-bottom: var(--space-7);
}

.alt-methods__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.alt-methods__head h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  margin-bottom: 0.25rem;
}

.alt-methods__head p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  max-width: 54ch;
}

.alt-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.35rem, 3vw, 2rem);
  box-shadow: var(--shadow-xs);
  animation: fadeUp var(--dur-base) var(--ease-out);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Without JS there are no tabs: show KPM and KUAL one after the other */
.no-js .alt-panel[hidden] {
  display: block !important;
  margin-top: var(--space-4);
}

.alt-panel__when {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
}

.alt-panel h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-2);
}

.alt-panel > p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  margin-bottom: var(--space-4);
  max-width: 64ch;
}

.alt-steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* long commands scroll inside their row */
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.alt-steps strong {
  color: var(--ink);
}

/* Copyable Command Line */
.cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding: 0.55rem 0.7rem 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.cmd-row code {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  background: transparent;
  border: 0;
  padding: 0;
  white-space: nowrap;
  font-size: 0.82rem;
}

.copy-btn {
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background-color var(--dur-fast);
}

.copy-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.copy-btn.is-copied {
  background: var(--status-done-bg);
  color: var(--status-done);
  border-color: var(--status-done-border);
}

/* The checkmark takes the label's place, so the button keeps its size */
.copy-btn > * {
  grid-area: 1 / 1;
}

.copy-btn__label {
  transition: opacity var(--dur-fast);
}

.copy-btn.is-copied .copy-btn__label {
  opacity: 0;
}

/* Supported Kindles */
.devices-section {
  scroll-margin-top: calc(var(--nav-height) + var(--space-5));
  margin-bottom: var(--space-7);
}

.devices-section__head {
  margin-bottom: var(--space-4);
}

.devices-section__head h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  margin-bottom: 0.25rem;
}

.devices-section__head p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  max-width: 72ch;
}

.device-tiers {
  display: grid;
  gap: var(--space-4);
}

.device-tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.35rem, 3vw, 1.85rem);
  box-shadow: var(--shadow-xs);
}

.device-tier--supported {
  border-color: var(--status-done-border);
}

.device-tier--coming {
  border-color: var(--status-next-border);
}

.device-tier--excluded {
  background: var(--bg-subtle);
  box-shadow: none;
  padding: var(--space-5);
}

.device-tier--excluded h3 {
  font-size: 1.02rem;
  margin-bottom: var(--space-2);
}

.device-tier--excluded p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.device-tier--excluded strong {
  color: var(--ink);
  font-weight: 600;
}

.device-tier__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: var(--space-2);
}

.device-tier__req {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.device-tier__lead {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  margin-bottom: var(--space-4);
  max-width: 72ch;
}

.device-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

@media (max-width: 780px) {
  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
}

.device-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.62rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.device-item__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.device-item__year {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  white-space: nowrap;
}

.device-tier__report {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.device-tier__report p {
  flex: 1 1 36ch;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.device-tier__report strong {
  color: var(--ink);
}

.device-tier__report .btn-secondary {
  flex: none;
}

.device-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.device-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
}

.device-pill__name {
  font-weight: 500;
  color: var(--ink);
}

.device-pill__year {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* Update & Uninstall Duo */
.lifecycle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 720px) {
  .lifecycle-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-2);
}

.info-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.info-card p + p {
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   3. USER GUIDE PAGE
   -------------------------------------------------------------------------- */
.reading-progress {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 100%;
  height: 2.5px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 88;
  pointer-events: none;
}

.guide-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.75rem);
  align-items: start;
  padding-bottom: var(--space-7);
}

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }
}

.guide-toc {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.guide-toc__title {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
  padding-inline: 0.5rem;
}

/* Glides to the current entry and replaces its own background (see initGuide) */
.guide-toc__marker {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius-xs);
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  pointer-events: none;
  transition: transform var(--dur-base) var(--ease-out), width var(--dur-base) var(--ease-out), height var(--dur-base) var(--ease-out);
}

.guide-toc__list {
  position: relative; /* above the marker */
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.guide-toc__link {
  display: block;
  text-decoration: none;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-xs);
  border-left: 2px solid transparent;
  transition: color var(--dur-fast), background-color var(--dur-fast), border-color var(--dur-fast);
}

.guide-toc__link:hover {
  color: var(--ink);
  background: var(--bg-subtle);
}

.guide-toc__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.guide-toc__marker ~ .guide-toc__list .guide-toc__link.is-active {
  background: none;
  border-left-color: transparent;
}

@media (max-width: 900px) {
  .guide-toc {
    position: relative;
    top: auto;
  }
  .guide-toc__list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.guide-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--shadow-xs);
  max-width: 78ch;
}

.guide-section {
  scroll-margin-top: calc(var(--nav-height) + 1.5rem);
}

.guide-section + .guide-section {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.guide-section h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  margin-bottom: var(--space-4);
}

/* Highlighter stroke on a heading that was jumped to: it sweeps in, line by
   line if the heading wraps, then fades (see initGuide) */
@property --stroke-strength {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

.jump-stroke {
  --stroke: color-mix(in srgb, var(--highlight-jump) calc(var(--stroke-strength) * 100%), transparent);
  padding-inline: 0.2em;
  margin-inline: -0.2em;
  border-radius: 0.14em 0.07em 0.12em 0.06em;
  background: linear-gradient(var(--stroke), var(--stroke)) 0 60% / 100% 88% no-repeat;
  /* Each line of a wrapped heading gets its own ends */
  box-decoration-break: clone;
  animation:
    jumpSweep var(--dur-slow) var(--ease-out) backwards,
    jumpFade 900ms ease-in-out 2600ms forwards;
}

@keyframes jumpSweep {
  from { background-size: 0 88%; }
}

@keyframes jumpFade {
  to { --stroke-strength: 0; }
}

.guide-section h3 {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 600;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.guide-section p {
  color: var(--ink-secondary);
  margin-bottom: var(--space-3);
}

.guide-section ul,
.guide-section ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.35rem;
  display: grid;
  gap: 0.55rem;
  color: var(--ink-secondary);
}

.guide-section li strong {
  color: var(--ink);
}

.guide-section code {
  overflow-wrap: anywhere; /* file paths wrap instead of widening the page on phones */
}

.guide-section ul ul {
  margin-top: 0.45rem;
  margin-bottom: 0.2rem;
}

/* --------------------------------------------------------------------------
   4. UNIFIED ROADMAP PAGE
   -------------------------------------------------------------------------- */
.no-js .roadmap-controls {
  display: none; /* the filter needs JS; all stages show */
}

.roadmap-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 360px) {
  .roadmap-controls .segmented__btn {
    padding-inline: 0.7rem; /* all four filters fit between the page margins */
  }
}

/* Unified Vertical Timeline Spine */
.roadmap-track {
  --track-indent: clamp(2rem, 4.5vw, 3.2rem);
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-6);
  padding-left: var(--track-indent);
}

/* Spine colors from top to bottom, registered so that they can blend */
@property --spine-1 {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

@property --spine-2 {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

@property --spine-3 {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

.roadmap-track::before {
  --spine-1: var(--status-done);
  --spine-2: var(--status-next);
  --spine-3: var(--status-future);
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 11px;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--spine-1) 0%,
    var(--spine-1) 38%,
    var(--spine-2) 54%,
    var(--spine-3) 84%,
    var(--border) 100%
  );
  border-radius: 2px;
  transition: --spine-1 var(--dur-base), --spine-2 var(--dur-base), --spine-3 var(--dur-base);
}

/* A single stage has a spine of its own color */
.roadmap-track[data-showing="done"]::before {
  --spine-2: var(--status-done);
  --spine-3: var(--status-done);
}

.roadmap-track[data-showing="next"]::before {
  --spine-1: var(--status-next);
  --spine-3: var(--status-next);
}

.roadmap-track[data-showing="future"]::before {
  --spine-1: var(--status-future);
  --spine-2: var(--status-future);
}

.roadmap-stage {
  position: relative;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.roadmap-stage.is-dimmed {
  display: none;
}

/* Filtering: the track changes height while stages slide, and a stage that was
   filtered out fades where it stood (see initRoadmapFilter) */
.roadmap-track.is-sliding {
  overflow: clip;
  overflow-clip-margin: 24px; /* the distance stages travel while fading */
}

.roadmap-stage.is-leaving {
  display: block;
  position: absolute;
  left: var(--track-indent);
  right: 0;
  pointer-events: none;
}

.stage-node {
  position: absolute;
  left: calc(3px - var(--track-indent));
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--node-color);
  background: var(--bg);
}

.stage-node::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--node-color);
}

.roadmap-stage--done { --node-color: var(--status-done); }
.roadmap-stage--next { --node-color: var(--status-next); }
.roadmap-stage--future { --node-color: var(--status-future); }

.roadmap-stage--future .stage-node::before {
  content: none;
}

.roadmap-stage--next .stage-node::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--status-next);
  opacity: 0;
  animation: nodePulse 2.4s ease-out 300ms 3;
}

/* Don't pulse again when a filter brings the stage back */
.stage-node.is-pulsed::after {
  animation: none;
}

@keyframes nodePulse {
  0% { transform: scale(0.85); opacity: 0.65; }
  80% { transform: scale(1.65); opacity: 0; }
  100% { transform: scale(1.65); opacity: 0; }
}

/* The spine draws itself down once as the page opens, and each node lights up
   when the line reaches it (see initRoadmapSpine) */
@media (prefers-reduced-motion: no-preference) {
  html:not(.no-js) .roadmap-track:not(.is-drawn)::before {
    clip-path: inset(0 0 calc(100% - var(--drawn, 0%)) 0);
  }

  .stage-node {
    transition: box-shadow var(--dur-base);
  }

  .stage-node::before {
    transition: transform var(--dur-base) var(--ease-spring);
  }

  html:not(.no-js) .roadmap-track:not(.is-drawn) .stage-node:not(.is-reached) {
    box-shadow: 0 0 0 2px var(--border-strong);
  }

  html:not(.no-js) .roadmap-track:not(.is-drawn) .stage-node:not(.is-reached)::before {
    transform: scale(0);
  }

  html:not(.no-js) .roadmap-track:not(.is-drawn) .stage-node:not(.is-reached)::after {
    animation: none;
  }

  /* The line can be ahead of the page: save the pulse until it can be seen */
  html:not(.no-js) .roadmap-stage:not(.is-visible) .stage-node::after {
    animation: none;
  }
}

.stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: var(--space-4);
}

.stage-head h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.65rem);
}

.stage-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.18rem 0.62rem;
  border-radius: var(--radius-pill);
}

.stage-tag--done {
  background: var(--status-done-bg);
  color: var(--status-done);
  border: 1px solid var(--status-done-border);
}

.stage-tag--next {
  background: var(--status-next-bg);
  color: var(--status-next);
  border: 1px solid var(--status-next-border);
}

.stage-tag--future {
  background: var(--status-future-bg);
  color: var(--status-future);
  border: 1px solid var(--status-future-border);
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 880px) {
  .stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .stage-grid {
    grid-template-columns: 1fr;
  }
}

.milestone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring), border-color var(--dur-fast), box-shadow var(--dur-base) var(--ease-out);
}

.milestone-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.milestone-card--next {
  border-color: var(--status-next-border);
}

.milestone-card--future {
  border-style: dashed;
}

.milestone-card h3 {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.milestone-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.52;
}

.milestone-card a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Out of Scope */
.roadmap-foot {
  margin-top: var(--space-7);
}

.roadmap-foot-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.roadmap-foot-card h3 {
  font-size: 1.08rem;
  margin-bottom: var(--space-2);
}

.roadmap-foot-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}
