/* ============================================================
   Madness and the Minotaur — Responsive Stylesheet
   Theme: Ancient Greek / Labyrinth / Mythology
   ============================================================ */

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

:root {
  --bg:          #110c04;
  --bg2:         #1e1508;
  --bg3:         #2b1d0d;
  --panel:       #241908;
  --border:      #6b4820;
  --accent:      #c8891f;
  --accent2:     #e8b84b;
  --text:        #ede0c8;
  --text-muted:  #a8916e;
  --nav-bg:      #0b0804;
  --link:        #e8b84b;
  --link-hover:  #f5d07a;
  --danger:      #8b2020;
  --max-width:   860px;
  --radius:      6px;
  --font-body:   Georgia, 'Times New Roman', serif;
  --font-ui:     system-ui, -apple-system, sans-serif;
  --font-mono:   'Courier New', Courier, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 18% 2%, rgba(232,184,75,0.12), transparent 24rem),
    radial-gradient(circle at 82% 8%, rgba(116,106,150,0.2), transparent 28rem),
    radial-gradient(circle at 50% 72%, rgba(139,32,32,0.13), transparent 32rem),
    linear-gradient(180deg, #120d12 0%, #1f1a2a 34%, #2b1d0d 100%);
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
}

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

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

/* --- Nav --------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  border-bottom: 2px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-brand:hover { color: var(--link-hover); text-decoration: none; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--bg3);
  color: var(--accent2);
  text-decoration: none;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 600px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-bottom: 2px solid var(--border);
    padding: 0.5rem 1.25rem 1rem;
    gap: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.65rem 0.5rem; font-size: 1rem; }
}

/* --- Page wrapper ------------------------------------------ */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* --- Hero -------------------------------------------------- */
.hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  text-align: center;
  padding: 3rem 1rem 2.5rem;
  margin-bottom: 2.5rem;
  background:
    radial-gradient(circle at 26% 16%, rgba(232,224,200,0.16), transparent 8rem),
    radial-gradient(circle at 74% 4%, rgba(116,106,150,0.22), transparent 24rem),
    linear-gradient(180deg, #1d1a2c 0%, #21170d 78%, var(--bg) 100%);
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: var(--accent2);
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.75rem;
}

.hero-compact {
  padding-bottom: 1.5rem;
}

.hero-cover {
  display: inline-block;
  cursor: zoom-in;
  overflow: hidden;
  transition: filter 0.2s, transform 0.2s;
}
.hero-cover:hover {
  filter: saturate(1.08) contrast(1.03);
  transform: translateY(-3px);
}
.hero-cover img {
  display: block;
  width: min(440px, 76vw);
  height: auto;
}

/* --- Lightbox --------------------------------------------- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.88);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox.open { display: flex; }

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.lightbox-inner img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 48px rgba(0,0,0,0.9);
}
.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: var(--danger); border-color: var(--danger); }

/* --- Section headings ------------------------------------- */
.page > section:not(.hero) {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  margin: 2rem 0;
  padding: 1.5rem;
}

.page h2 {
  font-size: 1.45rem;
  color: var(--accent2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin: 2rem 0 1rem;
}

.page h3 {
  font-size: 1.1rem;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem;
}

.about-question {
  margin-bottom: 1rem;
}

/* --- Info table ------------------------------------------- */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.info-table th,
.info-table td {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.info-table th {
  background: var(--bg3);
  color: var(--accent);
  font-weight: 600;
  width: 38%;
}
.info-table td { background: var(--panel); color: var(--text); }

.solution-about {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.solution-about h2 {
  margin-top: 0;
}

/* --- Play section ----------------------------------------- */
.play-section { text-align: center; }

.emulator-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  text-align: center;
}

#splashElement {
  display: block;
  cursor: pointer;
  max-width: 100%;
  height: auto;
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-left: auto;
  margin-right: auto;
}

#madnessConsole {
  background-color: #001a00 !important;
  color: #00ff01 !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  width: 100% !important;
  max-width: 420px;
  border: 2px solid var(--border);
  border-radius: 4px;
  resize: none;
  margin-left: auto;
  margin-right: auto;
}

.tape-toggle {
  display: none;
  padding: 0.45rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent2);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  cursor: pointer;
  margin: 0.75rem 0;
  transition: background 0.15s;
}
.tape-toggle.visible { display: inline-block; }
.tape-toggle:hover { background: var(--border); }

.tape-area { display: none; margin-top: 0.75rem; }
.tape-area.open { display: block; }

.tape-area ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.tape-area li { margin-bottom: 0.25rem; }

#cocoTape {
  width: 100%;
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  font-family: var(--font-mono);
  margin-top: 0.5rem;
}

.resource-list {
  display: inline-block;
  list-style: none;
  margin: 0.35rem auto 0.9rem;
  max-width: 42rem;
  text-align: left;
  width: min(100%, 42rem);
}

#play .resource-heading {
  text-align: left;
  width: min(100%, 42rem);
  margin-left: auto;
  margin-right: auto;
}

.indented-resource-list {
  padding-left: 1.5rem;
}

.resource-list li {
  padding: 0.28rem 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

/* --- Screenshots ------------------------------------------ */
.screenshots {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.screenshots img {
  width: calc(33.33% - 0.5rem);
  min-width: 140px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  flex: 1 1 140px;
}

/* --- Manual page ------------------------------------------ */
.manual-content { line-height: 1.75; }
.manual-content p { margin-bottom: 1rem; }
.manual-content strong { color: var(--accent2); }
.manual-content code {
  background: rgba(232,184,75,0.12);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent2);
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
}

.manual-content .spell-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.manual-content .spell-list li { margin-bottom: 0.35rem; }

blockquote.manual-block {
  background: var(--panel);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 1.25rem;
  color: var(--text);
}

/* --- Footer ------------------------------------------------ */
.site-footer {
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent2); }

.footer-heading {
  color: var(--accent2);
  font-size: 1rem;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
  text-align: center;
  text-transform: uppercase;
}

.games-footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.game-footer-link {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  transition: transform 0.2s;
  width: min(220px, 42vw);
}
.game-footer-link:hover {
  text-decoration: none;
  transform: translateY(-3px);
}

.game-footer-link img {
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
  display: block;
  height: auto;
  width: 100%;
}

.game-footer-link span {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.3;
  text-align: center;
}
.game-footer-link:hover span { color: var(--accent2); }

.footer-byline {
  border-top: 1px solid rgba(200,137,31,0.3);
  margin-top: 0.5rem;
  padding-top: 1rem;
  text-align: center;
}

/* --- Utility ---------------------------------------------- */
.note {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.spoiler-warning {
  background: #b43a2f;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 1rem 0 2rem;
  text-align: center;
}

.spoiler-warning strong {
  color: inherit;
}

.manual-about h2 {
  color: var(--text);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin: 0 0 0.85rem;
}

.manual-about-layout {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.manual-cover-link {
  display: block;
  flex: 0 0 auto;
}

.manual-cover-link img {
  width: min(120px, 36vw);
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.32);
}

.manual-about-text {
  flex: 1 1 260px;
  align-self: center;
}

.manual-solution-cta {
  text-align: center;
  margin-top: 1rem;
}

.manual-solution-button {
  display: inline-block;
  background: var(--accent);
  border: 1px solid var(--accent2);
  border-radius: var(--radius);
  color: #fff7e2;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.55rem 1.05rem;
  text-decoration: none;
  transition: background 0.18s, transform 0.18s;
}

.manual-solution-button:hover {
  background: var(--accent2);
  color: #fff7e2;
  text-decoration: none;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .hero-cover img { width: min(360px, 82vw); }
  .screenshots img { width: calc(50% - 0.375rem); }
  .game-footer-link { width: min(220px, 86vw); }
}
