/*
 * The A3 website's rotating look (owner, 18 Nov 2026: "the whole website shifting layouts every 3.5 days doesn't seem to
 * work"). Loaded after a3.css. shared/p4/variety.js sets data-p4-a3pal / -a3seam / -a3gap / -a3hero / -a3order on <html>
 * before the first paint, from the one shared seed and the 84-hour period, so every visitor sees the same page and it
 * changes for all of them at the same moment. Value 0 of each role is the page the owner approved on 8 Nov.
 *
 * Every page changes, the home page included:
 *   palette  the four colour fields (cobalt, vermilion, pink, lemon slots; the names are the slots, not the hues) and the
 *            mint of the small pieces; ink and white stay. The lettering art is a set of drawn pictures whose spot colours
 *            (ink, white, lemon, pink, vermilion, cobalt) are part of the drawing, so the palettes keep that contract:
 *            the cobalt slot is always a dark field (white, lemon and pink lettering read on it), the pink and lemon slots
 *            always light fields (ink, cobalt and vermilion lettering read on them), the vermilion slot a hot mid colour
 *            that carries white or ink text. Like spot colours on different paper stock.
 *   seam     the angle and direction of every diagonal: between home sections, under the inner pages' bands, above the footer
 *   gap      the height of the home page's seams
 *   hero     the hero picture left or right or under the headline, and the why list's staircase (wide screens)
 *   order    which of the non-critical bands (FAQ, services, support, reviews) come where on the home page
 * Menus, buttons, forms, the chat button and the footer keep their order. Only the visual order of home sections changes
 * (CSS order); each section's own content keeps its reading order. Contrast of every palette is checked by
 * apps/site/tests/a3-rotate.test.mjs (4.5:1 body text, 3:1 large lettering).
 */

/* ------------------------------------------------------------ palettes */
/* The small pieces on the inner pages (stickers, badges, chips, bands) read press.css's tokens: point them at this palette. */
:root[data-p4-a3pal] { --lemon: var(--a3-lem); --pink: var(--a3-pnk); --mint: var(--a3-mnt); --lime: var(--a3-mnt); --gold: var(--a3-lem); --cobalt: var(--a3-cob); }
/* 0: Cobalt: the approved A3 colours */
:root[data-p4-a3pal="0"] { --a3-cob: #1d3be0; --a3-ver: #ff4b2b; --a3-pnk: #ffb2d0; --a3-lem: #f3ef4f; --a3-mnt: #c8f3aa; --a3-ver-text: #131a2c; }
/* 1: Violet and lime */
:root[data-p4-a3pal="1"] { --a3-cob: #4b2bb8; --a3-ver: #ff3d6a; --a3-pnk: #ffd0a6; --a3-lem: #c8f25a; --a3-mnt: #bfe8ff; --a3-ver-text: #131a2c; }
/* 2: Forest and gold */
:root[data-p4-a3pal="2"] { --a3-cob: #0c5a3c; --a3-ver: #f2501f; --a3-pnk: #f5c8ff; --a3-lem: #ffe14a; --a3-mnt: #c9f0e2; --a3-ver-text: #131a2c; }
/* 3: Teal and butter */
:root[data-p4-a3pal="3"] { --a3-cob: #00647a; --a3-ver: #f9593a; --a3-pnk: #ffc6bd; --a3-lem: #e6f56a; --a3-mnt: #fff0a8; --a3-ver-text: #131a2c; }
/* 4: Plum and sky */
:root[data-p4-a3pal="4"] { --a3-cob: #6b1d70; --a3-ver: #ff5238; --a3-pnk: #bfe0ff; --a3-lem: #ffd54a; --a3-mnt: #ffc8e8; --a3-ver-text: #131a2c; }
/* 5: Navy and mint */
:root[data-p4-a3pal="5"] { --a3-cob: #14307a; --a3-ver: #f24a3c; --a3-pnk: #b4f0cc; --a3-lem: #fff04d; --a3-mnt: #ffd9b8; --a3-ver-text: #131a2c; }
/* 6: Crimson and peach */
:root[data-p4-a3pal="6"] { --a3-cob: #a3113d; --a3-ver: #c9400c; --a3-pnk: #ffd9c2; --a3-lem: #f6f06a; --a3-mnt: #c8f3d4; --a3-ver-text: #ffffff; }
/* 7: Olive and lilac */
:root[data-p4-a3pal="7"] { --a3-cob: #38480f; --a3-ver: #e8532e; --a3-pnk: #f9d5b0; --a3-lem: #f0ee62; --a3-mnt: #d8c8ff; --a3-ver-text: #131a2c; }

/* --------------------------------------------------------------- seams */
/* --a3-seam-r/-l: where the home seams' upper colour ends at the right and left edge; --a3-band-*: the same for the inner
   pages' bands (a drop from the bottom edge); --a3-band-x: how far a band reaches lower where its slope falls to the right,
   so the text at the left stays on the band; --a3-ft-*: the footer's top; -sm: the phone sizes. 0 is the approved slope. */
:root[data-p4-a3seam="0"] { --a3-seam-r: 38%; --a3-seam-l: 62%; --a3-band-r: calc(100% - 44px); --a3-band-l: 100%; --a3-band-r-sm: calc(100% - 26px); --a3-band-l-sm: 100%; --a3-band-x: 0px; --a3-band-x-sm: 0px; --a3-ft-r: 30%; --a3-ft-l: 100%; }
:root[data-p4-a3seam="1"] { --a3-seam-r: 62%; --a3-seam-l: 38%; --a3-band-r: 100%; --a3-band-l: calc(100% - 44px); --a3-band-r-sm: 100%; --a3-band-l-sm: calc(100% - 26px); --a3-band-x: 44px; --a3-band-x-sm: 26px; --a3-ft-r: 100%; --a3-ft-l: 30%; }
:root[data-p4-a3seam="2"] { --a3-seam-r: 14%; --a3-seam-l: 86%; --a3-band-r: calc(100% - 72px); --a3-band-l: 100%; --a3-band-r-sm: calc(100% - 40px); --a3-band-l-sm: 100%; --a3-band-x: 0px; --a3-band-x-sm: 0px; --a3-ft-r: 8%; --a3-ft-l: 100%; }
:root[data-p4-a3seam="3"] { --a3-seam-r: 86%; --a3-seam-l: 14%; --a3-band-r: 100%; --a3-band-l: calc(100% - 72px); --a3-band-r-sm: 100%; --a3-band-l-sm: calc(100% - 40px); --a3-band-x: 72px; --a3-band-x-sm: 40px; --a3-ft-r: 100%; --a3-ft-l: 8%; }

/* The home seams' height, as a share of the approved height (96px on a phone, 170px from 900px up). */
:root[data-p4-a3gap="0"] { --a3-gap: 1; }
:root[data-p4-a3gap="1"] { --a3-gap: .7; }
:root[data-p4-a3gap="2"] { --a3-gap: 1.35; }

/* --------------------------------------------------------- hero (wide screens) */
/* On a phone every hero is the approved one: headline, then the picture. */
@media (min-width: 900px) {
  /* 1: the picture on the left (visual order only; the headline and its button stay first for the reader), the why list's staircase the other way */
  html[data-p4-a3hero="1"] .a3-hero { grid-template-columns: .9fr 1.1fr; }
  html[data-p4-a3hero="1"] .a3-hero-photo { order: -1; }
  html[data-p4-a3hero="1"] .a3-hero-photo .a3-sticker { left: auto; right: -3%; transform: rotate(6deg); }
  html[data-p4-a3hero="1"] .a3-why-list li:nth-child(1) { margin-inline-start: 16%; }
  html[data-p4-a3hero="1"] .a3-why-list li:nth-child(2) { margin-inline-start: 8%; }
  html[data-p4-a3hero="1"] .a3-why-list li:nth-child(3) { margin-inline-start: 0; }
  /* 2: stacked: the headline and its button, then a wide picture across the page */
  html[data-p4-a3hero="2"] .a3-hero { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 34px; }
  html[data-p4-a3hero="2"] .a3-hero-title { max-width: 780px; }
  html[data-p4-a3hero="2"] .a3-hero-photo { align-self: stretch; }
  html[data-p4-a3hero="2"] .a3-hero-photo .a3-photo { aspect-ratio: 21 / 9; object-position: 50% 42%; }
  html[data-p4-a3hero="2"] .a3-hero-photo .a3-sticker { left: auto; right: 4%; bottom: -14%; }
}

/* ---------------------------------------------------- home section order */
/* 0 is the page as written. The others reorder the bands that carry no figure: the FAQ, services, support and reviews
   (the statement stays straight after "why": its big numeral runs over the seam below it and needs a light field there).
   The hero stays first, the closing band last. Visual order only. Each seam takes the two colours it now sits between. */
html:is([data-p4-a3order="1"], [data-p4-a3order="2"], [data-p4-a3order="3"]) #view-home.active { display: flex; flex-direction: column; }
html:is([data-p4-a3order="1"], [data-p4-a3order="2"], [data-p4-a3order="3"]) #view-home > * { flex: none; }
/* 1: hero, system, money, faq, services, support, reviews, close */
html[data-p4-a3order="1"] #view-home > .a3-hero { order: 0; }
html[data-p4-a3order="1"] #view-home > #system { order: 2; }
html[data-p4-a3order="1"] #view-home > #mc-statement { order: 4; }
html[data-p4-a3order="1"] #view-home > #faq { order: 6; }
html[data-p4-a3order="1"] #view-home > #services { order: 8; }
html[data-p4-a3order="1"] #view-home > #support { order: 10; }
html[data-p4-a3order="1"] #view-home > #home-reviews-section { order: 12; }
html[data-p4-a3order="1"] #view-home > .a3-close { order: 14; }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(1) { order: 1; --from: var(--a3-cob); --to: var(--a3-wht); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(2) { order: 3; --from: var(--a3-wht); --to: var(--a3-pnk); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(3) { order: 5; --from: var(--a3-pnk); --to: var(--a3-wht); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(4) { order: 7; --from: var(--a3-wht); --to: var(--a3-lem); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(5) { order: 9; --from: var(--a3-lem); --to: var(--a3-ver); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(6) { order: 11; --from: var(--a3-ver); --to: var(--a3-cob); }
html[data-p4-a3order="1"] #view-home > .a3-seam:nth-of-type(7) { order: 13; --from: var(--a3-cob); --to: var(--a3-ink); }
/* 2: hero, system, money, services, reviews, support, faq, close */
html[data-p4-a3order="2"] #view-home > .a3-hero { order: 0; }
html[data-p4-a3order="2"] #view-home > #system { order: 2; }
html[data-p4-a3order="2"] #view-home > #mc-statement { order: 4; }
html[data-p4-a3order="2"] #view-home > #services { order: 6; }
html[data-p4-a3order="2"] #view-home > #home-reviews-section { order: 8; }
html[data-p4-a3order="2"] #view-home > #support { order: 10; }
html[data-p4-a3order="2"] #view-home > #faq { order: 12; }
html[data-p4-a3order="2"] #view-home > .a3-close { order: 14; }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(1) { order: 1; --from: var(--a3-cob); --to: var(--a3-wht); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(2) { order: 3; --from: var(--a3-wht); --to: var(--a3-pnk); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(3) { order: 5; --from: var(--a3-pnk); --to: var(--a3-lem); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(4) { order: 7; --from: var(--a3-lem); --to: var(--a3-cob); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(5) { order: 9; --from: var(--a3-cob); --to: var(--a3-ver); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(6) { order: 11; --from: var(--a3-ver); --to: var(--a3-wht); }
html[data-p4-a3order="2"] #view-home > .a3-seam:nth-of-type(7) { order: 13; --from: var(--a3-wht); --to: var(--a3-ink); }
/* 3: hero, system, money, faq, services, reviews, support, close */
html[data-p4-a3order="3"] #view-home > .a3-hero { order: 0; }
html[data-p4-a3order="3"] #view-home > #system { order: 2; }
html[data-p4-a3order="3"] #view-home > #mc-statement { order: 4; }
html[data-p4-a3order="3"] #view-home > #faq { order: 6; }
html[data-p4-a3order="3"] #view-home > #services { order: 8; }
html[data-p4-a3order="3"] #view-home > #home-reviews-section { order: 10; }
html[data-p4-a3order="3"] #view-home > #support { order: 12; }
html[data-p4-a3order="3"] #view-home > .a3-close { order: 14; }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(1) { order: 1; --from: var(--a3-cob); --to: var(--a3-wht); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(2) { order: 3; --from: var(--a3-wht); --to: var(--a3-pnk); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(3) { order: 5; --from: var(--a3-pnk); --to: var(--a3-wht); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(4) { order: 7; --from: var(--a3-wht); --to: var(--a3-lem); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(5) { order: 9; --from: var(--a3-lem); --to: var(--a3-cob); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(6) { order: 11; --from: var(--a3-cob); --to: var(--a3-ver); }
html[data-p4-a3order="3"] #view-home > .a3-seam:nth-of-type(7) { order: 13; --from: var(--a3-ver); --to: var(--a3-ink); }
