/* Akatse — the front page.
 *
 * One world: a small ringed planet with a sakura on it, in the brand's black, mint and white. Every screen is a
 * place in that world with a field of one brand colour, and the primary logo's double outline is on everything
 * that can be pressed. The words hold still; the petals do the panicking.
 *
 * Motion ported from Magic UI (magicui.design, © Dillion Verma, MIT licence) into plain CSS: text-3d-flip
 * (the motto), border-beam (the one email field).
 * Without JavaScript the screens stack and scroll; with motion off everything is simply there.
 */

:root {
  /* The brand, verbatim. */
  --black: #000000;
  --mint: #7fc0a6;
  --white: #ffffff;
  /* Derived, for what the three cannot do alone. */
  --mint-light: #b9e3d1;
  --mint-deep: #2d6b55;
  --error: #b3261e;

  /* 8 Heavy in the brand book; Bagel Fat One is its free stand-in. Anton is the free cut of Impact. */
  --display: 'Bagel Fat One', 'Arial Black', sans-serif;
  --impact: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --text: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --maxw: 1560px;
  --gutter: clamp(18px, 4.4vw, 72px);
  --side: max(var(--gutter), calc((100% - var(--maxw)) / 2));
  --head-h: 92px;
  --foot-h: 76px;
  --out: cubic-bezier(.2, .8, .2, 1);

  --ground: var(--black);
  --ink: var(--white);
  --soft: var(--mint-light);
  --key: var(--mint);
  --on-key: var(--black);
  --alert: #ff9d92;
}

[data-tone="night"] { --ground: var(--black); --ink: var(--white); --soft: var(--mint-light); --key: var(--mint); --on-key: var(--black); --alert: #ff9d92; }
[data-tone="mint"] { --ground: var(--mint); --ink: var(--black); --soft: var(--black); --key: var(--black); --on-key: var(--white); --alert: #4a0500; }
[data-tone="paper"] { --ground: var(--white); --ink: var(--black); --soft: var(--mint-deep); --key: var(--black); --on-key: var(--white); --alert: var(--error); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--black); }
body { margin: 0; color: var(--ink); font: 400 1.0625rem/1.55 var(--text); text-rendering: optimizeLegibility; font-synthesis: none; }
::selection { background: var(--mint); color: var(--black); }
h1, h2, p, ul { margin: 0; }
svg { display: block; }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 8px; }
[tabindex="-1"]:focus { outline: none; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -70px; z-index: 30; padding: 10px 16px;
  background: var(--white); color: var(--black); border-radius: 12px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- the world ---------- */

.world { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
html:not(.js) .world, .no-3d .world { display: none; }
.no-3d body { background: var(--ground); }

/* ---------- buttons ---------- */

/* The logo's double outline: the shape, a gap of whatever it sits on, a line round that. */
.button {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 30px 16px; border: 0; border-radius: 18px;
  background: var(--key); color: var(--on-key); font: 400 1.1875rem/1.1 var(--display); letter-spacing: .01em; text-align: center;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 0 0 4px var(--ground), 0 0 0 7px var(--key);
  transition: background-color .25s, color .25s, box-shadow .25s;
}
.button:hover { background: var(--ink); color: var(--ground); box-shadow: 0 0 0 4px var(--ground), 0 0 0 9px var(--ink); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ground), 0 0 0 10px var(--ink); }
.button[disabled] { cursor: progress; opacity: .6; }

/* ---------- header ---------- */

.head {
  position: fixed; inset: 0 0 auto; z-index: 10; height: var(--head-h);
  display: flex; align-items: center; gap: clamp(18px, 3.2vw, 48px);
  padding-inline: var(--side); color: var(--ink); pointer-events: none;
}
.head > * { pointer-events: auto; }

/* The primary logo as on the board: the mark filled, the letters outlined. */
.lockup { flex: none; border-radius: 10px; }
.lockup svg { width: 152px; height: auto; overflow: visible; }
.mark-out, .type-out { fill: var(--ink); stroke: var(--ink); stroke-linejoin: round; }
.mark-out { stroke-width: 42; }
.mark-gap { fill: var(--ground); stroke: var(--ground); stroke-width: 22; stroke-linejoin: round; }
.mark-in { fill: var(--ink); }
.type-out { stroke-width: 30; }
.type-in { fill: var(--ground); }

.menu { display: flex; gap: clamp(16px, 2.4vw, 36px); }
.menu a { padding: 8px 0; color: var(--ink); font-weight: 600; font-size: .9375rem; text-decoration: none; white-space: nowrap; }
.menu a:hover, .menu a[aria-current="true"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; }

.head-right { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.lang { display: inline-flex; gap: 2px; }
.lang button {
  min-width: 40px; min-height: 36px; padding: 5px 10px; border: 0; border-radius: 999px; background: none; color: var(--ink);
  font: 600 .8125rem/1 var(--text); letter-spacing: .04em; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.lang button:focus-visible { outline-offset: 2px; }

/* ---------- the deck ---------- */

main { position: relative; z-index: 1; }
main:focus { outline: none; }

.view {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--head-h) + 8px) var(--side) var(--foot-h);
  color: var(--ink);
}
/* Until the script takes over, every screen carries its own field. */
html:not(.js) .view { background: var(--ground); }
.no-3d .view { background: var(--ground); }

.js.deck body { height: 100vh; height: 100dvh; overflow: hidden; }
.js.deck main { position: fixed; inset: 0; perspective: 1400px; }
.js.deck .view {
  position: absolute; inset: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  visibility: hidden; opacity: 0; pointer-events: none;
  transform: translate3d(90px, 0, -240px) rotateY(-16deg);
  transition: opacity .3s ease, transform .8s var(--out), visibility 0s .5s;
}
.js.deck .view.is-past { transform: translate3d(-90px, 0, 260px) rotateY(16deg); }
.js.deck .view.is-on {
  visibility: visible; opacity: 1; pointer-events: auto; transform: none;
  transition: opacity .5s .3s ease, transform 1s .15s var(--out), visibility 0s;
}
/* Before the script has run, the front is the one showing. */
.js.deck main:not(:has(.is-on)) #home { visibility: visible; opacity: 1; pointer-events: auto; transform: none; }

/* ---------- the front ---------- */

.home-copy { position: relative; z-index: 2; width: min(50%, 760px); display: grid; justify-items: start; pointer-events: none; }
.home-copy > * { pointer-events: auto; }
.motto { max-width: 100%; font: 400 clamp(2.875rem, min(8.2vw, 14dvh), 8.25rem)/.94 var(--display); color: var(--white); }
:root[lang="lt"] .motto { font-size: clamp(2.5rem, min(6.5vw, 14dvh), 6.625rem); }
.js .flip-source { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.flip { display: block; max-width: 6.8em; perspective: 4em; }
:root[lang="lt"] .flip { max-width: 8em; }
.flip .word { display: inline-block; white-space: nowrap; transform-style: preserve-3d; }
.flip .letter { display: inline-block; transform-origin: 50% 55% -.45em; backface-visibility: hidden; }

.who { margin-top: clamp(14px, 2.8dvh, 30px); font: 400 clamp(1.5rem, min(2.7vw, 4.8dvh), 2.625rem)/1.1 var(--impact); color: var(--mint); text-wrap: balance; }
.lede { margin-top: 10px; max-width: 30em; font-size: clamp(1rem, 1.35vw, 1.25rem); line-height: 1.5; text-wrap: pretty; }

.door {
  position: absolute; left: 0; top: 0; z-index: 1; width: 0; height: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--black); text-decoration: none;
  cursor: pointer; opacity: 0; transition: opacity .3s;
  user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;
}
html:not(.js) .door { display: none; }
.js.deck .view.is-on .door.placed { opacity: 1; }
.door.turning { cursor: grabbing; }
/* clear of the planet's own two lines, or the keyboard's place would not show */
.door:focus-visible { border-radius: 50%; outline: 5px solid var(--mint); outline-offset: 32px; }
.door-word {
  font: 400 1rem/1 var(--display); white-space: nowrap; transform: translateY(-.15em) rotate(-9deg);
  transition: transform .45s var(--out);
}
.door:hover .door-word, .door:focus-visible .door-word { transform: translateY(-.15em) rotate(-9deg) scale(1.13); }
/* No WebGL2: the planet flat, with the same two lines. */
.no-3d .door { background: var(--mint); box-shadow: 0 0 0 7px var(--black), 0 0 0 12px var(--white), 0 0 0 22px var(--black), 0 0 0 25px var(--white); }

/* ---------- akaverse ---------- */

.verse { align-items: flex-start; }
.verse-copy { width: min(56%, 820px); display: grid; justify-items: start; }
.verse-word { width: 100%; }
.verse-word svg { width: 100%; height: auto; overflow: visible; }
.verse-word text { font-family: var(--display); font-size: 200px; text-anchor: middle; stroke-linejoin: round; }
.word-out { fill: var(--black); stroke: var(--black); stroke-width: 26; }
.word-gap { fill: var(--mint); stroke: var(--mint); stroke-width: 13; }
.word-in { fill: var(--black); }
.soon { margin: -2px 0 0 14px; font: 400 clamp(1.75rem, 3.4vw, 3.25rem)/1 var(--impact); color: var(--black); transform: rotate(-5deg); }

.wait { width: min(100%, 580px); margin-top: clamp(28px, 6dvh, 64px); padding-left: 12px; }
.wait label { display: block; margin-bottom: 14px; font-weight: 600; }
.wait-line {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 4px; border-radius: 22px;
  background: var(--white); box-shadow: 0 0 0 4px var(--ground), 0 0 0 7px var(--black);
}
.wait-line input { flex: 1; min-width: 0; padding: 12px 16px; border: 0; border-radius: 16px; background: transparent; color: var(--black); }
.wait-line input::placeholder { color: #5d6b65; }
.wait-line input:focus-visible { outline: none; }
.wait-line:focus-within { box-shadow: 0 0 0 4px var(--ground), 0 0 0 9px var(--black); }
.wait-line:has([aria-invalid="true"]) { box-shadow: 0 0 0 4px var(--ground), 0 0 0 8px var(--error); }
.wait-line .button { --ground: var(--white); --ink: var(--mint-deep); padding: 12px 18px 13px; border-radius: 14px; font-size: 1rem; box-shadow: none; }
.wait-line .button:hover { background: var(--mint-deep); color: var(--white); box-shadow: none; }
.wait-line .button:focus-visible { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--mint-deep); }
.beam {
  position: absolute; inset: 0; border-radius: inherit; border: 4px solid transparent; pointer-events: none; opacity: 0;
  mask: linear-gradient(transparent, transparent), linear-gradient(#000, #000); mask-clip: padding-box, border-box; mask-composite: intersect;
}
.beam::after {
  content: ''; position: absolute; width: 120px; aspect-ratio: 1;
  background: linear-gradient(to left, var(--black), var(--mint), transparent);
  offset-anchor: 90% 50%; offset-path: rect(0 auto auto 0 round 120px);
}
.wait-line:focus-within .beam { opacity: 1; }
.wait .note { margin-top: 16px; }

.note { font-size: .875rem; line-height: 1.4; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.human-check:not(:empty) { margin-top: 10px; }
.status { margin-top: 8px; font-weight: 600; font-size: .9375rem; color: var(--ink); }
.status:empty { margin: 0; }
.status[data-state="error"] { color: var(--alert); }

/* ---------- to order ---------- */

.order { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); align-content: center; align-items: start; gap: 24px clamp(40px, 7vw, 120px); }
.order-intro { display: grid; gap: clamp(14px, 2.6dvh, 26px); }
.order-intro h2 { max-width: 10em; }
.order-intro p { max-width: 27em; }
.form { display: grid; gap: clamp(12px, 2.2dvh, 20px); min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field label { font-weight: 600; font-size: .9375rem; }
.field input, .field textarea {
  width: 100%; padding: 11px 14px; border: 2px solid var(--black); border-radius: 14px; background: var(--white); color: var(--black);
}
.field textarea { min-height: 96px; max-height: 24dvh; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #5d6b65; }
.field input:focus-visible, .field textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--mint-deep); }
.field [aria-invalid="true"] { border-color: var(--error); }
.form-end { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin: 8px 0 4px 7px; }
.copyright { font-size: .8125rem; color: var(--mint-deep); }

/* ---------- the foot ---------- */

.pager {
  position: fixed; inset: auto 0 0; z-index: 10; height: var(--foot-h);
  display: flex; align-items: center; gap: 22px;
  padding-inline: var(--side); color: var(--ink); pointer-events: none;
}
.pager > * { pointer-events: auto; }
/* The world passes under the foot: each control carries its own patch of ground. */
.pips, .motion, .pager-next, .lang { border-radius: 999px; background: var(--ground); }
.menu a { background: var(--ground); }
.pips { padding: 0 6px; margin-left: -6px; }
.pips { display: flex; align-items: center; gap: 2px; }
.pips button { position: relative; width: 28px; height: 32px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; transition: width .5s var(--out); }
.pips button::before { content: ''; position: absolute; inset: 11px 3px; border: 2px solid currentColor; border-radius: 999px; }
.pips button:hover::before { background: currentColor; }
.pips button[aria-current="step"] { width: 52px; }
.pips button[aria-current="step"]::before { background: currentColor; }

.motion { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 0; color: inherit; font: 500 .8125rem/1 var(--text); cursor: pointer; }
.motion svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.motion .i-play, .still .motion .i-pause { display: none; }
.still .motion .i-play { display: inline; }

.pager-next {
  display: inline-flex; align-items: center; gap: 14px; margin: 0 -14px 0 auto; min-height: 44px; padding: 6px 14px;
  border: 0; color: inherit; font: 400 1.0625rem/1.1 var(--display); cursor: pointer;
}
.pager-next svg { width: 66px; height: auto; overflow: visible; fill: currentColor; transition: transform .4s var(--out); }
.pager-next:hover svg { transform: translate(5px, -3px); }

/* ---------- the page that is not there ---------- */

.missing {
  min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: start; gap: 26px;
  padding: 48px var(--gutter); background: var(--black); color: var(--white);
}
.missing h1 { max-width: 9em; font: 400 clamp(2.5rem, 8vw, 6.5rem)/.98 var(--display); color: var(--mint); }
.missing .button { margin-left: 7px; }

/* ---------- motion ---------- */

@keyframes turn-in { from { transform: rotateX(96deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes arrive { from { opacity: 0; filter: blur(8px); transform: translateY(10px); } to { opacity: 1; filter: none; transform: none; } }
@keyframes run-round { to { offset-distance: 100%; } }

@media (prefers-reduced-motion: no-preference) {
  /* The one orchestrated moment: the petals storm, the motto turns over into place, the storm dies down. */
  html.js:not(.still) .flip .letter { animation: turn-in .8s var(--out) both; animation-delay: calc(var(--n, 0) * 38ms + .35s); }
  html.js:not(.still) .who { animation: arrive .8s 1.15s var(--out) both; }
  html:not(.still) .wait-line:focus-within .beam::after { animation: run-round 5s linear infinite; }
}
.still .view, .still .door-word, .still .pager-next svg { transition: none !important; }
.still.js.deck .view:not(.is-on) { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Without scripts the header leaves with the front, and what only a script can do is not offered. */
html:not(.js) .head { position: absolute; }
html:not(.js) .lang, html:not(.js) form { display: none; }

/* ---------- smaller screens ---------- */

@media (max-width: 1100px) {
  .menu { display: none; }
}

@media (max-height: 760px) and (min-width: 901px) {
  :root { --head-h: 78px; --foot-h: 62px; }
  .lockup svg { width: 128px; }
  .field textarea { min-height: 72px; }
}

/* A phone, or anything taller than it is wide: the planet goes above the words. */
@media (max-width: 720px), (max-aspect-ratio: 19/20) {
  .home { justify-content: flex-end; padding-bottom: calc(var(--foot-h) + 10px); }
  .home-copy { width: 100%; }
  .motto { font-size: clamp(2.5rem, min(13vw, 7.4dvh), 6rem); }
  :root[lang="lt"] .motto { font-size: clamp(2.125rem, min(11vw, 7dvh), 5.25rem); }
  .verse { justify-content: flex-start; }
  .verse-copy { width: 100%; padding-top: 5dvh; }
  .wait { padding: 0 8px; }
}

@media (max-width: 900px) {
  .order { grid-template-columns: minmax(0, 1fr); align-content: start; }
}

@media (max-width: 600px) {
  :root { --head-h: 72px; --foot-h: 60px; }
  body { font-size: 1rem; }
  .lockup svg { width: 104px; }
  .head { gap: 12px; }
  .head-right { gap: 14px; }
  .lang button { min-width: 32px; padding-inline: 6px; }
  .lede { font-size: 1rem; }
  .wait-line { flex-direction: column; align-items: stretch; padding: 8px; }
  .wait-line .button { white-space: normal; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .motion span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .motion { min-width: 36px; justify-content: center; }
  .pager { gap: 8px; }
  .pager-next { gap: 8px; font-size: .875rem; white-space: nowrap; }
  /* this one screen scrolls: nothing shows through the header and the foot */
  [data-view="order"] .head, [data-view="order"] .pager { background: var(--ground); }
  .pager-next svg { width: 42px; }
  .order .form { padding-bottom: 16px; }
}

@media (max-width: 400px) {
  .pager { padding-inline: 12px; gap: 4px; }
  .pips { margin-left: 0; padding: 0 2px; }
  .pips button { width: 22px; }
  .pips button[aria-current="step"] { width: 38px; }
  .motion { padding-inline: 8px; }
  .pager-next { margin-right: 0; padding-inline: 8px; font-size: .8125rem; }
  .pager-next svg { width: 30px; }
}

/* A phone on its side. */
@media (max-height: 480px) and (min-width: 560px) {
  :root { --head-h: 60px; --foot-h: 52px; }
  .lockup svg { width: 88px; }
  .motto, :root[lang="lt"] .motto { font-size: min(5.6vw, 13dvh); }
  .who { margin-top: 6px; font-size: min(2.7vw, 6dvh); }
  .lede { margin-top: 4px; font-size: .875rem; }
  .soon { font-size: 1.5rem; }
  .wait { margin-top: 12px; }
  .motion span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-height: 480px) { [data-view="order"] .head, [data-view="order"] .pager { background: var(--ground); } }
