/* ════════════════════════════════════════════════════════════════════════════
   Residential v2 — public address-first analysis  (/residential)

   Design language: a surveyor's field instrument, kept light and airy rather
   than heavy — a single column, brighter hues, soft shadows, quiet motion.
   · Single column — one search plate at the top, the field book of results
     flows beneath it at the same width, edges aligned.
   · Two lenses, two hues — lifestyle reads emerald, investment reads amber.
     Brighter and lighter than the app's own primary/accent so the page feels
     distinct without touching global tokens. The 1px glint border on live
     surfaces is the two hues meeting on the edge.
   · Type: Bricolage Grotesque (display voice), Instrument Sans (reading voice),
     JetBrains Mono for every measured value — address, metres, weights, scores.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
    --rv-display: 'Bricolage Grotesque', var(--font-display);
    --rv-body:    'Instrument Sans', var(--font-body);
    --rv-mono:    var(--font-mono);

    /* Two-tier hue: -fill is the bright, punchy tone for bars/dots/thumbs/glow
       (nothing readable ever sits on it); the bare token is a darker, text-safe
       shade used wherever the hue colors a label directly (checked at 4.5:1
       against white — the brighter -fill values fall to ~2.5-2.8:1 as text). */
    --rv-life:        #0b875e;
    --rv-life-fill:   #10b981;
    --rv-life-soft:   rgba(16, 185, 129, 0.10);
    --rv-invest:      #c35608;
    --rv-invest-fill: #f97316;
    --rv-invest-soft: rgba(249, 115, 22, 0.10);

    --rv-glint-a: rgba(249, 115, 22, 0.38);   /* investment ember    */
    --rv-glint-b: rgba(16, 185, 129, 0.34);   /* lifestyle verdigris */
    --rv-hairline: rgba(255, 255, 255, 0.8);
    --rv-line:     rgba(12, 10, 7, 0.08);     /* lighter than --border-strong */
    --rv-shadow-card: 0 1px 2px rgba(20, 20, 15, 0.04), 0 10px 28px rgba(20, 20, 15, 0.055);
    --rv-shadow-pop:  0 14px 32px rgba(20, 20, 15, 0.09);
}
.dark {
    /* Dark mode's bright tones already clear 4.5:1 on the dark card, so both
       tiers collapse to the same value — no separate muted text shade needed. */
    --rv-life:        #34d399;
    --rv-life-fill:   #34d399;
    --rv-life-soft:   rgba(52, 211, 153, 0.14);
    --rv-invest:      #fb923c;
    --rv-invest-fill: #fb923c;
    --rv-invest-soft: rgba(251, 146, 60, 0.14);

    --rv-glint-a: rgba(251, 146, 60, 0.55);
    --rv-glint-b: rgba(52, 211, 153, 0.48);
    --rv-hairline: rgba(255, 255, 255, 0.06);
    --rv-line:     rgba(255, 255, 255, 0.09);
    --rv-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
    --rv-shadow-pop:  0 16px 36px rgba(0, 0, 0, 0.45);
}

/* ── Residential's own chrome (ResidentialLayout.razor) ────────────────────── */
.rv-layout { min-height: 100vh; display: flex; flex-direction: column; }

.rv-topbar {
    height: 56px; flex: none;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--rv-line);
    position: sticky; top: 0; z-index: 100;
}
.rv-topbar-brand {
    font-family: var(--rv-display); font-weight: 700; font-size: 16px;
    letter-spacing: -0.01em; color: var(--text);
}
.rv-topbar-brand span { color: var(--rv-invest); font-weight: 600; }
.rv-topbar-actions { display: flex; align-items: center; gap: 8px; }
.rv-topbar-icon {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.rv-topbar-icon:hover { background: var(--surface-alt); color: var(--rv-invest); }

/* ── Single-column shell: search plate on top, field book flows below ────── */
.rv-shell {
    font-family: var(--rv-body);
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px 72px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.rv-rail { display: flex; flex-direction: column; gap: 14px; }

.rv-flow { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.rv-flow > * { animation: rv-rise 0.42s var(--ease-out) both; }
.rv-flow > *:nth-child(1) { animation-delay: 0ms;   }
.rv-flow > *:nth-child(2) { animation-delay: 50ms;  }
.rv-flow > *:nth-child(3) { animation-delay: 100ms; }
.rv-flow > *:nth-child(4) { animation-delay: 150ms; }
.rv-flow > *:nth-child(5) { animation-delay: 200ms; }
.rv-flow > *:nth-child(6) { animation-delay: 250ms; }
@keyframes rv-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── 1px glint: gradient border where the two lenses meet ─────────────────── */
.rv-glint {
    position: relative;
    border: 1px solid transparent;
    border-radius: 18px;
    background:
        linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
        linear-gradient(130deg,
            var(--rv-line) 0%,
            var(--rv-glint-a)   32%,
            var(--rv-glint-b)   58%,
            var(--rv-line) 88%) border-box;
    box-shadow: inset 0 1px 0 var(--rv-hairline), var(--rv-shadow-card);
}

/* ── Control rail ──────────────────────────────────────────────────────────── */
.rv-brand {
    font-family: var(--rv-mono);
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-sub);
    display: flex; align-items: center; gap: 8px;
}
.rv-brand::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.rv-plate { padding: 20px; display: flex; flex-direction: column; gap: 15px; }

.rv-fieldlabel {
    font-family: var(--rv-mono);
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-sub);
    margin-bottom: 6px;
    display: flex; justify-content: space-between; align-items: baseline;
}

.rv-input {
    width: 100%; height: 52px;
    font-family: var(--rv-body); font-size: 16px; font-weight: 500;
    color: var(--text);
    background: var(--bg-sec);
    border: 1px solid var(--rv-line);
    border-radius: 12px;
    padding: 0 15px;
    transition: border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                transform var(--duration-normal) var(--ease-out);
}
.rv-input:focus {
    outline: none;
    border-color: var(--rv-invest);
    box-shadow: 0 0 0 4px var(--rv-invest-soft);
    transform: translateY(-1px);
}
.rv-input::placeholder { color: var(--text-sub); font-weight: 400; }

/* Quadrant rose — Calgary's own address grammar. The resolved quadrant lights. */
.rv-rose {
    flex: none; width: 46px; height: 46px; position: relative;
    border: 1px solid var(--rv-line); border-radius: 50%;
}
.rv-rose::before, .rv-rose::after { content: ""; position: absolute; background: var(--rv-line); }
.rv-rose::before { left: 50%; top: 4px; bottom: 4px; width: 1px; }
.rv-rose::after  { top: 50%; left: 4px; right: 4px; height: 1px; }
.rv-q {
    position: absolute; z-index: 1;
    font-family: var(--rv-mono); font-size: 8px; font-weight: 600;
    letter-spacing: 0.03em; color: var(--text-muted);
    transition: color var(--duration-normal), text-shadow var(--duration-normal);
}
.rv-q.nw { top: 7px;    left: 8px; }
.rv-q.ne { top: 7px;    right: 7px; }
.rv-q.sw { bottom: 7px; left: 8px; }
.rv-q.se { bottom: 7px; right: 7px; }
.rv-q.on { color: var(--rv-invest); font-weight: 800; text-shadow: 0 0 10px var(--rv-glint-a); }

.rv-selected {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--rv-mono); font-size: 12px; color: var(--text-muted);
    min-width: 0;
    animation: rv-rise 0.3s var(--ease-out) both;
}
.rv-selected .addr {
    color: var(--text); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Profile chips — scoped animation so the shared .chip class elsewhere is untouched */
.rv-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.rv-chips .chip {
    transition: transform var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out),
                background var(--duration-fast) var(--ease-out);
}
.rv-chips .chip:hover { transform: translateY(-1px); border-color: var(--rv-invest); }
.rv-chips .chip.active { background: var(--rv-invest); border-color: var(--rv-invest); }

/* Focus beam — the two lenses on one axis */
.rv-beam-labels {
    display: flex; justify-content: space-between;
    font-family: var(--rv-mono); font-size: 11.5px; margin-bottom: 7px;
}
.rv-beam-labels .life   { color: var(--rv-life); }
.rv-beam-labels .invest { color: var(--rv-invest); }
.rv-beam-labels .dim    { opacity: 0.4; }
.rv-beam {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; border-radius: 99px;
    outline: none; cursor: pointer;
}
.rv-beam::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--bg-card); border: 2px solid var(--text);
    box-shadow: var(--shadow);
    transition: transform var(--duration-fast) var(--ease-out);
}
.rv-beam::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bg-card); border: 2px solid var(--text);
    box-shadow: var(--shadow);
    transition: transform var(--duration-fast) var(--ease-out);
}
.rv-beam:hover::-webkit-slider-thumb { transform: scale(1.15); }
.rv-beam:hover::-moz-range-thumb { transform: scale(1.15); }
.rv-beam:focus-visible { box-shadow: var(--focus-ring); border-radius: 99px; }

.rv-go {
    width: 100%; height: 50px; font-size: 15px; font-weight: 600;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}
.rv-go:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--rv-shadow-pop); }
.rv-go:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.rv-rail-note {
    font-family: var(--rv-mono);
    font-size: 10px; line-height: 1.8; color: var(--text-sub);
    padding: 0 4px;
}

/* ── Welcome panel (empty state) ───────────────────────────────────────────── */
.rv-welcome { position: relative; overflow: hidden; padding: 40px 36px 38px; }

.rv-title {
    font-family: var(--rv-display);
    font-size: clamp(30px, 5.4vw, 44px);
    font-weight: 800; line-height: 1.05; letter-spacing: -0.03em;
    color: var(--text);
    max-width: 14ch;
    position: relative; z-index: 1;
}
.rv-title em {
    font-style: normal;
    background: linear-gradient(115deg, var(--rv-invest), var(--rv-life));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.rv-sub {
    font-size: 15px; line-height: 1.65; color: var(--text-muted);
    max-width: 46ch; margin-top: 14px;
    position: relative; z-index: 1;
}

/* Ghost rose — one large 1px-line ornament, clipped by the panel edge */
.rv-ghost-rose {
    position: absolute; top: 50%; right: -100px;
    width: 280px; height: 280px;
    transform: translateY(-50%);
    border: 1px solid var(--rv-line);
    border-radius: 50%;
    opacity: 0.9;
    pointer-events: none;
}
.rv-ghost-rose::before, .rv-ghost-rose::after { content: ""; position: absolute; background: var(--rv-line); }
.rv-ghost-rose::before { left: 50%; top: 12px; bottom: 12px; width: 1px; }
.rv-ghost-rose::after  { top: 50%; left: 12px; right: 12px; height: 1px; }
.rv-ghost-rose .ring {
    position: absolute; inset: 46px;
    border: 1px solid var(--rv-line);
    border-radius: 50%;
}
.rv-ghost-rose .gq {
    position: absolute;
    font-family: var(--rv-display); font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em; color: var(--text-sub); opacity: 0.55;
}
.rv-ghost-rose .gq.nw { top: 32px;    left: 50px; }
.rv-ghost-rose .gq.ne { top: 32px;    right: 50px; }
.rv-ghost-rose .gq.sw { bottom: 32px; left: 50px; }
.rv-ghost-rose .gq.se { bottom: 32px; right: 50px; }

.rv-welcome-list { margin-top: 26px; display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 1; }
.rv-welcome-list .item {
    display: flex; gap: 12px; align-items: baseline;
    font-size: 13.5px; color: var(--text-muted);
    border-left: 2px solid var(--rv-invest-soft);
    padding-left: 14px;
}
.rv-welcome-list .item b { color: var(--text); font-weight: 600; }

/* ── Result header card ────────────────────────────────────────────────────── */
.rv-result-head { padding: 22px 24px; }
.rv-result-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rv-addr {
    font-family: var(--rv-mono);
    font-size: 16px; font-weight: 600; color: var(--text);
    letter-spacing: -0.01em;
}
.rv-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.rv-meta .mono { font-family: var(--rv-mono); }
.rv-meta .zone {
    font-family: var(--rv-mono); font-size: 11px; font-weight: 600;
    border: 1px solid var(--rv-line); border-radius: 6px;
    padding: 1px 6px; margin-left: 2px;
}

/* Band scale — five real bands (thresholds 35 / 50 / 65 / 80) */
.rv-scale { position: relative; padding-top: 34px; margin-top: 18px; }
.rv-scale-track { display: flex; height: 10px; border-radius: 99px; overflow: hidden; }
.rv-seg { height: 100%; opacity: 0.3; }
.rv-seg.b1 { width: 35%; background: var(--danger); }
.rv-seg.b2 { width: 15%; background: var(--warning); }
.rv-seg.b3 { width: 15%; background: #ca9a1e; }
.rv-seg.b4 { width: 15%; background: var(--rv-life-fill); opacity: 0.5; }
.rv-seg.b5 { width: 20%; background: var(--rv-life-fill); }
.rv-marker {
    position: absolute; top: 0;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    transition: left var(--duration-slower) var(--ease-out);
    animation: rv-sweep 0.55s var(--ease-out);
}
.rv-marker .score {
    font-family: var(--rv-display);
    font-size: 21px; font-weight: 800; letter-spacing: -0.02em;
    color: var(--text); white-space: nowrap; line-height: 1;
}
.rv-marker .pin { width: 2px; height: 15px; background: var(--text); border-radius: 1px; }
@keyframes rv-sweep { from { left: 2%; } }
.rv-scale-ticks {
    position: relative; height: 15px; margin-top: 4px;
    font-family: var(--rv-mono); font-size: 9px; color: var(--text-sub);
}
.rv-scale-ticks span { position: absolute; transform: translateX(-50%); }
.rv-band-line {
    margin-top: 10px;
    font-size: 14px; color: var(--text-muted);
}
.rv-band-line b { font-weight: 700; color: var(--text); }
.rv-band-line .mix { font-family: var(--rv-mono); font-size: 12px; }

/* Lens rows */
.rv-lenses { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.rv-lens { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 5px 0; }
.rv-lens .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.rv-lens .dot.life   { background: var(--rv-life-fill); }
.rv-lens .dot.invest { background: var(--rv-invest-fill); }
.rv-lens .name { width: 88px; color: var(--text); font-weight: 600; }
.rv-lens .bar  { flex: 1; height: 6px; background: var(--rv-line); border-radius: 99px; overflow: hidden; }
.rv-lens .bar > div { height: 100%; border-radius: 99px; animation: rv-fill 0.6s var(--ease-out); }
.rv-lens .bar .life   { background: var(--rv-life-fill); }
.rv-lens .bar .invest { background: var(--rv-invest-fill); }
.rv-lens .val  { font-family: var(--rv-mono); font-weight: 700; width: 42px; text-align: right; }
.rv-lens .conf { font-family: var(--rv-mono); font-size: 11px; color: var(--text-sub); width: 78px; text-align: right; }
@keyframes rv-fill { from { width: 0; } }

/* ── Section cards (field book pages) ──────────────────────────────────────── */
.rv-card {
    background: var(--bg-card);
    border: 1px solid var(--rv-line);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 var(--rv-hairline), var(--rv-shadow-card);
    padding: 20px 22px;
}
.rv-card-title {
    font-family: var(--rv-display);
    font-size: 16px; font-weight: 700; letter-spacing: -0.015em;
    color: var(--text);
}
.rv-card-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; margin-bottom: 12px; }

/* Component ledger rows */
.rv-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--rv-line);
}
.rv-row:last-child { border-bottom: none; padding-bottom: 2px; }
.rv-row .what { flex: 1; min-width: 0; }
.rv-row .what .l { font-size: 13px; font-weight: 600; color: var(--text); }
.rv-row .what .d { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.rv-row .w { font-family: var(--rv-mono); font-size: 11px; color: var(--text-sub); white-space: nowrap; }
.rv-row .bar { width: 110px; height: 7px; background: var(--rv-line); border-radius: 99px; overflow: hidden; flex: none; }
.rv-row .bar > div { height: 100%; border-radius: 99px; animation: rv-fill 0.6s var(--ease-out); }
.rv-row .bar .life   { background: var(--rv-life-fill); }
.rv-row .bar .invest { background: var(--rv-invest-fill); }
.rv-row .score { font-family: var(--rv-mono); font-size: 13px; font-weight: 700; color: var(--text); width: 34px; text-align: right; }

/* Relative density tiles */
.rv-density-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rv-density {
    background: var(--surface-alt); border-radius: 8px; padding: 10px 12px;
    box-shadow: inset 0 1px 0 var(--rv-hairline);
}
.rv-density .t { font-size: 12px; font-weight: 600; color: var(--text); text-transform: capitalize; }
.rv-density .m { font-family: var(--rv-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* Market / community fact grids */
.rv-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.rv-fact .k { font-size: 11px; color: var(--text-muted); }
.rv-fact .v { font-family: var(--rv-mono); font-size: 15px; font-weight: 700; color: var(--text); margin-top: 1px; }

/* Development potential rows */
.rv-dev { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.rv-dev .ref { font-family: var(--rv-mono); font-size: 11px; color: var(--text-sub); }

/* ── Teaser (anonymous) ───────────────────────────────────────────────────── */
.rv-teaser-head { padding: 22px 24px; }
.rv-teaser-bands {
    display: grid; grid-template-columns: 1.7fr 1fr; grid-auto-rows: 1fr;
    gap: 10px; margin-top: 16px;
}
.rv-band-tile {
    background: var(--surface-alt); border-radius: 10px; padding: 14px 16px;
    box-shadow: inset 0 1px 0 var(--rv-hairline);
    display: flex; flex-direction: column; justify-content: center;
}
.rv-band-tile.hero { grid-row: span 2; }
.rv-band-tile .k {
    font-family: var(--rv-mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-sub);
}
.rv-band-tile .v { font-family: var(--rv-display); font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-size: 19px; }
.rv-band-tile.hero .v { font-size: 30px; line-height: 1.05; }

.rv-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.rv-locked { padding: 20px 22px; }
.rv-locked-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.rv-locked-row .name { font-size: 13px; color: var(--text-muted); min-width: 220px; }
.rv-locked-row .ghost {
    flex: 1; height: 11px; border-radius: 6px; filter: blur(3px); opacity: 0.85;
    background: linear-gradient(90deg, var(--rv-line) 0%, var(--rv-invest-soft) 55%, var(--rv-line) 100%);
}
.rv-lock-glyph { width: 13px; height: 13px; flex: none; color: var(--text-sub); }
.rv-cta-row { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.rv-cta-link {
    font-size: 13px; color: var(--rv-invest); font-weight: 500;
    transition: color var(--duration-fast) var(--ease-out);
}
.rv-cta-link:hover { text-decoration: underline; }
.rv-cta-row .btn-primary { transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.rv-cta-row .btn-primary:hover { transform: translateY(-2px); box-shadow: var(--rv-shadow-pop); }

/* ── AI verdict ───────────────────────────────────────────────────────────── */
.rv-verdict { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rv-line); }
.rv-verdict-summary {
    background: var(--surface-alt);
    border-left: 3px solid var(--rv-invest);
    border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 10px;
    box-shadow: inset 0 1px 0 var(--rv-hairline);
}

.rv-notes { font-size: 11px; color: var(--text-muted); line-height: 1.75; padding: 0 6px; }
.rv-notes .mono { font-family: var(--rv-mono); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .rv-shell { gap: 18px; padding-top: 20px; }
    .rv-welcome { padding: 28px 22px; }
    .rv-title { font-size: clamp(26px, 8vw, 34px); }
    .rv-ghost-rose { width: 200px; height: 200px; right: -80px; opacity: 0.5; }
    .rv-ghost-rose .gq { font-size: 16px; }
    .rv-ghost-rose .gq.nw, .rv-ghost-rose .gq.sw { left: 36px; }
    .rv-ghost-rose .gq.ne, .rv-ghost-rose .gq.se { right: 36px; }
    .rv-teaser-bands { grid-template-columns: 1fr; }
    .rv-band-tile.hero { grid-row: auto; }
    .rv-lens .conf { display: none; }
    .rv-row .bar { width: 68px; }
    .rv-locked-row .name { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .rv-marker { animation: none; transition: none; }
    .rv-lens .bar > div, .rv-row .bar > div { animation: none; }
    .rv-flow > *, .rv-selected { animation: none; }
    .rv-input:focus, .rv-go:hover, .rv-chips .chip:hover { transform: none; }
}
