/* =========================================================
   nomoreh1bs.com styles
   Colors and fonts for each mode live in the two blocks
   right below. Change them there and they apply sitewide.
   ========================================================= */

:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);

  /* Light mode */
  --bg: #F4F6F8;
  --ink: #172131;
  --muted: #4B5668;
  --accent: #1D4F91;
  --rule: #D3DAE3;
  --ph: #E7EDF4;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --head: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
}

:root[data-theme="dark"] {
  /* Dark mode */
  --bg: #0C1412;
  --ink: #D8D1BC;
  --muted: #999380;
  --accent: #86A57C;
  --rule: #25352F;
  --ph: #13201C;
  --body: "EB Garamond", Garamond, "Times New Roman", serif;
  --head: "IM Fell English", "EB Garamond", Garamond, serif;
  --measure: 64ch;
}

html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
[data-theme="dark"] body { font-size: 1.1875rem; line-height: 1.7; }
img { max-width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout: sections down the left side ---------- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); align-self: start;
  height: calc(100vh - env(safe-area-inset-top, 0px)); overflow-y: auto;
  border-right: 1px solid var(--rule);
  padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.mark {
  font-family: var(--head); font-weight: 800; font-size: 1.2rem;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
}
[data-theme="dark"] .mark { font-weight: 400; font-style: italic; font-size: 1.35rem; letter-spacing: .01em; }

nav ul { list-style: none; margin: 0; padding: 0; }
nav li { border-bottom: 1px solid var(--rule); }
nav li:first-child { border-top: 1px solid var(--rule); }
nav a { display: block; padding: .45rem 0; color: var(--accent); text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
[data-theme="dark"] nav a { font-size: 1.1rem; }
[data-theme="dark"] nav a[aria-current="page"] { font-weight: 500; font-style: italic; }

.x-link { margin-top: auto; font-size: .9rem; color: var(--muted); text-decoration: none; }
.x-link:hover { color: var(--ink); text-decoration: underline; }

.toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-size: .9rem; color: var(--ink);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: .3rem .75rem; cursor: pointer;
}
.toggle svg { width: 18px; height: 18px; }

/* ---------- Page content ---------- */
main { padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem) 6rem; }
.page { max-width: var(--measure); }
.page.wide { max-width: 72rem; }
.page.wide > p, .page.wide > blockquote, .page.wide > ul, .page.wide > ol { max-width: var(--measure); }

h1 {
  font-family: var(--head); font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05; letter-spacing: -.025em; margin: 0 0 1rem;
}
[data-theme="dark"] h1 { font-weight: 400; letter-spacing: 0; line-height: 1.1; }
h2 { font-family: var(--head); font-size: 1.35rem; line-height: 1.25; margin: 2.75rem 0 .75rem; }
[data-theme="dark"] h2 { font-weight: 400; font-size: 1.6rem; }
h3 { font-family: var(--head); font-size: 1.1rem; margin: 2rem 0 .5rem; }
[data-theme="dark"] h3 { font-weight: 400; font-size: 1.4rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 4rem 0 0; }

/* The first paragraph under a page title reads as an intro */
h1 + p { font-size: 1.2rem; color: var(--muted); margin: 0 0 2rem; }

/* Regular quotes */
blockquote { margin: 1.5rem 0; padding-left: 1.1rem; border-left: 3px solid var(--rule); color: var(--muted); font-style: italic; }
blockquote p { margin: .4rem 0; }

/* Placeholder boxes: a quote starting with "To write" or "Tentative" */
blockquote.ph {
  background: var(--ph); border: 1px dashed var(--rule); border-radius: 6px;
  padding: 1rem 1.1rem; font-style: normal;
}
blockquote.ph strong { color: var(--ink); }

/* Buttons: <a class="btn" href="...">Label</a> in a page file */
.btn {
  display: inline-block; margin: .5rem 0; padding: .65rem 1.1rem; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
}
[data-theme="dark"] .btn { color: var(--bg); }

/* Tables scroll sideways on small screens instead of breaking the page */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; background: var(--ph); }
tr:last-child td { border-bottom: 0; }

.loading, .error { color: var(--muted); }

/* ---------- Bestiary (Necronomicon) ---------- */
.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0 2.5rem; margin-top: 1rem; }
.creature { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.creature h3 { font-size: 1.7rem; margin: 0; line-height: 1.15; }
.creature .src { font-style: italic; color: var(--muted); margin: .15rem 0 .6rem; }
.creature blockquote.ph { padding: .6rem .8rem; font-size: 1rem; margin: 0; }

/* ---------- "Outsourced" banner (light mode only) ---------- */
.banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: .8rem clamp(1rem, 4vw, 2.5rem);
  padding-bottom: calc(.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg);
  display: flex; align-items: center; gap: 1rem;
}
.banner p { margin: 0; flex: 1; }
.banner a { color: inherit; font-weight: 600; }
.banner button {
  flex: none; background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: .25rem .5rem;
}
.banner[hidden] { display: none; }

/* ---------- Mode switch transition ---------- */
.veil { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0; background: #0C1412; transition: opacity .35s ease; }
.veil.on { opacity: 1; }
.veil.to-light { background: #F4F6F8; }
@media (prefers-reduced-motion: reduce) { .veil { transition: none; } }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule);
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 1rem;
  }
  nav { flex-basis: 100%; }
  nav ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
  nav li, nav li:first-child { border: 0; }
  .x-link { flex-basis: 100%; margin-top: 0; }
}
