/* CC0AIMon showcase site. Built into site/ by build-site.py. */
:root {
  --bg: #07080c;
  --panel: #10131b;
  --panel-2: #171b27;
  --line: #262b3b;
  --text: #eceef4;
  --muted: #9aa1b5;
  --accent: #6ee7f6;
  --blood: #ef4444;

  /* Rarity palette shared with legend.html. */
  --r-Common: #9ca3af;
  --r-Uncommon: #22c55e;
  --r-Rare: #3b82f6;
  --r-Legendary: #f59e0b;

  --display: "Impact", "Haettenschweiler", "Arial Narrow Bold", "Franklin Gothic Heavy", ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code { font-size: .9em; overflow-wrap: anywhere; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-bottom: 56px; }
.hero-art { height: clamp(280px, 34vw, 68vh); overflow: hidden; position: relative; }
.hero-art img {
  width: 100%; height: 110%; object-fit: cover; object-position: center 40%;
  display: block; will-change: transform;
}
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7,8,12,0) 45%, var(--bg) 100%),
    radial-gradient(ellipse at center, rgba(7,8,12,0) 55%, rgba(7,8,12,.55) 100%);
}
.hero-copy {
  position: relative; margin: calc(-1 * clamp(70px, 9vw, 150px)) auto 0;
  max-width: 900px; padding-inline: 20px; text-align: center;
}
.eyebrow {
  margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .28em;
  font-size: .8rem; color: var(--muted);
}
.eyebrow a { color: var(--text); text-decoration-color: var(--blood); text-underline-offset: 4px; }
h1 {
  margin: .05em 0 0; font-family: var(--display); font-weight: 900;
  font-size: clamp(3.4rem, 13vw, 9rem); line-height: .95; letter-spacing: .02em; text-transform: uppercase;
  background: linear-gradient(95deg, #ffb347 0%, #ef4444 30%, #c084fc 65%, #6ee7f6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 24px rgba(239,68,68,.35));
}
.tagline { margin: .4em 0 0; font-size: clamp(1.1rem, 2.6vw, 1.5rem); font-weight: 600; }
.notice {
  margin: 20px auto 0; max-width: 640px; padding: 10px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--blood); border-radius: 6px;
  background: rgba(16,19,27,.8); color: var(--muted); font-size: .92rem; text-align: left;
}
.enter {
  margin-top: 28px; padding: 16px 38px; border: 0; border-radius: 4px; cursor: pointer;
  font: 900 1.25rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, #ef4444, #991b1b);
  box-shadow: 0 0 0 1px #fca5a5 inset, 0 10px 30px rgba(239,68,68,.35);
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: transform .15s ease, filter .15s ease;
  animation: pulse 2.4s ease-in-out infinite;
}
.enter:hover, .enter:focus-visible { transform: translateY(-2px) scale(1.03); filter: brightness(1.15); }
.enter:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px #fca5a5 inset, 0 10px 46px rgba(239,68,68,.6); } }
.stats {
  list-style: none; padding: 0; margin: 30px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px;
  color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em;
}
.stats b { display: block; font: 900 1.7rem/1.1 var(--display); color: var(--text); letter-spacing: .04em; }

/* ---------- Energy nav ---------- */
.energy-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px max(16px, calc((100% - 1400px) / 2));
  background: rgba(7,8,12,.97); /* opaque instead of backdrop-filter: no per-frame re-blur while scrolling */
  border-block: 1px solid var(--line);
}
.energy-nav::-webkit-scrollbar { display: none; }
.energy-nav a {
  flex: none; padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); transition: color .2s, border-color .2s, background .2s;
}
.energy-nav a:hover, .energy-nav a.active {
  color: var(--text); border-color: var(--ec);
  background: color-mix(in srgb, var(--ec) 22%, transparent);
}

/* ---------- Sections ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 8px 20px 40px; }
.intro { max-width: 720px; margin: 36px auto 10px; text-align: center; color: var(--muted); }
.energy { padding-top: 56px; }
.energy-head {
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 22px;
  padding-bottom: 10px; border-bottom: 2px solid var(--ec);
}
.energy-head h2 {
  margin: 0; font: 900 clamp(2.2rem, 6vw, 3.6rem)/1 var(--display); text-transform: uppercase;
  letter-spacing: .04em; color: var(--ec); text-shadow: 0 0 28px color-mix(in srgb, var(--ec) 45%, transparent);
}
.energy-head span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .14em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 22px; }

/* ---------- Species tile ---------- */
.mon {
  --rc: var(--r-Common);
  display: flex; flex-direction: column; cursor: pointer; outline: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  contain: layout paint;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.mon.r-Uncommon { --rc: var(--r-Uncommon); }
.mon.r-Rare { --rc: var(--r-Rare); box-shadow: 0 0 0 1px color-mix(in srgb, var(--rc) 50%, transparent), 0 0 22px color-mix(in srgb, var(--rc) 25%, transparent); }
.mon.r-Legendary { --rc: var(--r-Legendary); box-shadow: 0 0 0 1px color-mix(in srgb, var(--rc) 70%, transparent), 0 0 30px color-mix(in srgb, var(--rc) 35%, transparent); }
.mon:hover, .mon:focus-visible { transform: translateY(-6px); border-color: var(--ec); box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 0 1px var(--ec); }
.mon:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* --ph is a 12x16 inline preview of the card; the browser's upscale blurs it until the thumb arrives. */
.art { position: relative; aspect-ratio: 1024 / 1408; background: var(--panel-2) var(--ph, none) center / cover no-repeat; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease, opacity .4s ease; }
.js .art img { opacity: 0; }
.js .art img.loaded { opacity: 1; }
.mon:hover .art img { transform: scale(1.04); }
.play {
  position: absolute; right: 10px; bottom: 10px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; padding-left: 3px; font-size: 1rem; color: #fff;
  background: rgba(7,8,12,.7); border: 1px solid rgba(255,255,255,.35);
  opacity: .8; transition: opacity .2s, transform .2s, background .2s;
}
.mon:hover .play, .mon:focus-visible .play { opacity: 1; transform: scale(1.1); background: var(--blood); }

.info { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.title h3 { margin: 0; font: 900 1.45rem/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badges span {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 8px; border-radius: 3px;
}
.rarity { color: #0b0d12; background: var(--rc); }
.energy-tag { color: var(--efg); background: var(--ec); }
.desc { margin: 0; color: #c9cdd8; font-size: .92rem; flex: 1; }
.origin {
  display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-top: 10px;
  border-top: 1px dashed var(--line); color: var(--muted); font-size: .72rem; line-height: 1.35;
  text-transform: uppercase; letter-spacing: .06em;
}
.origin img {
  width: 36px; height: 36px; image-rendering: pixelated; flex: none;
  background: #e8e8e4; border-radius: 4px; padding: 2px; box-sizing: content-box;
}

/* ---------- Scroll reveal (JS only; everything stays visible without it) ---------- */
.js .mon { opacity: 0; transform: translateY(32px); }
.js .energy-head { opacity: 0; transform: translateX(-40px); }
.js .revealed {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1), border-color .25s, box-shadow .25s;
  transition-delay: var(--delay, 0ms);
}
.js .mon.revealed:hover, .js .mon.revealed:focus-visible { transform: translateY(-6px); transition-delay: 0ms; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .mon, .js .energy-head, .js .art img { opacity: 1; transform: none; }
  .enter { animation: none; }
  .mon, .art img, .mon:hover, .mon:hover .art img { transition: none; transform: none; }
}

/* ---------- Footer ---------- */
.credits {
  max-width: 900px; margin: 60px auto 0; padding: 40px 20px 100px;
  border-top: 1px solid var(--line); color: var(--muted);
}
.credits h2 { font: 900 2rem/1 var(--display); text-transform: uppercase; color: var(--text); letter-spacing: .04em; }
.credits strong { color: var(--text); }
.credits .notice { margin: 20px 0; }
.fine { font-size: .8rem; }

/* ---------- Sound toggle ---------- */
.sound {
  position: fixed; right: 16px; bottom: 16px; z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 12px;
  border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(16,19,27,.92); color: var(--text); backdrop-filter: blur(8px);
  font: 700 .8rem/1 var(--body); text-transform: uppercase; letter-spacing: .1em;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.sound .icon { font-size: 1.15rem; }
.sound[aria-pressed="true"] { border-color: var(--blood); }
.sound:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Clip modal ---------- */
.clip {
  width: min(92vw, 520px); padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); overflow: hidden;
}
.clip::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(4px); }
.clip video { display: block; width: 100%; max-height: 80vh; background: #000; }
.clip p { margin: 0; padding: 12px 16px; font: 900 1.2rem/1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.clip form { position: absolute; top: 8px; right: 8px; margin: 0; z-index: 1; }
.close {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); cursor: pointer;
  background: rgba(7,8,12,.75); color: #fff; font-size: 1.6rem; line-height: 1;
}

@media (max-width: 520px) {
  .grid { gap: 16px; }
  .hero-copy { padding-inline: 16px; }
  main { padding-inline: 16px; }
  .enter { padding: 14px 28px; font-size: 1.1rem; }
}
