/* Welcome page. Tokens come from lib/theme.css; the bubble and annotated words
   come from content/popup.css, unchanged, so the demo matches a real page. */

/* ...with one exception. content/popup.css gives the bubble the maximum
   z-index, because on a host page it has to beat whatever that page stacks. On
   THIS page the only thing above it is our own tour overlay (lib/tour.css,
   z-index 9999), and the bubble outranking it put the callout for the
   Conjugate/Workbook/Save steps behind the very bubble those steps point into
   — arrow and all. Nothing on this page competes for the stack, so the bubble
   drops below the tour: the callout is legible, and the scrim dims the rest of
   the bubble around the one spotlit button. */
.fla-bubble {
  z-index: 9998;
}

body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.masthead {
  padding: var(--fla-xl) var(--fla-lg) var(--fla-lg);
  text-align: center;
  border-bottom: 1px solid var(--fla-line);
  background: var(--fla-card);
}

.masthead h1 {
  margin: 0;
  font-family: var(--fla-serif);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fla-heading);
}

.tagline {
  margin: var(--fla-xs) 0 0;
  font-family: var(--fla-serif);
  font-size: 17px;
  font-style: italic;
  color: var(--fla-ink-muted);
}

.stage {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--fla-xl) var(--fla-lg) var(--fla-xl);
}

.stage > section {
  margin-bottom: var(--fla-xl);
}

/* -----------------------------
   Drawn browser toolbar (step 2)
   ----------------------------- */

.toolbar-mock__bar {
  display: flex;
  align-items: center;
  gap: var(--fla-gutter);
  padding: var(--fla-sm) var(--fla-gutter);
  background: var(--fla-raised);
  border: 1px solid var(--fla-line);
  border-radius: var(--fla-r);
}

.toolbar-mock__dots {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.toolbar-mock__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fla-line-strong);
}

.toolbar-mock__omni {
  flex: 1;
  padding: 5px var(--fla-gutter);
  background: var(--fla-card);
  border: 1px solid var(--fla-line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fla-ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-mock__puzzle {
  flex: 0 0 auto;
  font-size: 15px;
  opacity: 0.75;
}

.toolbar-mock__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--fla-r-sm);
  background: var(--fla-card);
  border: 1px solid var(--fla-line);
}

.toolbar-mock__cap {
  margin: var(--fla-sm) 0 0;
  font-size: 13px;
  color: var(--fla-ink-muted);
}

/* -----------------------------
   Demo article
   ----------------------------- */

.demo__eyebrow,
.chapters__lede {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fla-ink-faint);
  margin: 0 0 var(--fla-sm);
}

.demo__article {
  position: relative;
  padding: var(--fla-lg);
  background: var(--fla-card);
  border: 1px solid var(--fla-line);
  border-radius: var(--fla-r);
  box-shadow: var(--fla-shadow-sm);
  font-family: var(--fla-serif);
  font-size: 19px;
  line-height: 1.75;
  color: var(--fla-ink);
}

/* The demo's words are clickable, unlike a real page where the whole document
   is. Only the hover cue differs — the classes and colours are the real ones. */
.demo__article .fla-word {
  pointer-events: auto;
  cursor: pointer;
  border-radius: 3px;
}

.demo__article .fla-word:hover {
  background: var(--fla-primary-tint);
}

.demo__hint {
  margin: var(--fla-sm) 0 0;
  font-size: 13px;
  color: var(--fla-ink-muted);
}

/* -----------------------------
   Actions
   ----------------------------- */

.cta__row {
  display: flex;
  gap: var(--fla-sm);
  align-items: center;
  flex-wrap: wrap;
}

/* Shown once the six steps are done — the workbook is the half of the product
   this page can't demonstrate, so say so rather than leaving the user on a
   finished tour with nowhere obvious to go. */
.cta__quiet {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--fla-ink-muted);
  font-family: var(--fla-sans);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--fla-r-sm);
}

.cta__quiet:hover {
  background: var(--fla-raised);
  color: var(--fla-ink);
}

.cta__quiet[hidden] {
  display: none;
}

.cta__primary,
.cta__secondary {
  padding: 10px 18px;
  border-radius: var(--fla-r-sm);
  font-family: var(--fla-sans);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.cta__primary {
  background: var(--fla-primary);
  border: 1px solid var(--fla-primary);
  color: var(--fla-on-primary);
  font-weight: 500;
}

.cta__primary:hover {
  background: var(--fla-primary-soft);
  border-color: var(--fla-primary-soft);
}

.cta__secondary {
  background: transparent;
  border: 1px solid var(--fla-line-strong);
  color: var(--fla-ink-muted);
}

.cta__secondary:hover {
  background: var(--fla-raised);
  color: var(--fla-ink);
}

.cta__secondary[hidden] {
  display: none;
}

/* The end-of-tutorial nudge (welcome.js#pulse) — a scrim was ruled out here
   (it would make isTourActive() true and stop the demo bubble dismissing on
   click), so this is what "make it pop" became instead: a ring that draws the
   eye to the thing itself rather than the screen owning it. Applied to any
   element, so it has to keep its own layout assumptions to a minimum. */
.pulse-ring {
  position: relative;
}

.pulse-ring::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--fla-accent);
  animation: fla-pulse-ring 1.6s ease-out infinite;
  pointer-events: none;
}

/* `inherit` picks up whatever the pulsed element itself has; the chapters
   section has no radius of its own, and a hard-cornered ring around a grid of
   rounded cards reads as a mistake. */
#chapters.pulse-ring {
  border-radius: var(--fla-r);
}

/* A full-width section scales visibly further than a button at the same
   factor, so the ring grows by a flat amount instead. */
#chapters.pulse-ring::after {
  animation-name: fla-pulse-ring-wide;
}

@keyframes fla-pulse-ring {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.15);
    opacity: 0;
  }
}

@keyframes fla-pulse-ring-wide {
  from {
    inset: -4px;
    opacity: 0.8;
  }
  to {
    inset: -14px;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-ring::after {
    animation: none;
    opacity: 0;
  }
}

/* -----------------------------
   Chapter menu
   ----------------------------- */

.chapters[hidden] {
  display: none;
}

.chapters h2 {
  margin: 0 0 var(--fla-xs);
  font-family: var(--fla-serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--fla-heading);
}

.chapters__lede {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: var(--fla-md);
}

.chapters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--fla-gutter);
}

.chapter {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 2px var(--fla-sm);
  padding: var(--fla-gutter);
  text-align: left;
  background: var(--fla-card);
  border: 1px solid var(--fla-line);
  border-radius: var(--fla-r);
  cursor: pointer;
  font-family: var(--fla-sans);
  transition: border-color 0.12s, background 0.12s;
}

.chapter:hover {
  border-color: var(--fla-ink-faint);
  background: var(--fla-sunken);
}

.chapter__icon {
  grid-row: 1 / 3;
  font-size: 20px;
  line-height: 1.2;
}

.chapter__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fla-heading);
}

.chapter__desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fla-ink-muted);
}

/* A chapter the user has already taken — dimmed rather than ticked. A tick
   adds a mark to read; receding is the same signal with nothing to read, and
   it leaves the unvisited tiles as the only bright things in the grid. */
.chapter[data-seen="1"] {
  background: var(--fla-sunken);
  border-color: var(--fla-line);
}

.chapter[data-seen="1"] .chapter__name {
  color: var(--fla-ink-muted);
}

.chapter[data-seen="1"] .chapter__desc {
  color: var(--fla-ink-faint);
}

.chapter[data-seen="1"] .chapter__icon {
  /* Greyed, not faded — opacity on top of a tinted surface is what the
     contrast guard exists to stop (see check-contrast.js). */
  filter: grayscale(1);
}

/* Still fully reachable: a taken chapter can be replayed, so hover restores it. */
.chapter[data-seen="1"]:hover {
  background: var(--fla-card);
  border-color: var(--fla-ink-faint);
}

.chapter[data-seen="1"]:hover .chapter__name {
  color: var(--fla-heading);
}

.chapter[data-seen="1"]:hover .chapter__icon {
  filter: none;
}

/* -----------------------------
   Footer
   ----------------------------- */

.foot {
  padding-top: var(--fla-lg);
  border-top: 1px solid var(--fla-line);
  font-size: 13px;
  line-height: 1.65;
  color: var(--fla-ink-muted);
}

.foot p {
  margin: 0 0 var(--fla-sm);
}

.foot__status:empty {
  display: none;
}

.foot__status {
  margin: 0;
  padding: var(--fla-sm) var(--fla-gutter);
  border-radius: var(--fla-r-sm);
  background: var(--fla-warn-tint);
  color: var(--fla-warn);
}

.foot__status[data-ok="1"] {
  background: var(--fla-accent-tint);
  color: var(--fla-accent);
}

.foot__colophon {
  margin: var(--fla-gutter) 0 0;
  padding-top: var(--fla-gutter);
  border-top: 1px solid var(--fla-line);
  font-size: 12px;
  color: var(--fla-ink-faint);
}

.foot__link {
  color: var(--fla-ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--fla-line-strong);
}

.foot__link:hover {
  color: var(--fla-ink);
  border-bottom-color: var(--fla-ink);
}
