/* The roof story after the sign-up (try/story.js). Uses the site's tokens from css/tokens.css. */
html.has-story { overflow: hidden; }
.story {
  --st-out: cubic-bezier(0.23, 1, 0.32, 1);
  --st-bar: 56px;
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; background: var(--paper); color: var(--ink); font-family: var(--sans); outline: none;
}
.st-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the bar: logo, the property, back to the site */
.st-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; height: var(--st-bar);
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: rgba(253, 253, 247, 0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.st-logo { width: auto; height: 24px; }
.st-bar-address { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.st-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--sand); color: var(--ink-2); cursor: pointer; }
.st-close svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
@media (hover: hover) and (pointer: fine) { .st-close:hover { color: var(--ink); background: #e6e0d3; } }
@media (pointer: coarse) { .st-close { width: 44px; height: 44px; } }

/* one visual in view, the sections scrolling beside it (desktop) or under it (phones). On phones the visual runs
   edge to edge under the bar and each section's text starts just below it. */
.st-grid { max-width: 1400px; margin: 0 auto; }
.st-visual-wrap { position: sticky; top: var(--st-bar); z-index: 4; height: 38dvh; background: var(--paper); }
.st-visual { position: relative; width: 100%; height: 100%; overflow: hidden; background: #2a2f2a; }
.st-sections { display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.st-section {
  display: flex; flex-direction: column; min-height: calc(62dvh - var(--st-bar));
  padding: 20px max(18px, env(safe-area-inset-right)) 36px max(18px, env(safe-area-inset-left));
  scroll-snap-align: start; scroll-margin-top: calc(38dvh + var(--st-bar));
}
.st-section-in { display: flex; flex-direction: column; gap: 18px; max-width: 520px; }
@media (min-width: 1024px) {
  .st-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; padding: 0 64px 0 32px; }
  .st-visual-wrap { top: calc(var(--st-bar) + 16px); height: calc(100dvh - var(--st-bar) - 32px); margin: 16px 0; }
  .st-visual { border: 1px solid var(--line); border-radius: 20px; }
  .st-section { justify-content: center; min-height: calc(100dvh - var(--st-bar)); padding: 64px 0; scroll-snap-align: center; scroll-margin-top: 0; }
}
/* a phone on its side: the visual beside the sections, as on desktop, in a slimmer bar */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) and (max-width: 1023px) {
  .story { --st-bar: 48px; }
  .st-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .st-visual-wrap { top: calc(var(--st-bar) + 10px); height: calc(100dvh - var(--st-bar) - 20px); margin: 10px 0; }
  .st-visual { border: 1px solid var(--line); border-radius: 20px; }
  .st-section { justify-content: center; min-height: calc(100dvh - var(--st-bar)); padding: 24px 0; scroll-snap-align: center; scroll-margin-top: 0; }
}

/* dots, desktop only */
.st-dots { display: none; }
@media (min-width: 1024px) {
  .st-dots { position: fixed; top: 50%; right: 16px; z-index: 6; display: flex; flex-direction: column; gap: 4px; transform: translateY(-50%); }
  .st-dots button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
  .st-dots span { width: 6px; height: 6px; border-radius: 99px; background: rgba(113, 113, 122, 0.4); transition: width 200ms, height 200ms, background-color 200ms; }
  .st-dots button[aria-current="step"] span { width: 10px; height: 10px; background: var(--brand); }
}

/* the photo and what each section draws on it */
.st-photo { position: absolute; inset: 0; overflow: hidden; }
.st-photo-frame { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.st-photo-img, .st-photo-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; }
.st-photo-svg { overflow: visible; }
.st-outside { fill: #000; opacity: 0.28; transition: opacity 500ms ease; }
.st-visual[data-active="edges"] .st-outside { opacity: 0.5; }
.st-tint { opacity: 0; transition: opacity 500ms ease; isolation: isolate; }
.st-photo.is-tinted .st-tint { opacity: 1; }
.st-tint-color { fill-opacity: 0.9; mix-blend-mode: multiply; transition: fill 350ms ease; }
.st-faces path { fill: none; stroke: #ffd23f; stroke-width: calc(var(--px, 1) * 1.5px); stroke-linejoin: round; opacity: 0; transition: opacity 500ms ease; }
.st-visual:is([data-active="model"], [data-active="features"], [data-active="project"]) .st-faces path { opacity: 0.9; }
.st-edges line { stroke-width: calc(var(--px, 1) * 3.5px); stroke-linecap: round; opacity: 0; transition: opacity 500ms ease; }
.st-visual[data-active="edges"] .st-edges line { opacity: 1; }

.st-visual > .st-chip { position: absolute; top: 12px; left: 12px; z-index: 2; transition: opacity 300ms; }
.st-visual[data-active="roof-report"] > .st-chip, .st-visual[data-active="project"] > .st-chip,
.st-visual.has-house[data-active="materials"] > .st-chip { opacity: 0; }

/* the roof report sheet */
.st-sheet { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; background: #fff; opacity: 0; visibility: hidden; transition: opacity 400ms ease, visibility 400ms; }
.st-visual[data-active="roof-report"] .st-sheet { opacity: 1; visibility: visible; }
.st-sheet-top { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.st-sheet-title { font-family: var(--display); font-size: 24px; line-height: 1.2; }
.st-sheet-address { overflow: hidden; color: var(--ink-3); font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.st-sheet-figure { position: relative; flex: 1; min-height: 0; }
.st-sheet-figure .st-chip { position: absolute; top: 10px; left: 10px; }
.st-diagram { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-diagram-face { fill: #d9d4cc; stroke: #fff; stroke-width: calc(var(--px, 1) * 1px); }
.st-diagram line { stroke-width: calc(var(--px, 1) * 2.5px); stroke-linecap: round; }
.st-sheet-lines { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 8px 18px; list-style: none; border-top: 1px solid var(--line); font-size: 12px; }
.st-sheet-lines li { display: flex; align-items: center; gap: 6px; }
.st-sheet-lines i { width: 16px; height: 4px; border-radius: 99px; }
.st-sheet-figures { display: flex; flex-wrap: wrap; gap: 1px; margin: 0; border-top: 1px solid var(--line); background: var(--line); }
.st-sheet-figures div { flex: 1 1 90px; min-width: 0; padding: 8px 12px; background: #fff; }
.st-sheet-figures dt { color: var(--ink-3); font-size: 12px; }
.st-sheet-figures dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) {
  .st-sheet-top { padding: 8px 12px; }
  .st-sheet-title { font-size: 18px; }
  .st-sheet-address { font-size: 12px; }
  .st-sheet-lines { padding: 5px 12px; font-size: 12px; }
  .st-sheet-figures div { padding: 4px 10px; }
  .st-sheet-figures dt { font-size: 12px; }
}

/* their house, painted by AI */
.st-house { position: absolute; inset: 0; z-index: 2; background: #1d1b18; opacity: 0; visibility: hidden; transition: opacity 400ms ease, visibility 400ms; }
.st-visual[data-active="materials"] .st-house { opacity: 1; visibility: visible; }
.st-house-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: st-fade 600ms ease both; }
.st-house-img.is-leaving { z-index: -1; }
.st-house.is-painting::after {
  content: attr(data-painting); position: absolute; top: 14px; left: 14px; padding: 7px 12px; border-radius: 99px;
  background: rgba(20, 16, 24, 0.72); color: #fff; font-size: 13px; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: st-pulse 1500ms ease-in-out infinite;
}
.st-cap { position: absolute; bottom: 14px; left: 14px; z-index: 3; padding: 6px 12px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12.5px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* the project header, as the project page opens */
.st-project {
  position: absolute; inset: auto 0 0; z-index: 2; display: flex; flex-direction: column; gap: 6px; padding: 96px 20px 20px; color: #fff;
  background: linear-gradient(to top, rgba(20, 16, 24, 0.82), transparent); opacity: 0; transition: opacity 400ms ease;
}
.st-visual[data-active="project"] .st-project { opacity: 1; }
.st-project-street { font-family: var(--display); font-size: 30px; line-height: 1.15; }
.st-project-city { font-size: 14px; opacity: 0.9; }
.st-project-state { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; }

/* the text */
.st-eyebrow { color: var(--brand); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.st-title { margin: 6px 0 0; font-family: var(--display); font-size: clamp(28px, 3vw, 38px); font-weight: 500; line-height: 1.15; text-wrap: balance; }
.st-body { margin-top: 10px; color: var(--ink-2); font-size: 17px; line-height: 1.55; text-wrap: pretty; }
.st-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; background: #fdf3c4; color: #6b5400; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-chip.is-blue { background: #dbeafe; color: #1e40af; }
.st-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.st-stat span { color: var(--ink-3); font-size: 14px; }
.st-stat b { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-stat small { color: var(--ink-3); font-size: 12px; }
.st-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-3); font-size: 14px; }
.st-edge-list, .st-rows { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.st-edge-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.st-edge-list li + li, .st-rows li + li { border-top: 1px solid var(--line); }
.st-edge-list i { flex: none; width: 24px; height: 6px; border-radius: 99px; }
.st-edge-list span:not(.st-locked) { flex: 1; }
.st-edge-list b { font-variant-numeric: tabular-nums; font-weight: 600; }
.st-locked { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13.5px; }
.st-locked .st-icon { width: 12px; height: 12px; }
.st-rows li { display: flex; gap: 12px; padding: 12px 16px; }
.st-rows b { display: block; font-size: 15px; font-weight: 600; }
.st-rows div span { display: block; color: var(--ink-3); font-size: 14px; line-height: 1.45; }
.st-rows .st-row-icon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-tint); color: var(--brand); }
/* phones: the report's lines and what comes after the report are rows of cards to swipe through, so each section fits
   under the photo; the report's longer lines get wider cards */
@media (max-width: 1023px) {
  .st-section .st-rows {
    display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; margin: 0 -18px; padding: 2px 18px 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 18px;
    border: 0; border-radius: 0; background: none; scrollbar-width: none;
  }
  .st-section[data-section="roof-report"] .st-rows { grid-auto-columns: 60%; }
  .st-section .st-rows::-webkit-scrollbar { display: none; }
  .st-section .st-rows li {
    flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; scroll-snap-align: start;
  }
  .st-section .st-rows li + li { border-top: 1px solid var(--line); }
}
.st-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.st-free { font-size: 14px; font-weight: 500; }

/* materials */
.st-materials { display: flex; flex-direction: column; gap: 18px; }
.st-materials-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.st-material {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 99px;
  background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; transition: border-color 160ms, background-color 160ms;
}
.st-material i { width: 12px; height: 12px; border-radius: 99px; }
.st-material[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.st-palette { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.st-palette-head b { display: block; font-weight: 600; }
.st-palette-head span { color: var(--ink-3); font-size: 14px; }
.st-palette fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.st-palette legend { margin-bottom: 8px; font-size: 13px; font-weight: 500; line-height: 1.3; }
.st-picked { margin: 0; color: var(--ink); font-size: 14px; font-weight: 500; }
.st-picked:empty { display: none; }
/* each product's colors as a group, the groups side by side across the palette */
.st-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); align-items: start; gap: 14px 12px; }
.st-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.st-swatch { width: 44px; height: 44px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 11px; background: var(--sand); cursor: pointer; }
/* phones: the palette is the section's own width, without a card around it; its line repeats the section's text */
@media (max-width: 1023px) {
  .st-palette { gap: 12px; padding: 0; border: 0; border-radius: 0; background: none; }
  .st-palette-head span { display: none; }
}
@media (min-width: 1024px) {
  .st-products { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
  .st-swatches { gap: 8px; }
  .st-swatch { width: 52px; height: 52px; border-radius: 12px; }
}
.st-swatch img { width: 100%; height: 100%; object-fit: cover; }
.st-swatch[aria-pressed="true"] { border-color: var(--brand); }
.st-swatch:disabled { cursor: progress; opacity: 0.6; }
.st-error { color: #b42318; font-size: 14px; font-weight: 600; }
.st-gate { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--brand); border-radius: 14px; }
.st-gate span { color: var(--ink-3); font-size: 14px; }

/* the way in */
.st-finish { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.st-cta {
  display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 28px; border-radius: 14px; background: var(--brand);
  color: #fff; font-size: 16px; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 24px -12px rgba(110, 4, 189, 0.65);
  transition: background-color 160ms ease, transform 160ms var(--st-out);
}
@media (hover: hover) and (pointer: fine) { .st-cta:hover { background: var(--brand-hover); } }
.st-cta:active { transform: scale(0.98); }
.st-fine { color: var(--ink-3); font-size: 13.5px; }
.st-notice { padding: 14px 16px; border-radius: 14px; background: var(--brand-tint); color: var(--brand-deep); font-size: 15px; font-weight: 500; line-height: 1.5; }

/* coming in from the sign-up: the first section's text follows the photo */
.story.is-entering .st-section:first-child .st-section-in > * { animation: st-rise 620ms var(--st-out) backwards; }
.story.is-entering .st-section:first-child .st-section-in > :nth-child(1) { animation-delay: 380ms; }
.story.is-entering .st-section:first-child .st-section-in > :nth-child(2) { animation-delay: 460ms; }
.story.is-entering .st-section:first-child .st-section-in > :nth-child(3) { animation-delay: 540ms; }
.story.is-entering .st-bar { animation: st-fade 500ms ease 200ms backwards; }
::view-transition-group(roof-photo) { animation-duration: 720ms; animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1); overflow: clip; }
@media (min-width: 1024px), (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  ::view-transition-group(roof-photo) { border-radius: 20px; }
}
/* the tall measuring photo and the wide story photo each fill the growing frame, cropped rather than stretched */
::view-transition-old(roof-photo), ::view-transition-new(roof-photo) { width: 100%; height: 100%; object-fit: cover; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 420ms; }

@keyframes st-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes st-fade { from { opacity: 0; } }
@keyframes st-pulse { 50% { opacity: 0.7; } }

@media (prefers-reduced-motion: reduce) {
  .story { scroll-snap-type: none; }
  .story *, .story.is-entering * { animation: none !important; transition: none !important; }
}
