/* simply. Home effects 01, 02, 03, 04, 07, 08 (CSS twin), 12 and 14, copied unchanged from the effects sampler tiles (each tile.css, in the sampler order).
   Motion lives under html[data-motion="on"], which the inline script in index.html sets from the reduced-motion media query. */

/* ======== 02 cards answer the cursor ======== */
/* Tile 02, ui-interaction-design: hover, press, focus and cursor feel on the work cards and the price cards.
   Rules this file keeps: transform and opacity move things (one exception, named below); every transition has a named
   property (no "all"); 100 to 220 ms, ease-out; every :hover rule sits inside @media (hover: hover); focus is instant.
   Movement (lift, press, zoom) exists only under html[data-motion="on"]. The default state is Home exactly. */

/* ---- (c) one focus ring on every interactive thing: Home's 3 px purple, offset 4 ---- */
:focus-visible, .ast-btn:focus-visible, .scroll-arrow:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }

/* ---- (a) work cards ---- */
.work-card {
  overflow: visible;                 /* Home clips the picture with the card; here the picture clips itself so the shadow layer can show */
  isolation: isolate;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='-110 -110 220 220'%3E%3Cg fill='%23fff' stroke='%23fff' stroke-width='18' stroke-linejoin='round'%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19'/%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19' transform='rotate(60)'/%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19' transform='rotate(120)'/%3E%3C/g%3E%3Cg fill='%238A1CFF'%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19'/%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19' transform='rotate(60)'/%3E%3Crect x='-100' y='-19' width='200' height='38' rx='19' transform='rotate(120)'/%3E%3C/g%3E%3C/svg%3E") 14 14, pointer;
}
.work-card picture { display: block; overflow: hidden; border-radius: var(--radius-card) var(--radius-card) 0 0; }
/* The second, deeper shadow is made once and cross-faded (opacity); box-shadow itself never transitions. */
.work-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: 0 40px 34px rgba(42, 8, 102, .14), 0 14px 12px rgba(42, 8, 102, .16);
  opacity: 0; transition: opacity 220ms var(--ease-out);
}
.work-card:focus-visible::after { opacity: 1; }

.work-card, .work-card img, .figure { transition: transform 220ms var(--ease-out); }   /* declared always so no property is ever "all"; inert unless a transform changes */
html[data-motion="on"] .work-card { transform: translateY(var(--lift, 0px)) scale(var(--press, 1)); }
html[data-motion="on"] .work-card:focus-visible { --lift: -6px; }
html[data-motion="on"] .work-card:focus-visible img { transform: scale(1.03); }
html[data-motion="on"] .work-card:active { --press: .985; transition-duration: 100ms; }   /* press: the one fast tier, also the only state touch gets */

@media (hover: hover) {
  .work-card:hover::after { opacity: 1; }
  html[data-motion="on"] .work-card:hover { --lift: -6px; }
  html[data-motion="on"] .work-card:hover img { transform: scale(1.03); }
}

/* ---- (b) price cards: the rim thickens 6 to 8 px and the figure lifts 4 px ----
   -webkit-text-stroke-width is the one property here that is neither transform nor opacity. It is a paint, it sits on one
   104 px word, it does not touch layout, and the rim was asked for. The figure's lift is transform. */
.fig-n { transition: -webkit-text-stroke-width 220ms var(--ease-out); }
.price:focus-visible .fig-n { -webkit-text-stroke-width: 8px; }
html[data-motion="on"] .figure { transform: translateY(var(--fig-lift, 0px)); }
html[data-motion="on"] .price:focus-visible .figure { --fig-lift: -4px; }
@media (hover: hover) {
  .price:hover .fig-n { -webkit-text-stroke-width: 8px; }
  html[data-motion="on"] .price:hover .figure { --fig-lift: -4px; }
}

/* ======== 03 headings rise in ======== */
/* Tile 03, impeccable (animate pass): section headings rise in once as each section arrives.
   Motion thesis: one authored moment, the arrival of a section. A mask reveal (the heading slides up out of its own line box),
   once per heading, 640 ms, decelerating. No fade, no stagger, no loop. Nothing else on the page moves.
   Default (no JS, or html[data-motion="reduced"]) = every heading simply there. */
html[data-motion="on"] .rise {
  display: block; overflow: hidden;
  padding: .14em .25em .2em; margin: -.14em -.25em -.2em;   /* room inside the mask for Saira's italic overhang and descenders */
}
html[data-motion="on"] .rise-in { display: block; }
html[data-motion="on"] [data-rise="armed"] .rise-in { transform: translateY(110%); }
html[data-motion="on"] [data-rise="in"] .rise-in { transform: none; transition: transform 640ms var(--ease-out); }

/* ======== 04 light sweep on the prices ======== */
/* Tile 04, high-end-visual-design: one light sweep across the two Lemon price figures, once, when the prices arrive.
   Technique: a copy of the digits (aria-hidden, added by tile.js) laid exactly over the real ones, transparent, with a white
   diagonal band as its background and background-clip: text. The band can only show inside the glyph shapes, which are the
   Lemon fill, because Home paints the purple rim (text-stroke, paint-order stroke fill) outside them. The real figure, its rim
   and its layout box are never touched. No filter, no blend mode. Default (reduced, or JS off) = Home exactly: no overlay exists. */
html[data-motion="on"] .fig-n { position: relative; }
.glint {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none; user-select: none;
  line-height: normal; color: transparent; -webkit-text-stroke: 0;          /* the real digits carry the rim; the copy has none */
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, .95) 50%, rgba(255, 255, 255, 0) 58%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
  animation: glint-sweep 1100ms cubic-bezier(.45, .05, .35, 1) var(--d, 0ms) both;
}
@keyframes glint-sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* ======== 01 the asterisk layer ======== */
/* Tile 01: the asterisk layer. Two things share one box: the flat SVG (no WebGL, no JS, ?nogl=1) and the 3D canvas that replaces it.
   The box is 300 x 318 px in the right margin of the first screen (120 x 127, top-right corner, partly cropped, on a phone).
   Both sit in the document (position: absolute), never in the flow, so nothing moves when they appear. */
main { position: relative; }   /* so the layer below covers the whole page and clips at its edges (an overflowing box would widen a phone's layout viewport) */
.spine-layer { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.spine-flat, .spine-canvas { position: absolute; pointer-events: none; }
.spine-canvas { left: 0; top: 0; transform-origin: 0 0; visibility: hidden; will-change: transform; }
.spine-flat { --w: 300px; --rim: 6px; width: var(--w); height: calc(var(--w) * 1.06); right: 40px;
  top: calc(var(--stage-h) * .62 - var(--w) * .4657); }                        /* the asterisk's centre sits at 62% of the first screen */
.spine-flat-ast { position: absolute; width: calc(var(--w) * .9601); height: calc(var(--w) * .9601);
  left: calc(var(--w) * .02); top: calc(var(--w) * -.0144); overflow: visible; }
.spine-flat::after { content: ""; position: absolute; left: calc(var(--w) * .0295); top: calc(var(--w) * .8911);
  width: calc(var(--w) * .9409); height: calc(var(--w) * .1379);
  background: radial-gradient(closest-side, rgba(42, 8, 102, .32), rgba(42, 8, 102, 0)); }   /* the same soft blob as Home's button floor */
@media (max-width: 899.98px) {
  .spine-flat { --w: 120px; --rim: 3px; right: -24px; top: calc(110 * var(--u) - 6px - var(--w) * 1.06); }   /* just above the headline box, 24 px off the right edge */
}

/* ======== 08 the headline animation (CSS twin) ======== */
/* Tile 08, CSS twin: the same staggered headline with no library and no JavaScript, for the size comparison.
   Four words 70 ms apart, 24 px rise with a slight overshoot (620 ms), fade over 360 ms.
   Easings are the CSS forms of a back-out and a power1-out curve. "backwards" holds the hidden state through each word's delay
   and releases it at the end, so after the intro nothing is left on the page. Motion only under html[data-motion="on"]. */
@media (min-width: 900px) {
  html[data-motion="on"] .headline .w:not(.w-last) { display: inline-block; }
}
html[data-motion="on"] .headline .w {
  animation: w-rise 620ms cubic-bezier(.34, 1.56, .64, 1) backwards, w-fade 360ms cubic-bezier(.5, 1, .89, 1) backwards;
}
html[data-motion="on"] .headline .w:nth-child(2) { animation-delay: 70ms; }
html[data-motion="on"] .headline .w:nth-child(3) { animation-delay: 140ms; }
html[data-motion="on"] .headline .w:nth-child(4) { animation-delay: 210ms; }
@keyframes w-rise { from { transform: translateY(24px); } }
@keyframes w-fade { from { opacity: 0; } }

/* ======== 07 the 3D phone ======== */
/* Tile 07: only this effect's CSS. Home's own CSS comes from ../_shared/brandline/.
   The stage holds either the flat phone frame (the default: reduced motion, no WebGL, no JS) or the WebGL canvas (motion on). Same box either way, so nothing shifts. */
.phone-stage { position: relative; height: 340px; display: grid; place-items: center; background: var(--page); }
.phone-stage .phone-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the flat phone: 1 unit = 1/78 of its height, the same bezel proportions as the 3D model */
.phone-flat { --s: 3.9px; position: relative; height: calc(var(--s) * 78); aspect-ratio: 36.27 / 78; box-sizing: border-box;
  padding: calc(var(--s) * 3.4) calc(var(--s) * 1.5) calc(var(--s) * 2.6); border-radius: calc(var(--s) * 5.6);
  background: var(--violet-deep); box-shadow: 0 18px 22px rgba(42, 8, 102, .16), 0 6px 8px rgba(42, 8, 102, .14); }
.phone-flat img { display: block; width: 100%; height: 100%; border-radius: calc(var(--s) * 4.1); object-fit: cover; }
.phone-flat::before { content: ""; position: absolute; top: calc(var(--s) * 1.2); left: 50%; width: calc(var(--s) * 5.6); height: calc(var(--s) * 1);
  margin-left: calc(var(--s) * -2.8); border-radius: 999px; background: #1C0E38; }

/* WebGL has taken over: the flat frame stays in the layout (it keeps the image loaded) but is not painted */
.phone-stage[data-gl="pending"] .phone-flat, .phone-stage[data-gl="on"] .phone-flat { visibility: hidden; }
.phone-stage:focus-visible { outline: 3px solid var(--purple); outline-offset: -3px; border-radius: var(--radius-card) var(--radius-card) 0 0; }
.phone-stage[data-gl="on"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ======== 12 the collage film ======== */
/* Tile 12-collage-explainer: only this effect's CSS. Home's own CSS comes from ../_shared/brandline/.
   The default state is the reduced-motion still: the poster and the native controls. The play button only exists under html[data-motion="on"] (tile.js un-hides it). */
.how-video { position: relative; margin: 24px 0 0; border-radius: var(--radius-card); overflow: hidden; background: var(--white); box-shadow: var(--shadow-card); }
.how-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--white); }
.how-play { position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; padding: 0; display: grid; place-items: center;
  border: 3px solid var(--white); border-radius: 50%; background: var(--purple); color: var(--white); cursor: pointer;
  box-shadow: 0 6px 14px rgba(42, 8, 102, .35); }
.how-play[hidden] { display: none; }
.how-play svg { width: 24px; height: 24px; fill: currentColor; margin-left: 3px; }
.how-play:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--violet-deep); }
.how-video + .steps { margin-top: 32px; }
@media (min-width: 900px) {
  .how-video { margin-top: 34px; }
  .how-video + .steps { margin-top: 48px; }
}

/* ======== 14 the explainer film ======== */
/* Tile 14: the explainer film sits between Home's first screen and "The work". Home's CSS comes from ../_shared/brandline/.
   Default state = the finished still: the poster with the browser's own controls. Motion plays only under html[data-motion="on"]. */
.film { display: grid; place-items: center; padding: 56px 24px 0; }
.film-frame { position: relative; width: min(1000px, 100%); aspect-ratio: 16 / 9; border-radius: var(--radius-card); overflow: hidden;
  background: var(--page); box-shadow: var(--shadow-card); }
.film-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) { .film { padding-top: 96px; } }

/* The replay button: only when motion is on (reduced shows the native controls instead). Same white circle as Home's scroll arrow. */
.film-replay { display: none; position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; padding: 0; place-items: center;
  border-radius: 50%; background: var(--white); color: var(--purple); border: 2px solid var(--purple); cursor: pointer;
  box-shadow: 0 6px 16px rgba(42, 8, 102, .16); -webkit-tap-highlight-color: transparent; }
html[data-motion="on"] .film-replay { display: grid; }
