/* ============================================================
   SureServe — Eco Home
   Brand: Sureserve purple accents on neutral liquid glass
   ============================================================ */

@font-face {
    font-family: 'Friends';
    src: url('../fonts/Friends-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Friends';
    src: url('../fonts/Friends-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

:root {
    /* Sureserve corporate palette */
    --ss-deep:   #2d0a3d;   /* dark plum (nav/headings on sureserve.co.uk) */
    --ss-purple: #a32cc4;   /* vivid brand purple accent */
    --ss-vivid:  #b455ec;   /* bright purple (buttons) */
    --ss-light:  #d9a4f8;   /* light purple */
    --ss-paper:  #f9f9f9;

    /* deep plum liquid glass (opaque enough for readable text) */
    --glass-bg:      rgba(45, 8, 62, 0.72);
    --glass-bg-soft: rgba(45, 8, 62, 0.50);
    --glass-border:  rgba(255, 255, 255, 0.18);
    --glass-shadow:  0 8px 32px rgba(0, 0, 0, 0.38),
                     inset 0 1px 0 rgba(255, 255, 255, 0.20);
    --glass-blur:    blur(16px) saturate(1.2);

    --text:     #ffffff;
    --text-dim: rgba(255, 255, 255, 0.74);

    --radius: 18px;
    --topbar-h: 64px;
    --menu-w: 320px;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1); /* elastic overshoot */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #221f26;
    font-family: 'Friends', 'Segoe UI', Arial, sans-serif;
    color: var(--text);
}

#pano {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ---------- panorama loading ring ---------- */
.loader {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    pointer-events: none;
    opacity: 0;
    /* short delay so instant loads never flash the spinner */
    transition: opacity .25s ease .15s;
}
.loader.show { opacity: 1; }

.loader-bar {
    width: 168px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
}
.loader-bar-fill {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ss-purple), var(--ss-light));
    transition: width .12s linear;
}

.loader-disc {
    width: 92px;
    height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(45, 8, 62, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .4),
                inset 0 1px 0 rgba(255, 255, 255, .2);
}

.loader-ring {
    width: 56px;
    height: 56px;
    animation: loader-spin 1.2s linear infinite;
}
.loader-ring circle {
    stroke-dasharray: 90 36;
    animation: loader-dash 1.8s ease-in-out infinite;
}
@keyframes loader-spin {
    to { transform: rotate(360deg); }
}
@keyframes loader-dash {
    0%   { stroke-dasharray: 30 96; }
    50%  { stroke-dasharray: 95 31; }
    100% { stroke-dasharray: 30 96; }
}

/* ---------- glass primitive ---------- */
.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ---------- top bar ---------- */
.topbar {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--topbar-h);
    padding: 0 22px 0 14px;
    border-radius: var(--radius);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-logo { color: #fff; display: flex; align-items: center; }
.brand-logo svg { width: 158px; height: auto; display: block; }

.brand-divider {
    width: 1px;
    height: 26px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.5), transparent);
}

.brand-sub {
    font-weight: 600;
    font-size: 17px;
    letter-spacing: .4px;
    background: linear-gradient(90deg, var(--ss-light), var(--ss-vivid));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* hamburger */
.nav-toggle {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.10);
    cursor: pointer;
    transition: background .25s var(--ease);
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.20); }
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .3s var(--ease), opacity .3s var(--ease);
}
body.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- menu ---------- */
.menu {
    position: fixed;
    top: calc(16px + var(--topbar-h) + 12px);
    left: 16px;
    z-index: 25;
    width: var(--menu-w);
    /* height fits the content; caps at the viewport and scrolls inside */
    max-height: calc(100vh - var(--topbar-h) - 60px);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    transform: translateX(0);
    opacity: 1;
    transition: transform .55s var(--spring), opacity .3s var(--ease);
}
body:not(.menu-open) .menu {
    transform: translateX(calc(-100% - 40px));
    opacity: 0;
    pointer-events: none;
    transition: transform .4s var(--ease), opacity .3s var(--ease);
}

.menu-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 14px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .3) transparent;
}
.menu-scroll::-webkit-scrollbar { width: 5px; }
.menu-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .3); border-radius: 4px; }

.menu-intro {
    margin: 2px 8px 16px;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text-dim);
}

/* category accordion */
.cat {
    border-radius: 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    transition: background .3s var(--ease), border-color .3s var(--ease);
}
.cat.open {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.16);
}

.cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: none;
    background: none;
    color: var(--text);
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: .3px;
    text-align: left;
    cursor: pointer;
}

.cat-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--ss-light);
    background: rgba(255, 255, 255, 0.10);
    transition: background .3s var(--ease), color .3s var(--ease);
}
.cat-icon svg { width: 19px; height: 19px; }
.cat.open .cat-icon {
    color: #fff;
    background: linear-gradient(135deg, var(--ss-purple), var(--ss-vivid));
}

.cat-label { flex: 1; }

.cat-chevron {
    color: var(--text-dim);
    display: flex;
    transition: transform .5s var(--spring);
}
.cat-chevron svg { width: 16px; height: 16px; }
.cat.open .cat-chevron { transform: rotate(180deg); color: var(--ss-light); }

.cat-list {
    list-style: none;
    margin: 0;
    padding: 0 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .55s var(--spring), padding .55s var(--spring);
}
.cat.open .cat-list { max-height: 400px; padding: 2px 10px 12px; }

.cat-icon { transition: background .3s var(--ease), color .3s var(--ease), transform .5s var(--spring); }
.cat.open .cat-icon { transform: scale(1.08); }

.measure {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    margin: 2px 0;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.measure:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.measure.active {
    background: linear-gradient(90deg, var(--ss-purple), var(--ss-vivid));
    color: #fff;
}

.measure-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: background .25s var(--ease), box-shadow .25s var(--ease);
}
.measure.active .measure-dot,
.measure:hover .measure-dot {
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, .8);
}

.measure-video-badge {
    margin-left: auto;
    display: flex;
    color: var(--ss-light);
    opacity: .85;
}
.measure.active .measure-video-badge { color: #fff; }
.measure-video-badge svg { width: 13px; height: 13px; }

/* ---------- bottom-right stack (video CTA above info card) ---------- */
.stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}
.stack > * { pointer-events: auto; }

/* ---------- info card ---------- */
.info {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    padding: 22px 24px 20px;
    border-radius: var(--radius);
    animation: info-in .5s var(--ease);
}
@keyframes info-in {
    0%   { transform: translateY(28px) scale(.97); opacity: 0; }
    70%  { transform: translateY(-4px) scale(1.005); opacity: 1; }
    100% { transform: none; opacity: 1; }
}

.info-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .25s var(--ease);
}
.info-close:hover { background: rgba(255, 255, 255, .24); }

.info-cat {
    margin: 0 0 6px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--ss-light);
}
.info-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: .2px;
}
.info-desc {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- video CTA ---------- */
.video-cta {
    border-radius: var(--radius);
    overflow: hidden;
    animation: info-in .5s var(--ease);
}

.video-cta-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px 12px 12px;
    border: none;
    background: none;
    color: #fff;
    font-family: inherit;
    cursor: pointer;
}

.video-thumb {
    position: relative;
    width: 124px;
    height: 70px;
    flex: 0 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #17151b;
}
.video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.video-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .22);
    transition: background .25s var(--ease);
}
.video-play svg {
    width: 28px;
    height: 28px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
    transition: transform .25s var(--ease);
}
.video-cta-btn:hover .video-play { background: rgba(163, 44, 196, .30); }
.video-cta-btn:hover .video-play svg { transform: scale(1.15); }

.video-cta-text { text-align: left; }
.video-cta-text strong {
    display: block;
    font-size: 15.5px;
    font-weight: 600;
}
.video-cta-text small {
    display: block;
    margin-top: 2px;
    font-size: 13.5px;
    color: var(--text-dim);
}

/* ---------- video modal ---------- */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 13, 18, .65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.video-modal-panel {
    position: relative;
    width: min(960px, 100%);
    border-radius: var(--radius);
    padding: 14px;
    animation: modal-in .45s var(--spring);
}
@keyframes modal-in {
    from { transform: scale(.9); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.video-modal-panel video {
    width: 100%;
    max-height: min(72vh, 640px);
    display: block;
    border-radius: 12px;
    background: #000;
}
/* subtitle bar under the video */
.video-modal-subs {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6em;
    margin: 12px auto 0;
    max-width: 92%;
    text-align: center;
    font-size: 16.5px;
    font-weight: 500;
    line-height: 1.4;
    white-space: pre-line;
    color: #fff;
    opacity: 0;
    transition: opacity .15s var(--ease);
}
.video-modal-subs.show {
    opacity: 1;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}

.video-modal-title {
    margin: 8px 6px 4px;
    font-size: 15px;
    font-weight: 600;
}
.video-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ss-purple), var(--ss-vivid));
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
    transition: transform .25s var(--ease);
}
.video-modal-close:hover { transform: scale(1.1) rotate(90deg); }

/* ---------- app modal (HomeLINK resident app: image + text) ---------- */
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 13, 18, .65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.app-modal-panel {
    position: relative;
    display: flex;
    gap: 24px;
    width: min(900px, 100%);
    max-height: min(86vh, 720px);
    border-radius: var(--radius);
    padding: 22px;
    animation: modal-in .45s var(--spring);
}
.app-modal-media { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.app-modal-media img {
    max-height: min(72vh, 620px);
    max-width: 320px;
    width: auto;
    display: block;
    border-radius: 14px;
    background: #000;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}
.app-modal-text {
    flex: 1 1 auto;
    min-width: 0;
    align-self: center;
    overflow-y: auto;
    padding-right: 4px;
}
.app-modal-title {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    background: linear-gradient(90deg, var(--ss-light), var(--ss-vivid));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.app-modal-body p {
    margin: 0 0 12px;
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .85);
}
.app-modal-body p:last-child { margin-bottom: 0; }
.app-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ss-purple), var(--ss-vivid));
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
    transition: transform .25s var(--ease);
}
.app-modal-close:hover { transform: scale(1.1) rotate(90deg); }

@media (max-width: 760px) {
    .app-modal { padding: 12px; }
    .app-modal-panel { flex-direction: column; gap: 16px; padding: 18px; overflow-y: auto; }
    .app-modal-media img { max-height: 40vh; max-width: 220px; margin: 0 auto; }
    .app-modal-title { font-size: 19px; }
    .app-modal-close { top: -10px; right: -6px; }
}

/* ---------- in-pano leader-line callout ---------- */
.callout-svg,
.callout-html {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    overflow: visible;
    opacity: 0;
    transition: opacity .45s ease;
}
.callout-svg.is-visible,
.callout-html.is-visible { opacity: 1; }
.callout-svg { width: 100%; height: 100%; }

.tech-dot {
    fill: #fff;
    filter: drop-shadow(0 0 6px var(--ss-light));
}
.tech-pulse {
    fill: none;
    stroke: var(--ss-light);
    stroke-width: 2;
    transform-origin: center;
    animation: techPulse 2s ease-out infinite;
}
@keyframes techPulse {
    0%   { r: 8px;  opacity: .85; }
    100% { r: 42px; opacity: 0; }
}

.tech-line {
    fill: none;
    stroke: rgba(255, 255, 255, .85);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.tech-callout-chip-wrapper { position: absolute; }
.tech-callout-chip {
    padding: 9px 15px;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
    color: #fff;
    background: var(--glass-bg);
    border: 1px solid rgba(180, 85, 236, .45);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45), 0 0 12px rgba(180, 85, 236, .25);
}
.tech-callout-chip-wrapper.right .tech-callout-chip { transform: translate(0, -100%);       margin: -5px 0 0 5px; }
.tech-callout-chip-wrapper.left  .tech-callout-chip { transform: translate(-100%, -100%);    margin: -5px 5px 0 0; }

/* clickable callout — Home Survey intro entry point */
.tech-callout-chip.clickable {
    pointer-events: auto;
    cursor: pointer;
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.tech-callout-chip.clickable:hover {
    border-color: rgba(211, 54, 234, .85);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .5), 0 0 18px rgba(180, 85, 236, .5);
}
.tech-dot.clickable { pointer-events: auto; cursor: pointer; }

/* ---------- Home Survey: visualise-disruption toggle ---------- */
.disruption {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px 10px 18px;
    border-radius: var(--radius);
}
.disruption-label {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: .3px;
    color: #fff;
    white-space: nowrap;
}
.switch {
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}
.switch-track {
    position: relative;
    display: block;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .25);
    transition: background .3s var(--ease), border-color .3s var(--ease);
}
.switch-knob {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
    transition: left .3s var(--spring);
}
.disruption.on .switch-track {
    background: linear-gradient(90deg, var(--ss-purple), var(--ss-vivid));
    border-color: transparent;
}
.disruption.on .switch-knob { left: 23px; }

/* ---------- dev coordinate bar ---------- */
.devbar {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 60;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-family: Consolas, monospace;
    cursor: pointer;
    user-select: none;
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
    :root { --topbar-h: 56px; --menu-w: min(86vw, 330px); }

    .topbar { top: 10px; left: 10px; right: auto; padding-right: 16px; }
    .brand-logo svg { width: 124px; }
    .brand-sub { font-size: 15px; }

    .menu {
        top: calc(10px + var(--topbar-h) + 10px);
        left: 10px;
        max-height: calc(100vh - var(--topbar-h) - 40px);
    }

    .stack {
        right: 10px;
        left: 10px;
        bottom: 10px;
    }

    /* drop the toggle below the top bar so it never overlaps the brand */
    .disruption {
        top: calc(10px + var(--topbar-h) + 10px);
        padding: 8px 10px 8px 14px;
        gap: 10px;
    }
    .disruption-label { font-size: 13.5px; }
    .info {
        width: 100%;
        padding: 18px 20px 16px;
    }
    .info-title { font-size: 21px; }
    .info-desc { font-size: 15px; }

    .video-thumb { width: 96px; height: 56px; }

    .video-modal { padding: 10px; }
    .video-modal-close { top: -10px; right: -6px; }
    .video-modal-subs { font-size: 15px; min-height: 2.4em; }
}

@media (max-width: 760px) and (max-height: 500px) {
    /* landscape phones: tuck the stack to the right */
    .stack { left: auto; }
    .info { width: min(360px, calc(100vw - 20px)); }
}
