:root { color-scheme: light dark; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  max-width: 46rem;
  margin: 2rem auto 0;
  padding: 0 1.25rem 1.5rem;
  line-height: 1.55;
  /* Sticky footer: main grows to push .site-footer to the bottom of a short page. */
  box-sizing: border-box;
  min-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
/* A flex item keeps its first child's top margin inside, where the body's used to absorb it. */
main > :first-child { margin-top: 0; }
h1 { margin-bottom: 0.25rem; }
h2 { margin-top: 2rem; padding-bottom: 0.25rem; border-bottom: 1px solid; opacity: 0.9; }
nav { margin-bottom: 1rem; font-size: 0.9rem; }
ul { padding-left: 1.2rem; }
li { margin: 0.3rem 0; }

/* The back link on the left, the worldspace maps on the right. */
.site-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.map-link { margin-left: auto; }

/* The about page: the options as a two-column grid, the long file lists and each map folded. */
.meta-options { border-collapse: collapse; font-size: 0.9rem; }
.meta-options th, .meta-options td { text-align: left; font-weight: normal; padding: 0.2rem 1.5rem 0.2rem 0; vertical-align: top; border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
.meta-options td { overflow-wrap: anywhere; }
.file-list { margin: 0.5rem 0; }
.file-list summary { cursor: pointer; font-weight: 600; }
.map-export { margin: 0.4rem 0; }
.map-export > summary { cursor: pointer; font-weight: 600; }
.map-export > summary .muted { font-weight: normal; }
.map-export[open] { padding-bottom: 0.5rem; border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
.map-export > :not(summary) { margin-left: 1.1rem; }
.file-list ol { columns: 16rem; column-gap: 2rem; font-size: 0.9rem; padding-left: 2.2rem; }
.file-list li { margin: 0.1rem 0; break-inside: avoid; overflow-wrap: anywhere; }


.book-header { margin-bottom: 1.5rem; }
.book-header h1 { font-size: 1.75rem; line-height: 1.25; margin: 0; }
/* Grayed with color, not opacity, so the PDF link keeps its own color. */
.book-summary, .book-languages { margin: 0.35rem 0 0; font-size: 0.9rem; color: color-mix(in srgb, currentColor 65%, transparent); }
/* A narrow window wraps between the items, never inside one ("15 gold"). */
.book-summary span { white-space: nowrap; }
.source { font-size: 0.85em; font-weight: normal; opacity: 0.6; }

/* The Content and Metadata tabs. Without the script there are none: the metadata follows the book,
   after a light rule. */
.metadata { margin: 2.5rem 0 0; padding-top: 0.75rem; border-top: 1px solid rgba(128, 128, 128, 0.25); font-size: 0.95rem; }
body.js .metadata { margin-top: 0; padding-top: 0; border-top: none; }
/* Names the Locations section when there are no tabs to name it. */
.no-js-heading { font-size: 1rem; margin: 0 0 0.5rem; padding: 0; border: none; }
body.js .no-js-heading { display: none; }
.metadata dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 1rem; }
.metadata dt { opacity: 0.6; }
.metadata dd { margin: 0; }
.metadata .none { opacity: 0.4; }
.metadata dd .inline-icon { max-height: 1.4em; max-width: 8em; vertical-align: middle; margin-left: 0.4em; }

.metadata details { margin-top: 0.6rem; }
.metadata summary { cursor: pointer; font-weight: 500; opacity: 0.8; }
.metadata summary:hover { opacity: 1; }

/* A zero-count section (see EmptySectionHtml/ScriptsHtmlBuilder) keeps the exact same
   <details>/<summary> shape as a populated one — same disclosure triangle, same position on the
   page — so the page looks the same whether or not there's anything behind it. pointer-events:
   none (plus tabindex="-1" on the <summary> itself) is what actually makes it non-clickable, since
   a native <details> has no "disabled" attribute; the dark gray color and default cursor are the
   visual signal that it's inert rather than just collapsed. */
.metadata details.empty > summary {
  cursor: default;
  pointer-events: none;
  opacity: 1;
  color: rgba(128, 128, 128, 0.7);
}
/* A source-type group's <details> nests inside the "Locations (N)" <details> (see
   Rendering/BookPage/LocationsHtmlBuilder.Build) — indented so that nesting also reads visually,
   not just structurally, once the outer one is expanded. */
.metadata details details { margin-left: 1rem; }

.locations { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.92rem; }
.locations li { padding: 0.4rem 0; border-top: 1px solid rgba(128, 128, 128, 0.2); }
.locations li:first-child { border-top: none; }
.location-map { margin-top: 0.3rem; }
.location-map iframe { display: block; width: 100%; height: 24rem; margin: 0.4rem 0 0.2rem; border: 1px solid rgba(128, 128, 128, 0.35); border-radius: 0.3rem; }

.leveled-lists { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.92rem; }
.leveled-lists li { padding: 0.4rem 0; border-top: 1px solid rgba(128, 128, 128, 0.2); }
.leveled-lists li:first-child { border-top: none; }

.scripts { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.92rem; }
.scripts li { padding: 0.4rem 0; border-top: 1px solid rgba(128, 128, 128, 0.2); }
.scripts li:first-child { border-top: none; }

.menu-art-gallery { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.menu-art-gallery li { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.menu-art-gallery span { font-size: 0.8rem; opacity: 0.75; }

/* Checkbox-driven zoom, no JavaScript: each thumbnail's own <label class="image-zoom"> wraps a
   hidden checkbox plus its <img>, so a click anywhere on the image toggles that one checkbox
   without an id/for pair — :checked + img then scales that same image up in place. */
.zoom-toggle { display: none; }

.image-zoom img {
  display: block;
  max-width: 12rem;
  max-height: 12rem;
  height: auto;
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 0.3rem;
  cursor: zoom-in;
}

@media (prefers-reduced-motion: no-preference) {
  .image-zoom img { transition: transform 300ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  .image-zoom img { transition: none; }
}

.zoom-toggle:checked + img {
  transform: scale(3);
  cursor: zoom-out;
  position: relative;
  z-index: 1000;
}

.flag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0 0.5em;
  margin-left: 0.35em;
  border: 1px solid;
  border-radius: 1em;
  opacity: 0.85;
}

.tp-cmd {
  display: inline-block;
  font-size: 0.85em;
  padding: 0.05em 0.5em;
  margin-top: 0.3em;
  background: rgba(128, 128, 128, 0.15);
  border-radius: 0.3em;
  user-select: all;
}

/* Laid out in the book menu's own Flash stage pixels, so authored <img width/height> and
   <font size> values keep their in-game proportion to the text; zoom scales the page to screen. See
   docs/src/generator/styling.md#book-page-geometry. */
.content {
  --book-zoom: 0.75;
  zoom: var(--book-zoom);

  color: #302a20;
  background:
    radial-gradient(
      ellipse at center,
      #dfd0ad 0%,
      #d8c9a5 65%,
      #c8b58c 100%
    );

  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.6;

  padding: 42px 48px;
  margin: 21px 0;

  border: 1px solid #a99670;

  box-shadow:
    inset 0 0 30px rgba(80, 55, 25, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.25);
}
/* A narrow window: the text keeps most of the width. */
@media (max-width: 36rem) {
  .content { padding: 24px 20px; }
}

.content p {
  margin: 0 0 1.1em;
}

/* Inline on the text baseline, the way Scaleform lays out <img> in a book text field. */
.content img {
  max-width: 100%;
  height: auto;
}

/* Unsized images draw into a fixed 64 x 64 box in-game, whatever the texture's own size. */
.content img:not([width]) {
  width: 64px;
  height: 64px;
}

.content h1,
.content h2,
.content h3 {
  color: #292218;

  font-family: Georgia, "Times New Roman", serif;
  font-weight: normal;
  text-shadow: none;
}

.content h2 {
  margin: 1.8rem 0 0.8rem;
  padding: 0;

  font-size: 1.35rem;
  border: none;
}

.content h3 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.15rem;
}

.content a {
  color: #55452d;
  text-decoration: underline;
}

.content a:hover {
  color: #211b13;
}

.content hr.pagebreak {
  border: none;
  border-top: 1px solid rgba(75, 55, 30, 0.35);
  margin: 2rem 0;
}

/* A generated placeholder note (BookPageWriter's contentIsPlaceholder path — a book whose own
   DESC is empty, its real "content" a referenced object's baked-in artwork instead) isn't in-game
   text, so it reads in the site's own plain UI font rather than the SkyrimBooks content face —
   same font stack as body above, restated here since specificity-wise a class selector needs it
   spelled out to win over the plainer .content rule instead of just inheriting. */
.content.placeholder-note {
  --book-zoom: 1;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

/* Site UI inside the zoomed page: sized back down to the page's own UI text. */
.content .menu-art {
  margin-top: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: calc(1rem / var(--book-zoom));
  line-height: 1.55;
}
.content .menu-art summary { cursor: pointer; font-weight: 600; opacity: 0.85; }
.content .menu-art summary:hover { opacity: 1; }
.content .menu-art select { margin-top: 0.6rem; font: inherit; }

.content blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;

  color: #4b3e2b;
  font-style: italic;

  border-left: 2px solid #9b8965;
}

.muted { opacity: 0.65; font-size: 0.9em; }

input[type="search"] { box-sizing: border-box; font: inherit; padding: 0.3rem 0.5rem; }
#book-search { width: 100%; max-width: 28rem; }

/* The advanced search, folded under the search box: one dropdown of checkboxes per filter. */
.advanced-search { margin: 0.5rem 0 0.25rem; font-size: 0.9rem; }
.advanced-search[hidden] { display: none; }
.advanced-search > summary { cursor: pointer; opacity: 0.8; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.5rem; }
.filter-field { display: flex; align-items: baseline; gap: 0.5rem; }
.filter-name { opacity: 0.65; }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; min-width: 8rem; padding: 0.2rem 1.6rem 0.2rem 0.5rem; border: 1px solid rgba(128, 128, 128, 0.5); border-radius: 0.3rem; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::after { content: "\25BE"; position: absolute; right: 0.5rem; opacity: 0.6; }
.dropdown-list { position: absolute; z-index: 10; width: max-content; min-width: 100%; max-height: 16rem; overflow-y: auto; scrollbar-gutter: stable; margin-top: 0.2rem; padding: 0.3rem 0; border: 1px solid rgba(128, 128, 128, 0.5); border-radius: 0.3rem; background: Canvas; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.dropdown-list label { display: flex; gap: 0.4rem; padding: 0.15rem 0.6rem; white-space: nowrap; cursor: pointer; }
.dropdown-list label:hover { background: rgba(128, 128, 128, 0.15); }

#book-list { list-style: none; padding-left: 0; }
#book-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0; padding: 0.35rem 0; }
#book-list .form-id { flex-shrink: 0; font-family: ui-monospace, monospace; font-size: 0.8em; opacity: 0.65; }
#book-list a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#book-list li[hidden] { display: none; }
/* A narrow window: the FormId under the title, so the title keeps the whole row. */
@media (max-width: 36rem) {
  #book-list li { flex-direction: column; align-items: stretch; gap: 0; }
}

.site-footer {
  margin-top: 3rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(128, 128, 128, 0.25);
  font-size: 0.85rem;
  opacity: 0.65;
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 0.2rem; }
.site-footer a { color: inherit; }

/* Map page (maps/index.html): the menu on the left, the map filling the rest of the window. Without
   JavaScript the menu splits in half, the worldspaces above the metadata, and a note takes the map's place. */
body.map-page { max-width: none; margin: 0; padding: 0; min-height: 0; display: block; }
/* dvh: on a phone, 100vh is taller than what the browser's toolbars leave. */
.map-page main { height: 100vh; height: 100dvh; }
/* maps/embed.html: the map alone fills the window, an iframe on a book page. */
body.map-embed-page { max-width: none; margin: 0; padding: 0; min-height: 0; display: block; }
.map-embed-page main, .map-embed { height: 100vh; }
.map-embed { position: relative; }
/* Set by map_view.js while it adds the minimap, so a folded one doesn't animate as it appears. */
.map-no-transition .leaflet-control-minimap, .map-no-transition .leaflet-control-minimap a { transition: none; }
/* The colored dot before a marker group in the layer control (map_view.js). */
.legend { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; border: 1px solid #000; }
/* The altitude slider of a map with levels (map_view.js): bottom is low, top is high. */
.map-levels { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.4rem 0.3rem; background: #fff; color: #333; font-size: 0.75rem; }
.map-levels output { font-variant-numeric: tabular-nums; white-space: nowrap; }
.map-levels input[type="range"] { writing-mode: vertical-lr; direction: rtl; width: 1.5rem; height: 12rem; margin: 0; cursor: pointer; }
.map-layout { --map-menu-width: 22rem; position: relative; display: grid; grid-template-columns: var(--map-menu-width) 1fr; height: 100%; }
.map-menu { overflow-y: auto; padding: 1rem 1.25rem; margin: 0; border-right: 1px solid rgba(128, 128, 128, 0.3); font-size: 0.92rem; }
.map-menu h1 { font-size: 1.2rem; margin: 0 0 0.75rem; }
.map-menu h1 a { color: inherit; }
.map-menu input[type="search"] { box-sizing: border-box; width: 100%; margin-bottom: 0.5rem; }
.map-tree, .map-tree ul { list-style: none; padding-left: 0; margin: 0; }
.map-tree ul { padding-left: 1rem; border-left: 1px solid rgba(128, 128, 128, 0.25); }
.map-tree li { margin: 0.15rem 0; }
.map-tree a { display: block; padding: 0.15rem 0.4rem; border-radius: 0.3rem; color: inherit; text-decoration: none; }
.map-tree a:hover { background: rgba(128, 128, 128, 0.12); }
.map-tree a.current { background: rgba(128, 128, 128, 0.25); font-weight: 600; }
.map-tree small { opacity: 0.65; }
/* The Search and Meta tabs exist only with the script: without it both panels show, one under the other. */
:is(.map-tabs, .book-tabs) { display: none; }
body.js :is(.map-tabs, .book-tabs) { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; border-bottom: 1px solid rgba(128, 128, 128, 0.3); }
:is(.map-tabs, .book-tabs) [role="tab"] { font: inherit; padding: 0.3rem 0.8rem; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: inherit; opacity: 0.7; cursor: pointer; }
:is(.map-tabs, .book-tabs) [role="tab"]:hover { opacity: 1; }
:is(.map-tabs, .book-tabs) [role="tab"][aria-selected="true"] { opacity: 1; font-weight: 600; border-bottom-color: currentColor; }
.map-info { margin-top: 1.25rem; }
body.js .map-info { margin-top: 0; }
.map-info h2 { margin-top: 0; font-size: 1.1rem; }
.map-info h3 { font-size: 0.95rem; margin: 1rem 0 0.3rem; }
.map-info dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem; margin: 0.5rem 0; }
.map-info dt { font-weight: 600; opacity: 0.7; }
.map-info dd { margin: 0; }
.map-info table { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.map-info td, .map-info th { text-align: left; padding: 0.1rem 0.4rem 0.1rem 0; }
.map-info td:nth-child(n + 3), .map-info th:nth-child(n + 3) { text-align: right; }
.map-info details { margin: 0.75rem 0; }
.map-info summary { cursor: pointer; font-weight: 600; opacity: 0.85; }
.map-info summary:hover { opacity: 1; }
/* A level's tile path is one long word. */
.map-level-list td:nth-child(2) { overflow-wrap: anywhere; }
.map-children ul { list-style: none; padding-left: 1rem; margin: 0.3rem 0 0; }
/* The breadcrumb stays an ordered list; the arrow is drawn between its steps. */
.plugin-chain { list-style: none; padding: 0; margin: 0; }
.plugin-chain li { display: inline; }
.plugin-chain li + li::before { content: " → "; opacity: 0.6; }
.plugin-chain .plugin { font-weight: 600; }
/* The footer sits under the map; the map takes what the window height leaves. */
.map-view { display: flex; flex-direction: column; min-height: 20rem; min-width: 0; }
.map-canvas { position: relative; flex: 1 1 auto; min-height: 0; }
#map { position: absolute; inset: 0; }
.map-page .site-footer { margin: 0; padding: 0.4rem 1rem; }
.map-status { position: absolute; z-index: 1000; font-size: 0.8rem; left: 0.5rem; bottom: 0.5rem; padding: 0.15rem 0.5rem; border-radius: 0.3rem; background: rgba(0, 0, 0, 0.6); color: #fff; pointer-events: none; }
.map-status:empty { display: none; }
/* The menu's drag handle sits on its right border, above Leaflet's controls (z-index 1000). */
.map-resizer { display: none; }
body.js .map-resizer { display: block; position: absolute; z-index: 1001; top: 0; bottom: 0; left: var(--map-menu-width); width: 0.5rem; transform: translateX(-50%); cursor: col-resize; touch-action: none; }
body.js .map-resizer:hover, body.js .map-resizer:focus-visible, body.map-resizing .map-resizer { background: rgba(128, 128, 128, 0.35); outline: none; }
body.map-resizing { cursor: col-resize; user-select: none; }
/* Without JavaScript: each half of the menu scrolls on its own, the search box (which needs the script)
   is gone, and a worldspace link (#info-...) leaves its metadata alone in the lower half. */
body.map-page:not(.js) .map-menu { display: flex; flex-direction: column; overflow: hidden; }
body.map-page:not(.js) .map-tab-panel { flex: 1 1 0; min-height: 0; overflow-y: auto; }
body.map-page:not(.js) #map-tab-metadata { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgba(128, 128, 128, 0.3); }
body.map-page:not(.js) #map-search { display: none; }
body.map-page:not(.js) #map-tab-metadata:has(.map-info:target) .map-info:not(:target) { display: none; }
body.map-page:not(.js) .map-info:target { margin-top: 0; }
body.map-page:not(.js) #map { display: none; }
body.map-page:not(.js) .map-canvas { display: flex; align-items: center; justify-content: center; background: rgba(128, 128, 128, 0.06); }
.map-noscript { max-width: 26rem; margin: 1.5rem; padding: 1.25rem 1.5rem; border: 1px solid rgba(128, 128, 128, 0.35); border-radius: 0.5rem; background: Canvas; text-align: center; }
.map-noscript p { margin: 0; opacity: 0.75; }
.map-noscript .map-noscript-title { margin-bottom: 0.4rem; font-size: 1.1rem; font-weight: 600; opacity: 1; }

/* A narrow window: the menu above the map, its list cut to about seven worldspaces. */
@media (max-width: 48rem) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .map-menu { --map-list-height: 13rem; padding: 0.75rem 1rem; border-right: none; border-bottom: 1px solid rgba(128, 128, 128, 0.3); }
  /* A worldspace line is about 1.9rem high. The metadata tab adds the search box's height, so a switch
     of tab leaves the map in place. */
  body.js .map-tree { max-height: var(--map-list-height); overflow-y: auto; }
  body.js #map-tab-metadata { max-height: calc(var(--map-list-height) + 2.5rem); overflow-y: auto; }
  body.js .map-resizer { display: none; }
  /* Without the script, the two halves of the menu take the screen and the note shrinks to its text. */
  body.map-page:not(.js) .map-layout { grid-template-rows: 1fr auto; }
  body.map-page:not(.js) .map-view { min-height: 0; }
  .map-noscript { margin: 0.75rem 1rem; padding: 0.75rem 1rem; }
}
