/*
 * THE CHRONICLE OF LUNK — v3
 * Minimal lines, generous whitespace, tonal vellum surfaces, 2 fonts (Cinzel + Newsreader),
 * full-color hand-inked medieval RPG icons, and zoomable full-perimeter village map.
 */

:root {
  --vellum: #f7f2e7;
  --vellum-soft: #efe7d6;
  --vellum-deep: #e6dac2;
  --ink: #1b1510;
  --ink-muted: #5b4d3f;
  --ink-whisper: #8a7865;
  --rule-whisper: rgba(138, 120, 101, 0.22);
  --crimson: #8f2421;
  --crimson-soft: rgba(143, 36, 33, 0.09);
  --brass: #a86c25;
  --moss: #2f5e36;
  --font-display: "Cinzel", Georgia, serif;
  --font-serif: "Newsreader", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--vellum);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--vellum);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(168, 108, 37, 0.06) 0%, transparent 58%);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.62;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.032;
  z-index: 90;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.folio {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px) 96px;
}

.icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Masthead — Open, Breathable, Zero Heavy Lines */
.masthead {
  padding: 40px 0 32px;
}

.masthead-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.region-kicker {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-whisper);
  margin-bottom: 8px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.brand-subtitle {
  font-style: italic;
  font-size: 1.08rem;
  color: var(--ink-muted);
  margin-top: 6px;
}

.masthead-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.brand-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(253, 248, 238, 0.75);
  flex-shrink: 0;
}

.music-orb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--vellum-soft);
  color: var(--ink);
  border: 2px solid rgba(27, 21, 16, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.music-orb:hover {
  background: var(--vellum-deep);
  transform: translateY(-2px);
}

.music-orb.playing {
  background: var(--ink);
  color: var(--vellum);
  border-color: var(--ink);
}

.follow-seal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 11px;
  background: var(--crimson);
  color: #fdf8ee;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(143, 36, 33, 0.22);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
}

.follow-seal:hover {
  background: #781c1a;
  transform: translateY(-2px);
}

/* Soft Tonal Stat Strip (No grid lines or boxes!) */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  background: var(--vellum-soft);
  border-radius: 10px;
  padding: 26px 28px;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-whisper);
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  line-height: 1.1;
}

.stat-value.accent-crimson { color: var(--crimson); }
.stat-value.accent-brass { color: var(--brass); }

.stat-note {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Quiet Law Strip */
.law-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 4px 0;
  font-size: 0.96rem;
  color: var(--ink-muted);
}

.law-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-whisper);
}

.law-items {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.law-items strong { color: var(--crimson); }

/* Sections — Generous Breathing Room, No Heavy Top/Bottom Bars */
.section {
  padding-top: 64px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.section-kicker {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-whisper);
}

/* Zoomable Map Controls */
.map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-btn {
  padding: 7px 14px;
  background: var(--vellum-soft);
  color: var(--ink);
  border: none;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.map-btn:hover {
  background: var(--vellum-deep);
  transform: translateY(-1px);
}

.map-btn-accent {
  background: var(--ink);
  color: var(--vellum);
}

.map-btn-accent:hover {
  background: var(--crimson);
}

/* Map Split Layout */
.map-layout {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 32px;
  align-items: start;
}

.map-frame {
  position: relative;
  border-radius: 10px;
  background: #e9dcbe;
  box-shadow: 0 12px 32px rgba(27, 21, 16, 0.12);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  cursor: grab;
  user-select: none;
}

.map-frame:active { cursor: grabbing; }

.map-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-canvas.dragging {
  transition: none;
}

.map-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--vellum);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(27, 21, 16, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, color 0.2s ease;
}

.map-pin:hover,
.map-pin.active {
  background: var(--crimson);
  color: #fdf8ee;
  transform: translate(-50%, -56%) scale(1.12);
}

.inspector {
  background: var(--vellum-soft);
  border-radius: 10px;
  padding: 26px 26px 28px;
}

.inspector-status {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--crimson);
  background: var(--crimson-soft);
  padding: 5px 10px;
  border-radius: 4px;
}

.inspector-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  margin-top: 14px;
  line-height: 1.22;
}

.inspector-desc {
  color: var(--ink-muted);
  margin-top: 10px;
  font-size: 1.02rem;
}

.inspector-staff-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-whisper);
  margin-top: 22px;
}

.inspector-staff {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.98rem;
  font-weight: 600;
}

/* Soft Surface Tables (Stacked Full-Width, Minimal Subtle Hairlines) */
.ledger-surface {
  background: var(--vellum-soft);
  border-radius: 10px;
  padding: 24px 28px;
}

/* Bespoke Medieval Day Dropdown (Scales cleanly to Day 20+) */
.day-dropdown {
  position: relative;
}

.day-trigger {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  background: var(--vellum-soft);
  color: var(--ink);
  border: 1.5px solid rgba(27, 21, 16, 0.16);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.day-trigger:hover {
  background: var(--vellum-deep);
  border-color: rgba(27, 21, 16, 0.3);
}

.day-caret {
  font-size: 0.9rem;
  color: var(--crimson);
}

.day-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  list-style: none;
  background: var(--vellum);
  border: 1.5px solid rgba(27, 21, 16, 0.2);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(27, 21, 16, 0.16);
  padding: 6px;
  z-index: 60;
}

.day-menu[hidden] {
  display: none;
}

.day-option {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.day-option:hover {
  background: var(--vellum-soft);
}

.day-option.active {
  background: var(--crimson);
  color: #fdf8ee;
}

.citizen-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.citizen-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--vellum);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.folio-table {
  width: 100%;
  border-collapse: collapse;
}

.folio-table th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-whisper);
  padding: 0 0 14px;
}

.folio-table th:last-child,
.folio-table td:last-child {
  text-align: right;
}

.folio-table td {
  padding: 16px 14px 16px 0;
  border-top: 1px solid var(--rule-whisper);
  vertical-align: middle;
}

.folio-table td:last-child {
  padding-right: 0;
  font-weight: 700;
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.role-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wage-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.citizen-handle {
  font-weight: 700;
  font-size: 1.02rem;
}

.citizen-note {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.role-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
}

.guild-sub {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-whisper);
  margin-top: 2px;
}

.delta-income { color: var(--moss); }
.delta-expense { color: var(--crimson); }

.ledger-total-row td {
  border-top: 2px solid rgba(27, 21, 16, 0.25);
  padding-top: 18px;
  padding-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.96rem;
}

.ledger-total-row td:last-child {
  color: var(--brass);
  font-size: 1.12rem;
}

/* Daily Chronicle */
.chronicle-item {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 36px;
  align-items: start;
}

.reel-frame {
  border-radius: 10px;
  background: var(--vellum-deep);
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(27, 21, 16, 0.12);
}

.reel-frame iframe {
  width: 100%;
  height: 620px;
  border: 0;
  display: block;
}

.episode-kicker {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--crimson);
}

.episode-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  margin-top: 8px;
  line-height: 1.22;
}

.episode-summary {
  margin-top: 14px;
  color: var(--ink-muted);
  max-width: 58ch;
}

.episode-link {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--crimson);
  text-decoration: none;
}

.episode-link:hover { text-decoration: underline; }

/* Minimal Footer */
.footer {
  margin-top: 72px;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--ink-whisper);
}

/* Fullscreen Map Modal */
.map-modal {
  position: fixed;
  inset: 0;
  background: rgba(24, 18, 13, 0.88);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.map-modal[hidden] { display: none; }

.map-modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: var(--vellum);
}

.map-modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.modal-viewport {
  flex: 1;
  background: #e9dcbe;
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
}

.modal-viewport:active { cursor: grabbing; }

@media (max-width: 900px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .map-layout, .chronicle-item { grid-template-columns: 1fr; }
}
