/* Fantastic Fusion · Engineering — welcome page
   Poppins (SIL OFL 1.1, see ../fonts/OFL.txt) is self-hosted, Latin subset only.
   Chinese text falls through to the platform face (PingFang SC / Microsoft YaHei). */

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #04051a;
  --text: #eef0ff;
  --muted: #aab0dc;
  --dim: #8389bd;
  --sky: #62cdfb;
  --royal: #3d5afe;
  --violet: #8f6bff;
  --font: "Poppins", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
  --pad: clamp(20px, 5.6vw, 104px);
}

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

html {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- the field (WebGL) and its static stand-in ---------- */

.field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  pointer-events: none;
}
.gl .field { visibility: visible; }

.core-rings {
  position: absolute;
  left: 50.195%;   /* hole centre of the mark: 128.5 / 256 */
  top: 58.398%;    /* 149.5 / 256 */
  width: 1015.625%; /* 2600 / 256 */
  max-width: none;
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}
.gl .core-rings { display: none; }

/* soft halo behind the mark when the shader is not drawing it */
.core::before {
  content: "";
  position: absolute;
  left: 50.195%;
  top: 58.398%;
  width: 230%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(77, 107, 255, 0.34), rgba(77, 107, 255, 0.12) 48%, rgba(77, 107, 255, 0) 100%);
  pointer-events: none;
}
.gl .core::before { display: none; }

/* ---------- layout ---------- */

.stage {
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top   top"
    "entry core"
    "foot  foot";
  column-gap: clamp(16px, 3vw, 56px);
  padding: clamp(20px, 3.6vh, 40px) var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
}

.top { grid-area: top; }
.host {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.core {
  grid-area: core;
  place-self: center;
  position: relative;
  line-height: 0;
}
.mark {
  position: relative;
  display: block;
  width: clamp(190px, min(24vw, 42vh), 420px);
  height: auto;
}

.entry {
  grid-area: entry;
  align-self: center;
  position: relative;
  padding-block: 24px;
}

h1 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(2.125rem, 4.55vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.036em;
  color: var(--text);
}

.lede {
  margin: clamp(18px, 2.6vh, 30px) 0 0;
  max-width: 30em;
  font-size: clamp(1rem, 1.25vw, 1.3125rem);
  line-height: 1.6;
  color: var(--muted);
}

.signin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(28px, 4.6vh, 52px);
  min-height: 56px;
  padding: 14px 30px;
  border-radius: 12px;
  background: #f1f3ff;
  color: #060828;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 36px -8px rgba(61, 90, 254, 0.55);
  transition: transform 0.18s ease, box-shadow 0.25s ease, background-color 0.18s ease;
}
.signin:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 6px rgba(98, 205, 251, 0.16),
    0 16px 48px -8px rgba(110, 100, 255, 0.8);
}
.signin:active { transform: translateY(0) scale(0.99); }
.signin:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 4px;
}

.note {
  margin: 18px 0 0;
  max-width: 40em;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--dim);
}

.lede span, .note span { display: inline-block; }

.foot {
  grid-area: foot;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--dim);
}

/* ---------- narrow / portrait: mark above, entry below ---------- */

@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "top" "core" "entry" "foot";
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .mark { width: clamp(120px, min(42vw, 23vh), 260px); }
  .core { margin-block: 12px; }
  .entry { padding-block: 0 clamp(24px, 5vh, 56px); }
  h1 { font-size: clamp(2rem, 9vw, 3.5rem); }
  .signin { display: flex; width: 100%; max-width: 420px; padding-inline: 16px; }
}

/* ---------- arrival: one sequence, timed to the field opening from the core ---------- */

@keyframes ff-ignite {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: none; }
}
@keyframes ff-surface {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.mark   { animation: ff-ignite 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
h1      { animation: ff-surface 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.35s both; }
.lede   { animation: ff-surface 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.5s both; }
.signin { animation: ff-surface 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.65s both; }
.note, .host, .foot { animation: ff-surface 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.8s both; }

@media (prefers-reduced-motion: reduce) {
  .mark, h1, .lede, .signin, .note, .host, .foot { animation: none; }
  .signin { transition: none; }
  .signin:hover { transform: none; }
}

@media (forced-colors: active) {
  .signin { border: 1px solid ButtonText; }
}
