/* The companion's one stylesheet, shared by all three pages.
   Page accents key off the body class: page-hub, page-fusion, page-groups. */

/* Self-custodied faces (OFL, licenses beside the files): every reader sees the same site.
   Quicksand carries the Latin; the M PLUS Rounded kana subset carries the Japanese runs. */
@font-face {
  font-family: "Quicksand";
  src: url("./fonts/quicksand-variable.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "M PLUS Rounded 1c";
  src: url("./fonts/mplus-rounded-1c-kana.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #FDF6EC;
  --card: #FFFDF9;
  --ink: #4A3F38;
  --soft: #7A6C60;
  --line: #F0E4D6;
  --rose: #F7CBD3;  --rose-deep: #D97A8E;
  --peach: #FFDDBE; --peach-deep: #D98E4A;
  --butter: #FFEDB0; --butter-deep: #B8923A;
  --mint: #C5E8D2;  --mint-deep: #4E9A6E;
  --sky: #C9E4F2;   --sky-deep: #4E86A8;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Quicksand", "M PLUS Rounded 1c", sans-serif;
  line-height: 1.65; font-size: 16px;
}

/* layout */
header.top {
  padding: 2.2rem 1.5rem 1.4rem; text-align: center;
  background: linear-gradient(180deg, #E8F4EC 0%, var(--paper) 100%);
}
.page-hub header.top { background: linear-gradient(180deg, #FFE9DF 0%, var(--paper) 100%); }
header.top h1 { margin: 0; font-size: 1.7rem; letter-spacing: .02em; }
header.top p { margin: .4rem 0 0; color: var(--soft); font-size: .95rem; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 1.2rem 4rem; }
main section {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 1.5rem 1.7rem; margin: 1.5rem 0;
  box-shadow: 0 2px 10px rgba(180,150,120,.08);
}
footer { text-align: center; color: var(--soft); font-size: .85rem; padding: 2rem; }

/* type */
h2 { margin: 0 0 .3rem; font-size: 1.25rem; }
h2 .dot { font-size: 1rem; margin-right: .45rem; }
h3 { font-size: 1.02rem; margin: 1.3rem 0 .4rem; }
.purpose { color: var(--soft); font-size: .92rem; margin: 0 0 1rem; }
.soft { color: var(--soft); }
a.back { color: var(--rose-deep); text-decoration: none; font-weight: 600; }
rt { color: var(--soft); font-size: .62em; letter-spacing: .03em; }
code { background: #FFF0DD; border-radius: 6px; padding: .05rem .35rem; font-size: .88em; }
.gametext { background: #fff; border: 1px solid #000; border-radius: 0; padding: .04em .4em; font-size: .95em; }
.official-name { color: var(--soft); font-size: .8rem; }
.official-name::before { content: "og: "; letter-spacing: .04em; }
.symbol { font-size: 1.2rem; }
.example { color: var(--soft); font-size: .88em; }
.plus { color: var(--rose-deep); font-weight: 700; }
hr.soft-line { border: none; border-top: 1px solid var(--line); margin: 1.1rem 0 .1rem; }

/* tables */
table { border-collapse: collapse; width: 100%; margin: .6rem 0; font-size: .95rem; }
th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); font-weight: 600; padding: .35rem .6rem; }
td { padding: .42rem .6rem; border-top: 1px solid var(--line); }
tr:hover td { background: #FFF4E8; }
td:first-child, th:first-child { border-radius: 8px 0 0 8px; }
.numeric { text-align: right; color: var(--soft); font-variant-numeric: tabular-nums; }

/* chips, tags, pills */
.chip { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; margin: .12rem .18rem .12rem 0; }
a.chip { text-decoration: none; color: var(--ink); font-weight: 600; }
.chip-rose { background: var(--rose); } .chip-peach { background: var(--peach); }
.chip-butter { background: var(--butter); } .chip-mint { background: var(--mint); } .chip-sky { background: var(--sky); }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  padding: .1rem .55rem; border-radius: 999px; vertical-align: middle;
}
.tag-milo { background: var(--rose); color: var(--rose-deep); }
.tag-verified { background: var(--mint); color: var(--mint-deep); }
.tag-rule { background: var(--mint); color: var(--mint-deep); }
.tag-heuristic { background: var(--butter); color: var(--butter-deep); }
.version-pill {
  display: inline-block; min-width: 1.5em; text-align: center;
  padding: .02rem .32rem; border-radius: 999px; font-size: .72rem; font-weight: 700; margin: 0 .1rem;
}
.version-pill-yugi { background: var(--rose); color: var(--rose-deep); }
.version-pill-kaiba { background: var(--sky); color: var(--sky-deep); }
.version-pill-jonouchi { background: var(--mint); color: var(--mint-deep); }
.version-pill-postcredits { background: transparent; border: 2px dashed currentColor; }

/* boxes */
.callout { border-radius: 14px; padding: .8rem 1rem; margin: .8rem 0; font-size: .95rem; background: var(--mint); border: none; }
.trivia { border-radius: 14px; padding: .7rem .9rem; margin: .5rem 0 .2rem; font-size: .9rem; background: var(--peach); }
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: .8rem 0; }
.stat { flex: 1 1 130px; background: #FFF6EA; border-radius: 16px; padding: .8rem 1rem; text-align: center; }
.stat .stat-number { font-size: 1.6rem; font-weight: 700; }
.stat .stat-label { font-size: .82rem; color: var(--soft); }
.cycle { font-size: 1.05rem; text-align: center; padding: .7rem; background: #FFF6EA; border-radius: 14px; }
.cycle .beats { color: var(--rose-deep); font-weight: 700; }
.cycle-part { border-top: 1px dashed var(--line); margin-top: .55rem; padding-top: .55rem; }
p[id^="equip-"] { border-top: 1px dashed var(--line); padding-top: .95rem; margin-top: .95rem; }
ol.rules { padding-left: 1.3rem; }
ol.rules li { margin: .55rem 0; }

/* the hub's plain expandos (scoped so fusion's .entry summaries keep their own look) */
.page-hub details {
  background: #FFF6EA; border: 1px solid var(--line); border-radius: 14px;
  padding: .55rem .9rem; margin: .6rem 0;
}
.page-hub details summary { cursor: pointer; font-weight: 600; color: var(--peach-deep); }
.page-hub details[open] summary { margin-bottom: .5rem; }

/* the hub's sticky contents drawer */
details.side-nav {
  position: sticky; top: .8rem; z-index: 5;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: .45rem .8rem; font-size: .92rem; margin-bottom: 1.4rem;
  box-shadow: 0 2px 10px rgba(180,150,120,.14); width: fit-content;
}
details.side-nav summary {
  cursor: pointer; font-weight: 700; color: var(--rose-deep);
  list-style: none; padding: .15rem .4rem;
}
details.side-nav summary::-webkit-details-marker { display: none; }
details.side-nav[open] { width: auto; }
details.side-nav a {
  display: inline-block; color: var(--ink); text-decoration: none;
  padding: .3rem .7rem; border-radius: 999px; margin: .12rem .1rem;
  background: #FFF6EA;
}
details.side-nav a:hover { background: var(--rose); }

/* filters and entry lists */
input.filter {
  width: 100%; padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--line);
  background: #FFF6EA; font: inherit; color: var(--ink); outline: none; margin: .4rem 0 .6rem;
}
input.filter:focus { border-color: var(--mint-deep); }
.page-hub input.filter:focus { border-color: var(--rose-deep); }
details.entry {
  background: #FFF6EA; border: 1px solid var(--line); border-radius: 14px;
  padding: .5rem .9rem; margin: .45rem 0;
}
details.entry summary { cursor: pointer; }
details.entry summary::-webkit-details-marker { display: none; }
details.entry .chip-line { margin-left: .3rem; }
details.entry ul { margin: .5rem 0 .3rem; padding-left: 1.2rem; font-size: .93rem; }
details.entry li { margin: .35rem 0; }

/* card previews (markup contract shared with nyuu-dot-page's Cards transform and emojify.py) */
.card-preview { position: relative; display: inline-block; }
.card-preview .card-name { border-bottom: 2px dotted var(--rose-deep); cursor: help; }
.card-preview .card-image {
  display: none; position: absolute; bottom: 1.6em; left: 0;
  width: 320px; max-width: 78vw; image-rendering: pixelated;
  border-radius: 10px; box-shadow: 0 10px 26px rgba(120,80,60,.35); z-index: 20;
}
.card-preview:hover .card-image, .card-preview:focus-within .card-image, .card-preview.open .card-image { display: block; }
.summary-preview {
  cursor: zoom-in; background: #fff; border: 1px solid #000; border-radius: 0;
  padding: .05em .45em .05em .3em;
}
.summary-preview .card-name { border-bottom: none; font-weight: 700; }

/* emoji as images that copy as text (markup produced by emojify.py and companion.js) */
.emoji {
  display: inline-block; width: 1.2em; height: 1.2em; overflow: hidden; text-indent: 200%;
  white-space: nowrap; background-repeat: no-repeat; background-position: center;
  background-size: contain; vertical-align: -0.2em;
}
.emoji.pixelated { image-rendering: pixelated; }
.hanafuda { margin-right: .1em; }

/* fusion widgets */
.side { border-bottom: 2px dotted var(--mint-deep); cursor: pointer; }
.tap-note { color: var(--mint-deep); font-size: .8em; }
.side-list { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; margin: .3rem 0; font-size: .88em; }
.hit { display: inline-block; margin: .15rem; padding: .25rem .7rem; border-radius: 999px; background: var(--rose); cursor: pointer; font-size: .9rem; }
.tray { margin: .3rem 0; }
.tray .chipcard { display: inline-block; margin: .15rem; padding: .25rem .7rem; border-radius: 999px; background: var(--mint); cursor: pointer; font-size: .9rem; }
.tray .chipcard::after { content: " ✕"; color: var(--mint-deep); font-size: .8em; }
#lab-output ul { padding-left: 1.2rem; }

/* art toggle */
.art-toggle { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.art-toggle button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: .12rem .7rem; font: inherit; font-size: .85rem; cursor: pointer;
}
.art-toggle button[aria-checked="true"] { background: var(--mint); border-color: var(--mint-deep); }
