:root {
  --blue: #537bd2;
  --blue-deep: #3d54b0;
  --blue-ink: #24305e;
  --blue-soft: #8ba0d2;
  --blue-pale: #d7e0f4;
  --grid: #c5d0ea;
  --bg: #f4f7fd;
  --paper: #ffffff;
  --ink: #1c2450;
  --muted: #5a6794;
  --line: #d5dcf0;
  --shadow: 0 18px 50px rgba(36, 48, 94, 0.12);
  --radius: 1.6rem;
  --nav-h: 4.25rem;
  --font-d: "Outfit", "Nunito", system-ui, sans-serif;
  --font-b: "Nunito", "Outfit", system-ui, sans-serif;
  --font-m: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg); }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.grain, .vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 3;
}
.grain {
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.vignette {
  background: radial-gradient(ellipse at center, transparent 50%, rgba(28,36,80,.08) 100%);
}

#cursor {
  display: none;
  position: fixed;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  pointer-events: none;
  z-index: 80;
  mix-blend-mode: multiply;
  transition: transform .15s var(--ease);
}
@media (pointer: fine) and (hover: hover) {
  body.has-cursor { cursor: none; }
  body.has-cursor a, body.has-cursor button { cursor: none; }
  #cursor { display: block; }
}

/* Boot */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, #eef3fc 0%, #ffffff 55%, #eaf0fb 100%);
  transition: opacity .6s var(--ease), visibility .6s;
}
.boot.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot__inner { text-align: center; padding: 1.5rem; }
.boot__cat {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 12px 20px rgba(83,123,210,.25));
  animation: bob 2.2s ease-in-out infinite;
}
.boot__kicker {
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .68rem;
  color: var(--blue);
}
.boot__msg { margin: .45rem 0 1.1rem; color: var(--muted); font-size: .95rem; }
.boot__bar {
  width: min(240px, 70vw);
  height: 6px;
  margin: 0 auto;
  border-radius: 99px;
  background: var(--blue-pale);
  overflow: hidden;
}
.boot__bar i {
  display: block;
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--blue-deep));
  transition: width .25s var(--ease);
}
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Nav */
.mast {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-d);
  font-weight: 800;
  letter-spacing: .04em;
  font-size: 1.05rem;
  color: var(--blue);
  flex: 0 0 auto;
}
.brand img { width: 36px; height: 36px; object-fit: contain; }
.nav-links {
  display: none;
  gap: 1.1rem;
  font-family: var(--font-d);
  font-weight: 600;
  font-size: .92rem;
}
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--blue-ink); }
.mast__actions { display: flex; align-items: center; gap: .45rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 2.6rem;
  padding: 0 1.05rem;
  border-radius: 999px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .02em;
  border: 1.5px solid transparent;
  transition: transform .2s var(--ease), background .2s, box-shadow .2s, color .2s;
  white-space: nowrap;
}
.btn--blue {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 20px rgba(83,123,210,.28);
}
.btn--blue:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn--ghost {
  background: #fff;
  color: var(--blue-ink);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.btn--lg { min-height: 3rem; padding: 0 1.25rem; font-size: .98rem; }

/* Hero */
.hero {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  display: grid;
  isolation: isolate;
}
#stage, .hero__fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#stage, .hero, .hero__fallback, main, .mood { overflow-x: hidden; max-width: 100%; }
#stage canvas { display: block; width: 100% !important; height: 100% !important; max-width: 100%; }
.hero__fallback {
  display: none;
  background:
    url("../assets/gallery/g01-grid.png") center 30% / cover no-repeat,
    var(--bg);
}
.hero.is-static #stage { display: none; }
.hero.is-static .hero__fallback { display: block; }
.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem 1.15rem 4.6rem;
  max-width: 44rem;
}
.kicker {
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .68rem;
  color: var(--blue);
}
h1, h2, h3 { font-family: var(--font-d); font-weight: 800; letter-spacing: -.03em; line-height: 1.02; }
.hero h1 {
  margin: .35rem 0 .5rem;
  font-size: clamp(2.6rem, 10vw, 6.2rem);
  color: var(--blue);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .7rem;
  padding: .45rem .9rem;
  border: 2px solid var(--blue);
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-family: var(--font-d);
  font-weight: 800;
  letter-spacing: .06em;
  width: max-content;
}
.tag::before, .tag::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  opacity: .7;
}
.lede {
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.1rem;
}
.cta-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: .9rem; }

.ca-box {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 100%;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ca-box code {
  flex: 1;
  min-width: 0;
  padding: .7rem .95rem;
  font-family: var(--font-m);
  font-size: .72rem;
  color: var(--blue-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ca-box button {
  flex: 0 0 auto;
  padding: 0 1rem;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  background: var(--blue);
}
.ca-box button:hover { background: var(--blue-deep); }

.disclaimer--hero {
  margin-top: .85rem;
  max-width: 36rem;
  font-size: .72rem;
  line-height: 1.45;
  color: var(--muted);
}
.pet-hint {
  margin-top: .55rem;
  font-size: .8rem;
  color: var(--blue-soft);
  font-weight: 700;
}
.scroll-cue {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: .18em;
  font-size: .68rem;
  color: var(--blue);
  text-transform: uppercase;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: .45; transform: translateX(-50%) translateY(0); }
  50% { opacity: 1; transform: translateX(-50%) translateY(4px); }
}

/* Sections */
.wrap { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
section.block { position: relative; z-index: 2; padding: 4.5rem 0; }
.section-kicker {
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .7rem;
  color: var(--blue);
  margin-bottom: .6rem;
}
.section-title {
  font-size: clamp(2rem, 5vw, 3.6rem);
  color: var(--blue-ink);
  text-wrap: balance;
}

.glass {
  background: color-mix(in srgb, #fff 86%, transparent);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

/* Contract */
#contract .panel { padding: 1.4rem 1.2rem; }
#contract .panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.market {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin: 1.1rem 0;
}
.market div, .stats div, .step, .com-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 1.15rem;
  padding: 1rem;
}
.market span, .stats span, .step i {
  display: block;
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: .62rem;
  color: var(--blue);
  margin-bottom: .25rem;
}
.market b, .stats b { font-family: var(--font-d); font-size: 1.15rem; color: var(--blue-ink); }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin-top: .4rem;
}
.note { margin-top: 1rem; font-size: .85rem; color: var(--muted); }
.contract-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.steps { display: grid; gap: .7rem; margin-top: 1.6rem; }
.step { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; }
.step .num {
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-d);
  font-weight: 800;
}

/* Lore */
.lore-list { display: grid; gap: 2.5rem; margin-top: 2.4rem; }
.lore-row {
  display: grid;
  gap: 1.2rem;
  align-items: center;
}
.lore-row img {
  width: 100%;
  border-radius: 1.6rem;
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
.lore-copy h3 { font-size: clamp(1.6rem, 3vw, 2.3rem); color: var(--blue-ink); margin: .3rem 0 .6rem; }
.lore-copy p { color: var(--muted); font-size: 1.05rem; }

/* Gallery */
.gal-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.gal-grid {
  margin-top: 1.8rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: .8rem;
}
.gal-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.3rem;
  border: 1.5px solid var(--line);
  background: #fff;
  aspect-ratio: 1;
  cursor: pointer;
  transform: perspective(800px) rotateX(0) rotateY(0);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.gal-card img { width: 100%; height: 100%; object-fit: cover; }
.gal-card:hover { box-shadow: var(--shadow); }

/* Moodboard */
.mood { overflow: hidden; padding-bottom: 2rem; }
.marquee {
  display: flex;
  gap: .8rem;
  width: max-content;
  animation: slide 48s linear infinite;
}
.marquee:hover { animation-play-state: paused; }
.marquee img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 1.1rem;
  border: 1.5px solid var(--line);
}
@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Vibe */
.vibe-card {
  display: grid;
  gap: 1rem;
  align-items: center;
  padding: 1.3rem;
}
.vibe-card img { width: 140px; margin: 0 auto; }
.vibe-card h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); color: var(--blue-ink); }
.vibe-card p { color: var(--muted); margin: .5rem 0 1rem; }

/* Community */
.com-grid { display: grid; gap: .8rem; margin-top: 1.6rem; }
.com-card { display: block; transition: transform .2s var(--ease), border-color .2s; }
.com-card:hover { transform: translateY(-3px); border-color: var(--blue); }
.com-card h3 { font-size: 1.2rem; margin: .15rem 0; color: var(--blue-ink); }
.com-card p { color: var(--muted); font-size: .95rem; }

/* Footer */
footer {
  position: relative;
  z-index: 2;
  padding: 2.5rem 0 3rem;
  border-top: 1.5px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  font-family: var(--font-d);
  font-weight: 700;
  color: var(--blue);
}
.disclaimer--foot { max-width: 58rem; line-height: 1.5; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 1.2rem;
  background: rgba(28, 36, 80, .55);
  backdrop-filter: blur(10px);
}
.lightbox.is-on { display: grid; }
.lightbox img {
  max-width: min(920px, 100%);
  max-height: 86svh;
  border-radius: 1.2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.lightbox button {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  background: #fff;
  color: var(--blue-ink);
  font-size: 1.2rem;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 95;
  padding: .7rem 1.1rem;
  border-radius: 999px;
  background: var(--blue-ink);
  color: #fff;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .9rem;
  box-shadow: var(--shadow);
  transition: transform .3s var(--ease);
  pointer-events: none;
}
.toast.is-on { transform: translateX(-50%) translateY(0); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); animation: reveal-fallback .7s var(--ease) 1.1s forwards; }
.reveal.is-in { opacity: 1; transform: none; animation: none; }
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }

@media (min-width: 640px) {
  .mast { padding: 0 1.5rem; }
  .gal-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .marquee img { width: 240px; height: 240px; }
  .vibe-card { grid-template-columns: 160px 1fr; padding: 1.6rem 1.8rem; }
  .vibe-card img { margin: 0; }
  .com-grid { grid-template-columns: 1fr 1fr; }
  .hero__content { padding: 2rem 2rem 5rem; }
}

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .gal-grid { grid-template-columns: repeat(3, 1fr); }
  .lore-row { grid-template-columns: 1.1fr .9fr; }
  .lore-row:nth-child(even) { grid-template-columns: .9fr 1.1fr; }
  .lore-row:nth-child(even) .lore-copy { order: 2; }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero__content {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(280px, 30rem) 1fr;
    align-items: center;
    min-height: calc(100svh - var(--nav-h));
    padding: 2rem 0 4rem;
    justify-content: stretch;
    max-width: none;
  }
  .hero__copy { max-width: 30rem; }
  #contract .panel { padding: 2.2rem 2.3rem; }
}

@media (max-width: 639px) {
  .market { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  #stage, .hero__fallback { position: relative; height: min(36svh, 280px); overflow: hidden; }
  .hero__content { padding: 0.65rem 1rem 3.1rem; }
  .hero h1 { font-size: 2.25rem; }
  .lede { font-size: .95rem; margin-bottom: .65rem; }
  .disclaimer--hero { font-size: .66rem; margin-top: .65rem; }
  .pet-hint { font-size: .75rem; }
  .btn { min-height: 2.45rem; font-size: .84rem; padding: 0 .85rem; }
  .ca-box code { font-size: .68rem; }
  .mast { padding: 0 .7rem; gap: .4rem; }
  .btn { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boot__cat, .scroll-cue, .marquee, .reveal { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .hero #stage { display: none; }
  .hero__fallback { display: block; }
}
