/* ════════════════════════════════════════════════════════════════════════════
   WONDERBIT — sitewide stylesheet
   ────────────────────────────────────────────────────────────────────────────
   The aesthetic is "old workshop notebook" — vintage paper, pixel-display
   font for marks and headers, EB Garamond for body text. Accents pick up
   the deep teal that was already in the original CSS (#004d40 family).

   This file styles the landing page, games hub, and about page. The
   Dreamcraft sub-site has its own stylesheet (DreamCraft.css) that pushes
   the same family toward "chronicle" — that's the inner site, this is the
   outer one.

   Voice convention: this is the outer Wonderbit site. No Aura voice, no
   "the world remembers" framing — that belongs only inside Dreamcraft.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Colors ──────────────────────────────────────────────────────────── */
  --ink:        #2a2114;           /* warm near-black for body text */
  --ink-soft:   #5a4a36;           /* secondary text */
  --ink-faded:  rgba(42, 33, 20, 0.55);
  --teal-deep:  #004d40;           /* primary accent (kept from original) */
  --teal-mid:   #007a66;
  --teal-soft:  #4d8b80;
  --paper-line: rgba(42, 33, 20, 0.18);
  --warn:       #8b2c1a;

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font-display: 'Jersey 15', system-ui, sans-serif;
  --font-body:    'EB Garamond', 'Iowan Old Style', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink);
  background: url("vintage_paper.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center top;
  min-height: 100vh;
}

/* Subtle grain overlay so even empty sections feel like part of the paper. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(42, 33, 20, 0.04) 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(42, 33, 20, 0.03) 1px, transparent 2px);
  background-size: 7px 7px, 11px 11px;
  mix-blend-mode: multiply;
}

a { color: var(--teal-deep); text-decoration: none; border-bottom: 1px solid currentColor; }
a:hover { color: var(--teal-mid); }

/* ─── LAYOUT CONTAINER ─────────────────────────────────────────────────── */

.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 1.5fr 1fr;
  grid-template-areas:
    "header  header   header"
    "nav     main     news"
    "nav     weather  news"
    "footer  footer   footer";
}

/* ─── HEADER ───────────────────────────────────────────────────────────── */

header {
  grid-area: header;
  text-align: center;
  padding: 2rem 0 1rem;
}

header h1 {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--ink);
  line-height: 1;
  text-shadow:
    1px 1px 0 rgba(0, 77, 64, 0.12),
    2px 2px 12px rgba(0, 77, 64, 0.06);
}

header .tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--teal-deep);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

/* ─── NAV TILES ────────────────────────────────────────────────────────── */

nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
  padding-top: 1rem;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: rgba(255, 251, 240, 0.5);
  border: 1px solid var(--paper-line);
  border-bottom: none;
  transition: all 0.15s ease;
  color: var(--ink);
}

.tile:hover {
  background: rgba(0, 77, 64, 0.08);
  border-color: var(--teal-deep);
  transform: translateY(-2px);
}

.tile-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 4px rgba(42, 33, 20, 0.2));
}

.tile-label {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

/* ─── MAIN ─────────────────────────────────────────────────────────────── */

main {
  grid-area: main;
  padding: 1rem 0.5rem;
  max-width: 60ch;
  justify-self: center;
}

.welcome {
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 1.2rem;
  text-wrap: balance;
}

.welcome:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3rem;
  float: left;
  line-height: 0.85;
  padding: 0.25rem 0.5rem 0 0;
  color: var(--teal-deep);
}

.welcome-small {
  font-size: 1.05rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ─── WEATHER ──────────────────────────────────────────────────────────── */

.weather-card {
  grid-area: weather;
  align-self: start;
  justify-self: center;
  padding: 1rem 1.4rem;
  background: rgba(28, 22, 16, 0.85);
  color: #d8cdb8;
  border: 1px solid var(--teal-deep);
  font-family: var(--font-display);
  text-align: center;
  min-width: 240px;
}

.weather-label {
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  color: var(--teal-soft);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.weather-location {
  font-size: 1.2rem;
  color: #f0e8d4;
}

.weather-forecast {
  font-size: 1rem;
  color: #b5a98e;
  margin-top: 0.3rem;
  font-family: var(--font-body);
}

.weather-forecast strong { color: #e0d4ad; font-weight: 500; }

/* ─── NEWS PANEL ───────────────────────────────────────────────────────── */

.news-panel {
  grid-area: news;
  padding: 1.2rem;
  background: rgba(255, 251, 240, 0.45);
  border: 1px solid var(--paper-line);
  align-self: start;
}

.news-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--teal-deep);
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--teal-deep);
  text-align: center;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.news-entry {
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--paper-line);
}

.news-entry:last-child { border-bottom: none; }

.news-date {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faded);
  margin-bottom: 0.3rem;
}

.news-headline {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

.news-body {
  font-size: 1.02rem;
  color: var(--ink);
  line-height: 1.55;
}

.news-empty {
  font-style: italic;
  color: var(--ink-faded);
  text-align: center;
  padding: 1rem;
}

/* ─── FOOTER ───────────────────────────────────────────────────────────── */

footer {
  grid-area: footer;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--paper-line);
  margin-top: 1rem;
}

.social {
  border-bottom: none;
  transition: transform 0.15s ease;
}

.social:hover { transform: translateY(-3px); }

.social img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 4px rgba(42, 33, 20, 0.25));
}

/* ─── RESPONSIVE ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "nav"
      "main"
      "weather"
      "news"
      "footer";
    padding: 1.5rem 1rem 2.5rem;
    gap: 1.5rem;
  }

  nav {
    flex-direction: row;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .tile {
    flex: 1 1 30%;
    min-width: 140px;
    padding: 1rem 0.5rem;
  }

  .tile-icon { width: 48px; height: 48px; }
  .tile-label { font-size: 1.3rem; }

  header h1 { font-size: clamp(2.5rem, 14vw, 4rem); letter-spacing: 0.1em; }

  main, .weather-card, .news-panel { width: 100%; max-width: 100%; }
}

/* ════════════════════════════════════════════════════════════════════════
   PAGE-LEVEL OVERRIDES (used by /games, /about-me, etc.)
   These share the typography and color base but have their own layout.
   ════════════════════════════════════════════════════════════════════════ */

/* ─── COMMON: site-wide top nav (used on inner pages) ──────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 0.85rem 2rem;
  background: rgba(28, 22, 16, 0.94);
  border-bottom: 1px solid var(--teal-deep);
  backdrop-filter: blur(4px);
}

.site-nav a {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #d8cdb8;
  letter-spacing: 0.04em;
  border-bottom: none;
  padding: 0.15rem 0;
  position: relative;
}

.site-nav a:hover { color: var(--teal-soft); }

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--teal-soft);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.site-nav a:hover::after { transform: scaleX(1); }

.site-nav a.home { color: var(--teal-soft); }

/* ─── COMMON: page hero header for inner pages ─────────────────────────── */

.page-header {
  text-align: center;
  padding: 4rem 2rem 2rem;
  max-width: 84ch;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--teal-deep);
}

.page-header .intro {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--ink);
  max-width: 60ch;
  margin: 1.5rem auto 0;
  text-wrap: balance;
}

@media (max-width: 720px) {
  .site-nav { gap: 1rem; padding: 0.7rem 1rem; flex-wrap: wrap; }
  .site-nav a { font-size: 1.1rem; }
  .page-header { padding: 2.5rem 1.2rem 1.5rem; }
}

/* ════════════════════════════════════════════════════════════════════════
   WIKI SEARCH — search box on the landing page + modal for results.
   The search box itself sits inside <main> on the landing page; the
   modal is fixed-positioned and sits on top of the whole page.

   The wiki content rendered inside the modal arrives from PmWiki with
   minimal styling — we apply paper-friendly defaults so it doesn't look
   completely unstyled. PmWiki's own skin colors are overridden inside
   .wiki-modal-body for consistency.
   ════════════════════════════════════════════════════════════════════════ */

/* ─── Search box ───────────────────────────────────────────────────────── */

.wiki-search {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--paper-line);
}

.wiki-search-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 0.5rem;
}

.wiki-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.wiki-search-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--ink);
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--teal-deep);
  outline: none;
  transition: background 0.15s ease;
}

.wiki-search-input:focus {
  background: rgba(255, 251, 240, 0.95);
  box-shadow: 0 0 0 2px rgba(0, 77, 64, 0.2);
}

.wiki-search-input::placeholder {
  color: var(--ink-faded);
  font-style: italic;
}

.wiki-search-btn {
  padding: 0.6rem 1.2rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--teal-deep);
  color: #f0e8d4;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.wiki-search-btn:hover { background: var(--teal-mid); }

/* ─── Inline search results ────────────────────────────────────────────── */

.wiki-results {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.wiki-results-count {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faded);
}

.wiki-results-loading,
.wiki-results-empty {
  font-style: italic;
  color: var(--ink-faded);
  padding: 0.5rem 0;
}

.wiki-result {
  padding: 0.7rem 0.9rem;
  background: rgba(255, 251, 240, 0.5);
  border: 1px solid var(--paper-line);
  border-left: 3px solid var(--teal-deep);
  cursor: pointer;
  transition: all 0.15s ease;
}

.wiki-result:hover {
  background: rgba(255, 251, 240, 0.85);
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(42, 33, 20, 0.08);
}

.wiki-result-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 0.3rem;
}

.wiki-result-group {
  font-size: 0.85em;
  color: var(--ink-faded);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wiki-result-snippet {
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0.2rem 0 0;
}

.wiki-result-snippet mark {
  background: rgba(241, 196, 15, 0.4);
  color: var(--ink);
  padding: 0 2px;
  font-weight: 500;
}

/* ─── Modal ────────────────────────────────────────────────────────────── */

.wiki-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.wiki-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.wiki-modal-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 780px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: url("/stylings/vintage_paper.png");
  background-size: cover;
  background-position: center;
  border: 2px solid var(--teal-deep);
  box-shadow: 0 14px 60px rgba(0, 0, 0, 0.5);
}

.wiki-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: rgba(0, 77, 64, 0.92);
  color: #f0e8d4;
  border-bottom: 1px solid var(--teal-deep);
  flex-shrink: 0;
}

.wiki-modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 0;
  /* Long page names should not push the close button off-screen */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiki-modal-close {
  background: transparent;
  border: 1px solid rgba(240, 232, 212, 0.4);
  color: #f0e8d4;
  font-size: 1.1rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.wiki-modal-close:hover {
  background: rgba(240, 232, 212, 0.15);
  border-color: #f0e8d4;
}

.wiki-modal-body {
  padding: 1.4rem 1.8rem;
  overflow-y: auto;
  flex: 1;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink);
}

.wiki-modal-loading,
.wiki-modal-error {
  font-style: italic;
  color: var(--ink-faded);
  text-align: center;
  padding: 2rem;
}

.wiki-modal-error { color: var(--warn); }

/* Style the wiki content inside the modal — PmWiki's output gets
   a paper-friendly treatment so it doesn't look like a different site. */
.wiki-modal-body h1,
.wiki-modal-body h2,
.wiki-modal-body h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--teal-deep);
  letter-spacing: 0.04em;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
}

.wiki-modal-body h1 { font-size: 1.8rem; margin-top: 0; }
.wiki-modal-body h2 { font-size: 1.4rem; }
.wiki-modal-body h3 { font-size: 1.2rem; }

.wiki-modal-body p { margin-bottom: 0.9rem; }
.wiki-modal-body ul, .wiki-modal-body ol { margin: 0.6rem 0 1rem 1.5rem; }
.wiki-modal-body li { margin-bottom: 0.3rem; }

.wiki-modal-body a {
  color: var(--teal-deep);
  border-bottom: 1px solid currentColor;
}

.wiki-modal-body a:hover { color: var(--teal-mid); }

.wiki-modal-body code,
.wiki-modal-body pre {
  font-family: 'Courier New', monospace;
  background: rgba(28, 22, 16, 0.06);
  padding: 0.1rem 0.4rem;
  font-size: 0.95em;
}

.wiki-modal-body pre {
  padding: 0.8rem 1rem;
  overflow-x: auto;
  border-left: 3px solid var(--teal-deep);
}

.wiki-modal-body table {
  border-collapse: collapse;
  margin: 1rem 0;
  width: 100%;
}

.wiki-modal-body th,
.wiki-modal-body td {
  border: 1px solid var(--paper-line);
  padding: 0.4rem 0.7rem;
  text-align: left;
}

.wiki-modal-body img {
  max-width: 100%;
  height: auto;
}

/* ─── Search responsive ────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .wiki-search-row { flex-direction: column; }
  .wiki-search-btn { width: 100%; }

  .wiki-modal-panel { width: 96vw; max-height: 92vh; }
  .wiki-modal-body  { padding: 1rem 1.2rem; }
  .wiki-modal-head  { padding: 0.8rem 1rem; }
  .wiki-modal-title { font-size: 1.15rem; }
}
