/* Homemaker Services: the signature section, "Room by room".

   A drawn house, cut open like a doll's house: laundry and bedroom upstairs, kitchen and living room
   downstairs, the roof in the brand's plum with a gold trim, lavender growing by the wall. Each room is
   a link to its short list, so without scripts the drawing is a small map and the four lists sit beside
   it, all open.

   pages/homemaker.js adds .rm--live and turns the four rooms into tabs (one tab stop, arrow keys move
   between rooms). The chosen room lights up, the others fade back, and the homemaker's seal (the mop,
   as on the hero) walks to it along the gold dotted route of a visit: kitchen, laundry, bedroom, living
   room. "Next room" under the list follows the same order. The seal moves with transform, the light
   with opacity: nothing else animates. With reduced motion every change is immediate.

   The drawing is an SVG in a 640 x 600 box; the rooms (links) and the seal sit over it in percentages
   of that box, so they stay on their rooms at every width. */

.rm { overflow-x: clip; }
.rm__stage { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2.5rem, 6vw, 7rem); align-items: center; }

/* ---------- the house ---------- */
.rm__house { position: relative; justify-self: center; width: min(100%, 41rem); }
.rm__plan { position: relative; aspect-ratio: 640 / 600; }
.rm__draw { display: block; width: 100%; height: 100%; overflow: visible; }
.rm__ground { fill: none; stroke: rgba(200, 144, 48, .75); stroke-width: 2; }
.rm__roof { fill: var(--purple); }
.rm__trim { fill: none; stroke: var(--gold-light); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.rm__oculus { fill: #F6E9D8; stroke: var(--gold-light); stroke-width: 2.5; }
.rm__body { fill: #FFFBF4; }
.rm__lit { fill: url(#rm-lit); opacity: 0; transition: opacity 380ms ease; }
.rm__route { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: .1 11; }
.rm__f { fill: none; stroke: var(--purple-mid); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 380ms ease; }
.rm__steam { stroke: var(--gold); }
.rm__wall { fill: none; stroke: var(--purple); stroke-width: 4.5; stroke-linecap: square; stroke-linejoin: miter; }

/* lavender by the wall */
.rm__stems { position: absolute; right: -9%; bottom: 6.6%; z-index: 2; width: 13%; height: 54%; pointer-events: none; }
.rm__stem { --r: 0deg; position: absolute; bottom: 0; transform: rotate(var(--r)); transform-origin: 50% 100%; }
.rm__stem img { height: 100%; width: auto; max-width: none; filter: drop-shadow(0 12px 12px rgba(43, 16, 48, .22)); }
.rm__stem--a { --r: -6deg; left: 4%; height: 100%; }
.rm__stem--b { --r: 7deg; left: 34%; height: 80%; }
.rm__stem--c { --r: 16deg; left: 58%; height: 63%; }

/* ---------- the rooms: links over the drawing (tabs once the script runs) ---------- */
.rm__rooms { position: absolute; inset: 0; }
.rm__room { position: absolute; width: 39.0625%; height: 30%; border-radius: .3rem; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.rm__room--kitchen { left: 10.9375%; top: 63.3333%; }
.rm__room--laundry { left: 10.9375%; top: 33.3333%; }
.rm__room--bedroom { left: 50%; top: 33.3333%; }
.rm__room--living { left: 50%; top: 63.3333%; }
.rm__tag { position: absolute; left: .5rem; top: .5rem; display: inline-flex; align-items: center; min-height: 2.25rem; padding: .2rem .9rem; border: 1px solid rgba(78, 26, 88, .42); border-radius: 999px; background: #FFFBF4; box-shadow: 0 8px 14px -10px rgba(43, 16, 48, .55); font-size: .9375rem; font-weight: 600; line-height: 1.1; white-space: nowrap; color: var(--purple); transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, transform 160ms var(--ease-out); }
.rm__room:focus-visible { outline: 3px solid var(--purple); outline-offset: -4px; }
.rm__room:active .rm__tag { transform: scale(.95); }
.rm__room[aria-selected="true"] .rm__tag { border-color: var(--purple); background: var(--purple); color: var(--cream); }
@media (hover: hover) and (pointer: fine) {
  .rm__room:hover .rm__tag { border-color: var(--purple); }
  .rm--live .rm__plan:has(.rm__room--kitchen:hover) .rm__lit:nth-child(1):not(.is-on),
  .rm--live .rm__plan:has(.rm__room--laundry:hover) .rm__lit:nth-child(2):not(.is-on),
  .rm--live .rm__plan:has(.rm__room--bedroom:hover) .rm__lit:nth-child(3):not(.is-on),
  .rm--live .rm__plan:has(.rm__room--living:hover) .rm__lit:nth-child(4):not(.is-on) { opacity: .5; }
}

/* ---------- the homemaker's seal, walking the route ---------- */
.rm__walker { --mx: 30.625%; --my: 75.3333%; position: absolute; inset: 0; z-index: 3; pointer-events: none; transform: translate(var(--mx), var(--my)); transition: transform 780ms var(--ease-in-out); }
.rm__stage:not(.rm--live) .rm__walker { display: none; }
.rm--live[data-room="1"] .rm__walker { --mx: 30.625%; --my: 46%; }
.rm--live[data-room="2"] .rm__walker { --mx: 61.875%; --my: 46%; }
.rm--live[data-room="3"] .rm__walker { --mx: 61.875%; --my: 75.3333%; }
.rm__seal { --d: clamp(2.75rem, 5.4vw, 3.6rem); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2); border-radius: 50%; background: radial-gradient(circle at 50% 34%, #5C2567 0%, var(--aub-2) 72%); box-shadow: 0 0 0 1px rgba(232, 181, 82, .85), 0 0 0 .28rem #FFFBF4, 0 14px 20px -8px rgba(43, 16, 48, .6); }
.rm__seal .lottie { width: 70%; height: 70%; }

/* ---------- live: the chosen room is lit, the others step back ---------- */
.rm--live .rm__f { opacity: .4; }
.rm--live .rm__f.is-on { opacity: 1; }
.rm--live .rm__lit.is-on { opacity: 1; }

/* ---------- the lists ---------- */
.rm__texts { display: grid; gap: 2.25rem; }
.rm__text { padding-top: 1.4rem; border-top: 1px solid rgba(200, 144, 48, .6); }
.rm__text h3 { color: var(--purple); }
.rm__text p { max-width: 34rem; margin-top: .9rem; font-size: clamp(1.1875rem, .3vw + 1.12rem, 1.3125rem); line-height: 1.62; }
.rm__count { display: none; }
.rm__next { display: none; }

.rm--live .rm__count { display: block; margin-bottom: 1.1rem; font-size: .9375rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-deep); }
.rm--live .rm__texts { grid-template-areas: "room"; gap: 0; }
.rm--live .rm__text { grid-area: room; padding-top: 0; border-top: 0; visibility: hidden; opacity: 0; transform: translateY(.75rem); transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms; }
.rm--live .rm__text.is-on { visibility: visible; opacity: 1; transform: none; transition: opacity 420ms ease 120ms, transform 640ms var(--ease-out) 100ms, visibility 0s; }
.rm--live .rm__text h3 { font-size: clamp(2.25rem, 3.4vw, 3.125rem); line-height: 1.05; }
.rm--live .rm__text p { margin-top: 1.1rem; }
.rm--live .rm__next { display: inline-flex; margin-top: 2rem; }
.rm__next svg { width: 1.25rem; height: 1.25rem; flex: none; }

/* ---------- live: the section's own entrance (the script adds .is-in when the house is in view) ---------- */
.rm--live:not(.is-in) .rm__plan { clip-path: inset(100% -6% 0 -6%); }
.rm--live.is-in .rm__plan { clip-path: inset(-6% -6% -6% -6%); transition: clip-path 1200ms var(--rv-ease-soft); }
.rm--live:not(.is-in) .rm__stem { opacity: 0; transform: rotate(var(--r)) scaleY(.35); }
.rm--live.is-in .rm__stem { transition: opacity 500ms ease 450ms, transform 1300ms var(--rv-ease-soft) 450ms; }
.rm--live:not(.is-in) .rm__seal { opacity: 0; transform: scale(.7); }
.rm--live.is-in .rm__seal { transition: opacity 420ms ease 1000ms, transform 720ms var(--rv-ease-settle) 1000ms; }
.rm--live:not(.is-in) .rm__panel { opacity: 0; transform: translateY(1.5rem); }
.rm--live.is-in .rm__panel { transition: opacity 700ms var(--rv-ease) 250ms, transform 900ms var(--rv-ease) 250ms; }

/* ---------- "What is included" and "Room by room" are both cream here: a gold hairline marks the turn ---------- */
.sv-inc.cream + .rm.cream::before { content: ""; position: absolute; left: 50%; top: 0; width: min(100% - 2 * var(--gutter), var(--wrap)); height: 1px; transform: translateX(-50%); background: linear-gradient(90deg, rgba(200, 144, 48, 0), rgba(200, 144, 48, .6) 12%, rgba(200, 144, 48, .6) 88%, rgba(200, 144, 48, 0)); }

/* ---------- "Who it helps": the two closing lines under the list ---------- */
.sv-who__after { margin-top: 2rem; }

@media (max-width: 1023px) {
  .rm__stage { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .rm__house { width: min(100%, 36rem); }
  .rm__panel { justify-self: stretch; width: min(100%, 40rem); margin-inline: auto; }
}
@media (max-width: 559px) {
  .rm__tag { left: .3rem; top: .3rem; min-height: 2rem; padding: .15rem .65rem; }
  /* on a phone the room names take more of each room: the seal stands lower, by the washer, the bed,
     the stove and the chair, and the dotted route steps aside */
  .rm__route { display: none; }
  .rm--live[data-room="0"] .rm__walker { --mx: 30.625%; --my: 84%; }
  .rm--live[data-room="1"] .rm__walker { --mx: 30.625%; --my: 54%; }
  .rm--live[data-room="2"] .rm__walker { --mx: 61.875%; --my: 54%; }
  .rm--live[data-room="3"] .rm__walker { --mx: 61.875%; --my: 84%; }
  .rm__seal { box-shadow: 0 0 0 1px rgba(232, 181, 82, .85), 0 0 0 .2rem #FFFBF4, 0 10px 14px -6px rgba(43, 16, 48, .6); }
  .rm--live .rm__next { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rm__walker, .rm__lit, .rm__f, .rm__tag { transition: none; }
  .rm--live .rm__text, .rm--live .rm__text.is-on { transform: none; transition: opacity 200ms ease, visibility 0s; }
}
