/* FrontDesk main landing intro: a 15-second build at the top of / (site plan §3.2.0).
   The logo builds itself, three app screens slide in, a clock runs from 9 AM to 2:47 AM and
   the tagline lands. The default styles below are the final frame: that is what visitors see
   without JavaScript or with prefers-reduced-motion. /assets/intro.js adds .is-armed (every
   animation attached and held at 0 s) and .is-running (the clock moves). No libraries.
   Colors are raw palette tokens: the stage is always Ink, in light and dark mode. */

.intro {
  position: relative;
  padding: var(--space-8) 0 var(--space-4);
  background: var(--neutral-900);
  color: var(--white);
  overflow: hidden;
}
@media (min-width: 960px) { .intro { padding: var(--space-12) 0 var(--space-6); } }

/* ── Stage layout ── */
.intro__stage {
  position: relative; /* offsetParent for the logo measurement in intro.js */
  display: grid;
  grid-template-areas: "logo" "phones" "count" "tagline";
  gap: var(--space-6);
}
@media (min-width: 960px) {
  .intro__stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "logo phones" "count phones" "tagline phones";
    gap: var(--space-8) var(--space-12);
  }
}

/* ── Logo (inline copy of logo-dark.svg, split into mark and wordmark) ── */
.intro__logo {
  --logo-h: 2rem;
  grid-area: logo;
  justify-self: start;
  display: flex; align-items: center;
  gap: calc(var(--logo-h) * 18 / 64);
  height: var(--logo-h);
  transform-origin: 0 0;
}
@media (min-width: 960px) { .intro__logo { --logo-h: 2.5rem; } }
.intro__mark { width: var(--logo-h); height: var(--logo-h); flex: none; }
.intro__wordmark { width: calc(var(--logo-h) * 279 / 64); height: var(--logo-h); flex: none; }
.intro__mark-tile { transform-box: fill-box; transform-origin: 50% 100%; }
/* The bubble grows out of its tail, at 17 % / 100 % of its box. */
.intro__mark-bubble { transform-box: fill-box; transform-origin: 17% 100%; }
.intro__mark-counter { transform-box: fill-box; transform-origin: center; }

/* ── Phones (fictional businesses, same names as the rest of the page) ── */
.intro__phones {
  grid-area: phones;
  display: flex; justify-content: center; align-items: flex-start;
  gap: clamp(0.75rem, 2vw, 1rem);
}
@media (min-width: 960px) { .intro__phones { align-self: center; justify-self: end; width: 100%; max-width: 40rem; } }
.intro__phone {
  container-type: inline-size;
  flex: 1 1 0;
  min-width: 0;
  max-width: 12.5rem;
}
.intro__phone--1, .intro__phone--3 { margin-top: var(--space-6); }
.intro__device {
  aspect-ratio: 9 / 19;
  padding: 2.6cqw;
  border-radius: 14cqw;
  background: var(--neutral-800);
  box-shadow: 0 0 0 1px var(--neutral-700), 0 24px 48px rgba(0, 0, 0, 0.35);
}
.intro__screen {
  display: flex; flex-direction: column; gap: 0.6em;
  height: 100%;
  padding: 0 0.85em 1em;
  overflow: hidden;
  border-radius: 11.5cqw;
  background: var(--white);
  color: var(--neutral-900);
  font-family: var(--font-body);
  font-size: 10px;
  font-size: 5.4cqw;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.intro__screen b { font-weight: var(--weight-semibold); }
.intro__status {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9em 0.3em 0.2em;
  font-size: 0.85em; font-weight: var(--weight-semibold);
}
.intro__battery {
  width: 2em; height: 0.95em;
  border: 0.14em solid currentColor; border-radius: 0.3em;
  background: linear-gradient(90deg, currentColor 70%, transparent 70%) content-box;
  padding: 0.1em;
}
.intro__appbar-title { font-family: var(--font-display); font-size: 1.45em; font-weight: var(--weight-extrabold); line-height: 1.15; }
.intro__appbar-sub { color: var(--neutral-600); font-size: 0.9em; }

/* Screen 1: call with transcript */
.intro__caller {
  display: flex; align-items: center; gap: 0.6em;
  padding: 0.5em 0;
  border-block: 1px solid var(--neutral-200);
}
.intro__avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.3em; height: 2.3em;
  border-radius: 50%;
  background: var(--primary-50); color: var(--primary-700);
  font-size: 0.85em; font-weight: var(--weight-bold);
}
.intro__caller-text { display: grid; }
.intro__caller-text span { color: var(--neutral-600); font-size: 0.9em; }
.intro__bubble {
  max-width: 88%;
  padding: 0.55em 0.75em;
  border-radius: 1em;
  overflow-wrap: anywhere;
}
.intro__bubble--ai { align-self: flex-start; background: var(--primary-50); border-bottom-left-radius: 0.3em; }
.intro__bubble--caller { align-self: flex-end; background: var(--neutral-100); border-bottom-right-radius: 0.3em; }
.intro__chip {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.35em 0.8em;
  border-radius: var(--radius-pill);
  background: var(--success-50); color: var(--success-700);
  font-size: 0.9em; font-weight: var(--weight-bold);
}

/* Screen 2: calendar with the new booking */
.intro__day { margin-top: 0.2em; color: var(--neutral-600); font-size: 0.9em; font-weight: var(--weight-semibold); }
.intro__agenda { list-style: none; display: grid; gap: 0.5em; }
.intro__agenda li { display: grid; grid-template-columns: 2.6em minmax(0, 1fr); gap: 0.5em; align-items: start; }
.intro__time { padding-top: 0.45em; color: var(--neutral-600); font-size: 0.85em; }
.intro__appt {
  display: grid;
  padding: 0.45em 0.6em;
  border-left: 0.25em solid var(--neutral-300);
  border-radius: 0.5em;
  background: var(--neutral-100);
}
.intro__appt span { color: var(--neutral-600); }
.intro__appt--new {
  border-left-color: var(--primary-600);
  background: var(--primary-50);
  transform-origin: 0 50%;
}
.intro__appt .intro__booked { margin-top: 0.15em; color: var(--primary-700); font-size: 0.85em; font-weight: var(--weight-semibold); }

/* Screen 3: lock screen with push notifications */
.intro__screen--lock { background: var(--primary-700); color: var(--white); }
.intro__clock {
  margin-top: 0.5em;
  font-family: var(--font-display); font-size: 4.2em; font-weight: var(--weight-extrabold);
  line-height: 1; letter-spacing: var(--tracking-display); text-align: center;
}
.intro__date { margin-bottom: 0.6em; font-size: 0.95em; font-weight: var(--weight-medium); text-align: center; }
.intro__pushes { display: grid; gap: 0.5em; }
.intro__push {
  display: flex; align-items: flex-start; gap: 0.5em;
  padding: 0.55em 0.65em;
  border-radius: 0.9em;
  background: var(--white); color: var(--neutral-900);
  box-shadow: 0 0.3em 0.9em rgba(15, 27, 46, 0.25);
}
.mk .intro__push img { width: 1.9em; height: 1.9em; flex: none; border-radius: 0.45em; }
.intro__push-text { display: grid; min-width: 0; }
.intro__push-text span { color: var(--neutral-600); font-size: 0.9em; }
.intro__push-text .intro__push-app { font-size: 0.8em; }

/* ── Clock: a call at any hour (the 24/7 promise, not a usage metric) ── */
.intro__count { grid-area: count; align-self: center; }
.intro__count-line {
  display: grid; justify-items: start; row-gap: var(--space-2);
  font-family: var(--font-display); font-weight: var(--weight-extrabold);
  line-height: 1; letter-spacing: var(--tracking-display);
}
.intro__count-label { color: var(--neutral-300); font-size: var(--text-2xl); }
.intro__count-num {
  display: flex; align-items: baseline; gap: 0.15em;
  color: var(--white); font-size: clamp(3.25rem, 7vw, 6rem);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.intro__count-ampm { font-size: 0.42em; letter-spacing: 0; }
.intro__count-note { margin-top: var(--space-3); color: var(--neutral-300); font-size: var(--text-lg); max-width: 32ch; }

/* ── Tagline: "Answers the phone." in white, "Books the work." in the wordmark's Desk blue ── */
.intro__tagline {
  grid-area: tagline;
  font-family: var(--font-display); font-weight: var(--weight-extrabold);
  font-size: clamp(1.75rem, 3.8vw, 3rem);
  line-height: 1.1; letter-spacing: var(--tracking-display);
}
.intro__line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.intro__line > span { display: block; }
.intro__line--2 { color: var(--primary-300); }

/* ── Controls: progress and Pause / Play / Replay (WCAG 2.2.2), shown by intro.js ── */
.intro__controls { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-6); }
.intro__controls[hidden] { display: none; }
.intro__progress { flex: 1; height: 2px; overflow: hidden; border-radius: 1px; background: var(--neutral-700); }
.intro__progress-bar { display: block; height: 100%; background: var(--primary-300); transform-origin: 0 50%; }
.mk .intro__toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--neutral-300); border-radius: 50%;
  background: transparent; color: var(--white);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.mk .intro__toggle:hover { background: var(--neutral-800); }
.mk .intro :focus-visible { outline-color: var(--primary-300); }

/* ── Timeline: one row per element, delays in ms from the start of the 15 s intro.
   intro.js reads the clock from .intro__progress-bar and runs the time 8200–11200 ms; keep in step. ── */
.intro.is-armed { --intro-play: paused; }
.intro.is-armed.is-running { --intro-play: running; }

/* 0–3.7 s: the counter bar, the tile rising from it, the bubble, the check, the wordmark;
   then the lockup moves from the center of the stage to its place. */
.intro.is-armed .intro__mark-counter { animation: intro-grow-x 600ms var(--ease-standard) 0ms both var(--intro-play); }
.intro.is-armed .intro__mark-tile { animation: intro-rise 700ms var(--ease-standard) 400ms both var(--intro-play); }
.intro.is-armed .intro__mark-bubble { animation: intro-grow 600ms var(--ease-standard) 900ms both var(--intro-play); }
.intro.is-armed .intro__mark-check { stroke-dasharray: 1 1.2; animation: intro-draw 500ms var(--ease-standard) 1400ms both var(--intro-play); }
.intro.is-armed .intro__wordmark { animation: intro-wipe 800ms var(--ease-standard) 1900ms both var(--intro-play); }
.intro.is-armed .intro__logo { animation: intro-logo 700ms var(--ease-standard) 3000ms both var(--intro-play); }

/* 3.6–7.3 s: the three screens slide in, then their content arrives. */
.intro.is-armed .intro__phone--1 { animation: intro-slide 800ms var(--ease-standard) 3600ms both var(--intro-play); }
.intro.is-armed .intro__phone--2 { animation: intro-slide 800ms var(--ease-standard) 4300ms both var(--intro-play); }
.intro.is-armed .intro__phone--3 { animation: intro-slide 800ms var(--ease-standard) 5000ms both var(--intro-play); }
.intro.is-armed .intro__bubble:nth-of-type(1) { animation: intro-in 400ms var(--ease-standard) 4400ms both var(--intro-play); }
.intro.is-armed .intro__bubble:nth-of-type(2) { animation: intro-in 400ms var(--ease-standard) 4900ms both var(--intro-play); }
.intro.is-armed .intro__bubble:nth-of-type(3) { animation: intro-in 400ms var(--ease-standard) 5400ms both var(--intro-play); }
.intro.is-armed .intro__chip { animation: intro-in 400ms var(--ease-standard) 5900ms both var(--intro-play); }
.intro.is-armed .intro__appt--new { animation: intro-book 500ms var(--ease-standard) 5300ms both var(--intro-play); }
.intro.is-armed .intro__booked { animation: intro-in 400ms var(--ease-standard) 5800ms both var(--intro-play); }
.intro.is-armed .intro__push:nth-child(1) { animation: intro-drop 450ms var(--ease-standard) 6000ms both var(--intro-play); }
.intro.is-armed .intro__push:nth-child(2) { animation: intro-drop 450ms var(--ease-standard) 6400ms both var(--intro-play); }
.intro.is-armed .intro__push:nth-child(3) { animation: intro-drop 450ms var(--ease-standard) 6800ms both var(--intro-play); }

/* 7.8–11.5 s: the clock appears and runs from 9 AM to 2:47 AM (intro.js), then its note. */
.intro.is-armed .intro__count-line { animation: intro-lift 600ms var(--ease-standard) 7800ms both var(--intro-play); }
.intro.is-armed .intro__count-note { animation: intro-lift 500ms var(--ease-standard) 11000ms both var(--intro-play); }

/* 11.9–13.1 s: the tagline lands; the frame holds until 15 s. */
.intro.is-armed .intro__line--1 > span { animation: intro-mask 700ms var(--ease-standard) 11900ms both var(--intro-play); }
.intro.is-armed .intro__line--2 > span { animation: intro-mask 700ms var(--ease-standard) 12400ms both var(--intro-play); }

.intro.is-armed .intro__progress-bar { animation: intro-progress 15000ms linear 0ms both var(--intro-play); }

@keyframes intro-grow-x { from { transform: scaleX(0); } }
@keyframes intro-rise { from { opacity: 0; transform: scale(0.55); } }
@keyframes intro-grow { from { opacity: 0; transform: scale(0.2); } }
@keyframes intro-draw { from { stroke-dashoffset: 1.1; } to { stroke-dashoffset: 0; } }
@keyframes intro-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes intro-logo { from { transform: translate(var(--logo-dx, 0px), var(--logo-dy, 0px)) scale(var(--logo-s, 1)); } }
@keyframes intro-slide { from { opacity: 0; transform: translateX(min(50vw, 40rem)); } 40% { opacity: 1; } }
@keyframes intro-in { from { opacity: 0; transform: translateY(0.75em); } }
@keyframes intro-book { from { opacity: 0; transform: scale(0.9); } }
@keyframes intro-drop { from { opacity: 0; transform: translateY(-1.25em); } }
@keyframes intro-lift { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes intro-mask { from { transform: translateY(105%); } }
@keyframes intro-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* intro.js does not arm the timeline under reduced motion; this covers a change mid-play. */
@media (prefers-reduced-motion: reduce) {
  .intro.is-armed * { animation: none !important; }
}
