/* ===========================================================================
   PHASE 7.7 -- ONBOARDING, INSTALLATION AND SETUP & HELP.

   Loaded LAST, after phase76.css, for the same reason each of these is loaded
   after the previous one: the wizard restyles `.sheet__panel` from phase7.css,
   and overriding it from a later stylesheet is ordinary specificity rather
   than `!important`.

   ---------------------------------------------------------------------------
   NO INLINE STYLES. THE POLICY IS `style-src 'self'`
   ---------------------------------------------------------------------------
   `element.style.*` is blocked, and blocked SILENTLY -- the layout simply
   never applies. Phase 7 shipped a release where every progress bar rendered
   empty because of it. Everything the wizard needs to vary is therefore a
   class: the progress dots are `.ob-dot--now` / `.ob-dot--done`, and the
   install illustration is an inline SVG whose parts are classed rather than
   painted with attributes.

   ---------------------------------------------------------------------------
   PHONE FIRST, AND THE 44px RULE (Part Y)
   ---------------------------------------------------------------------------
   Every control in the wizard carries `.ob-tap`, which sets
   `min-height: var(--tap)` -- 48px, comfortably over the 44px the
   specification asks for. The actions row WRAPS rather than shrinking its
   buttons, because the alternative on a 320px screen is three 30px-tall
   buttons nobody can hit.

   ---------------------------------------------------------------------------
   NO STATE IS CARRIED BY COLOUR ALONE (Part Y)
   ---------------------------------------------------------------------------
   Every status in this phase is a WORD first: "Granted", "Yes", "Not from
   here", "Notifications are blocked". The colours below reinforce those words
   and never replace them, and the progress dots are backed by a live text
   sentence ("Step 3 of 6: Notifications") rather than being the only
   indication of where somebody is.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   THE WIZARD PANEL
   --------------------------------------------------------------------------- */

/*
 * Full bleed on a phone, a tall card on anything bigger.
 *
 * A six-step wizard is the whole screen on the device it is designed for --
 * a card floating in a backdrop wastes the height the install instructions
 * need. On a desktop it becomes a bounded column, because a full-screen
 * takeover on a 27-inch monitor reads as an error page.
 */
.sheet__panel--onboarding {
  max-width: none;
  width: 100%;
  min-height: 100%;
  margin: 0;
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(180deg, var(--bg-elev-2) 0%, var(--bg-elev) 55%, var(--bg) 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/*
 * `openDialog` renders its own `<h3 class="sheet__title">` for
 * `aria-labelledby`, and the wizard paints its own heading per step. Hiding
 * the dialog title VISUALLY while leaving it in the accessibility tree is what
 * keeps the dialog labelled without showing two headings -- the same technique
 * the pole takeover uses.
 */
.sheet__panel--onboarding .sheet__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .sheet__panel--onboarding {
    max-width: 34rem;
    min-height: 0;
    margin: 2rem auto;
    border: 1px solid var(--line);
    border-radius: 14px;
  }
}

/* ---------------------------------------------------------------------------
   PROGRESS
   --------------------------------------------------------------------------- */

.ob-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.25rem 0 0.75rem;
}

.ob-progress__dots {
  display: flex;
  gap: 0.35rem;
}

.ob-dot {
  flex: 1 1 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

/* Done and current are distinguished by WIDTH-independent means: the current
   step is brighter and taller, so the row is readable without colour vision. */
.ob-dot--done { background: var(--accent-dim); }
.ob-dot--now {
  background: var(--accent);
  height: 6px;
  margin-top: -1px;
}

.ob-progress__text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #8aa8a1);
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   TEXT
   --------------------------------------------------------------------------- */

.ob-heading {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.25;
}
/* Focused on every step change for announcement; never show a focus ring on a
   heading nobody clicked. The ring stays for keyboard users on real controls. */
.ob-heading:focus { outline: none; }

.ob-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ob-lead { margin: 0; font-size: 1rem; line-height: 1.45; }
.ob-text { margin: 0; line-height: 1.5; }
.ob-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted, #8aa8a1);
}

.ob-list,
.ob-steps {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  line-height: 1.45;
}
.ob-steps { padding-left: 1.6rem; }
.ob-steps li { padding-left: 0.15rem; }

.ob-note {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elev));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------------------
   STATUS LINES -- word first, colour second
   --------------------------------------------------------------------------- */

.ob-status {
  margin: 0;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.ob-status--ok    { color: var(--accent); }
.ob-status--warn  { color: var(--warn); }
.ob-status--muted { color: var(--muted, #8aa8a1); }

/* ---------------------------------------------------------------------------
   THE FACT LIST -- "is this phone set up?"
   --------------------------------------------------------------------------- */

.ob-facts {
  margin: 0;
  display: grid;
  /* `auto` then `max-content` so a long label wraps and the value stays put. */
  grid-template-columns: 1fr max-content;
  gap: 0.45rem 0.75rem;
  align-items: baseline;
}
.ob-facts dt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #8aa8a1);
}
.ob-facts dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}
.ob-fact--ok  { color: var(--accent); }
.ob-fact--off { color: var(--muted, #8aa8a1); }

/*
 * A hint appended INSIDE the definition list (Part K's "a tab cannot see a
 * Home Screen copy") has to span both columns or it would be squeezed into the
 * value column.
 */
.ob-facts .ob-hint { grid-column: 1 / -1; }

/* ---------------------------------------------------------------------------
   THE INSTALL ILLUSTRATION
   --------------------------------------------------------------------------- */

.ob-illus {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

.ob-illus__svg {
  width: 100%;
  max-width: 190px;
  height: auto;
}

/* Drawn with classes, not attributes, because `style-src 'self'` and because a
   stylesheet is where a colour belongs. */
.ob-illus__phone {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 2;
}
.ob-illus__bar { fill: var(--line); }
.ob-illus__toolbar { fill: var(--bg-elev-2); }
.ob-illus__glyph {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ob-illus__ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  opacity: 0.8;
}

/*
 * The ring pulses, to draw the eye to the Share button. ONLY where motion is
 * welcome: `no-preference`, not a `reduce` override, so a device that has
 * never expressed a preference and a device that asked for less motion both
 * get the still version.
 */
@media (prefers-reduced-motion: no-preference) {
  .ob-illus__ring {
    animation: ob-pulse 2.4s ease-in-out infinite;
  }
  @keyframes ob-pulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.95; }
  }
}

/* ---------------------------------------------------------------------------
   HOW FESTIVUS WORKS -- the five cards
   --------------------------------------------------------------------------- */

.ob-cards {
  display: grid;
  gap: 0.6rem;
}

.ob-card {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
}

.ob-card__heading {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.ob-card__body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------------------
   THE PREFERENCE SWITCHES
   --------------------------------------------------------------------------- */

.ob-prefs {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/*
 * The whole ROW is the target, not just the checkbox.
 *
 * `min-height: var(--tap)` on the row and a `<label for>` covering the text
 * means the 48px target is the entire line -- which is the only way a
 * checkbox is comfortably hittable on a phone. Part Y's 44px rule applies to
 * switches as much as to buttons.
 */
.ob-pref {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--tap);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.ob-pref:last-child { border-bottom: 0; }

.ob-pref__input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.ob-pref__label {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  /* The label is the tap target for the checkbox, so it must look tappable. */
  cursor: pointer;
}

.ob-pref__name { font-weight: 600; }
.ob-pref__hint {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted, #8aa8a1);
}

/* ---------------------------------------------------------------------------
   ACTIONS
   --------------------------------------------------------------------------- */

.ob-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.9rem;
}

/*
 * Part Y: at least 44px. `--tap` is 48px.
 *
 * `flex: 1 1 auto` with `wrap` above means two buttons share a row and a third
 * drops to its own line at full width, rather than three buttons becoming too
 * narrow to read. On a 320px screen that is the difference between a usable
 * wizard and one somebody abandons.
 */
.ob-tap {
  min-height: var(--tap);
  flex: 1 1 auto;
  /* So an <a> styled as a button matches a <button>. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------------
   THE NARROWEST PHONES
   ---------------------------------------------------------------------------
   320px is the floor this project designs to. Below the breakpoint the action
   row stacks completely: at that width two buttons side by side put
   "ENABLE NOTIFICATIONS" on three lines.
   --------------------------------------------------------------------------- */

@media (max-width: 360px) {
  .ob-heading { font-size: 1.12rem; }
  .ob-actions { flex-direction: column; }
  .ob-tap { width: 100%; }
  .ob-facts { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .ob-facts dd { text-align: left; margin-bottom: 0.35rem; }
  .ob-illus__svg { max-width: 150px; }
}
