/* AICO's own website. Served by Django on the apex host, not from a static directory, so
   interactive content is a view rather than a second deployment artifact.

   One page and one sentence, while the product is in development. There was a header, a footer and
   three cards here, and all of them are gone: nothing in this file has a rule it does not need, so
   what is left is the ground, the slogan's slot machine, and the two blocks the error pages share
   with the homepage.

   No inline <style> and no inline style="": `style-src` allows 'unsafe-inline' for the
   panels' generated markup, and a hand-written stylesheet has no reason to need it.

   The palette is the panel's - the company red on near-black - because this is the same
   product seen from outside, and a marketing page in a different palette is a second brand. */

:root {
  color-scheme: dark;
  --bg: #08090c;
  --panel: rgba(255, 255, 255, 0.032);
  --panel-2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --fg: #e9ebee;
  --muted: #99a1ab;
  --accent: #c80f2e;
  --accent-soft: rgba(200, 15, 46, 0.16);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* The UA's scrollbar is a bright, blocky bar that ignores the theme, and on a near-black page
   it is the one piece of chrome that reads as somebody else's. Two rules because there are two
   mechanisms: the standard properties for Firefox, and the WebKit pseudo-elements for Blink
   and WebKit, which still do not implement them. The thumb is inset by a transparent border
   with `background-clip: content-box`, which is what makes it a rounded pill rather than the
   block. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-color: var(--border-strong);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Two glows, one at each end of the fold, so the page reads as lit rather than as flat black.
   Fixed rather than in-flow: they belong to the room, not to the content. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  pointer-events: none;
}
body::before {
  top: -28vw;
  left: -12vw;
  background: radial-gradient(circle, rgba(200, 15, 46, 0.22), transparent 62%);
}
body::after {
  right: -18vw;
  bottom: -34vw;
  background: radial-gradient(circle, rgba(90, 120, 255, 0.12), transparent 62%);
}

/* The glows drift, so the ground is never quite still. The panel does this with a script,
   because it has an Effects toggle to answer to; here it is a keyframe path, which is the same
   path on every visit - and that is the right trade for a landing page, where nobody stays long
   enough to notice and it means no JavaScript at all. The waypoints are uneven on purpose: an
   even path reads as a loop, and an uneven one reads as drift.

   A visitor whose system asks for less motion gets none of it. There is deliberately no toggle
   here - the setting belongs where somebody is looking at a screen for an hour. */
@keyframes glow-a-drift {
  0%   { transform: translate(0, 0); }
  22%  { transform: translate(5vw, 4vh); }
  47%  { transform: translate(-3vw, 8vh); }
  71%  { transform: translate(6vw, 1vh); }
  100% { transform: translate(0, 0); }
}
@keyframes glow-b-drift {
  0%   { transform: translate(0, 0); }
  31%  { transform: translate(-5vw, -4vh); }
  58%  { transform: translate(3vw, -7vh); }
  82%  { transform: translate(-2vw, 2vh); }
  100% { transform: translate(0, 0); }
}
body::before { animation: glow-a-drift 72s ease-in-out infinite; }
body::after { animation: glow-b-drift 96s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

/* The page is one sentence, so it is centred in the viewport rather than sitting at the top of a
   mostly empty screen - which is what "under construction" is meant to look like, and the reason
   the header's padding-bottom went with the header.

   `svh` rather than `vh`, with `vh` first as the fallback: on a phone `vh` is the *large* viewport,
   so the content centres below the fold's real middle and shifts as the browser chrome hides. */
.shell {
  max-width: 62rem;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Hero. The three blocks below are shared with the error pages, which render this same section -
   so a rule here is not dead just because the homepage stopped using it. */
.hero { text-align: center; }

.eyebrow {
  margin: 0 0 1.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.slogan {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 4.6rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.35em;
}

.lede {
  max-width: 38rem;
  margin: 1.75rem auto 0;
  font-size: clamp(1rem, 1.6vw, 1.16rem);
  color: var(--muted);
}

/* The slot machine.
   A one-line window over a vertical strip of century names. `overflow: hidden` is the whole
   mechanism - the strip is translated and only one cell is ever visible. `tabular-nums` stops
   the individual digits shifting inside the cell.

   The fill is solid, and that is not decoration. The reel blurs its cells as it speeds up, and a
   blurred edge clipped by `overflow: hidden` against a transparent background reads as the blur
   being cut off - you can see the page through it, so the box edge looks like a mistake rather
   than the end of the motion. A solid fill puts the clip on the colour the blur is bleeding
   into. */
.slot {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: baseline;
  height: 1.12em;
  text-align: center;
  border-radius: 4px;
  /* The slogan is a flex row and a flex item shrinks by default. This box's width comes from the
     sizer below, so letting it shrink takes the width away from the digits - which is the box
     cutting off on the right. It wraps to the next line instead. */
  flex: none;
  /* Room for the digits *inside* the fill. Tabular figures make `21st` a hair wider than the
     proportional ones the sizer used to measure with, and a glyph flush against the edge of a
     solid fill reads as clipped even when it is not. */
  padding: 0 0.14em;
}

/* The box is sized by a hidden copy of the widest value it ever shows, rather than by a
   `ch` guess. `min-width` twitched between `1st` and `21st`, and a fixed `ch` width is
   always either too wide - which puts a visible gap between the reel and the words either
   side of it - or too narrow, which clips the answer. Sizing from the content is the only
   one of the three that is right by construction. */
.slot-sizer {
  display: block;
  height: 0;
  visibility: hidden;
  /* Measured with the same figures the reel draws with. Tabular digits are wider than
     proportional ones in most system fonts, so a sizer without this measured `21st` a little
     narrower than the cell that shows it - which is the box cutting off the right-hand side. */
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The SVG filter definition element. It has to be in the document for `url(#slot-blur)` to
   resolve, and it must not take up any space of its own. */
.slot-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* The fill is its own layer rather than the box's background. It used to *become* the rule
   underneath on landing, collapsing from the box to a 3px line - and that is scrapped. The
   collapse read as the box breaking rather than as the reel settling, and it moved the layout
   at the exact moment the reader was looking at the number. A solid box is also what the reel
   needs: the blur is clipped by `overflow: hidden`, so there has to be a colour for it to bleed
   into. The box stays a box. */
.slot::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.slot-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  will-change: transform;
  /* Vertical only. `blur()` is a Gaussian in both axes, which reads as soft focus rather
     than as motion; `stdDeviation` is `0 <n>` and the `<n>` is set from `slot.js`. */
  filter: url(#slot-blur);
}

/* One colour throughout. The digits used to be the page's near-black while the reel moved and
   light when it landed, on the theory that it made the blur read as a smear rather than as red
   on red. It did not: the accent fill already carries the contrast, so the switch bought nothing
   and read as the text flickering part-way through the animation. */
.slot-cell {
  display: block;
  height: 1.12em;
  line-height: 1.12em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

/* The settle: a short drop and rebound, so landing reads as the reel having *stopped* rather
   than as the animation having run out. Applied to the box, not the strip, because the strip's
   transform is the reel's own position and this is the machine taking the weight.

   A class of its own rather than a state class, because a tap re-triggers it: re-triggering a
   CSS animation means taking the class off and letting the style be recalculated, so a class
   that also meant something else would flicker that something else on every tap. */
@keyframes slot-bounce {
  0% { transform: translateY(-5%); }
  60% { transform: translateY(1.5%); }
  100% { transform: translateY(0); }
}
.slot.is-bouncing { animation: slot-bounce 260ms cubic-bezier(0.22, 0.7, 0.3, 1) 1; }

/* The cap: it has reached 99th and will not go further. Deliberately rougher and longer than
   the bounce, because "nothing happened" and "that is as far as it goes" are different
   answers, and only one of them should look like the machine refusing. */
@keyframes slot-capped {
  0% { transform: translateY(-9%); }
  20% { transform: translateY(6%); }
  40% { transform: translateY(-6%); }
  60% { transform: translateY(4%); }
  80% { transform: translateY(-2%); }
  100% { transform: translateY(0); }
}
.slot.is-capped { animation: slot-capped 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97) 1; }

a { color: var(--fg); }

/* Screen-reader-only: the animated slogan needs a still copy for assistive technology, and
   `clip-path` rather than `display: none` because a display-none element is not announced. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .slot.is-bouncing, .slot.is-capped { animation: none; }
}
