/* ═══════════════════════════════════════════════════════════
   MISKATONIC REPOSITORY — miskatonic.css
   Call of Cthulhu Community Content stylesheet
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Oswald:wght@400;600;700&display=swap');

/* ── TOKENS ── */
:root {
  --parchment:    #f2ead8;
  --parchment2:   #e8dcc0;
  --parchment3:   #d9c99a;
  --ink:          #1a1209;
  --ink2:         #352a18;
  --ink3:         #6b5a3e;
  --crimson:      #7a1a1a;
  --crimson2:     #9e2222;
  --gold:         #8b6914;
  --gold2:        #c49a27;
  --rule:         #8b6914;
  --example-bg:   #ddd0b0;
  --table-head:   #2a1f0e;
  --table-stripe: #e8dcc0;
  --shadow:       rgba(26,18,9,0.18);
  --col-gap:      28px;
  --page-max:     960px;
}

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

/* ── PAGE SHELL ── */
html { background: #1a1209; }

body {
  background: var(--parchment);
  color: var(--ink);
  font-family: Georgia, 'IM Fell English', serif;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  background-image:
    repeating-linear-gradient(
      0deg, transparent, transparent 23px,
      rgba(139,105,20,0.06) 23px, rgba(139,105,20,0.06) 24px
    );
}

/* ── DOCUMENT WRAPPER ── */
.document {
  max-width: var(--page-max);
  margin: 0 auto;
  box-shadow: 0 4px 40px var(--shadow);
}

/* ══════════════════════════════════════════════
   COVER PAGE
══════════════════════════════════════════════ */
.cover-page {
  background: #0d0905;
  color: #e8dcc0;
  padding: 60px 48px 48px;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  position: relative;
  border-bottom: 4px double var(--gold);
}

.cover-page .cover-logo {
  display: block;
  max-width: 192px;   /* 2 inches at 96dpi */
  max-height: 120px;
  width: auto;
  height: auto;
  margin-bottom: 40px;
}

.cover-page h1 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: clamp(32px, 6vw, 60px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #e8dcc0;
  line-height: 1.1;
  margin-bottom: 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.cover-page .cover-subtitle {
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
  color: var(--gold2);
  margin-bottom: 12px;
}

.cover-page .cover-author {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #a09070;
  margin-top: auto;
  padding-top: 32px;
  border-top: 1px solid rgba(139,105,20,0.4);
}

/* ══════════════════════════════════════════════
   CREDITS PAGE
══════════════════════════════════════════════ */
.credits-page {
  background: var(--parchment2);
  padding: 48px;
  border-bottom: 3px double var(--rule);
}

.credits-page h2 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.credits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
  margin-bottom: 32px;
}

.credit-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.credit-label {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink3);
  min-width: 80px;
  padding-top: 2px;
}
.credit-value { color: var(--ink); }

.credits-legal {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.65;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  text-align: center;
}
.credits-legal em { font-style: italic; }
.credits-legal a { color: var(--crimson); text-decoration: none; }
.credits-legal a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════
   TABLE OF CONTENTS
══════════════════════════════════════════════ */
.toc-page {
  background: var(--parchment);
  padding: 48px 48px 40px;
  border-bottom: 3px double var(--rule);
}

.toc-page h2 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--crimson);
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rule);
}

#toc-list {
  columns: 2;
  column-gap: var(--col-gap);
  list-style: none;
  padding: 0;
}

#toc-list li {
  break-inside: avoid;
  margin-bottom: 2px;
}

#toc-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  color: var(--ink2);
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 1px dotted rgba(139,105,20,0.3);
  transition: color 0.15s;
}
#toc-list a:hover { color: var(--crimson); }

#toc-list a .toc-title { flex: 1; }
#toc-list a .toc-dots {
  flex: 1;
  border-bottom: 1px dotted var(--parchment3);
  margin: 0 4px 3px;
}
#toc-list a .toc-page-num {
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  color: var(--ink3);
  min-width: 24px;
  text-align: right;
}

/* Indent sub-items */
#toc-list li.toc-h2 a { padding-left: 16px; font-size: 12px; color: var(--ink3); }
#toc-list li.toc-h3 a { padding-left: 28px; font-size: 11px; color: var(--ink3); font-style: italic; }

/* ══════════════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════════════ */
.content-area {
  padding: 40px 48px 64px;
  background: var(--parchment);
}

/* Two-column layout */
.two-col {
  columns: 2;
  column-gap: var(--col-gap);
  column-rule: 1px solid var(--parchment3);
}

/* Break points for spanning elements */
.col-span  { column-span: all; }
.col-break { break-before: column; }

/* ── HEADINGS ── */
h1, .h1 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--crimson);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rule);
  column-span: all;
  line-height: 1.15;
}

h2, .h2 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--crimson);
  margin: 20px 0 6px;
  break-after: avoid;
}

h3, .h3 {
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 4px;
  break-after: avoid;
}

h4, .h4 {
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  color: var(--ink2);
  margin: 12px 0 3px;
  break-after: avoid;
}

/* ── BODY TEXT ── */
p {
  font-size: 13px;
  text-align: justify;
  color: var(--ink);
  margin-bottom: 0;
  hyphens: auto;
}

p + p { text-indent: 1em; }
h1 + p, h2 + p, h3 + p, h4 + p,
.no-indent { text-indent: 0; }

/* ── LISTS ── */
ul, ol {
  margin: 6px 0 8px 20px;
  font-size: 13px;
  color: var(--ink);
}
li { margin-bottom: 3px; line-height: 1.55; }
li::marker { color: var(--crimson); }

/* ── EXAMPLE TEXT ── */
.example {
  background: var(--example-bg);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  margin: 10px 0;
  font-style: italic;
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.6;
  break-inside: avoid;
}

/* ── HORIZONTAL RULES ── */
hr {
  border: none;
  border-top: 1px solid var(--parchment3);
  margin: 18px 0;
  column-span: all;
}
hr.ornate {
  border: none;
  text-align: center;
  height: 14px;
  column-span: all;
  overflow: visible;
}
hr.ornate::before {
  content: '✦ ──── ✦ ──── ✦';
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 2px;
}

/* ── IMAGES ── */
.img-wrap {
  break-inside: avoid;
  margin: 10px 0 14px;
}
.img-wrap img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border: 1px solid var(--parchment3);
  box-shadow: 2px 3px 8px var(--shadow);
}
.img-wrap.img-full { column-span: all; }
.img-wrap.img-full img { max-height: 440px; margin: 0 auto; }
.img-caption {
  font-size: 10px;
  font-style: italic;
  color: var(--ink3);
  margin-top: 4px;
  text-align: center;
}

/* ══════════════════════════════════════════════
   STAT BLOCKS
══════════════════════════════════════════════ */
.stat-block {
  background: var(--parchment2);
  border: 1px solid var(--parchment3);
  border-left: 3px solid var(--crimson);
  padding: 12px 14px 14px;
  margin: 10px 0;
  font-size: 12px;
  break-inside: avoid;
}

.stat-block .stat-name {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--crimson);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--parchment3);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px 6px;
  margin-bottom: 8px;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--parchment);
  border: 1px solid var(--parchment3);
  padding: 3px 4px;
}
.stat-cell .stat-label {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink3);
  line-height: 1;
}
.stat-cell .stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.stat-derived {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12px;
  color: var(--ink2);
  margin-bottom: 8px;
  padding: 5px 0;
  border-top: 1px dotted var(--parchment3);
  border-bottom: 1px dotted var(--parchment3);
}
.stat-derived span { white-space: nowrap; }
.stat-derived .stat-key { color: var(--ink3); font-size: 11px; margin-right: 2px; }

.stat-block p,
.stat-attacks p {
  font-size: 12px;
  text-align: left;
  text-indent: 0;
  margin-bottom: 3px;
  color: var(--ink2);
  line-height: 1.5;
}
.stat-block p + p { text-indent: 0; }

/* ══════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════ */
.table-wrap {
  break-inside: avoid;
  margin: 12px 0;
  overflow-x: auto;
}
.table-wrap.table-full { column-span: all; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead th {
  background: var(--table-head);
  color: var(--parchment);
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: left;
  padding: 6px 10px;
  border: 1px solid #0d0905;
}
tbody tr:nth-child(even) { background: var(--table-stripe); }
tbody td {
  padding: 5px 10px;
  border: 1px solid var(--parchment3);
  vertical-align: top;
  color: var(--ink2);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════
   HANDOUT SECTION
══════════════════════════════════════════════ */
.handout-section {
  padding: 40px 48px;
  background: var(--parchment2);
  border-top: 3px double var(--rule);
}
.handout-section h2 {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--crimson);
  margin-bottom: 24px;
  column-span: all;
}
.handout {
  border: 2px solid var(--rule);
  background: #faf5e8;
  padding: 24px;
  margin-bottom: 28px;
  break-inside: avoid;
  box-shadow: 3px 4px 12px var(--shadow);
}
.handout-title {
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--parchment3);
  padding-bottom: 6px;
}
.handout p { font-size: 13px; text-align: left; font-style: italic; }
.handout p + p { text-indent: 0; margin-top: 8px; }

/* ══════════════════════════════════════════════
   SITE HEADER (page navigation bar)
══════════════════════════════════════════════ */
.site-header {
  background: #0d0905;
  color: #c8b898;
  padding: 10px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: 'Oswald', 'Trebuchet MS', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(139,105,20,0.4);
}
.site-header .site-title {
  color: var(--gold2);
  font-size: 14px;
  font-weight: 700;
}
.site-header nav { display: flex; gap: 20px; }
.site-header nav a {
  color: #a09070;
  text-decoration: none;
  transition: color 0.15s;
}
.site-header nav a:hover { color: var(--gold2); }

/* ══════════════════════════════════════════════
   SITE FOOTER
══════════════════════════════════════════════ */
.site-footer {
  background: #0d0905;
  color: #5a4a32;
  padding: 24px 48px;
  font-size: 11px;
  line-height: 1.65;
  border-top: 2px double var(--gold);
}
.site-footer p { color: #5a4a32; text-align: center; text-indent: 0; font-size: 11px; }
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { color: var(--gold2); }

/* ══════════════════════════════════════════════
   TOC TOGGLE (mobile / sidebar)
══════════════════════════════════════════════ */
.toc-toggle {
  display: none;
  background: var(--crimson);
  color: #e8dcc0;
  border: none;
  padding: 6px 14px;
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
}

/* ══════════════════════════════════════════════
   PRINT
══════════════════════════════════════════════ */
@media print {
  .site-header, .toc-page { display: none; }
  html { background: white; }
  body { font-size: 9pt; }
  .two-col { columns: 2; }
  h1 { font-size: 18pt; }
  h2 { font-size: 11pt; }
}

/* ══════════════════════════════════════════════
   SELECTION
══════════════════════════════════════════════ */
::selection { background: rgba(122,26,26,0.2); color: var(--crimson); }
