/* ============================================================
   MOSP Archive — stylesheet
   Faithfully reproduced from the original Django site's
   common.css (cream light theme) and dark.css (puzzle pages).
   ============================================================ */

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base / light-cream theme (matches original #f7f7e9) ── */
body {
  font-family: Georgia, "Times New Roman", serif;
  background-color: #f7f7e9;
  color: #111;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

strong {
  font-style: normal;
  font-weight: bold;
}

/* Teal glow on hover, no underline (original a:hover) */
a {
  color: #1a56a0;
  text-decoration: none;
}
a:hover {
  text-shadow: 0 0 12px #00cca7;
  text-decoration: none;
  color: inherit;
}
a.emoji-link,
a.emoji-link:link,
a.emoji-link:visited,
a.emoji-link:hover,
a.emoji-link:active {
  text-decoration: none;
}
a.noshadow,
a.noshadow:hover {
  text-shadow: none;
}

/* ── Container: wide outer shell (nav + footer span full width of this) ── */
#container {
  max-width: 56rem;
  width: 100vw;
  min-height: 100vh;
  padding: 0.5rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
@media (min-width: 1280px) {
  #container {
    max-width: 64rem;
  }
}

#content {
  flex: 1;
}

/* ── Inner content column: narrower, centered ── */
/* Mirrors original's "max-w-2xl mx-auto" content div */
#content-inner {
  max-width: 42rem;
  margin: 0 auto;
}

/* ── Navigation bar ── */
nav.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding: 0.25rem 0;
}
#back {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

/* Protagonist name in nav (italic yellow, like original "span.name") */
#setname {
  text-decoration: none !important;
}
#tokenname {
  font-style: italic;
  color: #92600a;
  font-size: 0.9rem;
  font-weight: normal;
  display: inline-block;
  transform: translateY(-2px);
}
#tokenname:hover {
  text-decoration: underline;
}
body.puzzle-page #tokenname {
  color: #c8a04a;
}

/* Protagonist name in content areas (yellow, like ancient span.name rule) */
span.name {
  color: #d97706;
}

/* Story link below round_text on chapter pages */
.story-link {
  font-size: 0.9rem;
  margin: 0.5rem 0 0.75rem;
}
#status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dotted nav item borders (dark.css span.navitem) */
span.navitem {
  border-bottom: 2px dotted #999;
  cursor: default;
}

/* Courage counter with tooltip */
#courage {
  position: relative;
}
#courage-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 2rem;
  background: #bbf7d0;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  z-index: 10;
  color: #111;
}
#courage:hover #courage-tooltip {
  display: block;
}

/* ── Footer ── */
#footer {
  margin-top: 0.5rem;
  font-style: italic;
  color: #9ca3af;
  font-size: 0.95rem;
}
#footer hr {
  border: none;
  border-top: 1px solid #d1d5db;
  margin-bottom: 0.25rem;
}
#footer-inner {
  display: flex;
  justify-content: space-between;
}

/* ── Typography ── */
h1,
h2,
h3,
h4 {
  font-family: Georgia, serif;
  font-weight: bold;
  text-align: center;
}
h1 {
  font-size: 2rem;
  margin: 0.75rem 0;
}
h2 {
  font-size: 1.5rem;
  margin: 0.75rem 0 0.5rem;
}
h3 {
  font-size: 1.2rem;
  margin: 0.6rem 0 0.3rem;
}
p {
  line-height: 1.65;
  margin-bottom: 0.75rem;
}
hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 1rem 0;
}

ul,
ol {
  margin: 0.5rem 0 0.75rem 2rem;
  line-height: 1.65;
}
blockquote {
  border-left: 4px solid #ccc;
  padding-left: 1rem;
  color: #555;
  margin: 0.75rem 0;
}
code {
  color: #cc0000;
}
pre {
  line-height: 125%;
}

/* ── Images in container (original: 512px, centered, #bbb border) ── */
#container img {
  max-width: 512px;
  width: 100%;
  display: block;
  margin: 0.5rem auto;
  border: 3px solid #bbbbbb;
  border-radius: 5px;
}
#container img.inline {
  display: inline;
  margin: 10px;
}

/* Glowing image links (generic) */
@keyframes glow-blue {
  from {
    box-shadow: 0px 0px 15px #55ffff;
  }
  to {
    box-shadow: 0px 0px 20px #6666dd;
  }
}
@keyframes glow-yellow {
  from {
    box-shadow: 0px 0px 35px #bbbb33;
  }
  to {
    box-shadow: 0px 0px 45px #eeeecc;
  }
}

/* ── "Proceed" glow animations (door, solve key, on-solve images) ── */
@keyframes proceed-emoji-pulse {
  0%,
  100% {
    text-shadow:
      0 0 6px #00cca7,
      0 0 12px #00cca7;
  }
  50% {
    text-shadow:
      0 0 16px #00ffcc,
      0 0 32px #00cca7,
      0 0 50px #007755;
  }
}
@keyframes proceed-image-pulse {
  0%,
  100% {
    box-shadow:
      0 0 8px #00cca7,
      0 0 18px #00cca7;
  }
  50% {
    box-shadow:
      0 0 20px #00ffcc,
      0 0 42px #00cca7,
      0 0 64px #007755;
  }
}
#container a.img-link > img {
  animation: glow-blue 8s linear infinite alternate both;
}
#container a.img-link:hover > img {
  animation: glow-yellow 2s linear infinite alternate both;
}
#container a.proceed-link > img {
  animation: proceed-image-pulse 2.5s ease-in-out infinite;
}
#container a.proceed-link:hover > img {
  animation: proceed-image-pulse 1s ease-in-out infinite;
}

/* ── Tables ── */
table {
  margin: 0 auto;
}
table td,
table th {
  padding: 3px 8px;
  vertical-align: bottom;
}
table.table th {
  text-align: left;
}
table.table {
  width: 100%;
  margin-bottom: 10px;
  border-collapse: collapse;
  font-size: 18px;
}

/* ── Strong emphasis (red/yellow highlight from common.css) ── */
div.strong-emph em {
  color: #cc3333;
  font-weight: bold;
  font-style: normal;
  background-color: #eeee66;
  border: 1px solid #cc3333;
  padding: 0 4px;
}

/* ── Volume gallery (index page) ── */
.volume-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}
.volume-card {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  display: block;
  outline: 4px solid #d1d5db;
  transition:
    outline-color 0.15s,
    transform 0.15s;
}
.volume-card:hover {
  outline-color: #00cca7;
  transform: scale(1.04);
  text-shadow: none;
}
.volume-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: filter 0.2s;
}
.volume-thumb-fallback {
  background: #9ca3af;
}
.volume-card:hover .volume-thumb {
  filter: brightness(0.45) grayscale(0.3);
}
.volume-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.volume-card:hover .volume-overlay {
  opacity: 1;
}
.volume-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-align: center;
  gap: 0.3rem;
}
.volume-num {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: Georgia, serif;
}
.volume-name {
  font-size: 0.9rem;
}
.volume-authors {
  font-size: 0.75rem;
  color: #ccc;
  font-style: italic;
}

/* ── Chapter gallery (vol page) ── */
.chapter-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2rem;
}
.chapter-card-art {
  position: relative;
  width: 220px;
  height: 160px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  display: block;
  outline: 3px solid #d1d5db;
  transition:
    outline-color 0.15s,
    transform 0.15s;
}
.chapter-card-art:hover {
  outline-color: #00cca7;
  transform: scale(1.04);
  text-shadow: none;
}
.chapter-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: filter 0.2s;
}
.chapter-thumb-fallback {
  background: linear-gradient(135deg, #8b9eb5 0%, #5a6f8a 100%);
}
.chapter-card-art:hover .chapter-thumb {
  filter: brightness(0.4);
}
.chapter-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s;
}
.chapter-card-art:hover .chapter-overlay {
  background: rgba(0, 0, 0, 0.15);
}
.chapter-label {
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.2s;
}
.chapter-card-art:hover .chapter-label {
  opacity: 1;
}

/* ── Puzzle table (chapter page) ── */
.puzzle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 18px;
  margin-top: 1rem;
}
.puzzle-table th,
.puzzle-table td {
  text-align: left;
  padding: 4px 8px;
  vertical-align: bottom;
  border-bottom: 1px solid #ddd;
}
.puzzle-table th {
  background: #eeeedd;
  font-weight: bold;
}
.puzzle-table .col-location {
  width: 25%;
}
.puzzle-table .col-title {
  width: 40%;
}
.puzzle-table .col-answer {
  width: 35%;
  font-family: Inconsolata, monospace;
}
.story-title {
  font-variant: small-caps;
  color: #4a4a9a;
}

/* Locked puzzle rows */
.puzzle-row.locked {
  opacity: 0.45;
}
.puzzle-row.locked .col-title a,
.puzzle-row.locked .col-location a {
  pointer-events: none;
  color: #888;
}
.lock-msg {
  font-size: 0.75rem;
  color: #888;
  display: block;
}

/* Show-all toggle button */
#show-all-btn {
  margin-top: 0.75rem;
  background: none;
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  font-family: inherit;
}
#show-all-btn:hover {
  background: #eee;
}

/* Answer hidden until puzzle is solved (revealed by unlock.js) */
.answer-hidden {
  color: #aaa;
}

/* Unlockable opened but puzzle not yet visited */
.new-puzzle {
  font-style: italic;
  font-size: 0.9em;
  color: #cc3333;
}

/* ── Flavor text ── */
.flavor-text {
  font-style: italic;
  margin-bottom: 1rem;
}

/* ── Solution page ── */
.answer-box {
  background: #d1fae5;
  border: 2px solid #4a9a4a;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  font-size: 1.05rem;
  text-align: center;
}
.answer-box .answer {
  font-family: Inconsolata, monospace;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: #166534;
}
.post-solve-story {
  background: #f5f3ff;
  border-left: 4px solid #7c3aed;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0 4px 4px 0;
}
.solution-text {
  background: #f0fdf4;
  border: 1px solid #a0d0a0;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.author-notes {
  background: #eff6ff;
  border: 1px solid #a0b0d0;
  border-radius: 4px;
  padding: 1rem;
}

/* ============================================================
   PUZZLE PAGE — dark theme (faithfully from dark.css)
   Applied when <body class="puzzle-page"> is set.
   ============================================================ */

body.puzzle-page {
  background-color: #121212;
}
body.puzzle-page.solved {
  transition: all 6s;
  background-color: #dfdfdf;
}
body.puzzle-page #content {
  color: #dfdfdf;
}
body.puzzle-page #content a {
  color: #7eb8f7;
}
body.puzzle-page #content a:hover {
  color: #b0d4ff;
}
body.puzzle-page nav.site-nav {
  color: #dfdfdf;
  box-shadow: none;
}
body.puzzle-page nav.site-nav a {
  color: #aac4e8;
}
body.puzzle-page #footer {
  color: #555;
}

/* Puzzle-specific head section (dashed box, from dark.css #puzzlehead) */
#puzzlehead {
  margin-top: 3px;
  margin-bottom: 16px;
  border: 2px dashed #aaaaaa;
  border-radius: 12px;
  padding: 20px 15px 25px;
}

/* Answer checker — centered (dark.css #answerchecker) */
#answerchecker {
  text-align: center;
}

/* Big Inconsolata input (dark.css #answer) */
#answer {
  height: 48px;
  width: min(500px, 100%);
  font-family: Inconsolata, monospace;
  font-size: 160%;
  text-align: center;
  padding: 3px;
  background-color: #121212;
  color: #dfdfdf;
  border: 1px solid #aaa;
  margin: 0 auto;
  display: block;
}
.solved #answer {
  background-color: #565656;
}

#check-btn {
  margin-top: 0.4rem;
  padding: 0.4rem 1.5rem;
  background: #2d4a7a;
  color: #dfdfdf;
  border: 1px solid #aaa;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-family: Inconsolata, monospace;
}
#check-btn:hover {
  background: #3d5a8a;
}
#check-btn:disabled,
#answer:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Feedback row above answer input */
div.feedback {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
span.icon {
  display: none;
  font-size: 160%;
}
#wrong {
  transition: all 2s;
}
#feedback-text {
  font-size: 120%;
  font-family: sans-serif;
  color: #dfdfdf;
  visibility: hidden;
}
/* ── Unlock / story intro pages ── */
.story-text {
  max-width: 40rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}
.story-text p {
  margin-bottom: 1rem;
}
.story-text img {
  max-width: 100%;
  display: block;
  margin: 1rem auto;
}

.door-link {
  text-align: center;
  margin: 2rem 0;
}
a.door {
  font-size: 5rem;
  display: inline-block;
  transition: transform 0.2s;
  animation: proceed-emoji-pulse 2.5s ease-in-out infinite;
}
a.door:hover {
  transform: scale(1.15);
  animation-duration: 1s;
}

/* puzzle-nav-links (breadcrumb line under puzzle title) */
.puzzle-nav-links {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 1rem;
}
.puzzle-page .puzzle-nav-links a {
  color: #7eb8f7;
}

/* ── Utility classes (used in puzzle content.md files) ── */
.font-mono {
  font-family: "Courier New", Courier, monospace;
}
.whitespace-pre {
  white-space: pre;
}
.relative {
  position: relative;
}
.text-sm {
  font-size: 0.875rem;
}

/* ── Prize key overlay (shown centered on puzzle solve) ── */
#prize-overlay {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 6rem;
  z-index: 100;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
#prize-overlay a {
  font-size: inherit;
  text-decoration: none !important;
  display: inline-block;
  transition: transform 0.2s;
  animation: proceed-emoji-pulse 2.5s ease-in-out infinite;
}
#prize-overlay a:hover {
  transform: scale(1.15);
  animation-duration: 1s;
}

/* ── Open-all toggle in nav ── */
#openall {
  position: relative;
  cursor: default;
  font-size: 1rem;
}
#openall-checkbox {
  display: none;
}
#openall-label {
  cursor: pointer;
  user-select: none;
}

/* Icon and text swap: show lock+Gated when gated, open-lock+Open when all-open */
#openall-icon-on,
#openall-text-on {
  display: none;
}
#openall-checkbox:checked + #openall-label #openall-icon-off,
#openall-checkbox:checked + #openall-label #openall-text-off {
  display: none;
}
#openall-checkbox:checked + #openall-label #openall-icon-on,
#openall-checkbox:checked + #openall-label #openall-text-on {
  display: inline;
}

/* Tooltip (same style as #courage-tooltip) */
#openall-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 2rem;
  background: #bbf7d0;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  z-index: 10;
  color: #111;
}
#openall:hover #openall-tooltip {
  display: block;
}

/* State text swap inside tooltip */
#openall-state-on {
  display: none;
}
#openall-checkbox:checked ~ #openall-tooltip #openall-state-off {
  display: none;
}
#openall-checkbox:checked ~ #openall-tooltip #openall-state-on {
  display: inline;
}

/* ── Responsiveness ── */
@media (max-width: 600px) {
  .puzzle-table .col-answer {
    display: none;
  }
  #answer {
    font-size: 110%;
  }
}

/* ── Hints page ── */
.hint-item {
  margin: 1.2rem 0;
}

.hint-question {
  margin-bottom: 0.3rem;
}

.hint-cost {
  font-size: 0.85em;
  color: #888;
  font-style: italic;
}

.hint-answer {
  margin-left: 1.5rem;
  padding: 0.3rem 0.5rem;
  background: #ddd;
  border-radius: 4px;
  display: inline-block;
  white-space: pre-wrap;
}

.hint-answer.blurred {
  filter: blur(5px);
  background: #222;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s;
}

.hint-answer.blurred:hover {
  filter: blur(3px);
}

.puzzle-page p.fourthwall {
  border: 3px #dd9999 dotted;
  padding: 6px;
  border-radius: 6px;
  background: #330000;
  margin-top: 1rem;
  margin-bottom: 1rem;
}
p.fourthwall {
  border: 3px #aa5555 dotted;
  padding: 6px;
  border-radius: 6px;
  background: #ff9999;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* ── Utilities ── */
.text-center {
  text-align: center;
}
.vol-authors {
  text-align: center;
  color: #555;
}
