/* andrii.ai — the placeholder. No build: this file is served as written.
   The page carries no inline style and no style attribute: everything visual
   is here. (The pak's CSP would allow inline style, for the sake of the
   enodia.andrii.net page beside it; this page does not use that.) */

:root {
  color-scheme: dark;
  --space: #000;
  --ink: #e9e6df;
  --dim: #8d8d92;
  /* The faintest text and the red letters are small, so each is the darkest
     value that still reads at 4.5 : 1 on black (4.71 and 5.05). */
  --faint: #77777c;
  --hal: #e3170a;
  --hal-text: #f02a1c;
  --hal-hot: #ff5a2a;
  --amber: #ffd84a;
  --slab-edge: rgba(255, 255, 255, 0.09);
  --sans: Futura, "Futura PT", "Century Gothic", "Avenir Next", Avenir, "Gill Sans", "Gill Sans MT", "Trebuchet MS", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* The slab's proportions: 1 : 4 : 9, lying on its long side. */
  --slab-w: min(396px, calc(100vw - 32px));
  --slab-h: calc(var(--slab-w) * 4 / 9);
  --slab-up: max(52px, calc(env(safe-area-inset-bottom) + 44px));
  --slow: 1.9s cubic-bezier(0.16, 0.84, 0.3, 1);
  /* One telephone key: the digit's size and its column's width. */
  --key: clamp(20px, 5.6vw, 30px);
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; background: var(--space); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  /* minmax(0, …): the column is the viewport, whatever its content wants.
     Without it the mark's own width sets the track, and the page scrolls
     sideways once the slab takes its share of a narrow screen. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  background: var(--space);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: var(--hal); color: #fff; }

a { color: inherit; }

:focus-visible { outline: 1px solid var(--hal-hot); outline-offset: 4px; border-radius: 2px; }

/* In the page for a screen reader, and nowhere on the screen: the status line
   that repeats what HAL says (hal.js). Out of flow, so it takes no grid row. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── the sky ─────────────────────────────────────────────────────────────── */

.sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease-out;
}
.sky.is-lit { opacity: 1; }

/* ── the ship ────────────────────────────────────────────────────────────── */

.discovery {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 6vh, 56px);
  padding: 48px 16px 24px;
  text-align: center;
  transition: padding var(--slow);
}
.discovery:focus { outline: none; }
/* While the slab stands, the ship keeps clear of it: of its real height, which
   the script measures (a narrow slab wraps and is taller than its 4 : 9). */
.has-slab .discovery { padding-bottom: calc(max(var(--slab-h), var(--slab-real, 0px)) + var(--slab-up) - 8px); }

/* The service mark is the master file, byte for byte; only this window onto
   it is ours. The lockup sits at 258,418 730x364 inside the 1200 square. */
.mark {
  position: relative;
  margin: 0;
  width: min(78vw, 440px);
  max-width: 100%;
  aspect-ratio: 730 / 364;
  overflow: hidden;
  touch-action: manipulation;
  transition: width var(--slow);
}
.mark img {
  position: absolute;
  left: -35.3425%;
  top: -114.8352%;
  width: 164.3836%;
  max-width: none;
  height: auto;
  filter: invert(0.92);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.com {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.com__tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--faint);
}
.com__line {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 6px 4px;
  text-decoration: none;
  font-variant-numeric: tabular-nums lining-nums;
}
.com__row { display: flex; }
.com__row--n {
  font-size: var(--key);
  font-weight: 500;
  color: var(--ink);
  transition: color 0.4s ease, text-shadow 0.4s ease, font-size var(--slow);
}
.com__row--a {
  font-size: clamp(8px, calc(var(--key) * 0.42), 12px);
  font-weight: 700;
  color: var(--hal-text);
  -webkit-user-select: none;
  user-select: none;
}
/* One key per column, the same width in both rows, so each letter stands
   under its own digit whatever face the stack lands on. */
.k {
  display: inline-block;
  width: var(--key);
  text-align: center;
  transition: width var(--slow), margin var(--slow);
}
.k.g { margin-left: calc(var(--key) * 0.46); }
.k.d { color: var(--faint); }
.com__cc {
  position: absolute;
  right: 100%;
  margin-right: calc(var(--key) * 0.4);
  color: var(--dim);
  font-weight: 400;
}
.com__line:hover .com__row--n,
.com__line:focus-visible .com__row--n { color: #fff; text-shadow: 0 0 18px rgba(227, 23, 10, 0.55); }

/* ── the small print ─────────────────────────────────────────────────────── */

.legal {
  position: relative;
  z-index: 10; /* above the slab's shadow, which would dim these links */
  padding: 0 16px max(18px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.legal a { color: var(--dim); text-decoration: none; padding: 6px 2px; }
.legal a:hover, .legal a:focus-visible { color: var(--ink); }

/* ── TMA-1 ───────────────────────────────────────────────────────────────── */

.monolith {
  position: fixed;
  z-index: 9;
  left: 0;
  right: 0;
  bottom: var(--slab-up);
  width: var(--slab-w);
  min-height: var(--slab-h);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 18px 14px 16px;
  background: #000;
  border: 1px solid var(--slab-edge);
  box-shadow: 0 0 0 1px #000, 0 24px 70px 10px rgba(0, 0, 0, 0.9), 0 0 90px rgba(255, 255, 255, 0.035);
  transform: translateY(var(--slab-rest, 0));
  transition: transform var(--slow), opacity 1.2s ease;
}
.monolith[hidden] { display: none; }
.monolith.is-below { transform: translateY(var(--slab-away, calc(100% + 90px))); opacity: 0; pointer-events: none; }

.monolith__body { min-width: 0; display: grid; gap: 7px; }
.monolith p { margin: 0; }
.monolith__q {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.25;
  min-height: 2.5em;
  display: flex;
  align-items: flex-end;
  transition: opacity 0.35s ease;
}
.monolith__q.is-fading { opacity: 0; }
.monolith__how {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.35;
}
.monolith__file {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent;
  border: 1px solid #3c3c41;
  border-radius: 0;
  padding: 6px 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.monolith__file::file-selector-button,
.monolith__file::-webkit-file-upload-button {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid #3c3c41;
  border-radius: 0;
  padding: 3px 8px;
  margin-right: 8px;
  cursor: pointer;
}
.monolith__file:hover::file-selector-button,
.monolith__file:focus-visible::file-selector-button,
.monolith__file:hover::-webkit-file-upload-button,
.monolith__file:focus-visible::-webkit-file-upload-button {
  color: #fff;
  border-color: var(--hal);
}
.monolith__verdict {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: #3c3c41;
  text-underline-offset: 3px;
}
.monolith__verdict:hover, .monolith__verdict:focus-visible { color: #fff; text-decoration-color: var(--hal); }
.monolith__act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding-top: 3px;
}
.monolith__no {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid #3c3c41;
  border-radius: 0;
  padding: 7px 12px 6px;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.monolith__no:hover, .monolith__no:focus-visible {
  color: #fff;
  border-color: var(--hal);
  box-shadow: 0 0 16px rgba(227, 23, 10, 0.4);
}
.monolith__cookies {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-decoration: underline;
  text-decoration-color: #3c3c41;
  text-underline-offset: 3px;
  padding: 6px 0;
}
.monolith__cookies:hover, .monolith__cookies:focus-visible { color: var(--ink); text-decoration-color: var(--dim); }

/* ── the eye ─────────────────────────────────────────────────────────────── */

.eye {
  --d: 64px;
  appearance: none;
  position: relative;
  width: var(--d);
  height: var(--d);
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  /* the brushed bezel */
  background: conic-gradient(from 20deg, #6f7278, #d9dbe0 12%, #7a7d84 25%, #c6c8ce 38%, #5b5e64 50%, #d2d4d9 63%, #70737a 76%, #c9cbd1 88%, #6f7278);
  box-shadow: 0 0 0 1px #000, 0 0 26px rgba(227, 23, 10, 0.28);
}
.eye::before {
  /* black glass inside the bezel */
  content: "";
  position: absolute;
  inset: 4.5%;
  border-radius: 50%;
  background: radial-gradient(circle, #0a0000 0 52%, #000 53% 100%);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 6px 2px #000;
}
.eye__lens {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fffbe0 0 3.5%, var(--amber) 6%, #ff8a1e 10%, var(--hal-hot) 14%, var(--hal) 24%, #9a0d05 38%, #4a0502 54%, #160100 70%, #000 78%);
  animation: watch 9000ms ease-in-out infinite;
}
.eye__lens::after {
  /* the room, reflected */
  content: "";
  position: absolute;
  left: 16%;
  top: 9%;
  width: 46%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.08) 55%, transparent 72%);
  transform: rotate(-24deg);
  filter: blur(0.6px);
}
.eye:hover .eye__lens, .eye:focus-visible .eye__lens, .eye.is-speaking .eye__lens { filter: brightness(1.35) saturate(1.15); }

@keyframes watch {
  0%, 100% { filter: brightness(0.92); }
  50% { filter: brightness(1.14); }
}

/* ── 404 ─────────────────────────────────────────────────────────────────── */

.eye--still { --d: 96px; display: block; cursor: default; }
.lost .discovery { gap: 18px; }
.lost__code {
  margin: 14px 0 0;
  font-size: clamp(44px, 12vw, 72px);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  line-height: 1;
}
.lost__why { margin: 0; font-size: 15px; color: var(--dim); letter-spacing: 0.04em; }
.lost__home { margin: 10px 0 0; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.lost__home a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #3c3c41; padding: 6px 0 4px; }
.lost__home a:hover, .lost__home a:focus-visible { border-color: var(--hal); }

/* ── Jupiter and beyond the infinite ─────────────────────────────────────── */

.gate {
  position: fixed;
  z-index: 20;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ── small screens, still air ────────────────────────────────────────────── */

@media (max-width: 380px) {
  .eye { --d: 52px; }
  .monolith { gap: 12px; padding: 14px 14px 12px 12px; }
}

@media (max-height: 520px) {
  .discovery { gap: 18px; padding-top: 20px; }
  .mark { width: min(46vw, 300px); }
}

/* Three ways to be short of room, by the viewport. Stacked, the page needs
   about 640px of height at full size. The three are nested queries so that
   they divide the plane exactly: "narrower than 560px" is written `not all
   and (min-width: 560px)`, which leaves no sliver between 559.98 and 560 for
   a zoomed, fractional viewport to fall into.

   1. Short and wide (a phone on its side, a short window, a page zoomed to
      200%), but taller than 300px: the slab stands beside the ship. While it
      stands, the ship moves over and the telephone row sizes itself to the
      room that leaves. */
@media (max-height: 660px) and (min-width: 560px) {
  @media not all and (max-height: 300px) {
    :root { --slab-w: min(360px, 46vw); }
    /* The row is 10 keys and 3 gaps (11.4 keys and 8px), centred, and "+1"
       hangs 1.55 keys to its left: 14.5 keys must fit between the paddings,
       or "+1" slides under a notch. */
    .has-slab {
      --key: clamp(15px, calc((100vw - var(--slab-w) - 40px - max(44px, env(safe-area-inset-left)) - env(safe-area-inset-right)) / 14.5), 30px);
    }
    .monolith {
      --slab-rest: 50%;
      --slab-away: calc(50% + 80vh);
      left: auto;
      right: max(16px, env(safe-area-inset-right));
      bottom: 50%;
      margin: 0;
    }
    .has-slab .discovery {
      padding-bottom: 24px;
      padding-left: max(44px, env(safe-area-inset-left));
      padding-right: calc(var(--slab-w) + 32px + env(safe-area-inset-right));
    }
  }
}

/* 2. Narrow, and above 520px up to 660px high: the slab stays under the
      ship, and while it stands the mark gives up the height that is missing
      (434px is everything else: paddings, the number, the slab, the footer). */
@media (max-height: 660px) {
  @media not all and (min-width: 560px) {
    @media not all and (max-height: 520px) {
      .has-slab .mark { width: min(78vw, 440px, max(140px, calc((100vh - 434px) * 2))); }
    }
  }
}

/* 3. Narrow and at most 520px high (a small phone on its side, a page zoomed
      to 400%), or at most 300px high at any width (a phone on its side with
      its toolbars showing): nothing fixed fits, so the slab joins the page,
      between the ship and the small print, and scrolls with them. */
@media (max-height: 520px) {
  @media not all and (min-width: 560px), (max-height: 300px) {
    body { grid-template-rows: 1fr auto auto; }
    .monolith,
    .monolith.is-below {
      position: static;
      grid-row: 2;
      margin: 0 auto 20px;
      transform: none;
    }
    .legal { grid-row: 3; }
    .has-slab .discovery { padding-bottom: 24px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky, .discovery, .mark, .com__row--n, .k, .monolith, .monolith__q { transition: none; }
  .eye__lens { animation: none; }
}

@media print {
  .sky, .gate, .monolith { display: none; }
  html, body { background: #fff; color: #000; }
  .mark img { filter: none; }
  .com__tag, .com__row--n, .com__cc, .k.d, .legal, .legal a, .lost__why, .lost__home a { color: #000; text-shadow: none; }
}

/* A forced light palette would put the inverted (near-white) mark on a light
   page. The mark keeps its own black ground there, whatever the theme. */
@media (forced-colors: active) {
  .mark { forced-color-adjust: none; background: #000; }
  /* The lens is drawn with gradients and shadows only, which a forced
     palette removes: without this the button is an invisible circle. */
  .eye, .eye * { forced-color-adjust: none; }
}
