/* Reno-or-Move — visual identity.
   Floor-plan vernacular: hairline "wall" borders, small-caps plan annotations,
   one gold "you are here" accent. Harbour navy on fog white, spruce actions.
   Mobile-first; the whole funnel is designed for a phone in one hand. */

:root {
    --ink: #24313d;
    --ink-soft: #4c5a66;
    --paper: #f5f4ee;
    --card: #fffefb;
    --wall: rgba(36, 49, 61, 0.28);
    --hair: rgba(36, 49, 61, 0.14);
    --spruce: #2f5d50;
    --spruce-deep: #24483e;
    --gold: #e2a63b;
    --radius: 6px;
    --display: 'Bricolage Grotesque', Georgia, serif;
    --body: 'Instrument Sans', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; }

/* scrollbar-gutter keeps the content width identical between screens that
   scroll and screens that don't — otherwise the bar popping in/out mid
   slide-in reads as a layout jolt on desktop. */
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

body {
    font-family: var(--body);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ---- masthead ---- */
.masthead {
    display: flex; align-items: baseline; gap: 0.6rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hair);
}
.mark {
    width: 14px; height: 14px; align-self: center; flex: none;
    border: 2px solid var(--spruce);
    border-bottom-color: var(--gold); border-right-color: var(--gold);
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.wordmark em { font-style: italic; font-weight: 400; color: var(--ink-soft); }
.byline { font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---- screens ---- */
body { overflow-x: hidden; }   /* transitions slide screens past the edge */
main { max-width: 40rem; margin: 0 auto; padding: 0 1.25rem 6rem; }
.screen { display: none; padding-top: 2.25rem; }
.screen[data-active="true"] { display: block; }

/* ---- screen transitions ----
   Forward: old screen fades + slides off left while the new one arrives
   from the right. Back: mirrored. Driven by show() in app.js; the global
   reduced-motion reset collapses all of it to instant swaps. */
.screen.exit-left { animation: exitLeft 0.22s ease-in both; }
.screen.exit-right { animation: exitRight 0.22s ease-in both; }
.screen.enter-right { animation: enterRight 0.3s ease-out both; }
.screen.enter-left { animation: enterLeft 0.3s ease-out both; }
/* Static start state for the layout-flush frames between display:block and
   the animation class landing — without it the screen paints one frame at
   its final position, then jumps back to slide in. */
.screen.pre-enter-right { opacity: 0; transform: translateX(32px); }
.screen.pre-enter-left { opacity: 0; transform: translateX(-32px); }
@keyframes exitLeft { to { opacity: 0; transform: translateX(-32px); } }
@keyframes exitRight { to { opacity: 0; transform: translateX(32px); } }
@keyframes enterRight { from { opacity: 0; transform: translateX(32px); } }
@keyframes enterLeft { from { opacity: 0; transform: translateX(-32px); } }

.eyebrow {
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--spruce);
    margin-bottom: 0.75rem;
}
.eyebrow::before { content: '— '; color: var(--gold); }

h1, h2 {
    font-family: var(--display); font-weight: 700; letter-spacing: -0.02em;
    line-height: 1.08; text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 8vw, 3.1rem); }
h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.accent { color: var(--spruce); }
.lede { margin: 1rem 0 1.75rem; color: var(--ink-soft); font-size: 1.05rem; max-width: 32rem; }

.back {
    background: none; border: none; padding: 0 0 1rem;
    font: 600 0.85rem var(--body); color: var(--ink-soft); cursor: pointer;
}
.back:hover { color: var(--ink); }

.fineprint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 1.25rem; }

/* ---- room cards (the signature) ----
   Each choice is drawn as a room on a plan: double hairline wall, a plan
   annotation label, and a gold corner tick that reads as "you are here". */
.room-grid { display: grid; grid-template-columns: 1fr; gap: 0.8rem; }
@media (min-width: 520px) { .room-grid { grid-template-columns: 1fr 1fr; } }

.room {
    position: relative;
    background: var(--card);
    border: 1px solid var(--wall);
    outline: 1px solid var(--hair);
    outline-offset: 3px;
    border-radius: var(--radius);
    padding: 1.15rem 1.15rem 1rem;
    text-align: left;
    font: inherit; color: inherit; cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.room:hover, .room:focus-visible { transform: translateY(-2px); border-color: var(--spruce); }
.room:focus-visible { outline: 2px solid var(--spruce); outline-offset: 3px; }
.room::after {                       /* gold corner tick */
    content: ''; position: absolute; top: 8px; right: 8px;
    width: 10px; height: 10px;
    border-top: 2px solid var(--gold); border-right: 2px solid var(--gold);
}
.room .tag {
    display: block; font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
    margin-bottom: 0.45rem;
}
.room .title { font-family: var(--display); font-size: 1.18rem; font-weight: 600; line-height: 1.2; }

/* ---- address ---- */
.address-box { position: relative; margin-top: 1.25rem; }
input[type="text"], input[type="tel"] {
    width: 100%; padding: 0.9rem 1rem;
    font: 500 1.05rem var(--body); color: var(--ink);
    background: var(--card); border: 1px solid var(--wall); border-radius: var(--radius);
}
input:focus { outline: 2px solid var(--spruce); outline-offset: 1px; }
#address-suggestions {
    list-style: none; padding: 0; position: absolute; z-index: 5;
    left: 0; right: 0; top: calc(100% + 4px);
    background: var(--card); border: 1px solid var(--wall); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(36, 49, 61, 0.12);
    max-height: 16rem; overflow-y: auto;
}
#address-suggestions:empty { display: none; }
#address-suggestions li {
    padding: 0.75rem 1rem; cursor: pointer; font-size: 0.95rem;
    border-bottom: 1px solid var(--hair);
}
#address-suggestions li:last-child { border-bottom: none; }
#address-suggestions li:hover, #address-suggestions li[aria-selected="true"] { background: var(--paper); }

/* ---- flythrough (screen 2b) ----
   Full-viewport takeover: daylight map underneath (Standard 'day' preset,
   matching the app's light theme), a glassy fog-white progress card on top
   in the app's own ink/gold tokens. */
.takeover[data-active="true"] {
    display: block;
    position: fixed; inset: 0; z-index: 15;
    padding: 0; background: var(--paper);
    animation: none;
}
#flight-map { position: absolute; inset: 0; }
.flight-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
    pointer-events: none;
    background: linear-gradient(to top, rgba(245, 244, 238, 0.75), transparent 40%);
    /* Hidden during the pan; fades in once the pin is centred. */
    opacity: 0; transition: opacity 0.35s ease;
}
.flight-overlay.on { opacity: 1; }
.flight-card {
    width: 100%; max-width: 26rem;
    background: rgba(255, 254, 251, 0.82);
    border: 1px solid var(--wall);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--ink);
    box-shadow: 0 8px 28px rgba(36, 49, 61, 0.14);
    display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.8rem; align-items: center;
}
.spinner {
    width: 20px; height: 20px; grid-row: span 2;
    border: 2.5px solid var(--hair);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.flight-status { font: 600 0.98rem var(--body); transition: opacity 0.25s ease; }
.flight-status.swap { opacity: 0; }
.flight-address { font-size: 0.8rem; color: var(--ink-soft); }
/* Under prefers-reduced-motion the global reset freezes the spinner into a
   static gold-topped ring — that's the intended degraded state. */

/* ---- registry confirm ---- */
.registry-line { margin: 0.75rem 0 1.5rem; color: var(--ink-soft); font-size: 0.98rem; max-width: 30rem; }
.stepper-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; max-width: 26rem; margin-bottom: 1.75rem; }
.stepper {
    background: var(--card);
    border: 1px solid var(--wall);
    outline: 1px solid var(--hair); outline-offset: 3px;
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
}
.stepper-label {
    display: block; font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
    margin-bottom: 0.5rem;
}
.stepper-controls { display: flex; align-items: center; gap: 0.9rem; }
.step {
    width: 2.2rem; height: 2.2rem; border-radius: var(--radius);
    border: 1px solid var(--wall); background: none;
    font: 600 1.2rem var(--body); color: var(--ink); cursor: pointer;
    line-height: 1;
}
.step:hover { border-color: var(--spruce); color: var(--spruce); }
.stepper-controls output {
    font-family: var(--display); font-size: 1.5rem; font-weight: 700;
    min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums;
}

/* ---- tuning ---- */
.option-row { display: grid; gap: 0.7rem; margin-top: 1.5rem; }
.option-row .room { padding: 0.95rem 1.1rem; }
.loadline {
    margin-top: 2.5rem; height: 2px; background: var(--hair);
    border-radius: 1px; overflow: hidden;
}
.loadline span {
    display: block; height: 100%; width: 30%;
    background: var(--gold);
    animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* ---- two paths ---- */
.asof { font-size: 0.8rem; color: var(--ink-soft); margin: 0.4rem 0 1.5rem; }
.paths { display: grid; gap: 1rem; }
/* Grid/flex children default to min-width:auto, which lets the carousel's
   content width blow the column (and the page) out past the viewport on
   mobile. min-width:0 restores the intended "scroll inside the card". */
.paths > * { min-width: 0; }
.plan-card .carousel { min-width: 0; max-width: 100%; }
@media (min-width: 720px) {
    main { max-width: 52rem; }
    /* Homes (move) lead with the wide column; the reno card rides shotgun. */
    .paths { grid-template-columns: 3fr 2fr; align-items: start; }
}

.plan-card {
    background: var(--card);
    border: 1px solid var(--wall);
    outline: 1px solid var(--hair); outline-offset: 3px;
    border-radius: var(--radius);
    padding: 1.25rem;
}
.plan-label {
    font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.6rem;
}
.plan-card h3 { font-family: var(--display); font-size: 1.35rem; font-weight: 600; margin-bottom: 0.4rem; }
.plan-card .big-number {
    font-family: var(--display); font-size: 1.9rem; font-weight: 700;
    color: var(--spruce); margin: 0.75rem 0 0.2rem;
    font-variant-numeric: tabular-nums;
}
.plan-card .note { font-size: 0.88rem; color: var(--ink-soft); margin-top: 0.9rem; }
.plan-card.move { border-color: var(--spruce); }
#move-count { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.75rem; }

/* ---- carousel ---- */
.carousel {
    display: flex; gap: 0.75rem; overflow-x: auto;
    scroll-snap-type: x mandatory; padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}
.listing-card {
    flex: 0 0 78%; max-width: 300px; scroll-snap-align: start;
    text-decoration: none; color: inherit;
    background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius);
    overflow: hidden;
}
@media (min-width: 720px) { .listing-card { flex-basis: 46%; } }
.listing-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--hair); }
.listing-card .body { padding: 0.7rem 0.85rem 0.85rem; }
.listing-card .price {
    font-family: var(--display); font-weight: 700; font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}
.listing-card .meta { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.15rem; }
.listing-card .hook {
    display: inline-block; margin-top: 0.5rem;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--spruce);
}
.listing-card .hook::after { content: ' ✓'; color: var(--gold); }

.ticket { font-size: 0.9rem; margin-top: 0.9rem; }
.ticket strong { font-variant-numeric: tabular-nums; }

.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.match-grid .listing-card { flex: none; max-width: none; }

/* ---- honesty + agent ---- */
.honesty {
    margin-top: 1.5rem; padding: 1.1rem 1.25rem;
    border-left: 3px solid var(--gold);
    background: var(--card); border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.92rem;
}
.agent-slot { margin-top: 0.6rem; font-size: 0.82rem; color: var(--ink-soft); }

/* ---- buttons ---- */
.primary {
    background: var(--spruce); color: #fff; border: none;
    font: 600 1rem var(--body);
    padding: 0.85rem 1.5rem; border-radius: var(--radius); cursor: pointer;
    transition: background 0.15s ease;
}
.primary:hover { background: var(--spruce-deep); }
.primary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ghost {
    background: none; border: 1px solid var(--wall); color: var(--ink);
    font: 600 0.9rem var(--body);
    padding: 0.7rem 1.2rem; border-radius: var(--radius); cursor: pointer; margin-top: 0.9rem;
}
.ghost:hover { border-color: var(--spruce); color: var(--spruce); }

/* ---- save CTAs (ATF card + sticky bar) ----
   The ATF card owns the ask while it's on screen; the sticky bar slides in
   only once the card has scrolled away, and yields again on scroll-back.
   app.js drives the swap with an IntersectionObserver. */
.save-atf {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    background: var(--ink); color: var(--paper);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.save-atf p { font-size: 0.95rem; max-width: 26rem; }
.save-atf .primary { flex: none; background: var(--gold); color: var(--ink); }
.save-atf .primary:hover { background: #d29a2f; }
.save-atf[hidden] { display: none; }

.savebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--ink); color: var(--paper);
    padding: 0.85rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom));
    transform: translateY(110%);
    transition: transform 0.3s ease;
}
.savebar.on { transform: none; }
.savebar[hidden] { display: none; }
.savebar-inner {
    max-width: 52rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.savebar p { font-size: 0.9rem; }
.savebar .primary { flex: none; background: var(--gold); color: var(--ink); }
.savebar .primary:hover { background: #d29a2f; }

.sheet-backdrop {
    position: fixed; inset: 0; z-index: 20;
    background: rgba(36, 49, 61, 0.45);
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
    background: var(--card); border-radius: 12px 12px 0 0;
    padding: 1.5rem 1.25rem 2rem; width: 100%; max-width: 32rem;
}
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 12px; } }
.sheet h3 { font-family: var(--display); font-size: 1.3rem; margin-bottom: 0.4rem; }
.sheet form { display: grid; gap: 0.9rem; margin-top: 1rem; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.88rem; }
.consent input { margin-top: 0.2rem; }

/* ---- listing detail ---- */
#detail-photo {
    width: 100%; aspect-ratio: 16/10; object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--hair);
    background: var(--hair);
    margin-bottom: 1.1rem;
}
#detail-price { font-variant-numeric: tabular-nums; }
.detail-sub { color: var(--ink-soft); margin: 0.35rem 0 1.25rem; font-size: 1rem; }

.tour-cta {
    display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
    background: var(--card);
    border: 1px solid var(--spruce);
    outline: 1px solid var(--hair); outline-offset: 3px;
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}
.tour-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    border: 2px solid var(--gold);
    background: var(--paper); flex: none;
}
.tour-copy { flex: 1; min-width: 10rem; }
.tour-copy p { font-size: 0.98rem; }
.tour-agent { color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.15rem; }
.tour-cta .primary { flex: none; }

.fact-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem; margin-bottom: 1.25rem;
}
.fact {
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
}
.fact .fact-label {
    display: block; font-size: 0.66rem; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
    margin-bottom: 0.2rem;
}
.fact .fact-value { font-family: var(--display); font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.remarks { margin: 1.5rem 0 1.25rem; }
.remarks h3 { font-family: var(--display); font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
.remarks p { font-size: 0.95rem; color: var(--ink-soft); white-space: pre-line; }
.courtesy {
    font-size: 0.78rem; color: var(--ink-soft);
    border-top: 1px solid var(--hair);
    padding-top: 0.9rem; margin-top: 1.5rem;
}

/* ---- states ---- */
.saved-note {
    margin-top: 0.75rem; font-size: 0.85rem; font-weight: 600; color: var(--spruce);
}
.empty-note { font-size: 0.92rem; color: var(--ink-soft); padding: 1rem 0; }

.foot {
    max-width: 52rem; margin: 3rem auto 0; padding: 1.25rem;
    border-top: 1px solid var(--hair);
    font-size: 0.72rem; color: var(--ink-soft);
}
