/* Hallmark · redesign · macrostructure: Binder (app page, card grid as the page) · genre: atmospheric
 * theme: Midnight (shared site tokens) · nav: N1a compact bar · footer: Ft7 inline line
 * audience: players · use: browse and inspect cards · tone: playful collector's binder
 * pre-emit critique: P4 H5 E4 S5 R5 V4
 */
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: var(--color-paper); color: var(--color-ink); font: var(--text-base)/1.55 var(--font-body);
  min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { color: var(--color-accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
h1, h2 { font-family: var(--font-display); font-style: normal; font-weight: 700; line-height: 1.05;
  margin: 0; overflow-wrap: anywhere; min-width: 0; }
p { margin: 0; overflow-wrap: anywhere; }
code { font: .9em var(--font-mono); color: var(--color-accent); }

/* ---- Controls ---------------------------------------------------------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md); min-height: 2.5rem; white-space: nowrap;
  border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-pill);
  background: var(--color-paper-2); color: var(--color-ink); cursor: pointer; text-decoration: none;
  transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.button:hover { border-color: var(--color-accent); color: var(--color-ink); }
.button:active { transform: translateY(1px); }
.button:disabled, .button[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; border-color: var(--color-rule); }
.button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); font-weight: 600;
  min-height: 3rem; padding-inline: var(--space-lg); }
.button.primary:hover { background: var(--color-focus); color: var(--color-accent-ink); }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .22em; }
.link:hover { color: var(--color-accent); }
input, select { width: 100%; min-width: 0; min-height: 2.5rem; padding: var(--space-xs) var(--space-md);
  border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-pill); background: var(--color-paper-2); }
input:hover, select:hover { border-color: var(--color-neutral); }
input::placeholder { color: var(--color-neutral); }
label { display: grid; gap: var(--space-2xs); font-size: var(--text-sm); color: var(--color-muted); }

/* ---- Frame ------------------------------------------------------------- */
.bar, .page, .foot { width: 100%; max-width: 1320px; margin-inline: auto; padding-inline: var(--page-gutter); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding-block: var(--space-md); }
.wordmark { font: 700 var(--text-md) var(--font-display); text-decoration: none; letter-spacing: -.02em; }
.bar nav { display: flex; align-items: center; gap: var(--space-lg); font-size: var(--text-sm); }
.bar nav a { white-space: nowrap; text-decoration: none; color: var(--color-muted); }
.bar nav a[aria-current="page"] { color: var(--color-ink); text-decoration: underline; text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px; text-underline-offset: .4em; }
.bar .link { color: var(--color-muted); text-decoration: none; white-space: nowrap; }
.page { flex: 1; padding-block: var(--space-xl) var(--space-3xl); }
.foot { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); padding-block: var(--space-lg);
  width: calc(100% - 2 * var(--page-gutter)); padding-inline: 0;
  border-top: var(--rule-hair) solid var(--color-rule); font-size: var(--text-sm); color: var(--color-neutral); }
.foot a { white-space: nowrap; }
.foot span { color: var(--color-muted); margin-right: auto; }

/* ---- Grade and finish tags -------------------------------------------- */
.grade { font-size: .8em; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  color: var(--grade-colour, var(--color-neutral)); }
[data-grade="bronze"] { --grade-colour: var(--grade-bronze); }
[data-grade="silver"] { --grade-colour: var(--grade-silver); }
[data-grade="gold"] { --grade-colour: var(--grade-gold); }
[data-grade="diamond"] { --grade-colour: var(--grade-diamond); }
.fullart { flex: none; white-space: nowrap; color: var(--color-accent); }
.fullart::before { content: "\00b7"; margin-inline: .4em; color: var(--color-neutral); }

/* ---- Sign-in / private ------------------------------------------------- */
.door { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: center;
  min-height: 60vh; }
.door h1 { font-size: var(--text-display); letter-spacing: -.035em; max-width: 14ch; }
.door .lede { margin-top: var(--space-lg); max-width: 44ch; font-size: var(--text-md); color: var(--color-muted); }
.door .button { margin-top: var(--space-xl); }
.door .fine { margin-top: var(--space-md); font-size: var(--text-sm); color: var(--color-neutral); }
.notice { margin-top: var(--space-lg); max-width: 44ch; padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-tile); background: var(--color-paper-3); }
.fan { position: relative; height: clamp(16rem, 34vw, 26rem); }
/* Real sample renders (scripts/render_site_samples.py), fanned like a fresh pull. */
.fan img { position: absolute; left: 50%; top: 50%; width: clamp(9rem, 17vw, 13rem); height: auto; aspect-ratio: 5 / 7;
  border-radius: var(--radius-card); translate: -50% -50%; }
.fan img:nth-child(1) { rotate: -14deg; translate: -112% -44%; }
.fan img:nth-child(2) { rotate: -2deg; translate: -50% -54%; z-index: 1; }
.fan img:nth-child(3) { rotate: 12deg; translate: 10% -42%; z-index: 2; }

/* ---- Collection -------------------------------------------------------- */
.binder-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.binder-head h1 { font-size: var(--text-display-s); letter-spacing: -.03em; }
.sharing { position: relative; }
.sharing summary { display: inline-flex; align-items: center; gap: var(--space-xs); list-style: none; cursor: pointer; white-space: nowrap;
  min-height: 2.5rem; padding: var(--space-xs) var(--space-md); border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill); font-size: var(--text-sm); }
.sharing summary::-webkit-details-marker { display: none; }
.sharing summary:hover, .sharing[open] summary { border-color: var(--color-accent); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--color-neutral); }
.dot.is-on { background: var(--color-accent); }
.sharing-body { position: absolute; right: 0; top: calc(100% + var(--space-xs)); z-index: var(--z-raised);
  width: min(22rem, calc(100vw - 2 * var(--page-gutter))); display: grid; gap: var(--space-sm); padding: var(--space-md);
  border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-tile); background: var(--color-paper-3); }
.sharing-body p { font-size: var(--text-sm); color: var(--color-muted); }
.copy-row { display: flex; gap: var(--space-xs); }
.copy-row input { font-size: var(--text-sm); }
.toolbar { display: flex; align-items: center; gap: var(--space-md) var(--space-lg); flex-wrap: wrap;
  margin: var(--space-xl) 0 var(--space-xl); }
.search { display: flex; gap: var(--space-xs); flex: 1 1 22rem; max-width: 30rem; }
.chips { display: flex; gap: var(--space-2xs); padding: var(--space-3xs); border-radius: var(--radius-pill);
  background: var(--color-paper-2); }
.chips a { padding: var(--space-2xs) var(--space-md); border-radius: var(--radius-pill); white-space: nowrap;
  text-decoration: none; font-size: var(--text-sm); color: var(--color-muted); }
.chips a[aria-current="true"] { background: var(--color-paper-3); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-rule); }
.tally { margin-left: auto; font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }

.binder { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); gap: var(--space-xl) var(--space-lg); }
.collection-card { min-width: 0; }
.collection-card > a { display: block; text-decoration: none; color: inherit; }
.collection-card .tilt-card { transition: translate var(--dur-short) var(--ease-out); }
.collection-card > a:hover .tilt-card { translate: 0 -4px; }
.collection-card > a:focus-visible { outline-offset: 6px; border-radius: var(--radius-tile); }
.slot-label { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  column-gap: var(--space-sm); row-gap: var(--space-2xs); margin-top: var(--space-sm); }
.slot-label h2 { font-size: var(--text-base); line-height: 1.3; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-card > a:hover h2 { color: var(--color-accent); }
.serial { justify-self: end; font: var(--text-sm) var(--font-mono); color: var(--color-neutral); }
.slot-label p { display: flex; min-width: 0; font-size: var(--text-sm); color: var(--color-muted); }
.slot-label .skin { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-label .grade { justify-self: end; font-size: var(--text-xs); }
.empty { padding: var(--space-3xl) 0; max-width: 40ch; }
.empty h2 { font-size: var(--text-xl); }
.empty p { margin-top: var(--space-sm); color: var(--color-muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--space-lg); margin-top: var(--space-3xl);
  font-size: var(--text-sm); color: var(--color-muted); }

/* ---- Card detail ------------------------------------------------------- */
.trail ol { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: 0 0 var(--space-xl); padding: 0; list-style: none;
  font-size: var(--text-sm); color: var(--color-muted); }
.trail li { white-space: nowrap; }
.trail li + li::before { content: "/"; margin-right: var(--space-xs); color: var(--color-neutral); }
.trail li[aria-current] { color: var(--color-ink); }
.inspection { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: center; }
.table { min-width: 0; padding: var(--space-2xl) var(--space-xl) var(--space-lg); border-radius: var(--radius-tile);
  background: radial-gradient(ellipse at 50% 40%, var(--color-paper-3), var(--color-paper-2) 70%); }
.table-foot { display: flex; justify-content: center; margin-top: var(--space-xl); }
.sheet { min-width: 0; }
.sheet h1 { font-size: var(--text-display); letter-spacing: -.035em; }
.skin-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-sm); margin-top: var(--space-sm);
  font-size: var(--text-md); color: var(--color-muted); }
.skin-line .fullart::before { margin-inline: 0 var(--space-sm); }
.big-serial { display: grid; margin-top: var(--space-xl); font: var(--text-3xl)/1 var(--font-mono); color: var(--color-accent); }
.big-serial span { margin-bottom: var(--space-xs); font: var(--text-sm) var(--font-body); color: var(--color-neutral); }
.sheet dl { margin: var(--space-xl) 0; border-top: var(--rule-hair) solid var(--color-rule); }
.sheet dl > div { display: flex; justify-content: space-between; gap: var(--space-lg); padding: var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule); }
.sheet dt { color: var(--color-neutral); }
.sheet dd { margin: 0; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.image-link { font-size: var(--text-sm); color: var(--color-muted); }

/* ---- Tilt card (vendored holo effect) ---------------------------------- */
.tilt-card {
  --card-aspect: 5 / 7; --card-radius: var(--radius-card);
  --pointer-x: 50%; --pointer-y: 50%; --card-scale: 1; --card-opacity: 0;
  --translate-x: 0px; --translate-y: 0px; --rotate-x: 0deg; --rotate-y: 0deg;
  --background-x: 50%; --background-y: 50%;
  --pointer-from-center: 0; --pointer-from-top: .5; --pointer-from-left: .5;
  position: relative; width: 100%; max-width: 420px; margin: 0 auto;
}
.tilt-card.masked { --foil: url('/assets/vendor/pokemon-cards-css/img/illusion.png'); }
.tilt-card.masked[data-rarity="rare secret"] { --foil: url('/assets/vendor/pokemon-cards-css/img/geometric.png'); }
.tilt-card .card__rotator { cursor: grab; }
.tilt-card .card__rotator:active { cursor: grabbing; }
.tilt-card[data-inspect="true"] .card__rotator { touch-action: none; }
.tilt-card img { display: block; width: 100%; height: auto; aspect-ratio: 5 / 7; border-radius: var(--radius-card);
  background: var(--color-paper-2); }
.tilt-card:not(.is-shiny) .card__shine { display: none; }
.tilt-card .card__rotator:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 5px; }

/* ---- Utilities --------------------------------------------------------- */
.skip-link { position: absolute; top: -100px; }
.skip-link:focus { top: var(--space-xs); left: var(--space-md); z-index: var(--z-sticky); background: var(--color-paper); padding: var(--space-md); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 860px) {
  .door { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: var(--space-xl); }
  .fan { order: -1; height: 13rem; }
  .fan img { width: 7.5rem; }
  .inspection { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
  .table { padding: var(--space-xl) var(--space-md) var(--space-md); }
}
@media (max-width: 600px) {
  .binder { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg) var(--space-sm); }
  .search { flex-basis: 100%; max-width: none; }
  .tally { margin-left: 0; }
  .bar nav { gap: var(--space-md); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .collection-card > a:hover .tilt-card { translate: none; }
  .tilt-card, .tilt-card .card__translater, .tilt-card .card__rotator { transform: none !important; }
  .tilt-card .card__shine, .tilt-card .card__glare { display: none !important; }
  .tilt-card[data-inspect="true"] .card__rotator { touch-action: auto; }
}
