/* Dino Squad Wiki — static rebuild.
   Content comes from the PukiWiki mirror; everything around it is new. */

:root {
  color-scheme: light dark;

  --bg:        #0E1113;
  --surface:   #15191C;
  --raised:    #1C2126;
  --ink:       #E6EAEC;
  --muted:     #9AA2A8;
  --faint:     #6B757B;
  --rule:      #242A2F;
  --rule-firm: #333B41;
  --accent:    #FFA057;
  --accent-dim:#3A2415;
  --on-accent: #17110A;
  --shadow:    0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #FBFAF7;
  --surface:   #F2F1EC;
  --raised:    #FFFFFF;
  --ink:       #17191B;
  --muted:     #596066;
  --faint:     #868D93;
  --rule:      #E2E2DC;
  --rule-firm: #CACAC2;
  --accent:    #B4560E;
  --accent-dim:#FBEBDC;
  --on-accent: #FFFFFF;
  --shadow:    0 1px 2px rgb(20 20 18 / .06), 0 8px 24px rgb(20 20 18 / .07);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:        #FBFAF7;
    --surface:   #F2F1EC;
    --raised:    #FFFFFF;
    --ink:       #17191B;
    --muted:     #596066;
    --faint:     #868D93;
    --rule:      #E2E2DC;
    --rule-firm: #CACAC2;
    --accent:    #B4560E;
    --accent-dim:#FBEBDC;
    --on-accent: #FFFFFF;
    --shadow:    0 1px 2px rgb(20 20 18 / .06), 0 8px 24px rgb(20 20 18 / .07);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
               "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .17em; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}

/* ── Top bar ─────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
  height: 3.5rem; padding-inline: .9rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand img { width: 26px; height: 26px; border-radius: 5px; }
.brand span.sub { color: var(--faint); font-weight: 450; }
@media (max-width: 30rem) { .brand span.sub { display: none; } }

.spacer { flex: 1; }

.iconbtn {
  display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem; flex: none;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); cursor: pointer;
}
.iconbtn:hover { background: var(--surface); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }

#menu-toggle { display: none; }
@media (max-width: 60rem) { #menu-toggle { display: grid; } }

/* ── Search ──────────────────────────────────────────── */

.search { position: relative; width: min(22rem, 42vw); }
.search input {
  width: 100%; height: 2.1rem;
  padding: 0 .65rem 0 2rem;
  font: inherit; font-size: .92rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-firm); border-radius: 7px;
}
.search input::placeholder { color: var(--faint); }
.search .mag {
  position: absolute; left: .55rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
.results {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0;
  max-height: min(24rem, 60vh); overflow-y: auto;
  background: var(--raised); border: 1px solid var(--rule-firm);
  border-radius: 9px; box-shadow: var(--shadow);
  padding: .3rem; display: none;
}
.results.open { display: block; }
.results a {
  display: block; padding: .42rem .55rem; border-radius: 6px; color: var(--ink);
}
.results a:hover, .results a.on { background: var(--surface); text-decoration: none; }
.results .t { font-weight: 550; font-size: .92rem; }
.results .c { color: var(--faint); font-size: .76rem; }
.results .empty { padding: .6rem; color: var(--faint); font-size: .88rem; }

/* ── Shell ───────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 0;
  max-width: 96rem; margin: 0 auto;
}
@media (min-width: 88rem) { .shell { grid-template-columns: 16rem minmax(0, 1fr) 14rem; } }
@media (max-width: 60rem) { .shell { grid-template-columns: minmax(0, 1fr); } }

/* ── Sidebar ─────────────────────────────────────────── */

.sidebar {
  position: sticky; top: 3.5rem; align-self: start;
  height: calc(100dvh - 3.5rem); overflow-y: auto;
  padding: 1.1rem .7rem 3rem 1rem;
  border-right: 1px solid var(--rule);
  scrollbar-width: thin;
}
.sidebar h2 {
  margin: 1.3rem 0 .35rem; padding-inline: .5rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--faint);
}
.sidebar h2:first-child { margin-top: 0; }
.sidebar a { display: block; padding: .3rem .5rem; border-radius: 6px; color: var(--muted); font-size: .9rem; }
.sidebar a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

.sidebar details > summary {
  display: flex; align-items: center; gap: .35rem;
  padding: .3rem .5rem; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-size: .9rem; list-style: none;
}
.sidebar details > summary::-webkit-details-marker { display: none; }
.sidebar details > summary:hover { background: var(--surface); color: var(--ink); }
.sidebar details > summary::before {
  content: ""; width: 0; height: 0; flex: none;
  border: 4px solid transparent; border-left-color: currentColor;
  transition: transform .15s ease;
}
.sidebar details[open] > summary::before { transform: rotate(90deg) translateX(-1px); }
.sidebar details > summary .n { margin-left: auto; color: var(--faint); font-size: .72rem; }
.sidebar details ul { margin: 0 0 .25rem; padding: 0 0 0 .95rem; list-style: none; border-left: 1px solid var(--rule); margin-left: .75rem; }

@media (max-width: 60rem) {
  .sidebar {
    position: fixed; inset: 3.5rem auto 0 0; z-index: 35;
    width: min(19rem, 84vw); height: calc(100dvh - 3.5rem);
    background: var(--bg); box-shadow: var(--shadow);
    transform: translateX(-102%); transition: transform .18s ease;
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 3.5rem 0 0; z-index: 34; background: rgb(0 0 0 / .45); display: none; }
  .scrim.open { display: block; }
}

/* ── Main ────────────────────────────────────────────── */

main { padding: 1.6rem clamp(1rem, 3vw, 2.6rem) 5rem; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: .3rem; font-size: .8rem; color: var(--faint); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: .55; }

main > h1 {
  margin: 0 0 1.3rem;
  font-size: clamp(1.6rem, 4.4vw, 2.15rem);
  font-weight: 700; letter-spacing: -.022em; line-height: 1.15;
  text-wrap: balance;
}

/* ── Wiki content ────────────────────────────────────── */

.wiki { max-width: 60rem; }
.wiki h2, .wiki h3, .wiki h4, .wiki h5 {
  position: relative;
  margin: 2.2rem 0 .7rem; line-height: 1.25;
  letter-spacing: -.012em; font-weight: 650; text-wrap: balance;
}
.wiki h2 { font-size: 1.32rem; padding-bottom: .35rem; border-bottom: 1px solid var(--rule); }
.wiki h3 { font-size: 1.1rem; }
.wiki h4, .wiki h5 { font-size: .98rem; color: var(--muted); }
.wiki h2:first-child, .wiki h3:first-child { margin-top: 0; }

.wiki .anchor_super {
  margin-left: .4rem; font-size: .66em; font-weight: 400;
  color: var(--faint); opacity: 0; transition: opacity .12s;
}
.wiki :is(h2,h3,h4,h5):hover .anchor_super { opacity: 1; }

.wiki p { margin: 0 0 .95rem; }
.wiki ul, .wiki ol { margin: 0 0 .95rem; padding-left: 1.35rem; }
.wiki li { margin-bottom: .2rem; }
.wiki li::marker { color: var(--faint); }
.wiki hr { height: 1px; border: 0; background: var(--rule); margin: 2rem 0; }
.wiki strong { font-weight: 650; }
.wiki img { max-width: 100%; height: auto; }

.wiki blockquote {
  margin: 0 0 .95rem; padding: .1rem 0 .1rem 1rem;
  border-left: 3px solid var(--rule-firm); color: var(--muted);
}

/* the wiki's own "contents" box at the top of a page */
.wiki .contents {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 9px; padding: .9rem 1.1rem; margin-bottom: 1.6rem;
}
.wiki .contents ul { margin: 0; padding-left: 1.1rem; }
.wiki .contents a { color: var(--muted); }
.wiki .contents a:hover { color: var(--accent); }

/* images */
.wiki .img_margin { margin: 0 0 1.1rem; }
.wiki .img_margin img { border-radius: 8px; background: var(--surface); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.3rem; border: 1px solid var(--rule); border-radius: 9px; }
.wiki table { border-collapse: collapse; width: 100%; font-size: .9rem; background: var(--raised); }
.wiki th, .wiki td { padding: .5rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.wiki thead th {
  background: var(--surface); color: var(--muted);
  font-size: .76rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap; border-bottom: 1px solid var(--rule-firm);
}
.wiki tbody tr:last-child td { border-bottom: 0; }
.wiki tbody tr:hover td { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.wiki td img { display: inline-block; vertical-align: middle; max-height: 44px; width: auto; }

/* ── Right-hand page outline ─────────────────────────── */

.outline { display: none; }
@media (min-width: 88rem) {
  .outline {
    display: block; position: sticky; top: 3.5rem; align-self: start;
    max-height: calc(100dvh - 3.5rem); overflow-y: auto;
    padding: 1.6rem 1.2rem 3rem .4rem; font-size: .84rem;
  }
  .outline h2 { margin: 0 0 .5rem; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
  .outline a { display: block; padding: .18rem 0 .18rem .6rem; color: var(--muted); border-left: 2px solid var(--rule); }
  .outline a:hover { color: var(--ink); text-decoration: none; }
  .outline a.lv3 { padding-left: 1.3rem; font-size: .8rem; }
  .outline a.on { color: var(--accent); border-left-color: var(--accent); }
}

/* ── Footer ──────────────────────────────────────────── */

.pagefoot {
  max-width: 60rem; margin-top: 3rem; padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: .4rem 1.2rem;
  color: var(--faint); font-size: .83rem;
}

/* ── Front page hero + section cards ─────────────────── */

.hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; padding: 1.5rem 1.6rem; margin-bottom: 2rem;
}
.hero img { width: 62px; height: 62px; border-radius: 12px; }
.hero h1 { margin: 0 0 .2rem; font-size: 1.6rem; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); font-size: .94rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .7rem; margin-bottom: 2.4rem; }
.card {
  display: block; padding: .85rem 1rem;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 10px;
  color: var(--ink);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card .k { font-weight: 600; font-size: .95rem; }
.card .v { color: var(--faint); font-size: .8rem; }

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: var(--on-accent); padding: .5rem .8rem; border-radius: 6px;
}
.skip:focus { left: .5rem; top: .5rem; z-index: 60; }

/* The wiki's own contents box duplicates the outline column, so it only
   earns its place on screens too narrow to show that column - and there it
   opens on demand rather than pushing the article off the first screen. */
.wiki .pagetoc { margin-bottom: 1.6rem; }
.wiki .pagetoc > summary { display: flex; align-items: center; gap: .45rem; cursor: pointer; list-style: none; }
.wiki .pagetoc > summary::-webkit-details-marker { display: none; }
.wiki .pagetoc > summary::before {
  content: ""; width: 0; height: 0; flex: none;
  border: 5px solid transparent; border-left-color: var(--faint);
  transition: transform .15s ease;
}
.wiki .pagetoc[open] > summary::before { transform: rotate(90deg) translateX(-2px); }
.wiki .pagetoc > summary :is(h2,h3,h4) { margin: 0; border: 0; padding: 0; font-size: 1.15rem; }
.wiki .pagetoc .contents { margin-top: .7rem; margin-bottom: 0; }
@media (min-width: 88rem) { .wiki .pagetoc { display: none; } }
