/* Slay Divinity wiki. Colours follow www.elegantfish.io (dark night blue, amber accent, Alata headings). */
@font-face {
  font-family: "Alata";
  src: url("/static/alata.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #0b0a17;
  --surface: #15142a;
  --surface-2: #1f1d38;
  --ink: #f3fbfb;
  --ink-2: #c9c8d6;
  --muted: #8d8c99;
  --rule: #2e2c48;
  --border: rgba(255, 255, 255, 0.09);
  --accent: #fba62c;
  --link: #ffc56b;
  --buff: #5fd068;
  --debuff: #ff7676;
  --kw: #f0b44a;
  /* In-game rarity colours: the bright band of cardview_title_bg_{common,uncommon,rare}.png. */
  --game-common: #8d7bbe;
  --game-uncommon: #1f79e1;
  --game-rare: #f5c505;
  --game-other: #6f6e80;
  --normal: #8d8c99;
  --elite: #e0703a;
  --boss: #d33b5b;
}

* { box-sizing: border-box; }
html { background: var(--page); color: var(--ink); }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, .brand, .sections { font-family: "Alata", system-ui, sans-serif; font-weight: 400; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 32px; margin-bottom: 8px; }
h2 { font-size: 22px; margin-bottom: 12px; }
h3 { font-size: 17px; margin: 14px 0 8px; }
h4 { font-size: 14px; color: var(--accent); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
h1 small, h2 small, h3 small { color: var(--muted); font-size: .6em; margin-left: 6px; }
p { margin: 0 0 10px; }
ul { margin: 0 0 10px; padding-left: 20px; }
.lead { color: var(--ink-2); font-size: 16px; max-width: 75ch; }
.sub { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); }
section { margin: 32px 0; }

/* Header */
.top { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding: 10px 24px; background: rgba(11, 10, 23, .92); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 19px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 8px; }
.brand em { font-style: normal; color: var(--accent); }
.sections { display: flex; gap: 2px; flex-wrap: wrap; font-size: 15px; }
.sections a { color: var(--ink-2); padding: 5px 10px; border-radius: 6px; }
.sections a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.sections a[aria-current] { color: var(--accent); background: var(--surface); }
.search { position: relative; margin-left: auto; }
.search input { width: 240px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: inherit; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.results { position: absolute; right: 0; top: calc(100% + 6px); width: min(380px, 90vw); background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); overflow: hidden; }
.results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--border); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.active { background: var(--surface-2); text-decoration: none; }
.results small { color: var(--muted); white-space: nowrap; }
.results .none { padding: 10px 12px; color: var(--muted); }

main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; flex: 1; }
footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; padding: 16px 24px; text-align: center; }
footer p { margin: 4px 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.toc { margin: 8px 0 0; color: var(--muted); }
.inline { display: inline; padding: 0; list-style: none; }
.inline li { display: inline; }
.inline li + li::before { content: " · "; color: var(--muted); }

/* Home */
.home-hero { display: flex; gap: 24px; align-items: center; margin: 12px 0 8px; }
.home-hero img { border-radius: 20px; flex: none; box-shadow: 0 8px 40px rgba(251, 166, 44, .15); }
.home-hero h1 { font-size: 40px; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.home-tile { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink); }
.home-tile:hover { border-color: var(--accent); text-decoration: none; }
.home-tile b { font-family: "Alata", sans-serif; font-weight: 400; font-size: 20px; color: var(--accent); }
.home-tile span { color: var(--ink-2); font-size: 14px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-chip { display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink); }
.hero-chip:hover { border-color: var(--accent); text-decoration: none; }
.hero-chip .portrait { width: 40px; height: 40px; border-radius: 50%; }

/* Characters */
.heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.hero-tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 14px; }
.hero-tile > a { display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.hero-tile > a:hover { text-decoration: none; }
.hero-tile > a:hover .name { color: var(--accent); }
.hero-tile .portrait { width: 100%; aspect-ratio: 1; border-radius: 10px; }
.hero-tile .name { font-family: "Alata", sans-serif; font-size: 22px; }
.hero-tile p { color: var(--ink-2); font-size: 14px; margin: 8px 0 0; }
.hero-tile .variants { color: var(--muted); display: inline; }
.portrait { display: block; object-fit: cover; background: var(--surface-2); }
.entity-head { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.entity-head .portrait.big { width: 240px; height: 240px; border-radius: 16px; }
.entity-head .portrait.wide { width: 100%; height: auto; aspect-ratio: auto; border-radius: 16px; }
.event-head { grid-template-columns: minmax(240px, 420px) 1fr; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 14px; min-width: 110px; display: flex; flex-direction: column; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 20px; font-weight: 600; }
.stat .note { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; font: 600 12px/1.6 system-ui, sans-serif; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); vertical-align: middle; }
.badge.kind-Elite { background: var(--elite); color: #1a0b02; }
.badge.kind-Boss { background: var(--boss); color: #fff; }
.badge.buff { background: color-mix(in srgb, var(--buff) 25%, transparent); color: var(--buff); }
.badge.debuff { background: color-mix(in srgb, var(--debuff) 25%, transparent); color: var(--debuff); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; position: sticky; top: 58px; z-index: 5; background: var(--page); padding: 8px 0; }
.filters input, .filters select { padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.filters input { min-width: 220px; }
.filters .count { margin-left: auto; color: var(--muted); font-size: 14px; }

/* Card tiles: the game's own card renders (315 x 500, transparent corners) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; align-items: start; }
.card { position: relative; display: block; color: var(--ink); }
.card .render { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.card .render.missing { aspect-ratio: 315 / 500; background: var(--surface); border-radius: 12px; padding: 12px; font-size: 13px; filter: none; }
a.card { transition: transform .12s; }
a.card:hover { transform: translateY(-3px); text-decoration: none; }
.card[hidden] { display: none; }
.card .flag { display: block; width: fit-content; margin: 6px auto 0; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; }
.rar { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--game-other); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); }
.rar.Common { background: var(--game-common); } .rar.Uncommon { background: var(--game-uncommon); } .rar.Rare { background: var(--game-rare); }

/* Card page */
.card-page { display: grid; grid-template-columns: 315px 1fr; gap: 32px; align-items: start; }
.card-big .render { display: block; width: 315px; max-width: 100%; height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .55)); }
.card-info h1 { margin-top: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 20px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Keyword boxes */
.defs { display: flex; flex-direction: column; gap: 8px; }
.defs.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.def { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--ink-2); scroll-margin-top: 80px; }
.def b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.def:target { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.status { white-space: nowrap; }
.sico { width: 1.25em; height: 1.25em; vertical-align: -0.3em; margin-right: 3px; }

/* Card text markup */
.ct .big { font-size: 1.45em; font-weight: 700; color: var(--ink); }
.ct .semibig { font-size: 1.2em; font-weight: 600; }
.ct .buff { color: var(--buff); font-weight: 600; }
.ct .debuff { color: var(--debuff); font-weight: 600; }
.ct .kw { color: var(--kw); font-weight: 600; }
.ct .gray { color: var(--muted); }
img.ico { height: 1.15em; width: 1.15em; vertical-align: -0.2em; margin: 0 1px; }

/* Enemies */
.enemy-grid, .event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.event-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.enemy-tile, .event-tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; color: var(--ink); padding-bottom: 10px; }
.enemy-tile:hover, .event-tile:hover { border-color: var(--accent); text-decoration: none; }
.enemy-tile img, .enemy-tile .ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.event-tile img, .event-tile .ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.enemy-tile .name, .event-tile .name { font-family: "Alata", sans-serif; font-size: 17px; padding: 8px 12px 0; }
.enemy-tile .kind, .event-tile .kind { color: var(--muted); font-size: 13px; padding: 0 12px; }
.enemy-tile.kind-Elite { border-color: color-mix(in srgb, var(--elite) 60%, transparent); }
.enemy-tile.kind-Boss { border-color: color-mix(in srgb, var(--boss) 70%, transparent); }
details.asc { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 16px; margin: 12px 0; }
details.asc > summary { cursor: pointer; font-family: "Alata", sans-serif; font-size: 17px; color: var(--accent); }
details.asc[open] > summary { margin-bottom: 12px; }

/* Events */
.flavor { font-style: italic; color: var(--ink-2); max-width: 70ch; font-size: 16px; }
.choices { padding-left: 22px; display: flex; flex-direction: column; gap: 14px; max-width: 1000px; }
.choice::marker { color: var(--accent); font-weight: 700; }
.choice-text { font-size: 16px; font-weight: 600; }
.choice .cards { margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-width: 840px; }
.follow { border-left: 3px solid var(--rule); padding: 4px 0 4px 16px; margin-top: 10px; }

/* Achievements */
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ach { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 16px; scroll-margin-top: 80px; }
.ach:target { border-color: var(--accent); }
.ach h3 { margin: 0 0 6px; color: var(--ink); }
.ach p { margin: 0; color: var(--ink-2); }
.ach .reward { color: var(--accent); font-weight: 600; margin-top: 2px; }
.hidden-achs { color: var(--muted); margin: 12px 0 0; }

@media (max-width: 760px) {
  main { padding: 16px; }
  .top { padding: 8px 14px; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .entity-head, .event-head, .card-page { grid-template-columns: 1fr; }
  .entity-head .portrait.big { width: 160px; height: 160px; }
  .home-hero { flex-direction: column; align-items: flex-start; }
  .filters { position: static; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .card-big .render { width: 260px; }
  h1 { font-size: 26px; }
}
