/* Dungeon Scriber beta site. Hand-written, no frameworks, no external fonts or scripts. */

:root {
  color-scheme: light dark;
  --bg: #faf7f0;
  --surface: #ffffff;
  --text: #1f1b16;
  --muted: #5a5246;
  --accent: #7a4510;
  --link: #8a3f06;
  --rule: #e2dacb;
  --note-bg: #f3ecdf;
  --todo-bg: #ffe066;
  --todo-text: #1f1b16;
  --banner-bg: #fff4cc;
  --banner-rule: #e0b84a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120e;
    --surface: #1f1b16;
    --text: #ece5d8;
    --muted: #b4a993;
    --accent: #e3b866;
    --link: #f0c27a;
    --rule: #3b342a;
    --note-bg: #26211a;
    --todo-bg: #f5c84c;
    --todo-text: #1a1408;
    --banner-bg: #33290f;
    --banner-rule: #8a6a1c;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header and footer */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-nav a {
  margin-left: 1rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:first-child {
  margin-left: 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer .wrap {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

/* Text */

main {
  padding-top: 1.5rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.25;
  color: var(--text);
}

h1 {
  font-size: 2rem;
  margin: 0.5rem 0 0.75rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
  padding-top: 0.5rem;
}

h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

p,
ul,
ol {
  margin: 0.6rem 0;
}

ul,
ol {
  padding-left: 1.35rem;
}

li {
  margin: 0.3rem 0;
}

li > ul,
li > ol {
  margin: 0.3rem 0;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
  overflow-wrap: anywhere;
}

a:hover {
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 650;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.lede {
  font-size: 1.15rem;
  color: var(--text);
}

.meta {
  color: var(--muted);
}

.note {
  background: var(--note-bg);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.contents {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  list-style: none;
  font-size: 0.9375rem;
}

.contents li {
  margin: 0.15rem 0;
}

/* Landing page links */

.cards {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 34rem) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

.cards a {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.cards a:hover {
  border-color: var(--accent);
}

.cards strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--link);
}

.cards span {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Tables: scroll sideways inside their own box on a narrow phone, never the page. */

.table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  font-weight: 650;
  background: var(--note-bg);
}

/* On a phone, each row becomes a small card: the first cell is its heading. */

@media (max-width: 34rem) {
  .table-wrap {
    overflow-x: visible;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
  }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  tr {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--rule);
  }
  tr:last-child {
    border-bottom: 0;
  }
  td {
    padding: 0.15rem 0;
    border-bottom: 0;
  }
  td:first-child {
    font-weight: 650;
  }
  td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 650;
    color: var(--muted);
  }
}

/* Open items for the owner: highlighted so nobody publishes them by mistake. */

mark.todo {
  background: var(--todo-bg);
  color: var(--todo-text);
  border-radius: 3px;
  padding: 0 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.draft-banner {
  background: var(--banner-bg);
  border: 1px solid var(--banner-rule);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

/* Focus that shows on every background */

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

@media print {
  .site-header,
  .site-footer,
  .contents {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
