/*
 * The Home Screen guide is a flat sheet. Header and actions stay within reach
 * when a short viewport or large text needs a scrollable instruction area.
 */
html:has(.ia-sheet[open]) { overflow: hidden; }
.ia-sheet {
  --ia-top: max(12px, env(safe-area-inset-top, 0px));
  --ia-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  --ia-left: max(8px, env(safe-area-inset-left, 0px));
  --ia-right: max(8px, env(safe-area-inset-right, 0px));
  position: fixed;
  inset: auto var(--ia-right) var(--ia-bottom) var(--ia-left);
  z-index: 200;
  box-sizing: border-box;
  width: min(420px, calc(100% - var(--ia-left) - var(--ia-right)));
  max-width: none;
  max-height: calc(100vh - var(--ia-top) - var(--ia-bottom));
  max-height: calc(100dvh - var(--ia-top) - var(--ia-bottom));
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line, #e2e8e4);
  border-radius: 24px;
  background: var(--paper, #fff);
  color: var(--ink, #10231a);
  font-family: var(--sans, Manrope, system-ui, sans-serif);
}
.ia-sheet[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ia-sheet::backdrop { background: rgb(16 35 26 / .44); }
@media (min-width: 700px) {
  .ia-sheet { inset: 0; margin: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .ia-sheet[open] { animation: ia-up 180ms cubic-bezier(.22, .8, .3, 1); }
}
@keyframes ia-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.ia-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line, #e2e8e4);
  background: var(--mint, #e8f8ef);
}
.ia-heading img { display: block; width: 44px; height: 44px; border-radius: 10px; }
.ia-heading h2 {
  margin: 0;
  color: var(--green-ink, #064e2a);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.ia-sheet .ia-x {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--paper, #fff);
  color: var(--green-ink, #064e2a);
}
.ia-x .ia-glyph { width: 18px; height: 18px; }
.ia-x:focus-visible, .ia-primary:focus-visible, .ia-later:focus-visible, .install-offer button:focus-visible {
  outline: 2px solid var(--green-ink, #064e2a);
  outline-offset: 2px;
}

.ia-body {
  min-block-size: 0;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}
.ia-body:focus-visible { outline: 2px solid var(--green-ink, #064e2a); outline-offset: -3px; }
.ia-why { margin: 0; color: var(--ink-2, #45584e); font-size: 15px; line-height: 1.5; }
.ia-steps {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line, #e2e8e4);
  border-radius: 10px;
  list-style: none;
}
.ia-steps > li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
}
.ia-steps > li + li { border-top: 1px solid var(--line, #e2e8e4); }
.ia-step-icon {
  display: grid;
  box-sizing: border-box;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line, #e2e8e4);
  border-radius: 10px;
  background: var(--mint, #e8f8ef);
  color: var(--green-ink, #064e2a);
}
.ia-glyph {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ia-steps strong { display: block; color: var(--ink, #10231a); font-size: 15px; font-weight: 800; line-height: 1.3; }
.ia-steps li > div > span { display: block; margin-top: 2px; color: var(--ink-2, #45584e); font-size: 14px; line-height: 1.35; }
.ia-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  color: var(--ink-2, #45584e);
  font-size: 13px;
  line-height: 1.4;
}
.ia-note .ia-glyph { flex: none; width: 18px; height: 18px; color: var(--green-ink, #064e2a); }

.ia-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line, #e2e8e4);
  background: var(--paper, #fff);
}
.ia-sheet .ia-primary, .install-offer .ia-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--green-button, #0e8644);
  color: #fff;
  font: 800 16px/1.2 var(--sans, Manrope, system-ui, sans-serif);
  text-decoration: none;
}
.ia-sheet .ia-primary { flex: 1 1 150px; }
.ia-sheet .ia-primary:active, .install-offer .ia-primary:active { background: var(--green-button-edge, #08592c); }
.ia-sheet .ia-later, .install-offer .install-offer-later {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line, #e2e8e4);
  border-radius: 10px;
  background: var(--paper, #fff);
  color: var(--ink-2, #45584e);
  font: 700 14px/1.2 var(--sans, Manrope, system-ui, sans-serif);
  text-decoration: none;
}
@media (hover: hover) {
  .ia-sheet :is(.ia-x, .ia-later):hover, .install-offer .install-offer-later:hover { background: var(--mint, #e8f8ef); }
  .ia-sheet .ia-primary:hover, .install-offer .ia-primary:hover { background: var(--green-strong, #0b7a3b); }
}

@media (max-width: 359px) {
  .ia-heading { grid-template-columns: 32px minmax(0, 1fr) 44px; gap: 8px; }
  .ia-heading img { width: 32px; height: 32px; }
  .ia-heading h2 { font-size: 18px; }
  .ia-steps > li { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
  .ia-step-icon { width: 36px; height: 36px; }
}

@media (max-height: 600px) {
  .ia-sheet { border-radius: 18px; }
  .ia-heading { padding: 6px 12px; }
  .ia-body { padding: 8px 12px; }
  .ia-steps > li { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; padding: 6px 8px; }
  .ia-step-icon { width: 32px; height: 32px; }
  .ia-steps li > div > span { margin-top: 1px; font-size: 13px; }
  .ia-note { margin-top: 6px; font-size: 12px; }
  .ia-note .ia-glyph { width: 16px; height: 16px; }
  .ia-actions { padding: 6px 12px 8px; }
}

/* The offer at the end of lesson 1 uses the same controls as the guide. */
.install-offer {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line, #e2e8e4);
  border-radius: 14px;
  background: var(--paper, #fff);
  color: var(--ink, #10231a);
  text-align: left;
}
.install-offer img { grid-row: span 2; width: 42px; height: 42px; border-radius: 10px; }
.install-offer h2 { margin: 0; color: var(--ink, #10231a); font-size: 18px; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.install-offer p { margin: 0; color: var(--ink-2, #45584e); font-size: 14px; line-height: 1.4; }
.install-offer-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.install-offer .ia-primary { width: auto; flex: 1 1 160px; margin: 0; }
