@font-face { font-family: "Cinzel"; font-weight: 400; font-display: swap; src: url(fonts/Cinzel-Regular.woff2) format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 700; font-display: swap; src: url(fonts/Cinzel-Bold.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url(fonts/AlegreyaSans-Regular.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url(fonts/AlegreyaSans-Medium.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url(fonts/AlegreyaSans-Bold.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: italic; font-display: swap; src: url(fonts/AlegreyaSans-Italic.woff2) format("woff2"); }

:root {
  --ink: #0d0a09;
  --ink-2: #16110e;
  --line: rgba(226, 180, 87, 0.16);
  --glass: rgba(22, 17, 14, 0.55);
  --parchment: #f1e6d0;
  --parchment-dim: #c9bba2;
  --muted: #9a8a73;
  --gold: #e2b457;
  --gold-hi: #f6d68e;
  --gold-deep: #b9832f;
  --lapis: #4d8dff;
  --ok: #7fbf6a;
  --bad: #d9674f;
  --radius: 16px;
  --display: "Cinzel", Georgia, serif;
  --body: "Alegreya Sans", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--parchment);
  font: 400 1.125rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  /* Fallback sky when WebGL is unavailable; the canvas paints over it. */
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, rgba(226, 180, 87, 0.10), transparent 70%),
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(40, 70, 140, 0.22), transparent 70%),
    var(--ink);
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration-color: rgba(226, 180, 87, 0.4); text-underline-offset: 3px; }
a:hover { color: var(--gold-hi); }
code {
  font: 0.86em ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.08em 0.4em;
  border-radius: 6px;
  word-break: break-word;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); margin: 0.25em 0 0.55em; color: #f7ecd8; }
h3 { font-size: 1.02rem; letter-spacing: 0.02em; color: var(--gold); margin-bottom: 0.4em; }
p { margin: 0 0 1em; }
.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }
.narrow { max-width: 760px; }
.center { text-align: center; margin-inline: auto; }
.small { font-size: 0.95rem; color: var(--muted); }
.eyebrow {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}
.lede { color: var(--parchment-dim); font-size: 1.18rem; }

#sky {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#sky.on { opacity: 1; }

/* ---------- top bar ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) max(18px, calc((100% - 1080px) / 2)) 14px;
  transition: background 0.3s, backdrop-filter 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.top.scrolled {
  background: rgba(13, 10, 9, 0.62);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
.realm-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--parchment-dim);
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70vw;
}
.realm-pill .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.realm-pill:hover { color: var(--parchment); }
.top-cta {
  font-family: var(--display); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  padding: 9px 16px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  white-space: nowrap;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.top.scrolled .top-cta, html:not(.js) .top-cta { opacity: 1; transform: none; pointer-events: auto; }
.top-cta:hover { color: var(--ink); filter: brightness(1.08); }

.dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--muted);
  box-shadow: 0 0 0 0 currentColor;
}
.up .dot { background: var(--ok); color: rgba(127, 191, 106, 0.55); animation: ping 2.4s ease-out infinite; }
.down .dot { background: var(--bad); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 currentColor; } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 96px 20px 88px;
}
.crest {
  position: relative;
  width: min(760px, 92vw);
  margin: 0 0 14px;
  /* Shine sweep: a highlight band clipped to the logo's alpha. */
  --sweep: -60%;
}
.crest img {
  width: 100%;
  filter: drop-shadow(0 18px 50px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 40px rgba(226, 180, 87, 0.18));
}
.crest::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 236, 190, 0.12) 44%, rgba(255, 248, 225, 0.5) 50%, rgba(255, 236, 190, 0.12) 56%, transparent 62%);
  background-size: 250% 100%;
  background-position: 120% 0;
  -webkit-mask: url(img/logo.webp?v=3) center / 100% 100% no-repeat;
  mask: url(img/logo.webp?v=3) center / 100% 100% no-repeat;
  mix-blend-mode: screen;
  pointer-events: none;
}
.js .crest::after { animation: sweep 7.5s var(--ease) 1.2s infinite; }
@keyframes sweep {
  0% { background-position: 120% 0; }
  32%, 100% { background-position: -20% 0; }
}
/* The Lapis Prima in the crest: a slow blue breathing glow. */
.gem {
  position: absolute;
  left: 49.8%; top: 22.6%;
  width: 18%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 175, 255, 0.75) 0%, rgba(77, 141, 255, 0.28) 32%, transparent 68%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: breathe 4.6s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.9); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }

.js .crest, .js .hero .eyebrow, .js .tagline, .js .cta, .js .scroll-cue {
  opacity: 0; transform: translateY(14px); filter: blur(6px);
  animation: rise 1.1s var(--ease) forwards;
}
.js .crest { transform: scale(0.96); animation-duration: 1.6s; }
.js .hero .eyebrow { animation-delay: 0.45s; }
.js .tagline { animation-delay: 0.6s; }
.js .cta { animation-delay: 0.78s; }
.js .scroll-cue { animation-delay: 1.4s; }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }

.tagline {
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  color: #f7ecd8;
  margin: 14px 0 30px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
}
.cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 170px; padding: 13px 26px;
  border-radius: 999px;
  font-family: var(--display); font-weight: 700; font-size: 0.92rem; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, color 0.25s;
}
.btn.primary {
  color: #1a1209;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 8px 30px rgba(226, 180, 87, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn.primary:hover { color: #1a1209; transform: translateY(-2px); box-shadow: 0 12px 40px rgba(226, 180, 87, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { color: var(--parchment); border: 1px solid rgba(241, 230, 208, 0.28); background: rgba(13, 10, 9, 0.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn.ghost:hover { color: var(--gold-hi); border-color: var(--gold); transform: translateY(-2px); }
.btn:focus-visible, .dl:focus-visible, .top-cta:focus-visible, summary:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

.scroll-cue {
  position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; margin-left: -12px;
  width: 24px; height: 38px; border-radius: 12px;
  border: 1.5px solid rgba(241, 230, 208, 0.35);
}
.scroll-cue span {
  position: absolute; left: 50%; top: 8px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px;
  background: var(--gold);
  animation: cue 2s ease-in-out infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* ---------- news strip ---------- */
.strip {
  border-block: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(13, 10, 9, 0.2), rgba(22, 17, 14, 0.7), rgba(13, 10, 9, 0.2));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  position: relative; overflow: hidden;
}
.strip::before {
  content: ""; position: absolute; top: -1px; height: 1px; width: 30%;
  background: linear-gradient(90deg, transparent, var(--gold-hi), transparent);
  animation: run 6s linear infinite;
}
@keyframes run { from { left: -30%; } to { left: 100%; } }
.strip-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 28px;
  padding-block: 14px;
  font-size: 0.98rem; color: var(--parchment-dim);
}
.strip-row p { margin: 0; display: inline-flex; align-items: center; gap: 9px; }
.strip .k { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }

/* ---------- sections ---------- */
.section { padding: clamp(72px, 11vw, 128px) 0; position: relative; }
.pillars {
  list-style: none; padding: 0; margin-top: 44px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.pillars li {
  position: relative;
  padding: 22px 20px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(30, 23, 19, 0.72), rgba(16, 12, 10, 0.6));
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pillars li::before {
  content: ""; position: absolute; left: 20px; right: 20px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(246, 214, 142, 0.7), transparent);
}
.pillars p { margin: 0; color: var(--parchment-dim); font-size: 1.02rem; line-height: 1.5; }

.join { padding-top: 24px; }
.dl-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); justify-content: center; gap: 18px;
  margin: 36px auto 10px;
}
.dl {
  --mx: 50%; --my: 50%;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: 4px;
  padding: 24px 26px;
  border-radius: var(--radius);
  text-decoration: none; color: var(--parchment);
  background: rgba(22, 17, 14, 0.78);
  border: 1px solid rgba(226, 180, 87, 0.28);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.dl::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(226, 180, 87, 0.22), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.dl:hover { color: var(--parchment); transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(226, 180, 87, 0.25); }
.dl:hover::before { opacity: 1; }
.dl.mine { border-color: var(--gold); box-shadow: 0 0 40px rgba(226, 180, 87, 0.16); }
.dl.mine::after {
  content: "Your system"; position: absolute; top: 14px; right: 16px;
  font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); background: var(--gold); padding: 3px 8px; border-radius: 999px;
}
.dl .os { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: #f7ecd8; }
.dl .meta { color: var(--muted); font-size: 0.98rem; }
.dl .go { margin-top: 10px; color: var(--gold); font-weight: 700; letter-spacing: 0.02em; }
.dl .go span { display: inline-block; transition: transform 0.3s var(--ease); }
.dl:hover .go span { transform: translateX(5px); }

.steps {
  list-style: none; counter-reset: step; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin: 44px 0 26px;
}
.steps li {
  counter-increment: step;
  padding: 22px 22px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(16, 12, 10, 0.55);
  font-size: 1.02rem; color: var(--parchment-dim);
}
.steps h3::before {
  content: counter(step);
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-right: 10px; border-radius: 50%;
  font-size: 0.8rem; color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep));
  vertical-align: 2px;
}
.steps strong { color: var(--parchment); }

.fine {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(16, 12, 10, 0.55);
  margin-bottom: 22px;
}
.fine summary {
  cursor: pointer; list-style: none;
  padding: 16px 22px;
  font-family: var(--display); font-size: 0.95rem; color: var(--gold);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.fine summary::-webkit-details-marker { display: none; }
.fine summary::after { content: "+"; font-size: 1.3rem; line-height: 1; transition: transform 0.3s var(--ease); }
.fine[open] summary::after { transform: rotate(45deg); }
.fine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; padding: 0 22px 10px; }
.fine ul { margin: 0 0 12px; padding-left: 1.1em; color: var(--parchment-dim); font-size: 1rem; }
.fine li { margin-bottom: 4px; }
.fine li::marker { color: var(--gold-deep); }
.manual { margin-top: 8px; }

footer {
  padding: 40px 0 max(40px, env(safe-area-inset-bottom));
  text-align: center;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.5));
  color: var(--parchment-dim);
  font-size: 1rem;
}
footer p { margin: 0 0 4px; }

/* ---------- scroll reveals ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js [data-reveal].in { opacity: 1; transform: none; }
.js .pillars li:nth-child(2) { transition-delay: 0.08s; }
.js .pillars li:nth-child(3) { transition-delay: 0.16s; }
.js .pillars li:nth-child(4) { transition-delay: 0.24s; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 1.06rem; }
  .hero { padding-top: 84px; }
  .crest { width: 96vw; }
  .btn { min-width: 0; flex: 1 1 140px; padding: 13px 14px; font-size: 0.84rem; letter-spacing: 0.05em; white-space: nowrap; }
  .cta { width: 100%; max-width: 360px; }
  .pillars { grid-template-columns: 1fr; gap: 12px; }
  .dl-grid { grid-template-columns: 1fr; }
  .fine-grid { grid-template-columns: 1fr; }
  .strip-row { flex-direction: column; align-items: flex-start; }
  .realm-pill { font-size: 0.85rem; padding: 7px 12px; }
  .top-cta { font-size: 0.7rem; letter-spacing: 0.06em; padding: 8px 12px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .js .crest, .js .hero .eyebrow, .js .tagline, .js .cta, .js .scroll-cue, .js [data-reveal] { opacity: 1; transform: none; filter: none; }
  .gem { opacity: 0.7; }
}
