/* sol · web · home: "your way" (sitio/plantillas/vistas.html; behaviour in sitio/js/vistas.js).
   Built on tokens.css, base.css and componentes.css (.section, .section-head, .frame-laptop), and on the home's round
   pause button (inicio.css .in-round, .in-motion). Classes start with "vs-".
   No inline styles (CSP): every change of state is a class or an ARIA attribute set by vistas.js.
   Four layouts of the same parts (laptop, captions, Settings panel, pause):
   · narrow: one column; the captions under the laptop, then the panel, then the pause (right, under the panel);
   · 900 px and up: the panel beside the laptop, the pause under it, the captions under the laptop;
   · phones held sideways: the same, with the captions and the pause under the panel, so it all fits under the header;
   · 1180 px and up: the panel over the laptop's top right corner, where the app's own Settings panel opens; the captions
     and the pause under the laptop.
   From 900 px, in a short window (a laptop screen inside the browser's toolbars) the laptop narrows so the whole stage
   fits under the header: the tour runs only while the panel, the laptop and the pause are all in sight (vistas.js). */

.vs {
  --vs-fade: .65s; --vs-panel-w: 20.625rem; /* panel: 22em at its 15 px */
  --vs-gap: clamp(18px, 2.4vw, 28px);       /* the stage's row gap */
  --vs-lid: clamp(8px, 1vw, 14px); --vs-base: clamp(10px, 1.4vw, 18px); /* componentes.css .frame-laptop: lid padding, frame below */
  /* the height a screenshot may have so the whole stage fits under the header with 16 px above and below: the lid, the
     frame below, the gap and the row of captions and pause (44 px) */
  --vs-scr-h: calc(100vh - var(--header-h) - 32px - 2 * var(--vs-lid) - var(--vs-base) - var(--vs-gap) - 44px);
  isolation: isolate;
}
@supports (height: 100svh) { .vs { --vs-scr-h: calc(100svh - var(--header-h) - 32px - 2 * var(--vs-lid) - var(--vs-base) - var(--vs-gap) - 44px); } }
.vs-head .lead { max-width: 56ch; }

/* ---------- the stage ---------- */
.vs-stage {
  position: relative; container: vs-stage / inline-size;
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: start;
  row-gap: var(--vs-gap);
}
/* lacquer: a faint glow of brass and moonlight under the laptop, never a pattern */
.vs-stage::before {
  content: ""; position: absolute; z-index: -1; left: 4%; right: 4%; top: 12%; bottom: 0; pointer-events: none;
  background:
    radial-gradient(48% 52% at 56% 48%, rgba(201, 169, 97, .085), transparent 72%),
    radial-gradient(36% 44% at 28% 42%, rgba(134, 169, 222, .06), transparent 70%);
}

/* ---------- the laptop and its three screenshots, one over the other ---------- */
.vs-laptop { width: 92%; max-width: 820px; }
.vs-screen { position: relative; }
.vs-shot { opacity: 0; transition: opacity var(--vs-fade) var(--ease); }
.vs-shot:first-child { position: relative; }
.vs-shot:not(:first-child) { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
/* the one on screen, under everything; the next fades in over it (never a dip to black); the one before fades out */
.vs-shot.is-base { opacity: 1; z-index: 1; transition: none; }
.vs-shot.is-out { opacity: 0; z-index: 2; }
.vs-shot.is-top { opacity: 1; z-index: 3; }
/* the first view first: a lazy picture that is not drawn is not fetched, so the other two wait until the one on screen
   has arrived (vistas.js sets data-vs-more) and never take its bandwidth. Without JavaScript they never show, so they
   are never fetched. */
.vs:not([data-vs-more]) .vs-shot:not(.is-base) { display: none; }

/* ---------- what the screen shows: three captions (not controls), the one on screen in gold ----------
   Gold words, a gold frame on its little picture and a short gold bar under its words: the bar is the cue that does not
   depend on colour (gold against the grey of the others is only about 3:1). */
.vs-foot { width: 100%; container: vs-foot / inline-size; }
.vs-states {
  list-style: none; margin: 0 auto; padding: 0; width: min(100%, 560px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.vs-state {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0;
  padding: 0 0 10px; /* room for the bar */
  color: var(--text-3); font: 600 .875rem/1.25 var(--font-body); text-align: center; text-wrap: balance;
  transition: color .4s var(--ease);
}
.vs-state > span { position: relative; max-width: calc(100% - 16px); } /* in three columns a long caption wraps before it nears the next one */
.vs-state > span::after {
  content: ""; position: absolute; left: 50%; top: calc(100% + 5px); width: 20px; height: 2px; margin-left: -10px;
  border-radius: 1px; background: var(--gold); opacity: 0; transform: scaleX(.25);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.vs-state.is-on { color: var(--gold-hi); }
.vs-state.is-on > span::after { opacity: 1; transform: none; }
.vs-pict { flex: none; width: 32px; height: 22px; overflow: visible; opacity: .55; transition: opacity .4s var(--ease); }
.vs-state.is-on .vs-pict { opacity: 1; }
.vs-pict .fr { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-opacity: .6; transition: stroke .4s var(--ease), stroke-opacity .4s var(--ease); }
.vs-state.is-on .vs-pict .fr { stroke: var(--gold); stroke-opacity: 1; }
.vs-pict .st { fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-opacity: .85; }
.vs-pict .lb { fill: var(--blue); }
.vs-pict .rg { fill: var(--gold); }
.vs-pict .kb { fill: var(--ivory); fill-opacity: .78; }
/* room enough: one line, each caption with its picture at its side */
@container vs-foot (min-width: 470px) {
  .vs-states { display: flex; flex-wrap: wrap; justify-content: center; width: auto; column-gap: clamp(22px, 4cqw, 40px); row-gap: 6px; }
  .vs-state { flex-direction: row; gap: 10px; white-space: nowrap; }
  .vs-state > span { max-width: none; }
}

/* ---------- the Settings panel: a copy of the app's (fuente/src/style.css .popover, .pop-row, .switch) ----------
   Sizes in em, so the whole panel grows with its font size; at 15 px the switch is the app's 42 x 25. */
.vs-panel {
  position: relative; z-index: 2; width: min(100%, 22em);
  font-size: .9375rem; padding: .3em 1.0667em .45em;
  border-radius: var(--radius-card);
  background: rgba(22, 22, 25, .96); border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9), 0 30px 80px -50px rgba(201, 169, 97, .4);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
/* the panel's name: the site's eyebrow (13 px, uppercase), quieter than gold beside the gold switches */
.vs-panel-t { display: flex; align-items: center; gap: 9px; margin: 0; padding: .85em 0 .75em; border-bottom: 1px solid var(--line); line-height: 1.2; }
.vs-panel-t .eyebrow { color: var(--text-2); }
.vs-panel-t .ic { width: 18px; height: 18px; color: var(--gold); }
.vs-row {
  position: relative; z-index: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; min-height: max(48px, 3.2em); margin: 0; padding: .55em 0;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none;
  color: var(--text); font: 400 1em/1.3 var(--font-body); text-align: left;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.vs-row:last-child { border-bottom: 0; }
/* without JavaScript the Settings panel is a picture of the app's: its switches do not answer a click (vistas.js) */
html:not(.js) .vs-row { pointer-events: none; cursor: default; }
.vs-row-t { min-width: 0; }
.vs-row:focus-visible { border-radius: 10px; }
.vs-switch {
  flex: none; position: relative; width: 2.8em; height: 1.6667em; border-radius: var(--radius-pill);
  background: rgba(244, 241, 234, .16); transition: background-color .3s var(--ease), box-shadow .25s var(--ease);
}
.vs-switch::after {
  content: ""; position: absolute; top: .2em; left: .2em; width: 1.2667em; height: 1.2667em; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .32s var(--ease);
}
/* on; a row with no aria-checked is the picture of the panel (without JavaScript, or before vistas.js has run), which
   shows the app with both views on */
.vs-row[aria-checked="true"] .vs-switch, .vs-row:not([aria-checked]) .vs-switch { background: var(--gold); }
.vs-row[aria-checked="true"] .vs-switch::after, .vs-row:not([aria-checked]) .vs-switch::after { transform: translateX(1.1333em); }
@media (hover: hover) {
  .vs-row:hover .vs-switch { box-shadow: 0 0 0 4px rgba(244, 241, 234, .07); }
  .vs-row[aria-checked="true"]:hover .vs-switch, .vs-row:not([aria-checked]):hover .vs-switch { box-shadow: 0 0 0 4px rgba(201, 169, 97, .18); }
}
/* the cue (.is-cue, vistas.js ring()): the tour's tap, or the other switch turning itself on. The row lights up and its
   switch gets a halo, still, also with reduced motion; with motion a 2 px ring also opens around the switch. */
.vs-row::before {
  content: ""; position: absolute; z-index: -1; inset: 4px -10px; border-radius: 10px; pointer-events: none;
  background: rgba(201, 169, 97, .08); opacity: 0; transition: opacity .3s var(--ease);
}
.vs-row.is-cue::before { opacity: 1; }
.vs-row.is-cue .vs-switch { box-shadow: 0 0 0 5px rgba(201, 169, 97, .22); }
.vs-switch::before {
  content: ""; position: absolute; inset: -6px; border-radius: inherit; pointer-events: none;
  border: 2px solid rgba(234, 211, 154, .85); opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .vs-row.is-cue .vs-switch::before { animation: vs-tap .8s var(--ease-out); }
}
@keyframes vs-tap {
  0% { opacity: 0; transform: scale(.8); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.3); }
}

/* ---------- the pause: the home's own button (inicio.js), for the page's self-running animations (WCAG 2.2.2) ----------
   After the panel in the page, so Tab goes from the switches to it. Shown once vistas.js runs (it is the one that moves
   here), its room kept before (no shift); with reduced motion nothing moves by itself, so there is nothing to pause. */
.vs-motion { justify-self: end; margin-inline-end: calc((100% - min(100%, var(--vs-panel-w))) / 2); }
.vs:not([data-vs-ready]) .vs-motion { visibility: hidden; }

/* ---------- the panel beside the laptop: wider screens, and phones held sideways ---------- */
@media (min-width: 900px), (orientation: landscape) and (max-height: 540px) and (min-width: 560px) {
  .vs-stage {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lap panel" "foot motion";
    justify-items: stretch; align-items: center; column-gap: clamp(16px, 3vw, 40px);
  }
  /* in a short window the laptop gets narrower, so the whole stage fits under the header (the tour runs only while the
     panel, the laptop and the pause are all in sight). Its width is always a share of its cell, never shrink-to-fit:
     .frame img is width 100%, so a shrink-to-fit laptop would be as wide as its image, nothing until the lazy image
     arrives, and everything under it would jump when it does. */
  .vs-laptop { grid-area: lap; justify-self: center; width: min(90%, max(320px, calc(1.6 * var(--vs-scr-h) + 2 * var(--vs-lid)))); max-width: none; margin-inline: 0; }
  .vs-foot { grid-area: foot; }
  .vs-panel { grid-area: panel; width: 17.5em; }
  .vs-motion { grid-area: motion; justify-self: end; margin: 0; }
}
/* phones held sideways: the whole stage fits the short screen under the header; the captions go under the panel, the
   pause at their right, at the foot of the laptop */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 560px) and (max-width: 1179px) {
  .vs-stage { grid-template-areas: "lap panel" "lap foot"; align-items: start; align-content: center; row-gap: 12px; }
  .vs-laptop {
    align-self: center; justify-self: center; margin-inline: 0; max-width: none;
    width: min(92%, calc(1.6 * (100vh - var(--header-h) - 34px))); width: min(92%, calc(1.6 * (100svh - var(--header-h) - 34px)));
  }
  .vs-panel { width: 17.5em; font-size: .875rem; align-self: end; }
  .vs-foot { align-self: start; padding-inline-end: 52px; }
  .vs-motion { grid-area: foot; align-self: end; }
  .vs-states { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; gap: 4px; }
  .vs-state { flex-direction: row; justify-content: flex-start; gap: 10px; padding-bottom: 9px; text-align: left; }
  .vs-state > span { max-width: none; }
  .vs-state > span::after { left: 0; margin-left: 0; transform-origin: left center; }
}

/* ---------- the panel over the laptop's top right corner, as in the app ----------
   Columns: room for the part of the panel outside the laptop, at both sides (so the laptop stays centred), then the
   laptop, the part of the panel over it. The panel's top sits under the app's own top bar (6.9 % of the screen's
   height in the screenshot, after the lid's border: componentes.css .frame-laptop .lid). */
@media (min-width: 1180px) {
  .vs { --vs-pw: clamp(18rem, 15rem + 4vw, 22rem); --vs-ov: calc(var(--vs-pw) * .3); --vs-out: calc(var(--vs-pw) - var(--vs-ov)); }
  /* a short window (a laptop screen inside the browser's toolbars): the whole stage narrower, so it fits under the
     header; the panel's place is worked out from the stage's own width (100cqw), so it follows */
  .vs-stage {
    grid-template-columns: var(--vs-out) minmax(0, 1fr) var(--vs-ov) var(--vs-out); grid-template-areas: none;
    align-items: start; column-gap: 0;
    max-width: max(calc(2 * var(--vs-out) + 560px), calc(2 * var(--vs-out) + 2 * var(--vs-lid) + 1.6 * var(--vs-scr-h)));
    margin-inline: auto;
  }
  .vs-laptop { grid-column: 2 / 4; grid-row: 1; justify-self: stretch; width: auto; max-width: none; margin: 0; }
  .vs-foot { grid-column: 2 / 4; grid-row: 2; }
  .vs-motion { grid-column: 2 / 4; grid-row: 2; align-self: center; }
  .vs-panel {
    grid-column: 3 / 5; grid-row: 1; width: auto; font-size: calc(var(--vs-pw) / 19.2);
    margin-top: 52px;
    margin-top: calc(var(--vs-lid) + (100cqw - 2 * var(--vs-out) - 2 * var(--vs-lid)) * .0431);
  }
  .vs-state { font-size: .9375rem; }
}
@media (min-width: 2200px) {
  .vs-state { font-size: 1.0625rem; }
  .vs-pict { width: 38px; height: 26px; }
}

/* ---------- high contrast (forced colours): the switches, the cue and the current caption keep their state visible ---------- */
@media (forced-colors: active) {
  .vs-switch { forced-color-adjust: none; background: Canvas; border: 1px solid CanvasText; }
  .vs-switch::after { background: CanvasText; box-shadow: none; }
  .vs-row[aria-checked="true"] .vs-switch, .vs-row:not([aria-checked]) .vs-switch { background: Highlight; border-color: Highlight; }
  .vs-row[aria-checked="true"] .vs-switch::after, .vs-row:not([aria-checked]) .vs-switch::after { background: HighlightText; }
  .vs-row.is-cue .vs-switch::before { opacity: 1; border-color: Highlight; }
  .vs-state > span::after { forced-color-adjust: none; background: Highlight; }
}

/* ---------- reduced motion: every change is instant, and no pause (nothing moves by itself) ---------- */
@media (prefers-reduced-motion: reduce) {
  .vs-shot, .vs-state, .vs-pict, .vs-pict .fr, .vs-state > span::after, .vs-row::before, .vs-switch, .vs-switch::after { transition: none !important; }
  .vs-motion { display: none; }
}
