/* ============================================================
   About This Project — Mazes of Menace
   Typography stylesheet matching the guidebook style
   ============================================================ */

/* --- Variables ---------------------------------------------- */

:root {
  --font-body: 'EB Garamond', 'Garamond', 'Georgia', serif;
  --font-mono: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", monospace;
  --color-text: #1a1a1a;
  --color-bg: #fffff8;
  --color-accent: #6b2c2c;
  --color-rule: #c4a882;
  --color-code-bg: #f5f0e8;
  --color-table-border: #c4a882;
  --color-table-stripe: #fcfaf5;
  --color-link: #4a2020;
  --color-blockquote-border: #c4a882;
  --color-blockquote-bg: #faf6ef;
}

/* --- Base --------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  margin: 0 auto;
  max-width: 38em;
  padding: 2em 1.5em 4em;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

/* --- Headings ----------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.2;
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: var(--color-text);
}

h1 {
  font-size: 2.4em;
  font-weight: 700;
  text-align: center;
  margin-top: 1.5em;
  margin-bottom: 0.3em;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 1.6em;
  font-weight: 600;
  margin-top: 2.5em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--color-rule);
}

h3 {
  font-size: 1.3em;
  font-weight: 600;
  margin-top: 2em;
}

h4 {
  font-size: 1.1em;
  font-weight: 600;
  margin-top: 1.5em;
}

h5 {
  font-size: 1em;
  font-weight: 600;
  font-style: italic;
}

/* --- Paragraphs --------------------------------------------- */

p {
  margin: 0.8em 0;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* --- Links -------------------------------------------------- */

a {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

a:hover {
  border-bottom-color: var(--color-link);
}

/* --- Blockquotes -------------------------------------------- */

blockquote {
  margin: 1.5em 0;
  padding: 1em 1.2em;
  background: var(--color-blockquote-bg);
  border-left: 3px solid var(--color-blockquote-border);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}

blockquote p {
  margin: 0.5em 0;
}

blockquote p:first-child { margin-top: 0; }
blockquote p:last-child  { margin-bottom: 0; }

blockquote strong {
  font-style: normal;
}

/* --- Horizontal Rules --------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--color-rule);
  height: 0;
  margin: 2em auto;
  max-width: 8em;
  position: relative;
  overflow: visible;
}

hr::after {
  content: '\25C6'; /* ◆ */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-rule);
  font-size: 0.8em;
  line-height: 1;
  background: var(--color-bg);
  padding: 0 0.3em;
}

/* --- Code --------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--color-code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.78em;
  line-height: 1.125;
  background: var(--color-code-bg);
  padding: 1em 1.2em;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.2em auto;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

/* --- Tables ------------------------------------------------- */

table {
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.92em;
  line-height: 1.4;
}

thead {
  border-bottom: 2px solid var(--color-table-border);
}

th {
  font-weight: 600;
  text-align: left;
  padding: 0.5em 0.7em;
  white-space: nowrap;
}

td {
  padding: 0.4em 0.7em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
}

tbody tr:nth-child(even) {
  background: var(--color-table-stripe);
}

/* --- Lists -------------------------------------------------- */

ul, ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

ul {
  list-style: none;
}

ul > li::before {
  content: '\25C6'; /* ◆ */
  font-size: 0.5em;
  position: relative;
  top: -0.1em;
  margin-left: -1.5em;
  margin-right: calc(1.5em - 0.5em);
  display: inline-block;
  width: 0.5em;
}

li {
  margin: 0.3em 0;
}

li > p {
  margin: 0.4em 0;
}

li > ul, li > ol {
  margin: 0.2em 0;
}

/* --- Strong / Emphasis -------------------------------------- */

strong { font-weight: 600; }
em     { font-style: italic; }

/* --- Responsive --------------------------------------------- */

@media screen and (max-width: 640px) {
  html { font-size: 16px; }
  body { padding: 1em 1em 3em; }
  h1   { font-size: 1.8em; }
  h2   { font-size: 1.4em; }

  pre {
    font-size: 0.72em;
    padding: 0.8em;
  }

  table { font-size: 0.85em; }

  th, td { padding: 0.3em 0.4em; }

  blockquote {
    padding: 0.7em 0.8em;
    margin-left: 0;
    margin-right: 0;
  }
}

@media screen and (max-width: 420px) {
  html { font-size: 15px; }
  h1   { font-size: 1.6em; }

  pre {
    font-size: 0.65em;
    padding: 0.5em 0.4em;
    border-radius: 0;
    margin-left: -1em;
    margin-right: -1em;
  }

  table {
    font-size: 0.78em;
    display: block;
    overflow-x: auto;
  }
}

