/* ═══════════════════════════════════════════════════════════════════
   #villa — Smart villa automation (index.html)
   A live villa: tap a device tile (lights, lock, garage, climate,
   curtains, blinds, AI cameras) or a scene (Welcome home, Good night,
   Away) and the house answers — the garage rolls up, the car drives in,
   windows light, curtains draw, the blind rolls, the AI camera tags what
   it sees. The message: we automate the villa you already have, with
   small add-ons and no new wall wiring.

   State lives in data-* attributes on .vl-stage (set by js/villa.js), so
   every visual here is plain CSS. Light by default, night look under
   [data-theme="glass"]. Brand palette only; the section tone comes from
   tones.css like every other homepage band.
   ═══════════════════════════════════════════════════════════════════ */
.villa-section {
    --vl-sky-a: #d8f3f6; --vl-sky-b: #fbf3ff;
    --vl-wall: #ffffff; --vl-wall-2: #f6f1fb; --vl-edge: rgba(52,71,103,0.22);
    --vl-slab: #344767; --vl-glass: #cfdcea; --vl-mullion: rgba(52,71,103,0.35);
    --vl-int: #2a2c4a; --vl-ground: #e9e2d4; --vl-lawn: #9fdcc6;
    --vl-door: #8A328A; --vl-cloth: #C77DBA; --vl-blind: #e9e3f2; --vl-gdoor: #e6e9f1;
    --vl-trunk: #9b7b5b; --vl-frond: #2f9e6b;
    --vl-card: var(--tn-card, #ffffff);
    --vl-tile: rgba(255,255,255,0.86);
    --vl-tile-on: linear-gradient(135deg, rgba(0,201,198,0.16), rgba(138,50,138,0.14));
}
[data-theme="glass"] .villa-section {
    --vl-sky-a: #101634; --vl-sky-b: #241645;
    --vl-wall: #2d3158; --vl-wall-2: #363a68; --vl-edge: rgba(255,255,255,0.10);
    --vl-slab: #121630; --vl-glass: #151b38; --vl-mullion: rgba(255,255,255,0.16);
    --vl-int: #0b0d1d; --vl-ground: #1d2142; --vl-lawn: #134a3f;
    --vl-door: #a04aa0; --vl-cloth: #7d3a83; --vl-blind: #4a4478; --vl-gdoor: #3a3f6b;
    --vl-trunk: #6b5641; --vl-frond: #1f7c5a;
    --vl-tile: rgba(255,255,255,0.06);
    --vl-tile-on: linear-gradient(135deg, rgba(94,234,212,0.18), rgba(255,177,255,0.16));
}

.vl-wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: stretch; }

/* ── the stage card ── */
.vl-stage {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 26px; background: var(--vl-card); border: 1px solid var(--sx-line);
    box-shadow: var(--sx-shadow-lg);
}
.vl-house { display: block; width: 100%; height: auto; }
.vl-scenes { order: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid var(--sx-line); }
.vl-scene {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--sx-line); background: var(--vl-tile); color: var(--sx-ink);
    font: 800 .86rem/1 var(--font-heading, system-ui, sans-serif); transition: transform .2s, box-shadow .2s, background .2s;
}
.vl-scene .material-icons-round { font-size: 18px; color: var(--sx-pink); }
.vl-scene:hover { transform: translateY(-2px); box-shadow: var(--sx-shadow); }
.vl-scene.is-on { background: linear-gradient(135deg, #00C9C6 0%, #8A328A 75%); color: #fff; border-color: transparent; }
.vl-scene.is-on .material-icons-round { color: #fff; }
.vl-scene:focus-visible, .vl-tile:focus-visible { outline: 2px solid #00C9C6; outline-offset: 2px; }

.vl-badge {
    position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; margin: 0;
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
    background: var(--sx-badge); border: 1px solid var(--sx-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    font: 800 .78rem/1 var(--font-heading, system-ui, sans-serif); letter-spacing: .4px; color: var(--sx-ink);
}
.vl-badge .material-icons-round { font-size: 16px; color: var(--sx-teal); }

/* phone-style notification for each scene */
.vl-note {
    position: absolute; top: 14px; inset-inline-start: 14px; z-index: 3; width: min(310px, 62%);
    padding: 10px 13px; border-radius: 16px; background: var(--sx-badge); border: 1px solid var(--sx-line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--sx-shadow);
    opacity: 0; transform: translateY(-14px) scale(.97); transition: opacity .3s, transform .4s cubic-bezier(.3,1.4,.5,1); pointer-events: none;
}
.vl-note.on { opacity: 1; transform: none; }
.vl-note-app { display: flex; align-items: center; gap: 6px; font: 800 .72rem/1 var(--font-heading, system-ui, sans-serif); color: var(--sx-mute); letter-spacing: .4px; margin-bottom: 5px; }
.vl-note p { display: none; margin: 0; font-size: .84rem; line-height: 1.4; color: var(--sx-ink); font-weight: 600; }
.vl-note[data-show="welcome"] [data-note="welcome"], .vl-note[data-show="night"] [data-note="night"], .vl-note[data-show="away"] [data-note="away"] { display: block; }

/* ── the villa drawing ── */
.vl-house .vl-sky-a { stop-color: var(--vl-sky-a); }
.vl-house .vl-sky-b { stop-color: var(--vl-sky-b); }
.vl-sun-glow { fill: #FFF7D6; opacity: .9; }
.vl-sun-core { fill: #FFE9A8; }
[data-theme="glass"] .vl-sun { opacity: 0; }
.vl-nightsky { opacity: 0; transition: opacity 1.2s ease; }
.vl-dusk { fill: #120f2e; opacity: .55; }
.vl-moon { fill: #FFF7D6; }
.vl-stars circle { fill: #FFF7D6; animation: vl-twinkle 3s ease-in-out infinite; }
.vl-stars circle:nth-child(2n) { animation-delay: -1.2s; }
.vl-stars circle:nth-child(3n) { animation-delay: -2.1s; }
@keyframes vl-twinkle { 50% { opacity: .3; } }
[data-theme="glass"] .vl-nightsky { opacity: .75; }
[data-theme="glass"] .vl-dusk { opacity: .25; }
.vl-stage[data-sky="night"] .vl-nightsky { opacity: 1; }
.vl-sun { transition: opacity 1s; }
.vl-stage[data-sky="night"] .vl-sun { opacity: 0; }

.vl-trunk { fill: none; stroke: var(--vl-trunk); stroke-width: 7; stroke-linecap: round; }
.vl-frond { fill: none; stroke: var(--vl-frond); stroke-width: 6; stroke-linecap: round; }
.vl-palm { transform-box: fill-box; transform-origin: 50% 100%; animation: vl-sway 6s ease-in-out infinite; }
@keyframes vl-sway { 50% { transform: rotate(1.6deg); } }
.vl-ground { fill: var(--vl-ground); }
.vl-lawn { fill: var(--vl-lawn); }
.vl-wall { fill: var(--vl-wall); stroke: var(--vl-edge); stroke-width: 1.5; }
.vl-wall-2 { fill: var(--vl-wall-2); }
.vl-slab { fill: var(--vl-slab); }
.vl-int { fill: var(--vl-int); }
.vl-glass { fill: var(--vl-glass); stroke: var(--vl-edge); stroke-width: 1.5; }
.vl-mullion { stroke: var(--vl-mullion); stroke-width: 2.5; fill: none; }
.vl-door { fill: var(--vl-door); }
.vl-door-panel { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 2; }
.vl-lock-body { fill: #1c1a3c; }
.vl-sconce { fill: var(--vl-slab); }
.vl-cord { stroke: var(--vl-mullion); stroke-width: 1.5; }
.vl-bulb { fill: var(--vl-mullion); transition: fill .4s; }
.vl-rail { stroke: var(--vl-slab); stroke-width: 3; stroke-linecap: round; }
.vl-cloth { fill: var(--vl-cloth); opacity: .92; }
.vl-fold { stroke: rgba(0,0,0,0.12); stroke-width: 2; }
.vl-blind-cloth { fill: var(--vl-blind); }
.vl-slat { stroke: rgba(52,71,103,0.18); stroke-width: 1.5; }
.vl-blind-bar { fill: var(--vl-slab); }
.vl-gdoor-panel { fill: var(--vl-gdoor); stroke: var(--vl-edge); stroke-width: 1.5; }
.vl-gdoor-slat { stroke: rgba(52,71,103,0.20); stroke-width: 1.5; }
.vl-car-win { fill: rgba(255,255,255,0.75); }
.vl-tyre { fill: #1c1a3c; }
.vl-hub { fill: #c9cde0; }
.vl-car-light { fill: #FFF7D6; }
.vl-pkg-box { fill: #d9a86c; }
.vl-pkg-tape { stroke: #FFF7D6; stroke-width: 2; }

/* lights: every window glows in turn */
.vl-glow { opacity: 0; transition: opacity .6s ease var(--d, 0s); }
.vl-stage[data-lights="on"] .vl-glow { opacity: 1; }
.vl-stage[data-lights="on"] .vl-bulb { fill: #FFF7D6; filter: drop-shadow(0 0 6px #FFE9A8); }
.vl-stage[data-lights="on"] .vl-sconce { fill: #FFF7D6; }

/* door lock: the padlock shackle and the LED */
.vl-pad { fill: #1c1a3c; }
.vl-pad-hole { fill: #FFF7D6; }
.vl-shackle { stroke: #1c1a3c; stroke-width: 3.4; stroke-linecap: round; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
[data-theme="glass"] .vl-pad, [data-theme="glass"] .vl-lock-body { fill: #FFF7D6; }
[data-theme="glass"] .vl-pad-hole { fill: #1c1a3c; }
[data-theme="glass"] .vl-shackle { stroke: #FFF7D6; }
.vl-lock-led { fill: #00C9C6; filter: drop-shadow(0 0 3px #00C9C6); transition: fill .3s; }
.vl-stage[data-lock="off"] .vl-shackle { transform: translate(5px, -6px); }
.vl-stage[data-lock="off"] .vl-lock-led { fill: #FFB1FF; filter: drop-shadow(0 0 3px #FFB1FF); }
.vl-padlock { transform-box: fill-box; transform-origin: center; }
.vl-padlock.bump { animation: vl-bump .4s cubic-bezier(.3,1.6,.5,1); }
@keyframes vl-bump { 40% { transform: scale(1.25); } }

/* garage: the door rolls up into the lintel */
.vl-gdoor { transform-box: fill-box; transform-origin: 50% 0; transition: transform 1s cubic-bezier(.45,0,.25,1); }
.vl-stage[data-garage="on"] .vl-gdoor { transform: scaleY(.06); }
.vl-garage-light { transition-delay: 0s; }
.vl-stage[data-garage="on"] .vl-garage-light { opacity: 1; }

/* the car: off stage → at the gate → parked */
.vl-car-g { transition: transform 1.5s cubic-bezier(.45,0,.25,1); }
.vl-stage[data-car="off"] .vl-car-g { transform: translateX(720px); }
.vl-stage[data-car="gate"] .vl-car-g { transform: translateX(548px); }
.vl-stage[data-car="in"] .vl-car-g { transform: translateX(-8px); }
.vl-stage.no-anim .vl-car-g { transition: none; }

/* curtains draw to the sides; the blind rolls up */
.vl-curtain { transform-box: fill-box; transition: transform 1.1s cubic-bezier(.45,0,.25,1); }
.vl-curtain-l { transform-origin: 0 50%; }
.vl-curtain-r { transform-origin: 100% 50%; }
.vl-stage[data-curtains="on"] .vl-curtain { transform: scaleX(.14); }
.vl-blind { transform-box: fill-box; transform-origin: 50% 0; transition: transform 1.1s cubic-bezier(.45,0,.25,1); }
.vl-stage[data-blinds="on"] .vl-blind { transform: scaleY(.1); }

/* climate: the thermostat ring fills and cool air drifts */
.vl-thermo-face { fill: var(--vl-slab); }
.vl-thermo-ring { fill: none; stroke: rgba(255,255,255,0.18); stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-box: fill-box; transform-origin: center; transition: stroke-dashoffset .9s ease, stroke .3s; }
.vl-thermo text { font: 800 12px/1 var(--font-heading, system-ui, sans-serif); fill: #FFF7D6; }
.vl-thermo-on { opacity: 0; }
.vl-stage[data-climate="on"] .vl-thermo-ring { stroke: #00C9C6; stroke-dashoffset: 30; }
.vl-stage[data-climate="on"] .vl-thermo-on { opacity: 1; }
.vl-stage[data-climate="on"] .vl-thermo-off { opacity: 0; }
.vl-air { fill: none; stroke: #00C9C6; stroke-width: 2.4; stroke-linecap: round; opacity: 0; transition: opacity .6s; }
.vl-stage[data-climate="on"] .vl-air { opacity: .85; animation: vl-air 2.4s linear infinite; }
@keyframes vl-air { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
.vl-air path { stroke-dasharray: 6 5; }
.vl-stage[data-blinds="off"] .vl-air-2 { opacity: 0; }

/* AI cameras: watch cones, a sweeping scan line, tags on what they see */
.vl-cam-body { fill: var(--vl-slab); }
[data-theme="glass"] .vl-cam-body { fill: #FFF7D6; }
.vl-cam-led { fill: #666b85; }
.vl-cam-cones { opacity: 0; transition: opacity .5s; }
.vl-sweep { stroke: #00C9C6; stroke-width: 2; opacity: .5; transform-box: view-box; transform-origin: 588px 160px; animation: vl-sweep 3.2s ease-in-out infinite alternate; }
@keyframes vl-sweep { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }
.vl-stage[data-cams="on"] .vl-cam-cones { opacity: 1; }
.vl-stage[data-cams="on"] .vl-cam-led { fill: #FFB1FF; filter: drop-shadow(0 0 3px #FFB1FF); animation: vl-rec 1.4s steps(2) infinite; }
@keyframes vl-rec { 50% { opacity: .35; } }
.vl-ai { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(1.08); transition: opacity .3s, transform .4s cubic-bezier(.3,1.5,.5,1); }
.vl-ai-corner { fill: none; stroke: #00C9C6; stroke-width: 3; stroke-linecap: round; }
.vl-ai-tag { fill: #00C9C6; }
.vl-ai-txt { font: 800 11px/1 var(--font-heading, system-ui, sans-serif); fill: #0b1221; }
.vl-stage[data-ai="car"] .vl-ai-car, .vl-stage[data-ai="pkg"] .vl-ai-pkg { opacity: 1; transform: none; }
.vl-pkg { opacity: 0; transform: translateY(-14px); transition: opacity .3s, transform .5s cubic-bezier(.3,1.5,.5,1); }
.vl-stage[data-pkg="on"] .vl-pkg { opacity: 1; transform: none; }

/* ── the control side ── */
.vl-side { display: flex; flex-direction: column; gap: 14px; }
.vl-side-title { margin: 0; font: 800 .8rem/1.2 var(--font-heading, system-ui, sans-serif); letter-spacing: 1.8px; text-transform: uppercase; color: var(--sx-mute); }
.vl-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vl-tile {
    position: relative; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 11px; align-items: center;
    padding: 12px 13px; border-radius: 18px; cursor: pointer; text-align: start;
    border: 1px solid var(--sx-line); background: var(--vl-tile); color: var(--sx-ink);
    transition: transform .2s, box-shadow .25s, background .25s, border-color .25s;
}
.vl-tile:hover { transform: translateY(-2px); box-shadow: var(--sx-shadow); }
.vl-tile > .material-icons-round {
    grid-row: 1 / 3; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; font-size: 22px;
    background: var(--sx-track); color: var(--sx-mute); transition: background .25s, color .25s, box-shadow .25s;
}
.vl-tile b { font: 800 .95rem/1.15 var(--font-heading, system-ui, sans-serif); }
.vl-tile small { font-size: .78rem; line-height: 1.3; color: var(--sx-mute); font-weight: 600; }
.vl-tile[aria-pressed="true"] { background: var(--vl-tile-on); border-color: rgba(0,201,198,0.45); }
.vl-tile[aria-pressed="true"] > .material-icons-round { background: linear-gradient(135deg, #00C9C6, #8A328A); color: #fff; box-shadow: 0 8px 18px -8px rgba(0,201,198,0.8); }
.vl-tile[aria-pressed="true"] small { color: var(--sx-teal); }
.vl-tile[aria-pressed="true"] .vl-off, .vl-tile[aria-pressed="false"] .vl-on { display: none; }
.vl-tile-wide { grid-column: 1 / -1; }
/* a little "switch" in the corner of each tile */
.vl-tile::after {
    content: ''; position: absolute; top: 12px; inset-inline-end: 12px; width: 26px; height: 15px; border-radius: 999px;
    background: radial-gradient(circle 5.5px at 7.5px 50%, #fff 96%, transparent) no-repeat, var(--sx-outline);
    transition: background-position .25s, background-color .25s;
}
.vl-tile[aria-pressed="true"]::after { background: radial-gradient(circle 5.5px at 18.5px 50%, #fff 96%, transparent) no-repeat, #00C9C6; }
.vl-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: auto; padding-top: 6px; }

/* ── the four promises ── */
.vl-points { list-style: none; margin: 34px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.vl-points li { display: grid; gap: 6px; padding: 18px; border-radius: 20px; background: var(--vl-tile); border: 1px solid var(--sx-line); }
.vl-points .material-icons-round { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; font-size: 22px; color: #fff; background: linear-gradient(135deg, #00C9C6, #8A328A); margin-bottom: 4px; }
.vl-points li:first-child { border-color: rgba(0,201,198,0.5); box-shadow: 0 0 0 3px rgba(0,201,198,0.12); }
.vl-points b { font: 800 1rem/1.25 var(--font-heading, system-ui, sans-serif); color: var(--sx-ink); }
.vl-points small { font-size: .88rem; line-height: 1.5; color: var(--sx-soft); }

@media (max-width: 1024px) {
    .vl-wrap { grid-template-columns: 1fr; }
    .vl-points { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .vl-points { grid-template-columns: 1fr; }
    .vl-badge { top: 10px; inset-inline-end: 10px; font-size: .66rem; padding: 5px 9px; gap: 4px; }
    .vl-badge .material-icons-round { font-size: 13px; }
    /* on phones the notification sits under the house instead of over it */
    .vl-note { order: 1; position: relative; top: auto; inset-inline-start: auto; width: auto; margin: 0 12px 12px; display: none; }
    .vl-note.on { display: block; }
    .vl-scenes { gap: 6px; padding: 12px; }
    .vl-scene { padding: 8px 11px; font-size: .78rem; gap: 5px; }
    .vl-scene .material-icons-round { font-size: 16px; }
    .vl-tiles { gap: 8px; }
    .vl-tile { grid-template-columns: 34px 1fr; column-gap: 9px; padding: 10px; border-radius: 15px; }
    .vl-tile > .material-icons-round { width: 34px; height: 34px; font-size: 19px; border-radius: 11px; }
    .vl-tile b { font-size: .86rem; }
    .vl-tile small { font-size: .72rem; }
    .vl-tile::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .villa-section *, .villa-section *::after { transition-duration: .01s !important; animation: none !important; }
}
