/* nwn-wiki — base stylesheet for generated module wikis. */

:root {
  --fg: #1f1f1f;
  --bg: #fafaf6;
  --muted: #6b6b6b;
  --accent: #6b3a1c;
  --accent-soft: #c8a577;
  --border: #d6d2c4;
  --card: #fff;
  --hostile: #a13a2c;
  --friendly: #2d6a3a;
  --link: #5a3210;
  --link-hover: #a05a1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
}

body { padding: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

header.site, header.site-header {
  background: var(--accent);
  color: #fff;
  padding: 0.75em 1.5em;
  border-bottom: 4px solid var(--accent-soft);
  text-align: center;
}
header.site a, header.site-header a { color: #fff; }
header.site-header .brand {
  font-size: 1.3em;
  margin-right: 1.5em;
}
header.site-header .brand img.site-header-img {
  height: 40px;
  width: auto;
  vertical-align: middle;
  display: inline-block;
}
header.site h1 {
  margin: 0;
  font-size: 1.4em;
  font-weight: normal;
  letter-spacing: 0.02em;
}
header.site nav, header.site-header nav {
  display: inline;
  font-size: 0.95em;
}
header.site nav a, header.site-header nav a { margin-right: 1.2em; }

dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2em 1.2em;
  margin: 0.5em 0 1em;
}
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }

table.data {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0 1em;
  background: var(--card);
}
.map-hint { color: var(--muted); font-size: 0.9em; margin-bottom: 0.3em; }
.map-hint .legend.trigger::before,
.map-hint .legend.door::before {
  content: "—"; display: inline-block; margin-right: 0.25em;
}
.map-hint .legend.trigger { color: #6b3a1c; }
.map-hint .legend.door    { color: #2d6a3a; }
.map-hint .legend.convo   { color: #9b4dca; }
.map-hint .legend.pseudo  { color: #9b4dca; font-size: 1.1em; }
footer { text-align: center; color: var(--muted); font-size: 0.85em; padding: 1.5em 0 2em; }
.muted { color: var(--muted); font-size: 0.85em; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5em;
}

h1, h2, h3 {
  font-family: "Iowan Old Style", Georgia, serif;
  color: var(--accent);
  font-weight: normal;
}
h1 { font-size: 1.8em; margin-top: 0; }
h2 {
  font-size: 1.3em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2em;
  margin-top: 1.6em;
}
h3 { font-size: 1.1em; margin-top: 1.2em; }

.muted { color: var(--muted); }
.tag {
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.05);
  padding: 0.05em 0.4em;
  border-radius: 3px;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2em 1em;
  margin: 0.5em 0 1em;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0 1em;
  background: var(--card);
}
th, td {
  text-align: left;
  padding: 0.4em 0.6em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: rgba(107, 58, 28, 0.08);
  font-weight: normal;
  color: var(--accent);
}
tr:hover td { background: rgba(0,0,0,0.02); }

.hostile  { color: var(--hostile);  }
.friendly { color: var(--friendly); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1em 1.2em;
  margin: 0.8em 0;
  border-radius: 4px;
}

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
  padding: 1.5em 0 2em;
}

/* The giant area map. Breaks out of the centred main column so it can use
 * almost the full viewport, since labels become unreadable when hundreds of
 * areas are crammed into 1100 px. The SVG inside renders at its native
 * pixel size (set by width/height attributes) so browser zoom enlarges the
 * map proportionally with the rest of the page; the wrap scrolls when the
 * map is wider than the viewport. */
.map-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 1em 0;
  width: 1000px;
  max-width: 100%;
  height: 1000px;
  overflow: auto;
}
.map-wrap svg { display: block; }
.map-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0.4em 0 0.2em;
  width: 1000px;
  max-width: 100%;
}
.map-toolbar button {
  font: inherit;
  padding: 0.3em 0.8em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.map-toolbar button:hover { background: var(--accent-soft); }
.map-legend {
  font-size: 0.85em;
  color: var(--muted);
  padding: 0.5em 1em;
  border-top: 1px solid var(--border);
}
.map-legend .swatch {
  display: inline-block;
  width: 0.9em;
  height: 0.4em;
  vertical-align: middle;
  margin-right: 0.3em;
}

/* SVG node defaults (overridable inline) */
svg .area-node rect {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2.4;
}
svg .area-node:hover rect {
  fill: var(--accent-soft);
}
svg .area-node text {
  fill: var(--fg);
  pointer-events: none;
  font-family: "Iowan Old Style", Georgia, serif;
}
svg .edge-trigger { stroke: #6b3a1c; stroke-width: 2.5; opacity: 0.55; fill: none; }
svg .edge-door    { stroke: #2d6a3a; stroke-width: 2.5; opacity: 0.55; fill: none; }
svg .edge-convo   {
  stroke: #9b4dca; stroke-width: 2.5; opacity: 0.7; fill: none;
  stroke-dasharray: 6, 4;
}
/* Invisible thicker hit-area paired with each visible edge so the SVG
 * <title> tooltip fires on a generous hover target instead of needing the
 * user to land on a near-pixel-thin line. */
svg .edge-hit {
  stroke: transparent;
  stroke-width: 30;
  fill: none;
  pointer-events: stroke;
  cursor: help;
}
svg .external-node rect { fill: #ddd; stroke: #999; stroke-dasharray: 3,3; }

svg .convo-node polygon {
  fill: #f3e8ff;
  stroke: #9b4dca;
  stroke-width: 2.4;
}
svg .convo-node:hover polygon { fill: #e3c9ff; }
svg .convo-node text {
  fill: #5a2b78;
  pointer-events: none;
  font-family: "Iowan Old Style", Georgia, serif;
}

/* Conversations index + per-dialog page styling. Goal: scannable
 * outline, with NPC entries and PC replies visually distinct so a
 * branching tree is readable as a flat list. */
.badge {
  display: inline-block;
  padding: 0.05em 0.45em;
  border-radius: 3px;
  font-size: 0.75em;
  font-family: "SFMono-Regular", Consolas, monospace;
  vertical-align: middle;
}
.badge.global   { background: #f3e8ff; color: #5a2b78; }
.badge.teleport { background: #fff0c2; color: #6b4a00; }

.dlg-callers { margin: 0.5em 0 1em; padding-left: 1.2em; }
.dlg-callers li { margin-bottom: 0.25em; }

.dlg-node {
  margin: 0.4em 0;
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
}
.dlg-node.entry {
  border-left: 4px solid var(--accent);
}
.dlg-node.reply {
  border-left: 4px solid #2d6a3a;
  margin-left: 1.5em;
  background: #f7faf6;
}
.dlg-head {
  font-size: 0.85em;
  color: var(--muted);
  margin-bottom: 0.3em;
}
.dlg-id { font-family: "SFMono-Regular", Consolas, monospace; }
.dlg-speaker { color: var(--accent); }
.dlg-action  { color: #5a2b78; }
.dlg-text { white-space: pre-wrap; }
.dlg-links {
  font-size: 0.85em;
  margin: 0.4em 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  list-style: "↳ ";
}
.dlg-links li { margin: 0.1em 0; }
.dlg-links a { color: var(--link); }
.dlg-link-preview {
  color: var(--text);
  font-style: italic;
}

/* Conversation-flow tree (nested <details> view) */
.dlg-tree { margin: 0.5em 0 1.5em; }
.dlg-tree-node {
  margin: 0.4em 0;
  padding: 0.4em 0.6em 0.4em 0.7em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
}
.dlg-tree-node.entry { border-left: 4px solid var(--accent); }
.dlg-tree-node.reply {
  border-left: 4px solid #2d6a3a;
  background: #f7faf6;
}
.dlg-tree-node > summary {
  font-size: 0.9em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  margin-bottom: 0.25em;
}
.dlg-tree-node > summary::-webkit-details-marker { display: none; }
.dlg-tree-node > summary::before {
  content: "▾ ";
  display: inline-block;
  width: 1em;
  color: var(--muted);
}
.dlg-tree-node:not([open]) > summary::before { content: "▸ "; }
.dlg-tree-node > .dlg-text { white-space: pre-wrap; }
.dlg-tree-children {
  margin-top: 0.4em;
  margin-left: 1.2em;
  border-left: 1px dotted var(--border);
  padding-left: 0.8em;
}
.dlg-tree-ref {
  font-size: 0.9em;
  color: var(--muted);
  margin: 0.3em 0;
  padding: 0.15em 0.5em;
  border-left: 2px dashed var(--border);
}
.dlg-tree-ref a { color: var(--link); }
.dlg-tree-broken {
  font-size: 0.85em;
  color: #b54708;
  margin: 0.3em 0;
}
.dlg-anchor {
  text-decoration: none;
  color: var(--muted);
  opacity: 0.5;
  margin-left: 0.4em;
}
.dlg-anchor:hover { opacity: 1; }
.featlist {
  column-count: 2;
  column-gap: 1.5em;
  padding-left: 1.5em;
}
.featlist li { break-inside: avoid; }

/* Fallback-transition warnings */
.warn-fallback {
  color: #b54708;
  font-size: 0.85em;
  margin-left: 0.5em;
  cursor: help;
}
.warn-fallback-note {
  background: #fff8ed;
  border-left: 3px solid #f0a830;
  color: #7a4a00;
  padding: 0.5em 0.75em;
  margin: 0.5em 0 1em;
  font-size: 0.9em;
}
.warn-cursed {
  background: #fff0f0;
  border-left: 4px solid #c0392b;
  color: #7a1a0a;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}
.warn-creature {
  background: #fffbf0;
  border-left: 4px solid #b07820;
  color: #6b4800;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}
.warn-no-drop {
  background: #f0f4ff;
  border-left: 4px solid #5070c0;
  color: #1a2a60;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}
.warn-damage-gate {
  background: #fff6e8;
  border-left: 4px solid #cc6600;
  color: #6b3a00;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}
.note-retaliation {
  background: #eef4fb;
  border-left: 4px solid #3a6ea5;
  color: #1d3a5c;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}

/* Duplicate destination tag warnings */
.warn-dup-tag {
  color: #b54708;
  font-size: 0.85em;
  margin-left: 0.5em;
  cursor: help;
}
.warn-dup-tag-note {
  background: #fff8ed;
  border-left: 3px solid #cc6600;
  color: #7a3c00;
  padding: 0.5em 0.75em;
  margin: 0.5em 0 1em;
  font-size: 0.9em;
}
.note-pickpocket {
  background: #f0fff4;
  border-left: 4px solid #2e8b57;
  color: #1a4d2e;
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.95em;
}
p.note {
  background: var(--card);
  border-left: 4px solid var(--accent);
  color: var(--muted);
  padding: 0.6em 0.9em;
  margin: 0.5em 0 1em;
  font-size: 0.92em;
}
p.note strong, p.note em { color: var(--fg); }
.reason-missing     { color: #888; font-size: 0.9em; }
.reason-undroppable { color: #b07820; font-size: 0.9em; font-style: italic; }
.badge-no-drop {
  background: #dde3f5;
  color: #3a4a80;
  border-radius: 3px;
  font-size: 0.75em;
  padding: 0.1em 0.4em;
  margin-left: 0.4em;
  vertical-align: middle;
  cursor: help;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.9em;
  cursor: pointer;
}

.dlg-node:target {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

/* Documents nav dropdown */
.nav-dropdown {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
.nav-dropdown-label {
  margin-right: 1.2em;
  color: #fff;
  cursor: default;
  white-space: nowrap;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--accent);
  border: 1px solid var(--accent-soft);
  min-width: 11em;
  z-index: 100;
  padding: 0.25em 0;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.35em 0.85em;
  color: #fff;
  white-space: nowrap;
  margin-right: 0;
}
.nav-dropdown-menu a:hover {
  background: rgba(255,255,255,0.18);
  text-decoration: none;
}

/* Submenu (folder entries inside the Documents dropdown) */
.nav-submenu {
  position: relative;
}
.nav-submenu-label {
  display: block;
  padding: 0.35em 0.85em;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  font-size: 0.88em;
  letter-spacing: 0.03em;
  cursor: default;
}
.nav-submenu-label::after { content: " \25b8"; }
.nav-submenu-menu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: var(--accent);
  border: 1px solid var(--accent-soft);
  min-width: 11em;
  z-index: 102;
  padding: 0.25em 0;
}
.nav-submenu:hover .nav-submenu-menu { display: block; }
.nav-submenu-menu a {
  display: block;
  padding: 0.35em 0.85em;
  color: #fff;
  white-space: nowrap;
  margin-right: 0;
}
.nav-submenu-menu a:hover {
  background: rgba(255,255,255,0.18);
  text-decoration: none;
}

/* Items index two-pane layout */
.items-layout {
  display: flex;
  gap: 1.5em;
  align-items: flex-start;
}
.items-toc {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 1em;
  max-height: calc(100vh - 3em);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6em 0.75em;
  font-size: 0.9em;
}
.items-toc a {
  display: block;
  padding: 0.2em 0.25em;
  border-radius: 3px;
  line-height: 1.35;
}
.items-toc a:hover {
  background: rgba(107, 58, 28, 0.07);
  text-decoration: none;
}
.items-toc a.toc-current {
  font-weight: 600;
  background: rgba(107, 58, 28, 0.1);
}
.items-toc .muted { font-size: 0.85em; }
.items-toc .toc-group-heading {
  font-weight: 600;
  margin-top: 0.75em;
  padding: 0 0.25em 0.15em;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.items-toc .toc-group-heading:first-child { margin-top: 0; }
.items-toc--wide { width: 280px; }
.items-content { flex: 1; min-width: 0; }
/* Keep anchored rows from hiding under the sticky site header */
tr[id] { scroll-margin-top: 4em; }
section[id] { scroll-margin-top: 4em; }

/* Creature artwork galleries (Pictures page + inline on creature pages) */
.creature-pic { max-width: 100%; height: auto; display: block; border-radius: 4px; }
.creature-pics figure, .items-content figure { margin: 0 0 1em; }

/* NWN canonical damage / effect text colours.
 * Source: https://nwn.wiki/spaces/NWN1/pages/38177018/Colour+Tokens
 * The hex colours come through inline so the page works without this
 * stylesheet; the rules here just make the lighter NWN palette legible
 * on the wiki's light page background. */
.nwn-dmg {
  font-weight: 600;
  text-shadow:
     0 0 1px rgba(0, 0, 0, 0.55),
     0 0 2px rgba(0, 0, 0, 0.35);
}
/* Positive damage is white in-game; on a light page it needs a real outline. */
.nwn-dmg-positive {
  text-shadow:
    -1px 0 0 #444,  1px 0 0 #444,
     0 -1px 0 #444, 0  1px 0 #444;
}

/* Item search form */
.item-search-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1em 1.25em;
  margin-bottom: 1.5em;
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 1em;
  margin-bottom: 0.75em;
}
.search-row:last-child { margin-bottom: 0; }
.search-row label {
  font-size: 0.9em;
  font-weight: 600;
  min-width: 6.5em;
  color: var(--muted);
}
.search-row select,
.search-row input[type="number"] {
  font: inherit;
  font-size: 0.9em;
  padding: 0.3em 0.5em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  min-width: 10em;
}

/* Multi-property filter rows */
.prop-rows { margin-bottom: 0.75em; }
.prop-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.4em;
  flex-wrap: wrap;
}
.prop-row > label {
  font-size: 0.85em;
  font-weight: 600;
  width: 6.5em;
  flex-shrink: 0;
  color: var(--muted);
}
.prop-row select,
.prop-row input[type="number"] {
  font: inherit;
  font-size: 0.9em;
  padding: 0.3em 0.5em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
}
.prop-row .prop-sel { flex: 2; min-width: 9em; }
.prop-row .subtype-sel { flex: 1.5; min-width: 7em; }
.prop-row input[type="number"] { width: 5.5em; }
.search-row button {
  font: inherit;
  padding: 0.35em 1.2em;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}
.search-row button:hover { opacity: 0.85; }

/* Custom token annotations in dialog text */
.custom-token {
  background: #f0f4ff;
  border: 1px solid #c8d0e8;
  border-radius: 3px;
  padding: 0 2px;
  font-family: monospace;
  cursor: help;
}
.custom-token-unknown {
  background: #fff8f0;
  border-color: #e8d0c8;
  opacity: 0.8;
}
.token-setters {
  font-size: 0.75em;
  margin-left: 2px;
  font-family: sans-serif;
}

/* Light item-property colour styles (NWN iprp_lightcolor table).
 * Applied to the colour name wherever Light properties appear: property detail
 * page tables, individual item pages, and search result rows.
 * To override in a module theme, redefine any of these in wiki-theme/theme.css. */
.nwn-light-blue   { color: #2255cc; font-weight: 600; }
.nwn-light-yellow { color: #997700; font-weight: 600; }
.nwn-light-purple { color: #882299; font-weight: 600; }
.nwn-light-red    { color: #bb2222; font-weight: 600; }
.nwn-light-green  { color: #228833; font-weight: 600; }
.nwn-light-orange { color: #cc5500; font-weight: 600; }
/* White light is invisible on the wiki's light background; a pill gives it presence. */
.nwn-light-white  {
  color: #555;
  font-weight: 600;
  background: #f0f0ec;
  border: 1px solid #ccc;
  padding: 0.05em 0.35em;
  border-radius: 3px;
}
