/*
  The aura. One light that travels with the reader.
  - With motion on (html.motion), a fixed layer of four soft lights (.aura) drifts to sit behind whatever section is
    in view, and changes shape there: a wide ellipse, a beam, a corner flare, a halo (js/aura.js).
    Each light is a pre-softened radial gradient that only ever moves by transform and opacity; nothing animates blur.
  - With motion off, without JavaScript, or under reduced motion, every section paints its own still light
    (.aura-anchor) in the same place and shape. The anchors are also where the travelling light measures its targets.
*/

/* ---------- The travelling light ---------- */
.aura {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: var(--black); /* an opaque floor, so the grain's overlay blend leaves black as black */
  direction: ltr; /* decorative layer in screen pixels: js/aura.js measures from the top-left corner */
  display: none;
}
.motion .aura { display: block; }
.aura-blob {
  position: absolute; inset-block-start: 0; inset-inline-start: 0;
  inline-size: 600px; block-size: 600px; margin-block-start: -300px; margin-inline-start: -300px;
  opacity: 0; will-change: transform, opacity;
}
.aura-blob i { position: absolute; inset: 0; border-radius: 50%; }
.aura-blob.b-deep i { background: radial-gradient(closest-side, rgb(122 6 16 / 0.85) 0%, rgb(96 4 12 / 0.55) 45%, rgb(60 2 8 / 0.22) 72%, rgb(60 2 8 / 0) 100%); }
.aura-blob.b-body i { background: radial-gradient(closest-side, rgb(226 22 32 / 0.95) 0%, rgb(204 16 26 / 0.82) 26%, rgb(160 10 20 / 0.52) 52%, rgb(122 6 16 / 0.16) 78%, rgb(122 6 16 / 0) 100%); }
/* the hot core: hot red-orange at the centre, falling to the body red */
.aura-blob.b-core i { background: radial-gradient(closest-side, rgb(255 112 88 / 0.95) 0%, rgb(255 86 66 / 0.92) 14%, rgb(255 74 61 / 0.85) 28%, rgb(245 34 45 / 0.56) 48%, rgb(208 16 26 / 0.16) 74%, rgb(208 16 26 / 0) 100%); }
.aura-blob.b-ember i { background: radial-gradient(closest-side, rgb(255 112 52 / 0.85) 0%, rgb(255 82 50 / 0.55) 30%, rgb(245 34 45 / 0.18) 64%, rgb(245 34 45 / 0) 100%); }
/* Slow breathing, each light on its own period so they never pulse together */
.aura-blob i { animation: aura-breathe 9s var(--ease-in-out) infinite alternate; }
.aura-blob.b-deep i { animation-duration: 13s; }
.aura-blob.b-core i { animation-duration: 7.4s; animation-delay: -2s; }
.aura-blob.b-ember i { animation-duration: 10.6s; animation-delay: -5s; }
@keyframes aura-breathe {
  from { transform: scale(0.93); opacity: 0.82; }
  to { transform: scale(1.07); opacity: 1; }
}
.aura.is-paused .aura-blob i { animation-play-state: paused; }
html.a11y-still .aura-blob i { animation: none; }

/* Film grain over the light. On the black floor the overlay blend leaves black untouched. */
.grain {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay; opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

/* ---------- The still lights: one per section, same place, same shape ---------- */
.aura-anchor {
  position: absolute; z-index: 0; pointer-events: none;
  inset-block-start: 10%; inset-inline: 10%; block-size: 70%;
}
.motion .aura-anchor { visibility: hidden; } /* still measured by js/aura.js */
.aura-anchor::before, .aura-anchor::after { content: ''; position: absolute; pointer-events: none; }
.aura-anchor::before { inset: -20%; }
/* Grain over the still light. Not an overlay blend here: inside a stacking context that blend turns black into grey.
   A faint grain, masked to the lit middle, so it never reaches the black. */
.aura-anchor::after {
  inset: -10%; opacity: 0.14;
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 20%, transparent 72%);
}

.aura-anchor[data-shape='hero']::before {
  background:
    radial-gradient(22% 30% at 76% 40%, rgb(255 190 176 / 0.55), rgb(255 74 61 / 0.5) 30%, rgb(255 74 61 / 0) 72%),
    radial-gradient(24% 32% at 22% 52%, rgb(255 112 52 / 0.6), rgb(255 82 50 / 0.3) 40%, rgb(255 82 50 / 0) 72%),
    radial-gradient(56% 50% at 50% 54%, rgb(226 22 32 / 0.85), rgb(160 10 20 / 0.5) 52%, rgb(122 6 16 / 0) 100%);
}
.aura-anchor[data-shape='ellipse']::before {
  background:
    radial-gradient(30% 22% at 50% 50%, rgb(255 74 61 / 0.55), rgb(255 74 61 / 0) 70%),
    radial-gradient(50% 40% at 50% 50%, rgb(208 16 26 / 0.65), rgb(122 6 16 / 0.3) 60%, rgb(122 6 16 / 0) 100%);
}
.aura-anchor[data-shape='beam']::before {
  background:
    radial-gradient(7% 46% at 50% 50%, rgb(255 98 80 / 0.6), rgb(255 74 61 / 0) 80%),
    radial-gradient(20% 50% at 50% 50%, rgb(208 16 26 / 0.55), rgb(122 6 16 / 0) 100%);
}
.aura-anchor[data-shape='flare']::before {
  background:
    radial-gradient(26% 16% at 50% 50%, rgb(255 74 61 / 0.6), rgb(255 74 61 / 0) 75%),
    radial-gradient(46% 34% at 50% 50%, rgb(208 16 26 / 0.6), rgb(122 6 16 / 0.25) 60%, rgb(122 6 16 / 0) 100%);
  transform: rotate(-22deg);
}
.aura-anchor[data-shape='halo']::before {
  background:
    radial-gradient(24% 22% at 50% 42%, rgb(255 74 61 / 0.5), rgb(255 74 61 / 0) 75%),
    radial-gradient(48% 48% at 50% 50%, rgb(208 16 26 / 0.6), rgb(122 6 16 / 0.28) 58%, rgb(122 6 16 / 0) 100%);
}
.aura-anchor[data-shape='dim']::before {
  background: radial-gradient(44% 40% at 50% 50%, rgb(176 12 22 / 0.42), rgb(122 6 16 / 0.16) 60%, rgb(122 6 16 / 0) 100%);
}
.aura-anchor::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

/* ---------- The grid of soft squares in front of the light (hero and close) ---------- */
.tiles {
  position: absolute; z-index: 1; inset-inline: 0; inset-block-start: 50%; margin-inline: auto;
  inline-size: min(1180px, 100% + 40px); translate: 0 -50%;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 56% 58% at 50% 50%, #000 52%, transparent 100%);
  mask-image: radial-gradient(ellipse 56% 58% at 50% 50%, #000 52%, transparent 100%);
}
/* Soft squares: mostly a light veil, a few deeper, a few lit from within; the gaps barely differ from the squares. */
.tiles i {
  aspect-ratio: 1; border-radius: 8px;
  background: rgb(0 0 0 / var(--a, 0.26));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.035), inset 0 1px 0 rgb(255 255 255 / 0.04);
}
.tiles i:nth-child(3n) { --a: 0.36; }
.tiles i:nth-child(4n + 1) { --a: 0.18; }
.tiles i:nth-child(5n + 2) { --a: 0.46; }
.tiles i:nth-child(7n) { background: rgb(255 120 100 / 0.05); }
.tiles i:nth-child(11n + 3) { --a: 0.56; }
.tiles i:nth-child(13n + 6) { background: rgb(255 160 140 / 0.07); }
@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(4, 1fr); inline-size: calc(100% + 60px); gap: 6px; }
  .tiles i:nth-child(n + 25) { display: none; }
}

/* ---------- Product windows: a dark frame, a rim of red light, a halo, dotted grain at the edges ---------- */
.frame {
  position: relative; isolation: isolate;
  border-radius: var(--r-frame); padding: 10px;
  background: linear-gradient(180deg, #19191D 0%, #0C0C0E 40%, #08080A 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 0 0 1px rgb(255 255 255 / 0.06),
    0 50px 120px -40px rgb(0 0 0 / 0.95);
}
/* Real child layers, not pseudo-elements, so motion can fade them by opacity alone without restyling the screen. */
.frame > .rim { /* the rim: hot at the top edge, falling to deep red down the sides */
  position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgb(255 210 200 / 0.95) 0%, rgb(255 74 61 / 0.9) 10%, rgb(208 16 26 / 0.45) 38%, rgb(122 6 16 / 0.1) 75%, rgb(255 255 255 / 0.06) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.frame > .halo { /* the halo the rim throws on the black */
  position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: 0 -18px 70px -10px rgb(255 74 61 / 0.55), 0 0 120px -10px rgb(245 34 45 / 0.42), 0 40px 140px -30px rgb(208 16 26 / 0.5);
}
.frame-dots { /* Huly's dotted grain, in red, just outside the frame's edge */
  position: absolute; inset: -46px; z-index: -2; border-radius: 60px; pointer-events: none;
  background-image: radial-gradient(rgb(255 92 80 / 0.55) 0.9px, transparent 1.4px);
  background-size: 7px 7px;
  -webkit-mask-image: radial-gradient(closest-side, transparent 72%, #000 86%, transparent 100%);
  mask-image: radial-gradient(closest-side, transparent 72%, #000 86%, transparent 100%);
  opacity: 0.75;
}
.screen {
  position: relative; overflow: hidden; border-radius: 19px;
  background: #060607; border: 1px solid rgb(255 255 255 / 0.06);
}
.mock-note {
  display: inline-flex; align-items: center; gap: 8px; margin-block-start: 16px;
  color: var(--ink-3); font-size: 0.875rem; line-height: 1.4;
}
.mock-note::before { content: ''; inline-size: 14px; block-size: 1px; background: rgb(255 255 255 / 0.3); }

/* ---------- Cards: rounded, dark, a light top edge; the one that matters gets a red rim ---------- */
.card {
  position: relative; isolation: isolate; border-radius: var(--r-card);
  background: linear-gradient(180deg, #131316 0%, #0B0B0D 60%, #09090B 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.11), inset 0 0 0 1px rgb(255 255 255 / 0.06), 0 30px 60px -36px rgb(0 0 0 / 0.95);
}
.card--glow { background: radial-gradient(120% 80% at 50% 120%, rgb(208 16 26 / 0.42), rgb(122 6 16 / 0.12) 55%, transparent 75%), linear-gradient(180deg, #141417 0%, #0B0B0D 100%); }
.card--glow::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(0deg, rgb(255 74 61 / 0.95) 0%, rgb(245 34 45 / 0.55) 30%, rgb(255 255 255 / 0.12) 70%, rgb(255 255 255 / 0.2) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card--glow > .glow {
  position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  box-shadow: 0 18px 60px -14px rgb(245 34 45 / 0.6), 0 0 90px -24px rgb(255 74 61 / 0.55);
}
.icon-tile {
  display: grid; place-items: center; inline-size: 48px; block-size: 48px; border-radius: 14px; flex: none;
  background: linear-gradient(180deg, #1C1C21, #0C0C0E);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), inset 0 0 0 1px rgb(255 255 255 / 0.06), 0 8px 22px -10px rgb(245 34 45 / 0.6);
  color: var(--white);
}
.icon-tile .icon { inline-size: 22px; block-size: 22px; filter: drop-shadow(0 0 6px rgb(255 74 61 / 0.7)); }
.card--glow .icon-tile { color: var(--white); background: linear-gradient(180deg, #E61E29, #9C0A12); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 10px 26px -8px rgb(245 34 45 / 0.85); }
.card--glow .icon-tile .icon { filter: none; }

/* High contrast: the light steps back, outlines step forward */
html.a11y-contrast .aura, html.a11y-contrast .aura-anchor, html.a11y-contrast .tiles, html.a11y-contrast .frame-dots { display: none; }
html.a11y-contrast .frame, html.a11y-contrast .card { box-shadow: none; border: 2px solid #FFFFFF; }
html.a11y-contrast .frame > .halo, html.a11y-contrast .card--glow > .glow { display: none; }
