/* ── PokéVault design tokens ───────────────────────────────────────────── */
:root {
  --font-display: "Clash Display", sans-serif;
  --font-text: "Satoshi", sans-serif;

  --bg: #0b0c10;
  --bg-raise: #12141b;
  --ink: #e9ebf2;
  --ink-dim: #9aa1b2;
  --ink-faint: #5b6172;
  --line: rgb(255 255 255 / 0.08);

  --cyan: oklch(0.86 0.11 205);
  --violet: oklch(0.78 0.13 300);
  --pink: oklch(0.8 0.13 340);
  --gold: oklch(0.87 0.12 90);
  --holo: linear-gradient(115deg, var(--cyan) 0%, var(--violet) 28%, var(--pink) 52%, var(--gold) 78%, var(--cyan) 100%);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);

  --shadow-md: 0 2px 4px -2px rgb(5 8 20 / .5), 0 6px 14px -4px rgb(5 8 20 / .45), 0 14px 32px -8px rgb(10 14 40 / .4);
  --shadow-lg: 0 4px 10px -4px rgb(5 8 20 / .55), 0 16px 36px -8px rgb(8 10 30 / .5), 0 32px 72px -16px rgb(20 16 60 / .45);

  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 80% -10%, rgb(96 100 180 / 0.12), transparent 60%),
    radial-gradient(900px 600px at -10% 100%, rgb(70 140 160 / 0.08), transparent 55%);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100dvh;
  text-wrap: pretty;
}

/* film grain */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Nav ───────────────────────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  position: sticky; top: 0; z-index: 50;
  background: rgb(11 12 16 / 0.7);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.wordmark .orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--holo); background-size: 300% 300%;
  animation: holoshift 7s var(--ease-in-out-cubic) infinite;
  box-shadow: 0 0 12px rgb(150 180 255 / 0.5);
}
@keyframes holoshift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--ink-dim); text-decoration: none; font-weight: 500; font-size: 0.92rem;
  padding: 7px 14px; border-radius: 99px;
  transition: color .25s var(--ease-out-quart), background .25s var(--ease-out-quart);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); background: rgb(255 255 255 / 0.07); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.shell { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 90px; }

.page-head { margin: 18px 0 30px; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem);
  line-height: 0.98; letter-spacing: -0.02em; margin: 0; text-wrap: balance;
}
.page-head h1 .holo-text {
  background: var(--holo); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: holoshift 8s var(--ease-in-out-cubic) infinite;
}
.page-head p { color: var(--ink-dim); margin: 10px 0 0; max-width: 52ch; }

/* ── Stats strip ───────────────────────────────────────────────────────── */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 28px; }
.stat {
  flex: 1 1 140px;
  background: rgb(255 255 255 / 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
}
.stat .num {
  font-family: var(--font-display); font-weight: 600; font-size: 1.7rem;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.stat .label { color: var(--ink-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Vault grid + holo cards (the signature moment) ────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative;
  border-radius: var(--radius);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .45s var(--ease-out-expo), box-shadow .45s var(--ease-out-expo);
  box-shadow: var(--shadow-md);
  text-align: left; padding: 0; color: inherit; font: inherit; /* it's a <button> */
}
.card:hover { box-shadow: var(--shadow-lg); }
.card .photo { aspect-ratio: 3 / 4.18; width: 100%; background: #16181f; }
.card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* holo sheen tracks the pointer */
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(420px circle at var(--mx) var(--my), rgb(255 255 255 / 0.14), transparent 45%),
    linear-gradient(115deg, transparent 30%, rgb(125 211 252 / 0.12) 42%, rgb(196 181 253 / 0.14) 50%, rgb(240 171 252 / 0.12) 58%, transparent 70%);
  background-position: var(--mx) var(--my), calc(var(--mx) * 1.6) 0;
  opacity: 0;
  transition: opacity .4s var(--ease-out-quart);
  mix-blend-mode: screen;
}
.card:hover::before, .card:focus-visible::before { opacity: 1; }
.card .meta { padding: 10px 12px 12px; position: relative; z-index: 3; }
.card .meta .name { font-weight: 700; font-size: 0.93rem; line-height: 1.25; display: block; }
.card .meta .sub { color: var(--ink-faint); font-size: 0.78rem; display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; }
.card .meta .est { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 700; }
.type-chip {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px;
  background: rgb(10 12 18 / 0.72); backdrop-filter: blur(6px);
  border: 1px solid rgb(255 255 255 / 0.14);
}
.verdict-chip { position: absolute; top: 8px; right: 8px; z-index: 3; font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.verdict-grade { background: oklch(0.45 0.1 150 / 0.85); border: 1px solid oklch(0.7 0.12 150 / 0.5); }
.verdict-raw { background: rgb(60 64 80 / 0.85); border: 1px solid var(--line); }

/* ── Buttons / inputs ──────────────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 700; color: #0b0c10;
  background: var(--ink);
  border: none; border-radius: 12px; padding: 13px 22px; cursor: pointer;
  transition: transform .2s var(--ease-out-quart), box-shadow .25s var(--ease-out-quart), opacity .2s;
  box-shadow: var(--shadow-md);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn[disabled] { opacity: 0.5; cursor: default; transform: none; }
.btn-holo { position: relative; background: var(--ink); }
.btn-holo::after {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: 14px;
  background: var(--holo); background-size: 300% 300%;
  animation: holoshift 6s var(--ease-in-out-cubic) infinite;
  filter: blur(10px); opacity: 0.55;
}
.btn-ghost {
  background: transparent; color: var(--ink-dim);
  border: 1px solid var(--line); box-shadow: none;
}
.btn-ghost:hover { color: var(--ink); border-color: rgb(255 255 255 / 0.2); }
.btn-danger { background: oklch(0.55 0.18 25); color: #fff; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: rgb(255 255 255 / 0.045);
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
  transition: border-color .25s var(--ease-out-quart), background .25s var(--ease-out-quart);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--cyan); background: rgb(255 255 255 / 0.07);
}
.field textarea { resize: vertical; min-height: 70px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  font: inherit; font-weight: 600; font-size: 0.88rem; color: var(--ink-dim);
  background: rgb(255 255 255 / 0.04); border: 1px solid var(--line);
  border-radius: 99px; padding: 9px 16px; cursor: pointer;
  transition: all .25s var(--ease-out-quart);
}
.seg button[aria-pressed="true"] {
  color: #0b0c10; background: var(--ink); border-color: transparent; font-weight: 700;
}

/* ── Photo slots (add page) ────────────────────────────────────────────── */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.slot {
  aspect-ratio: 3 / 4; border-radius: var(--radius); cursor: pointer; position: relative; overflow: hidden;
  border: 1.5px dashed rgb(255 255 255 / 0.18);
  background: rgb(255 255 255 / 0.03);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-faint); font-weight: 600; font-size: 0.85rem;
  transition: border-color .25s var(--ease-out-quart), background .25s var(--ease-out-quart);
}
.slot:hover { border-color: var(--cyan); color: var(--ink-dim); }
.slot.filled { border-style: solid; border-color: rgb(255 255 255 / 0.14); }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .retake {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 0.72rem; font-weight: 700; padding: 4px 12px; border-radius: 99px;
  background: rgb(10 12 18 / 0.75); color: var(--ink); backdrop-filter: blur(6px);
  border: 1px solid rgb(255 255 255 / 0.15);
}
.slot svg { width: 26px; height: 26px; stroke: currentColor; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
dialog.modal {
  border: 1px solid var(--line); border-radius: 20px; padding: 0;
  background: var(--bg-raise); color: var(--ink);
  width: min(860px, calc(100vw - 28px)); max-height: calc(100dvh - 48px);
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgb(5 6 10 / 0.7); backdrop-filter: blur(8px); }
.modal-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 0; }
@media (max-width: 700px) { .modal-body { grid-template-columns: 1fr; } }
.modal-photos { background: #0e0f14; padding: 18px; display: flex; gap: 12px; align-items: flex-start; }
.modal-photos img { width: calc(50% - 6px); border-radius: 10px; box-shadow: var(--shadow-md); }
.modal-photos img:only-child { width: 70%; margin: 0 auto; }
.modal-info { padding: 22px 24px 24px; overflow-y: auto; }
.modal-info h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 2px; font-size: 1.5rem; }
.modal-info .sub { color: var(--ink-dim); font-size: 0.9rem; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 0.9rem; margin-bottom: 18px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; }

.psa-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; margin: 10px 0 14px; }
.psa-table th, .psa-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.psa-table th { color: var(--ink-faint); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; }
.psa-table tr.likely { background: rgb(125 211 252 / 0.07); }
.psa-table tr.likely td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }

.verdict-banner {
  border-radius: 12px; padding: 12px 16px; font-weight: 700; margin-bottom: 16px;
  border: 1px solid var(--line); background: rgb(255 255 255 / 0.04);
}
.verdict-banner.grade { border-color: oklch(0.6 0.12 150 / 0.4); background: oklch(0.45 0.1 150 / 0.12); }
.verdict-banner .why { display: block; font-weight: 500; color: var(--ink-dim); font-size: 0.85rem; margin-top: 3px; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  background-image: radial-gradient(900px 600px at 50% -20%, rgb(96 100 180 / 0.16), transparent 60%);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 28px;
  padding: 20px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 120px; aspect-ratio: 3/4.2; border-radius: 12px;
  background: var(--holo); background-size: 300% 300%;
  animation: holoshift 6s var(--ease-in-out-cubic) infinite, floaty 5s var(--ease-in-out-cubic) infinite;
  box-shadow: var(--shadow-lg), 0 0 60px rgb(140 160 255 / 0.3);
  opacity: 0.9;
}
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }
.gate h1 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; font-size: 1.1rem; margin: 0; }
.gate form { display: flex; gap: 10px; width: min(360px, 90vw); }
.gate input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; letter-spacing: 0.3em; text-align: center;
  color: var(--ink); background: rgb(255 255 255 / 0.05);
  border: 1px solid var(--line); border-radius: 12px; padding: 13px;
}
.gate input:focus { outline: none; border-color: var(--cyan); }
.gate .err { color: oklch(0.72 0.18 25); font-size: 0.88rem; min-height: 1.4em; margin: 0; }

/* ── Report page ───────────────────────────────────────────────────────── */
.report-section { margin: 34px 0; }
.report-section h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em;
  margin: 0 0 14px; display: flex; align-items: baseline; gap: 12px;
}
.report-section h2 .count { color: var(--ink-faint); font-size: 0.95rem; font-family: var(--font-text); }
.row-list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 14px;
  background: rgb(255 255 255 / 0.035); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
  cursor: pointer; transition: background .25s var(--ease-out-quart);
  text-align: left; color: inherit; font: inherit; width: 100%;
}
.row:hover { background: rgb(255 255 255 / 0.06); }
.row img { width: 40px; height: 54px; object-fit: cover; border-radius: 6px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow .name { font-weight: 700; font-size: 0.92rem; }
.row .grow .why { color: var(--ink-faint); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); }

/* ── Empty states / toast / reveal ─────────────────────────────────────── */
.empty {
  text-align: center; padding: 70px 20px; color: var(--ink-dim);
  border: 1.5px dashed rgb(255 255 255 / 0.12); border-radius: 18px;
}
.empty .big { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #0b0c10; font-weight: 700;
  padding: 12px 22px; border-radius: 99px; box-shadow: var(--shadow-lg);
  transition: transform .5s var(--ease-out-expo); z-index: 200;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease-out-quart), transform .7s var(--ease-out-expo); }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .card { transform: none !important; }
}
