:root {
  --bg: #fdfbff;
  --surface: #ffffff;
  --fg: #1b1524;
  --muted: #6b6280;
  --rule: #e7e1f2;
  --accent: #7c3aed;
  --accent-2: #db2777;
  --glow-1: rgba(168, 85, 247, 0.28);
  --glow-2: rgba(236, 72, 153, 0.22);
  --shadow: 0 1px 2px rgba(27, 21, 36, 0.05), 0 12px 28px rgba(27, 21, 36, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100c18;
    --surface: #191327;
    --fg: #f0ecf8;
    --muted: #a79dc0;
    --rule: #2b2140;
    --accent: #c4a5ff;
    --accent-2: #ff8ec4;
    --glow-1: rgba(139, 92, 246, 0.34);
    --glow-2: rgba(236, 72, 153, 0.26);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

h1, h2, h3 { letter-spacing: -0.022em; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 0 16px;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.aura {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 130%;
  background:
    radial-gradient(42% 46% at 22% 26%, var(--glow-1), transparent 62%),
    radial-gradient(38% 42% at 78% 16%, var(--glow-2), transparent 64%),
    radial-gradient(46% 40% at 54% 78%, var(--glow-1), transparent 68%);
  filter: blur(14px);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(4rem, 14vh, 8rem) 0 clamp(3rem, 9vh, 5rem);
}

.eyebrow {
  margin: 0 0 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78125rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  line-height: 1.04;
  font-weight: 680;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 0 0 1.75rem;
  max-width: 34rem;
  font-size: clamp(1.0625rem, 2.4vw, 1.1875rem);
  color: var(--muted);
  text-wrap: pretty;
}

.fanfic {
  display: inline-block;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 1px dashed var(--rule);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--muted);
}

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

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 16px;
}

section { padding: clamp(3rem, 9vh, 5.5rem) 0; }
section + section { border-top: 1px solid var(--rule); }

section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4.2vw, 2.125rem);
  font-weight: 640;
}

.section-lead {
  margin: 0 0 2.5rem;
  max-width: 34rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
}

.card {
  position: relative;
  padding: 1.5rem 1.375rem 1.375rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.card .num {
  margin: 0 0 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.3125rem;
  font-weight: 640;
}

.card .stat {
  margin: 0 0 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}

.card p { text-wrap: pretty; }

.card blockquote {
  margin: 1rem 0 0;
  padding-top: 0.875rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--muted);
}

/* ---------- categories ---------- */

.categories {
  margin-top: 2rem;
  padding: 1.5rem 1.375rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.categories h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 620;
}

.categories ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.categories li {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

.categories p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  text-wrap: pretty;
}

/* ---------- links ---------- */

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover { color: var(--accent-2); }

.source {
  margin-top: 1.25rem !important;
  font-size: 0.9375rem;
}

/* ---------- reasons ---------- */

.reasons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 2rem 2.5rem;
  margin-top: 2.5rem;
}

.reasons h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 620;
  color: var(--accent);
}

.reasons p {
  margin: 0;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- closing ---------- */

.closing p {
  max-width: 38rem;
  margin: 0;
  font-size: clamp(1.0625rem, 2.4vw, 1.1875rem);
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- footer ---------- */

footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2.5rem 16px 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

footer p { margin: 0 0 0.5rem; max-width: 42rem; text-wrap: pretty; }
footer .meta { margin: 0; opacity: 0.75; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- trading cards ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16.5rem), 1fr));
  gap: 2rem;
}

/* perspective belongs on each card: a shared one on the grid gives every
   card the same vanishing point, which reads as flat */
.tcard {
  --px: 50%;
  --py: 50%;
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0;
  position: relative;
  aspect-ratio: 63 / 88;          /* real trading card proportions */
  perspective: 800px;
}

.tcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 13px;
  overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) scale(calc(1 + var(--lift) * 0.05));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s;
  box-shadow: 0 2px 6px rgba(20, 10, 40, .2), 0 12px 30px rgba(20, 10, 40, .24);
  will-change: transform;
}

.tcard:hover .tcard-inner {
  transition: transform .06s linear, box-shadow .3s;
  box-shadow: 0 8px 18px rgba(20, 10, 40, .3), 0 30px 70px rgba(88, 28, 135, .42);
  z-index: 2;
}

/* --- the iconic yellow border --- */

.tcard-frame {
  position: absolute;
  inset: 0;
  padding: 6.5%;
  border-radius: 13px;
  background: linear-gradient(150deg, #ffe066 0%, #f7c948 40%, #e0a920 100%);
}

.tcard-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 5% 5.5%;
  border-radius: 4px;
  background: linear-gradient(165deg, #fdf8ff 0%, #efe4fb 45%, #e2d2f6 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
  container-type: inline-size;
  font-size: clamp(6.5px, 3.6cqi, 11px);
}

.tcard[data-rarity="futuristic"] .tcard-body { background: linear-gradient(165deg, #241542 0%, #3b1f68 46%, #150d2c 100%); color: #f4eeff; }
.tcard[data-rarity="classic"]    .tcard-body { background: linear-gradient(165deg, #fffaec 0%, #f4e8cd 46%, #e8dab6 100%); }
.tcard[data-rarity="ex"]         .tcard-body { background: linear-gradient(165deg, #f0fdff 0%, #dcf2fc 46%, #e6dcfb 100%); }

/* --- header --- */

.stage {
  margin: 0;
  font-size: .82em;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .62;
}

.tcard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .4em;
  margin-bottom: .35em;
}

.tcard-head h3 {
  margin: 0;
  font-size: 1.62em;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.tcard-head .ex {
  font-size: .62em;
  font-style: italic;
  font-weight: 900;
  color: #db2777;
}

.hp {
  display: flex;
  align-items: center;
  gap: .3em;
  font-size: .95em;
  font-weight: 800;
  white-space: nowrap;
}

/* psychic energy symbol */
.type, .pip {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f5d0fe, #a21caf 68%, #4a044e);
  box-shadow: inset 0 0 0 .09em rgba(255, 255, 255, .65);
  flex: none;
}

.pip { width: 1em; height: 1em; margin-right: .12em; }

/* --- artwork, in its gold inner frame --- */

.tcard-art {
  position: relative;
  aspect-ratio: 4 / 3;
  border: .28em solid;
  border-image: linear-gradient(150deg, #fff3c4, #d4a017 45%, #8a6508) 1;
  overflow: hidden;
}

.tcard-art svg { display: block; width: 100%; height: 100%; }

/* --- attacks --- */

.atks {
  flex: 1;
  margin-top: .5em;
  padding-top: .35em;
}

.atk {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .15em .45em;
  padding: .3em 0;
  border-top: 1px solid rgba(0, 0, 0, .13);
}

.tcard[data-rarity="futuristic"] .atk { border-top-color: rgba(255, 255, 255, .16); }

.cost { display: flex; align-items: center; }

.atk-name { font-weight: 750; font-size: 1.02em; }
.dmg { font-weight: 850; font-size: 1.15em; }

.atk-text {
  grid-column: 1 / -1;
  margin: .1em 0 0;
  font-size: .86em;
  line-height: 1.32;
  opacity: .72;
}

/* --- weakness / resistance / retreat --- */

.wrr {
  display: flex;
  justify-content: space-between;
  gap: .3em;
  padding: .32em 0;
  border-top: 1px solid rgba(0, 0, 0, .3);
  border-bottom: 1px solid rgba(0, 0, 0, .3);
  font-size: .8em;
}

.tcard[data-rarity="futuristic"] .wrr { border-color: rgba(255, 255, 255, .28); }
.wrr b { font-weight: 800; display: block; opacity: .6; font-size: .92em; }

.flavor {
  margin: .45em 0 0;
  font-size: .86em;
  font-style: italic;
  line-height: 1.35;
  opacity: .78;
}

.tcard-foot {
  display: flex;
  justify-content: space-between;
  gap: .4em;
  margin-top: auto;
  padding-top: .4em;
  font-size: .76em;
  opacity: .72;
}

.rarity { font-weight: 800; }

/* --- layer 1: rainbow holo --- */

.foil {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 13px;
  background: repeating-linear-gradient(
    108deg,
    rgba(255, 119, 225, .42) 0%, rgba(255, 236, 138, .42) 6%,
    rgba(120, 255, 214, .42) 12%, rgba(125, 190, 255, .42) 18%,
    rgba(206, 130, 255, .42) 24%, rgba(255, 119, 225, .42) 30%
  );
  background-size: 250% 250%;
  background-position: var(--px) var(--py);
  mix-blend-mode: color-dodge;
  opacity: .18;
  transition: opacity .35s;
  pointer-events: none;
}

.tcard:hover .foil { opacity: .5; }
.tcard[data-rarity="futuristic"] .foil { mix-blend-mode: screen; opacity: .12; }
.tcard[data-rarity="futuristic"]:hover .foil { opacity: .32; }

/* --- layer 2: specular glare --- */

.glare {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 13px;
  background: radial-gradient(
    36% 36% at var(--px) var(--py),
    rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .2) 44%, transparent 72%
  );
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
}

.tcard:hover .glare { opacity: 1; }

/* --- layer 3: spot UV on the border and nameplate only --- */

.coating {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: 13px;
  background: linear-gradient(
    100deg, transparent 34%, rgba(255, 255, 255, .5) 44%,
    rgba(255, 255, 255, .95) 50%, rgba(255, 255, 255, .5) 56%, transparent 66%
  );
  background-size: 220% 220%;
  background-position: var(--px) var(--py);
  mix-blend-mode: overlay;
  opacity: .28;
  transition: opacity .35s;
  pointer-events: none;
}

.tcard:hover .coating { opacity: 1; }

/* reduced motion: keep the foil, drop the tilt only */
@media (prefers-reduced-motion: reduce) {
  .tcard-inner { transform: none !important; transition: box-shadow .3s; }
}

@media (hover: none) {
  .foil { opacity: .3; }
  .coating { opacity: .45; }
}

/* ---------- build credit ---------- */

.built {
  display: inline-block;
  margin: .75rem 0 1rem !important;
  padding: .6rem .9rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  font-size: .8125rem;
  line-height: 1.5;
}

.built strong {
  font-weight: 700;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- card artwork ---------- */

.tcard-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center 58%;
  padding: 4% 6% 2%;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .34));
  transform: scale(1.02);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

.tcard:hover .tcard-art img { transform: scale(1.09); }

@media (prefers-reduced-motion: reduce) {
  .tcard-art img, .tcard:hover .tcard-art img { transform: none; transition: none; }
}
