/* arc.ai: one arch at the scale of the room (the look approved on 18 Oct 2026). The site's own engraved
   arch (js/engrave/frame.js), cut by its engraver at 4.4 px per plate unit and inked for paper (#bp-ink) into
   assets/arch/: the crown, one period of each pier and the base. Blue inside (the window), paper outside. Used by the
   Kimi K3 API page (k3.html) and the page-not-found page (404.html), one arch per page.
   Markup: section.arch-hero > div.arch-room > svg.arch-crown.arch-sky, span.arch-fill, div.arch-stones (svg.arch-crown
   with the image and the keystone's tablet, span.arch-pier-l, span.arch-pier-r, span.arch-base), div.arch-win. */

/* ---------- the arch. Plate units of a 600-unit-wide arch, so 100cqw = 600 units: centre (300, 300), window radius 240,
   jambs at x 60 and 540 from the springing (y 300) down to the sill; piers x 25.5-60.5 and 539.5-574.5, tiled from y 310
   in 65-unit periods; the base strip, 38 units, under everything ---------- */
.arch-hero { padding-top: calc(env(safe-area-inset-top, 0px) + 76px); }
.arch-room {
  position: relative; isolation: isolate; container-type: inline-size; margin-inline: auto; color: #fff;
  /* as wide as the room allows, and never so wide that the buttons fall below the first screen */
  width: min(1180px, calc(100vw - 2 * var(--gutter)));
  width: min(1180px, calc(100vw - 2 * var(--gutter)), calc((100svh - 104px) * 1.6));
}
.arch-crown { position: absolute; left: 0; top: 0; z-index: 0; display: block; width: 100%; height: auto; aspect-ratio: 600 / 310; pointer-events: none; }
/* the stone: crown, piers and base in one layer over the window, so the sweep cuts them together */
.arch-stones { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.arch-tab rect { fill: var(--paper); }
.arch-tab text { fill: var(--arc); font-family: var(--f-display); font-size: 10.5px; letter-spacing: 0.04em; }
/* the light through the window: brightest at the springing's centre, the window's own blue at its edge (the crown's
   gradient is the same circle) */
.arch-fill {
  position: absolute; z-index: 0; left: calc(100cqw * 60 / 600); right: calc(100cqw * 60 / 600); top: calc(100cqw * 299 / 600); bottom: calc(100cqw * 34 / 600);
  background-color: var(--arc); background-image: radial-gradient(circle calc(100cqw * 240 / 600) at 50% 0, #1b44e3, var(--arc));
}
.arch-pier {
  position: absolute; z-index: 2; top: calc(100cqw * 310 / 600); bottom: calc(100cqw * 36 / 600); width: calc(100cqw * 35 / 600);
  background-repeat: repeat-y; background-size: 100% auto; background-position: center top; pointer-events: none;
}
.arch-pier-l { left: calc(100cqw * 25.5 / 600); background-image: url("../assets/arch/pier-l.webp"); }
.arch-pier-r { right: calc(100cqw * 25.5 / 600); background-image: url("../assets/arch/pier-r.webp"); }
.arch-base { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: calc(100cqw * 38 / 600); background: url("../assets/arch/base.webp") center bottom / 100% auto no-repeat; pointer-events: none; }

/* the window: one line (and, on the K3 page, its price), set inside the jambs and under the curve */
.arch-win {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center;
  min-height: calc(100cqw * 470 / 600);
  padding: calc(100cqw * 146 / 600) calc(100cqw * 86 / 600) calc(100cqw * 78 / 600);
}
.arch-win .eyebrow { color: rgba(255, 255, 255, 0.78); font-size: max(0.82rem, calc(100cqw * 8.2 / 600)); }
.arch-title {
  margin-top: calc(100cqw * 12 / 600); max-width: 9em; color: #fff;
  font: 400 calc(100cqw * 47 / 600)/0.98 var(--f-display); letter-spacing: 0.01em;
}
.arch-win .lead { margin-top: calc(100cqw * 14 / 600); max-width: 30em; color: rgba(255, 255, 255, 0.9); font-size: max(1rem, calc(100cqw * 9.8 / 600)); line-height: 1.5; }
.arch-win .cta-row { margin-top: calc(100cqw * 20 / 600); }
.arch-win .btn-arch { background: #fff; color: var(--arc); }
.arch-win .btn-arch:hover { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px #fff; }
.arch-win .btn-line { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62); }
.arch-win .btn-line:hover { background: #fff; color: var(--arc); box-shadow: none; }
.arch-win :focus-visible { outline-color: #fff; }

/* phones: the arch is wider than the screen, so its piers stand just outside the edges and the window is the screen;
   the capitals and the stones of the crown still show */
@media (max-width: 760px) {
  .arch-hero { padding-top: calc(env(safe-area-inset-top, 0px) + 66px); }
  .arch-room { width: 128vw; margin-inline: -14vw; }
  .arch-win { padding: calc(100cqw * 150 / 600) calc(100cqw * 92 / 600) calc(100cqw * 92 / 600); min-height: 0; }
  .arch-title { font-size: calc(100cqw * 54 / 600); max-width: 8em; }
  .arch-win .cta-row { flex-direction: column; align-items: stretch; width: 100%; }
}

/* ---------- motion: draw it in once. The stone is cut by a sweep from the top left, as the site's plates are
   (js/engrave/plateview.js: 1.6 s, even, with a soft edge), while the window is lit from the start, so its words are
   read at once; then the keystone's tablet takes its numeral, the only accelerating move (a fall, then a damped settle).
   Reduced motion, or no script: the finished arch, still. ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.reduced) .arch-stones {
    -webkit-mask-image: linear-gradient(to bottom right, #000 42%, transparent 58%); mask-image: linear-gradient(to bottom right, #000 42%, transparent 58%);
    -webkit-mask-size: 300% 300%; mask-size: 300% 300%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    animation: arch-burin 1.6s linear 0.2s both;
  }
  html.js:not(.reduced) .arch-tab text { animation: arch-key 0.95s 1.75s both; }
}
@keyframes arch-burin { from { -webkit-mask-position: 100% 100%; mask-position: 100% 100%; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes arch-key {
  0% { transform: translateY(-24px); opacity: 0; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  10% { opacity: 1; }
  79% { transform: translateY(0); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  88% { transform: translateY(-1.2px); }
  100% { transform: translateY(0); opacity: 1; }
}

