/* MRPG Realms player wiki — readable column, fluid gutters, images fill column */
:root {
  --bg: #0b1020;
  --panel: #121a2e;
  --border: #2a3a5c;
  --text: #e8eefc;
  --muted: #9aabc8;
  --link: #9ec1ff;
  --accent: #3d6df0;
  /* Main text/content column — images match this width exactly */
  --content: 40rem;
  /* Side gutters scale with viewport */
  --gutter: clamp(0.75rem, 4vw, 2rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
}

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

/* Single centered column: text + figures share the same width */
.wrap {
  width: 100%;
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 1.5rem) var(--gutter) clamp(2.5rem, 6vw, 4rem);
  min-width: 0;
}

/* Constrain everything that can blow out layout */
.wrap > *,
figure.shot,
.shot-link,
.table-wrap,
.gallery,
.grid,
.card,
img {
  max-width: 100%;
  min-width: 0;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 22px;
}
header.site .brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
nav.site {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.9rem;
}
nav.site a {
  color: var(--muted);
}
nav.site a:hover,
nav.site a[aria-current='page'] {
  color: var(--link);
}

h1 {
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  margin: 0 0 10px;
}
h2 {
  font-size: clamp(1.05rem, 3vw, 1.2rem);
  margin: 28px 0 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
h3 {
  font-size: 1.02rem;
  margin: 18px 0 8px;
  color: #c5d4f0;
}
p,
li {
  color: var(--text);
}
.lead {
  color: var(--muted);
  margin: 0 0 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr));
  gap: 12px;
  margin: 16px 0 24px;
  width: 100%;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}
.card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0;
}
th,
td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #1a243c;
  color: #c5d4f0;
  font-weight: 600;
}
tr:nth-child(even) td {
  background: rgba(18, 26, 46, 0.55);
}

code,
kbd {
  font: 0.88em/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #1a243c;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  word-break: break-word;
}
kbd {
  border-bottom-width: 2px;
}

.note {
  background: rgba(61, 109, 240, 0.12);
  border: 1px solid #3d6df0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 14px 0;
  width: 100%;
}

/* Screenshots = full width of the text column (never wider) */
figure.shot {
  display: block;
  width: 100%;
  margin: 16px 0 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
figure.shot a.shot-link {
  display: block;
  width: 100%;
  cursor: zoom-in;
  line-height: 0;
  text-decoration: none;
}
figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  /* intrinsic aspect via HTML width/height attrs; never force a fixed px width */
  max-width: 100%;
  object-fit: contain;
  object-position: center center;
  background: #0a0e18;
  vertical-align: middle;
}
figure.shot figcaption {
  padding: 10px 12px 12px;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0 22px;
  width: 100%;
}
.gallery figure.shot {
  margin: 0;
  width: 100%;
}

/* On wider viewports, gallery can be 2-up still inside the column */
@media (min-width: 640px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Lightbox — full viewport, not the column */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(6px);
}
.lightbox[data-open='true'] {
  display: flex;
}
.lightbox img {
  max-width: min(100%, 96vw);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}
.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  border: 1px solid #63759a;
  background: #1c2740;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font: 0.9rem system-ui, sans-serif;
}
.lightbox-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--muted);
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
footer a {
  color: var(--muted);
}

@media (max-width: 560px) {
  table {
    font-size: 0.84rem;
  }
  nav.site {
    font-size: 0.82rem;
    gap: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
