/* Structural CSS shared by all themes. Themes only override the custom
   properties below (and a few decorative modifier classes) — never the
   HTML/layout itself (docs/06-themes-skins.md 6.4). */

:root {
  --bg: #ffffff;
  --fg: #202122;
  --muted: #54595d;
  --accent: #3366cc;
  --border: #a2a9b1;
  --surface: #f8f9fa;
  --font-body: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --badge-draft: #8a8a8a;
  --badge-proposed: #b8860b;
  --badge-canon: #2e7d32;
  --badge-fiction: #6a1b9a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Phones and tablets (incl. iPad portrait): wrapping nav links across
   several lines eats the whole screen before any content shows. Collapse
   each nav row to one horizontally-scrollable strip instead. */
@media (max-width: 900px) {
  .site-header { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0.6rem 1rem; }
  .site-header nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    padding-bottom: 0.15rem;
  }
  .site-header nav > * { flex: none; }
  .site-header nav::-webkit-scrollbar { height: 4px; }
}

.brand { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent); }
.icon-hammer-sickle, .icon-star { width: 1.3em; height: 1.3em; flex: none; color: var(--accent); }

.site-main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

.generator-tabs { color: var(--muted); font-size: 0.9rem; margin-bottom: 0; }

/* Map page: let the atlas use the full viewport width instead of the
   960px reading-width column — a map benefits from screen space, prose doesn't. */
.map-page .site-main { max-width: none; padding: 1rem 1.5rem; }

.site-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.theme-switcher { display: inline-flex; align-items: center; }
.theme-switcher select { cursor: pointer; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  color: #fff;
}
.badge-draft { background: var(--badge-draft); }
.badge-proposed { background: var(--badge-proposed); }
.badge-canon { background: var(--badge-canon); }
.badge-fiction { background: var(--badge-fiction); }

.wiki-body img { width: 100%; height: auto; display: block; margin: 0 auto 1rem; cursor: zoom-in; }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
  cursor: zoom-out;
}
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  box-shadow: 0 0 2rem rgba(0, 0, 0, 0.6);
}

.quick-edit-toolbar { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.quick-edit-toolbar button { padding: 0.2rem 0.6rem; cursor: pointer; }
#quick-edit-textarea { width: 100%; font-family: var(--font-mono); }

.disclaimer { border: 2px solid var(--accent); padding: 1rem 1.5rem; margin: 1rem 0; background: var(--surface); }
.disclaimer h2 { margin-top: 1.2rem; font-size: 1rem; }
.disclaimer h2:first-child { margin-top: 0; }

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }

.map-widget { width: 100%; height: 400px; border: 1px solid var(--border); }

.messages { list-style: none; padding: 0; }
.messages li { padding: 0.5rem 1rem; margin-bottom: 0.5rem; border: 1px solid var(--border); }

form p { margin: 0.6rem 0; }
label { font-weight: 600; }
input, select, textarea, button {
  font: inherit;
  padding: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}
