/* Fandom reader (aong.dev/fandom/): the form, the page head and the wiki page itself.
   The wiki's own class names arrive with a w- prefix (src/fandom.js adds it), so .w-portable-infobox here
   is Fandom's .portable-infobox. Fandom's own styles never load; this is the whole look of a wiki page. */

.reader { max-width: 1000px; }
.reader .sheet { min-width: 0; }
.reader code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); padding: 2px 6px; border-radius: 6px; }

/* ---------- forms ---------- */
.reader input {
  width: 100%; min-width: 0; padding: 11px 14px 10px; border: 0; border-radius: 10px;
  font: 400 1.05rem/1.2 var(--f-body); color: var(--ink);
  background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line);
}
.reader input::placeholder { color: var(--ink-dim); opacity: .8; }
.reader input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.reader button.btn { border: 0; cursor: pointer; font-family: var(--f-head); }
.reader-form { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 12px; align-items: end; }
.reader-form label { display: grid; gap: 6px; }
.reader-form label span { font: 400 .74rem/1.2 var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.reader-form em { font-style: normal; text-transform: none; letter-spacing: 0; }
.reader-search { display: flex; gap: 10px; max-width: 560px; }
.reader-search input { padding: 8px 12px 7px; font-size: 1rem; }

.reader-head .label a { color: var(--sky-deep); text-decoration: none; }
html[data-theme="dark"] .reader-head .label a { color: var(--sun); }
.reader-head .label a:hover { text-decoration: underline; }
.reader-head h1 { overflow-wrap: anywhere; }

/* ---------- lists of links: wikis to try, categories, results ---------- */
.reader-picks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reader-picks a {
  display: inline-block; padding: 7px 12px 6px; border-radius: 999px; text-decoration: none;
  background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); font-size: .95rem;
}
.reader-picks a:hover { background: var(--sun); color: #1d1606; box-shadow: none; }
.reader-sub { font-size: 1.2rem; }
.reader-foot { gap: 12px; }
.reader-results { margin: 0; padding-left: 1.4em; display: grid; gap: 14px; }
.reader-results > li > a { font: 600 1.15rem/1.2 var(--f-head); }
.reader-results p { margin-top: 4px; font-size: .95rem; }
.reader-list { columns: 3 200px; column-gap: 24px; margin: 0; padding-left: 1.2em; }
.reader-list li { break-inside: avoid; margin-bottom: 4px; }
.reader-members { display: grid; gap: 12px; margin-top: 18px; }
.w-searchmatch { background: var(--sun); color: #1d1606; border-radius: 3px; padding: 0 2px; }

/* ---------- the wiki page ---------- */
.wiki { display: block; background: var(--panel); overflow-wrap: break-word; }
.wiki::after { content: none; }
.wiki::before { content: ""; display: table; } /* keeps floats inside */
.wiki > * { max-width: 100%; }
.wiki p, .wiki ul, .wiki ol, .wiki dl, .wiki blockquote, .wiki pre, .wiki figure { margin: 0 0 14px; }
.wiki p { color: var(--ink); }
.wiki ul, .wiki ol { padding-left: 1.4em; }
.wiki li { margin-bottom: 3px; }
.wiki dt { font-weight: 600; font-family: var(--f-head); }
.wiki dd { margin: 0 0 6px 1.2em; }
.wiki h2, .wiki h3, .wiki h4, .wiki h5, .wiki h6 { margin: 26px 0 10px; clear: none; }
.wiki h2 { font-size: 1.7rem; padding-bottom: 6px; border-bottom: 2px solid var(--line); overflow: hidden; } /* overflow: the line stops at the infobox */
.wiki h3 { font-size: 1.35rem; }
.wiki h4, .wiki h5, .wiki h6 { font-size: 1.12rem; }
.wiki a { color: var(--sky-deep); }
html[data-theme="dark"] .wiki a { color: #8cc4f2; }
.wiki a:hover { color: var(--ink); }
.wiki a:not([href]) { color: var(--berry-deep); text-decoration: none; cursor: default; } /* pages that don't exist yet */
html[data-theme="dark"] .wiki a:not([href]) { color: var(--berry); }
.wiki img { display: inline-block; height: auto; vertical-align: middle; border-radius: 4px; }
/* in a table an image's 100% is the cell, which is sized by its content, so a max-width there shrinks images to nothing */
.wiki td img, .wiki th img, .w-pi-data-value img { max-width: none; }
.wiki blockquote { padding: 10px 16px; background: color-mix(in srgb, var(--sun) 22%, var(--panel-sub)); border-radius: 10px; }
.wiki pre { padding: 12px 14px; overflow-x: auto; background: var(--panel-sub); border-radius: 10px; font: .9rem/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.wiki hr { border: 0; border-top: 2px solid var(--line); margin: 18px 0; }
.wiki sup, .wiki sub { line-height: 0; }

/* tables: each sits in a .table-wrap (added by src/fandom.js) that scrolls sideways when it's wider than the page,
   so the table keeps its own layout and its columns aren't squeezed */
.wiki .table-wrap { max-width: 100%; overflow-x: auto; margin: 0 0 14px; }
/* a table is as wide as its columns need (each up to 26em before it wraps); a "100%" table is at least the page */
.wiki .table-wrap > table { margin: 0; width: max-content; }
.wiki table { border-collapse: collapse; font-size: .95rem; }
.wiki td, .wiki th { overflow-wrap: normal; max-width: 26em; }
.w-portable-infobox .table-wrap > table { width: 100%; }
.wiki .w-wikitable > tbody > tr:nth-child(even) > td, .wiki .w-article-table > tbody > tr:nth-child(even) > td { background: var(--panel-sub); }
.wiki th, .wiki td { padding: 6px 10px; border: 1px solid var(--line); vertical-align: top; text-align: left; }
.wiki th { background: var(--panel-sub); font-family: var(--f-head); font-weight: 600; }
.wiki caption { padding: 6px 0; font-family: var(--f-head); font-weight: 600; text-align: left; }

/* the infobox, beside the text on wide screens */
.w-portable-infobox, .w-infobox {
  float: right; clear: right; width: 300px; margin: 0 0 18px 22px; padding: 0; overflow: hidden;
  border-radius: 12px; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); font-size: .95rem;
}
.w-portable-infobox > *, .wiki .w-portable-infobox h2, .wiki .w-portable-infobox h3 { margin: 0; border: 0; overflow: visible; }
.w-pi-title, .w-portable-infobox .w-pi-header {
  margin: 0; padding: 10px 14px; font: 600 1.25rem/1.15 var(--f-head); border: 0; text-align: center;
  background: var(--sky); color: #0f1420;
}
.w-portable-infobox .w-pi-header { font-size: 1rem; background: var(--line); color: var(--ink); }
.w-pi-image, .w-pi-media { margin: 0; padding: 10px; text-align: center; }
.w-pi-image img, .w-pi-media img { margin: 0 auto; display: block; }
.w-pi-caption { padding: 0 12px 10px; font-size: .88rem; color: var(--ink-dim); text-align: center; }
.w-pi-data { display: grid; grid-template-columns: 40% 1fr; gap: 8px; padding: 7px 14px; border-top: 1px solid var(--line); }
.w-pi-data-label { margin: 0; font: 600 .95rem/1.3 var(--f-head); }
.w-pi-data-value { min-width: 0; }
.w-pi-data-value ul { margin: 0; padding-left: 1.1em; }
.w-pi-group { border-top: 1px solid var(--line); }
.w-pi-horizontal-group { display: block; overflow-x: auto; margin: 0; }
.w-pi-smart-group { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); }
.w-pi-smart-data-label, .w-pi-smart-data-value { padding: 6px 14px; flex: 1 1 33%; }
.w-pi-smart-data-label { font-family: var(--f-head); font-weight: 600; }
.w-wds-tabs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; margin: 0; }
.w-wds-tabs__tab { margin: 0; padding: 3px 8px; border-radius: 999px; font-size: .85rem; background: var(--panel-sub); }

/* pictures in the text */
/* a picture with a caption: the box is as wide as the picture (the width the wiki gave it, else the picture's
   own), and the caption wraps under it */
.wiki :where(figure:not(.w-pi-image), .w-thumb) {
  box-sizing: content-box; width: min-content; max-width: calc(100% - 16px); margin: 4px 0 14px; padding: 8px;
  border-radius: 12px; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line);
}
/* not max-width: 100%: inside a min-content box that would shrink the picture to nothing */
.wiki :where(figure:not(.w-pi-image), .w-thumb) img { display: block; max-width: min(900px, calc(100vw - 100px)); }
.w-thumb .w-thumbinner { max-width: 100%; }
.w-thumb figure, .w-thumb .w-thumb { padding: 0; background: none; box-shadow: none; margin: 0; }
.wiki .w-tright, .wiki .w-floatright, .wiki .w-mw-halign-right { float: right; clear: right; margin-left: 18px; }
.wiki .w-tleft, .wiki .w-floatleft, .wiki .w-mw-halign-left { float: left; clear: left; margin-right: 18px; }
.wiki figcaption, .w-thumbcaption, .w-lightbox-caption { margin-top: 6px; font-size: .88rem; color: var(--ink-dim); }
.w-wikia-gallery-row { display: contents; }
.w-wikia-gallery, .w-gallery { display: flex; flex-wrap: wrap; gap: 12px; padding: 0; list-style: none; clear: both; }
.w-wikia-gallery-item, .w-gallerybox { max-width: 100%; margin: 0; text-align: center; }
.w-wikia-gallery-item .w-thumb { width: auto; padding: 6px; margin: 0; }
.w-wikia-gallery-item img, .w-gallerybox img { margin: 0 auto; display: block; }
.w-wikia-gallery-item .w-lightbox-caption, .w-gallerytext { font-size: .85rem; }

/* table of contents */
.w-toc { display: inline-block; min-width: 240px; margin: 4px 0 18px; padding: 12px 18px; border-radius: 12px; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); }
.w-toc h2 { margin: 0 0 6px; padding: 0; border: 0; font-size: 1.1rem; }
.w-toc ul { list-style: none; margin: 0; padding-left: 0; }
.w-toc ul ul { padding-left: 1.1em; }
.w-toc li { margin: 2px 0; }
.w-toc a { text-decoration: none; }
.w-tocnumber { color: var(--ink-dim); margin-right: 6px; }

/* notices, quotes and boxes made with wiki templates */
.w-notice, .w-ambox, .w-mbox, .w-message-box, .w-hatnote, .w-dablink, .w-rellink { margin: 0 0 14px; padding: 8px 14px; border-radius: 10px; background: var(--panel-sub); color: var(--ink-dim); font-size: .95rem; }
.w-hatnote, .w-dablink, .w-rellink { font-style: italic; }
.w-quote, .w-quotation { padding: 10px 16px; background: color-mix(in srgb, var(--sun) 22%, var(--panel-sub)); border-radius: 10px; margin-bottom: 14px; }

/* navigation boxes at the end of a page: small and below everything */
.w-navbox, table.w-navbox, .w-navbox-container { clear: both; font-size: .85rem; margin-top: 18px; }
.w-navbox th, .w-navbox td { padding: 4px 8px; }
.w-mw-collapsible-toggle, .w-mw-collapsible-text { display: none; }

/* references */
.w-references, .w-reflist { font-size: .9rem; color: var(--ink-dim); }
.w-reference { font-size: .75em; }
.w-mw-references-wrap { clear: both; }

.w-clear, .w-visualClear, [class~="w-clearfix"] { clear: both; }

@media (max-width: 720px) {
  .reader-form { grid-template-columns: minmax(0, 1fr); }
  .w-portable-infobox, .w-infobox { float: none; width: auto; max-width: 100%; margin: 0 0 16px; }
  .wiki .w-tright, .wiki .w-tleft, .wiki .w-floatright, .wiki .w-floatleft, .wiki .w-mw-halign-right, .wiki .w-mw-halign-left { float: none; margin: 0 auto 16px; }
  .wiki { padding: 20px 18px; }
}
