/* Magicians United — design system specimen.
   Self-contained: this file imports nothing from the Enterprise Design
   System's _shared/. Every rule below is the rule the product ships; the
   specimens on the page are drawn by this stylesheet, not by an
   approximation of it. */

/* ─── Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Surfaces — near-black, cool, matte */
  --color-void: #0c0a10;
  --color-crypt: #14111b;
  --color-slab: #1c1826;
  --color-slab-hover: #231e30;

  /* Ink — parchment */
  --color-bone: #ece5d6;
  --color-bone-soft: #bfb5a3;
  --color-ash: #857d70;
  --color-ash-faint: #55504b;

  /* Gold — the one accent */
  --color-gold: #d4af5a;
  --color-gold-hot: #e7c66f;
  --color-gold-dim: #6b5628;

  /* Status — reserved, never decorative */
  --color-ok: #6fb98a;
  --color-warn: #c9744c;

  /* Rules and lines */
  --color-rule: rgba(236, 229, 214, 0.12);
  --color-rule-strong: rgba(236, 229, 214, 0.28);
  --color-rule-gold: rgba(212, 175, 90, 0.5);

  /* Type */
  --font-display: "Cormorant Garamond", ui-serif, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────────────── */
/* Law 8: clip, not hidden. hidden makes these scroll containers and the
   sticky masthead stops sticking. */
html, body { overflow-x: clip; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--color-void);
  color: var(--color-bone-soft);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Page ground: grain and cast. Both drawn, not images. */
body::before {
  content: ""; position: fixed; inset: 0;
  pointer-events: none; z-index: 1; opacity: 0.5;
  background-image: radial-gradient(rgba(236,229,214,0.028) 1px, transparent 1px);
  background-size: 3px 3px;
}
body::after {
  content: ""; position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(70rem 32rem at 50% -14rem, rgba(212,175,90,0.11), transparent 65%),
    radial-gradient(130% 100% at 50% 55%, transparent 55%, rgba(0,0,0,0.5) 100%);
}
::selection { background: var(--color-gold-dim); color: var(--color-bone); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ─── Type — three faces, three jobs ─────────────────────────────────── */
.display-italic {
  font-family: var(--font-display);
  font-style: italic; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.08;
  color: var(--color-bone);
}
.display {
  font-family: var(--font-display);
  font-weight: 600; letter-spacing: -0.005em; line-height: 1.1;
  color: var(--color-bone);
}
.label-mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--color-ash);
}
.body { max-width: 42rem; }
.mono { font-family: var(--font-mono); }
code {
  font-family: var(--font-mono); font-size: 0.8125em;
  color: var(--color-gold); background: rgba(212,175,90,0.07);
  padding: 0.1em 0.35em;
}

/* ─── Rules — hairlines do the work boxes and shadows do elsewhere ───── */
.rule       { border-top: 1px solid var(--color-rule-strong); }
.rule-soft  { border-top: 1px solid var(--color-rule); }
.rule-gold  { border-top: 1px solid var(--color-rule-gold); }
.rule-ornament {
  position: relative; height: 1px;
  background: linear-gradient(90deg, transparent,
    var(--color-rule-strong) 18%, var(--color-rule-strong) 82%, transparent);
}
.rule-ornament::after {
  content: "\2726"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); padding: 0 0.7rem;
  background: var(--color-void); color: var(--color-gold);
  font-size: 0.7rem; line-height: 1;
}

/* ─── Buttons — three weights, one small size ────────────────────────── */
.btn, .btn-ghost, .btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.8rem 1.5rem; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn { background: var(--color-gold); color: var(--color-void); }
.btn:hover:not(:disabled) {
  background: var(--color-gold-hot);
  box-shadow: 0 10px 28px -12px rgba(212,175,90,0.7);
}
.btn:active:not(:disabled), .btn-ghost:active:not(:disabled) { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--color-bone); border-color: var(--color-rule-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--color-bone); }
.btn-quiet {
  background: transparent; color: var(--color-bone-soft);
  border-color: var(--color-rule); padding: 0.5rem 0.9rem; font-size: 0.6875rem;
}
.btn-quiet:hover:not(:disabled) { color: var(--color-bone); border-color: var(--color-rule-strong); }
.btn-quiet.is-destructive:hover:not(:disabled) { color: var(--color-warn); border-color: var(--color-warn); }
.btn:disabled, .btn-ghost:disabled, .btn-quiet:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.6875rem; }

@media (max-width: 40rem) {
  .btn, .btn-ghost, .btn-quiet, .btn-sm {
    min-height: 2.75rem; padding-top: 0.5rem; padding-bottom: 0.5rem;
    white-space: normal; line-height: 1.35; text-align: center;
  }
  .btn-sm, .btn-quiet { padding-left: 1rem; padding-right: 1rem; }
  .btn-ghost, .btn-quiet { border-color: var(--color-rule-strong); color: var(--color-bone); }
}

/* ─── Chips — a choice you can make more than once ───────────────────── */
.chip {
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.75rem; border: 1px solid var(--color-rule);
  color: var(--color-bone-soft); cursor: pointer; white-space: nowrap;
  background: transparent;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}
.chip:hover { border-color: var(--color-rule-strong); color: var(--color-bone); }
.chip[aria-pressed="true"], .chip[aria-current] {
  border-color: var(--color-gold); color: var(--color-gold);
  background: rgba(212,175,90,0.08);
}
.chip-sm { padding: 0.3rem 0.6rem; font-size: 0.625rem; letter-spacing: 0.08em; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
@media (max-width: 40rem) {
  .chip-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; scrollbar-width: none; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { display: inline-flex; align-items: center; min-height: 2.25rem; }
}

/* ─── Fields — one style for every input ─────────────────────────────── */
.field {
  width: 100%; background: var(--color-crypt);
  border: 1px solid var(--color-rule); padding: 0.7rem 0.9rem;
  font-size: 0.9375rem; outline: none; transition: border-color 150ms ease;
  color: var(--color-bone); font-family: inherit;
}
.field::placeholder { color: var(--color-ash-faint); }
.field:focus { border-color: var(--color-gold); }
select.field {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-ash) 50%),
    linear-gradient(135deg, var(--color-ash) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 2.25rem;
}
/* Under 16px, iOS Safari zooms the page when a field takes focus and never
   zooms back. This is not a preference. */
@media (max-width: 40rem) {
  input, select, textarea { font-size: 16px !important; }
}

/* ─── Panels, disclosures, folding headings ──────────────────────────── */
.panel { border-bottom: 1px solid var(--color-rule); }
.panel-head {
  display: flex; width: 100%; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 0.85rem 0.25rem; text-align: left; cursor: pointer;
  transition: color 150ms ease; background: transparent; border: 0;
}
.panel-head:hover .panel-title { color: var(--color-gold); }
.panel-title {
  font-family: var(--font-display); font-style: italic; font-size: 1.125rem;
  color: var(--color-bone); transition: color 150ms ease;
}
.panel-body { padding: 0.25rem 0.25rem 1.5rem; }

.disclosure > summary { list-style: none; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .caret { display: inline-block; transition: transform 150ms ease; }
.disclosure[open] > summary .caret { transform: rotate(90deg); }

/* The caret is DRAWN, not written, so the button must carry an explicit
   aria-label. Without it the accessible name is "› Creatures · 22". */
.fold-head {
  display: inline-flex; align-items: baseline; gap: 0.5rem;
  text-align: left; cursor: pointer; background: transparent; border: 0;
  font: inherit; font-style: inherit; letter-spacing: inherit;
  text-transform: inherit; color: inherit;
  transition: color 150ms ease;
  padding-block: 0.3rem; margin-block: -0.3rem;
}
@media (max-width: 40rem) { .fold-head { padding-block: 0.5rem; margin-block: -0.5rem; } }
.fold-head::before {
  content: '\203A'; display: inline-block; flex: none;
  color: var(--color-ash); transition: transform 150ms ease;
}
.fold-head[aria-expanded='true']::before { transform: rotate(90deg); }
.fold-head:hover, .fold-head:hover::before { color: var(--color-gold); }

/* ─── Numbers — counts are mono, always ──────────────────────────────── */
.stat-panel {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--color-rule);
  background: color-mix(in srgb, var(--color-crypt) 70%, transparent);
}
.stat-cell {
  padding: 0.8rem 1rem;
  border-right: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
}
.stat-cell:nth-child(2n) { border-right: 0; }
.stat-cell:nth-last-child(-n+2) { border-bottom: 0; }
@media (min-width: 40rem) {
  .stat-panel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-cell { padding: 1rem 1.25rem; border-bottom: 0; }
  .stat-cell:nth-child(2n) { border-right: 1px solid var(--color-rule); }
  .stat-cell:last-child { border-right: 0; }
}
.stat-value {
  font-family: var(--font-display); font-weight: 600; font-size: 1.75rem;
  line-height: 1.1; color: var(--color-bone); letter-spacing: -0.01em;
}
.stat-value.is-gold { color: var(--color-gold); }
.stat-label {
  display: block; margin-top: 0.2rem; font-family: var(--font-mono);
  font-size: 0.625rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--color-ash);
}

.viz-row { padding: 0.15rem 0.25rem; margin: 0 -0.25rem; outline: none; transition: background-color 120ms ease; }
.viz-row:hover, .viz-row:focus-visible { background: rgba(212,175,90,0.08); }
.viz-fill { border-radius: 0 4px 4px 0; transition: width 700ms cubic-bezier(0.22,1,0.36,1); }
.viz-colbar { border-radius: 4px 4px 0 0; transition: height 700ms cubic-bezier(0.22,1,0.36,1); }
@media (prefers-reduced-motion: reduce) { .viz-fill, .viz-colbar { transition: none; } }

.section-title {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 1.375rem; line-height: 1.2; color: var(--color-bone);
}
.section-title .count {
  font-family: var(--font-mono); font-style: normal; font-size: 0.6875rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-ash);
  margin-left: 0.6rem; vertical-align: 0.2em;
}

/* ─── Tile — the one container. Nothing nests inside another tile. ───── */
.tile {
  position: relative; display: block;
  background: var(--color-crypt); border: 1px solid var(--color-rule);
  transition: border-color 150ms ease, transform 150ms ease;
}
.tile:hover {
  border-color: var(--color-rule-gold); transform: translateY(-2px);
  box-shadow: 0 14px 32px -16px rgba(212,175,90,0.45);
}
.tile[data-selected="true"] {
  border-color: var(--color-gold);
  box-shadow: inset 0 0 0 1px var(--color-gold), 0 0 0 3px rgba(212,175,90,0.12);
}
.tile img, .tile .art-face {
  aspect-ratio: 488 / 680; width: 100%; object-fit: cover; display: block;
  background: var(--color-slab);
}
.tile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 30rem) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; } }

.tile .art { position: relative; overflow: hidden; }
.tile[data-foil="true"] .art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  mix-blend-mode: screen; opacity: 0.45;
  background: linear-gradient(125deg,
    rgba(255,90,120,0.55) 0%, rgba(255,190,70,0.5) 18%, rgba(120,230,120,0.45) 36%,
    rgba(80,200,255,0.5) 54%, rgba(150,110,255,0.5) 72%, rgba(255,110,200,0.5) 90%,
    rgba(255,90,120,0.55) 100%);
  background-size: 220% 220%; background-position: 0% 0%;
}
.tile[data-finish="etched"] .art::before {
  background: repeating-linear-gradient(125deg,
    rgba(255,255,255,0.10) 0 6px, rgba(120,200,255,0.28) 6px 12px,
    rgba(255,210,120,0.22) 12px 18px, rgba(200,140,255,0.24) 18px 24px);
  opacity: 0.5;
}
@media (prefers-reduced-motion: no-preference) {
  .tile[data-foil="true"]:hover .art::before { animation: foil-shift 3s ease-in-out infinite alternate; }
  @keyframes foil-shift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
}
.tile-caption { padding: 0.55rem 0.7rem; }

/* ─── Colour identity — pips ─────────────────────────────────────────── */
.pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05em; height: 1.05em; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.72em; font-weight: 500; line-height: 1;
  color: #111; margin: 0 0.06em; vertical-align: -0.1em; background: #c9c4b8;
}
.pip-W { background: #f3edd7; }  .pip-U { background: #a9c9e8; }
.pip-B { background: #a59c96; }  .pip-R { background: #eaa08a; }
.pip-G { background: #9fcaa5; }  .pip-C { background: #cfcac0; }
.pip-X, .pip-n { background: #cfcac0; }
.pip-hybrid { background: linear-gradient(135deg, var(--pa) 50%, var(--pb) 50%); }

/* An avatar is the other thing a chip may carry. Never both. */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15em; height: 1.15em; border-radius: 999px;
  background: var(--color-gold-dim); color: var(--color-bone);
  font-family: var(--font-mono); font-size: 0.7em; line-height: 1;
  vertical-align: -0.15em; margin-right: 0.4em;
}

/* ─── Navigation ─────────────────────────────────────────────────────── */
.nav-link { position: relative; padding-bottom: 0.15rem; }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.1rem; height: 1px;
  background: var(--color-gold);
  transform: scaleX(0); transform-origin: left;
  transition: transform 220ms cubic-bezier(0.22,1,0.36,1);
}
.nav-link:hover::after, .nav-link.is-active::after { transform: scaleX(1); }

.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.6rem; min-width: 0; }
.crumb {
  display: inline-block; max-width: 14rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom; transition: color 150ms ease;
}
.crumb-sep { color: var(--color-rule-strong); font-family: var(--font-display); font-style: italic; font-size: 0.95rem; line-height: 1; }
.crumb-here { color: var(--color-bone); }
.crumb-back { color: var(--color-gold); }
@media (max-width: 40rem) {
  .crumb-far, .crumb-sep, .crumb-here { display: none; }
  .crumb-back { max-width: 100%; }
  .crumb-back::before { content: '\2190 '; }
}

/* ─── Overflow — nothing may push the page sideways ──────────────────── */
.scroll-row { position: relative; --scroll-row-bg: var(--color-void); }
.scroll-row-track {
  display: flex; gap: 0.5rem; align-items: center;
  overflow-x: auto; scrollbar-width: none;
  /* Proximity, not mandatory: mandatory fights a short flick near the end of
     the row and lands you somewhere you did not aim for. */
  scroll-snap-type: x proximity;
}
.scroll-row-track::-webkit-scrollbar { display: none; }
.scroll-row-track > * { scroll-snap-align: start; flex: none; }
.scroll-row::before, .scroll-row::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 2.5rem;
  pointer-events: none; opacity: 0; transition: opacity 150ms ease; z-index: 1;
}
.scroll-row::before { left: 0; background: linear-gradient(to right, var(--scroll-row-bg), transparent); }
.scroll-row::after  { right: 0; background: linear-gradient(to left,  var(--scroll-row-bg), transparent); }
.scroll-row[data-left]::before, .scroll-row[data-right]::after { opacity: 1; }

/* ─── States ─────────────────────────────────────────────────────────── */
.state { border: 1px solid var(--color-rule); background: var(--color-crypt); padding: 1.5rem; text-align: center; }
.state-title { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--color-bone); }
.state-note { margin-top: 0.35rem; font-size: 0.875rem; color: var(--color-bone-soft); }
.notice { border: 1px solid var(--color-rule-strong); padding: 0.7rem 0.9rem; font-size: 0.875rem; color: var(--color-bone); }
.notice-ok { border-color: var(--color-ok); color: var(--color-ok); }
.notice-error { border-color: var(--color-warn); color: var(--color-warn); }

/* ─── Overlay — a card without leaving the page ──────────────────────── */
.card-overlay-panel {
  display: flex; flex-direction: column;
  width: 100%; max-width: 44rem; max-height: 92vh; overflow: hidden; outline: none;
  border: 1px solid var(--color-rule-strong); background: var(--color-void);
}
.card-overlay-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* ─── The specimen page's own chrome ─────────────────────────────────── */
.masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--color-crypt) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-rule);
}
.masthead-inner {
  max-width: 78rem; margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
@media (max-width: 26rem) { .masthead-sub { display: none; } }
.wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; position: relative; z-index: 2; }
.layout { display: block; }
@media (min-width: 64rem) {
  .layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .contents-rail { position: sticky; top: 5rem; max-height: calc(100vh - 7rem); overflow-y: auto; }
  .contents-chips { display: none; }
}
@media (max-width: 63.99rem) { .contents-rail { display: none; } }
.contents-rail ol { list-style: none; margin: 0; padding: 0; }
.contents-rail a {
  display: flex; gap: 0.6rem; padding: 0.3rem 0;
  font-family: var(--font-mono); font-size: 0.625rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-ash);
  transition: color 150ms ease;
}
.contents-rail a:hover { color: var(--color-gold); }
.contents-rail .no { color: var(--color-ash-faint); }

.part { padding-top: 3.5rem; scroll-margin-top: 5rem; }
.part-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.part-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0.5rem 0 0; }
.part-lead { margin: 1rem 0 0; max-width: 42rem; color: var(--color-bone-soft); }

.spec { border-top: 1px solid var(--color-rule); padding-top: 1rem; margin-top: 2rem; }
.spec-name { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.spec-note { margin: 0.4rem 0 0; font-size: 0.875rem; color: var(--color-ash); max-width: 42rem; }
.spec-stage {
  margin-top: 0.85rem; padding: 1.25rem;
  background: var(--color-crypt); border: 1px solid var(--color-rule);
}
.stage-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.swatch {
  display: block; flex: none; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--color-rule-strong);
}
.swatch-row { display: flex; gap: 0.85rem; align-items: center; padding: 0.5rem 0; }
.swatch-row + .swatch-row { border-top: 1px solid var(--color-rule); }
.swatch-meta { min-width: 0; }
.swatch-hex { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--color-ash); }

.laws { list-style: none; margin: 0; padding: 0; counter-reset: law; }
.laws li {
  counter-increment: law; position: relative;
  padding: 1rem 0 1rem 3rem; border-top: 1px solid var(--color-rule);
  max-width: 46rem;
}
.laws li::before {
  content: counter(law, decimal-leading-zero);
  position: absolute; left: 0; top: 1rem;
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.16em; color: var(--color-gold);
}
.laws b { color: var(--color-bone); font-weight: 500; }

table.voice { width: 100%; border-collapse: collapse; }
table.voice th, table.voice td {
  text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--color-rule);
  vertical-align: top; font-size: 0.9375rem;
}
table.voice th { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-ash); font-weight: 500; }
table.voice td.this { color: var(--color-bone); }
table.voice td.not  { color: var(--color-ash); }

.foot { margin-top: 5rem; padding: 2rem 0 3rem; border-top: 1px solid var(--color-rule); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (min-width: 48rem) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.min-w-0 { min-width: 0; }
