/* Quiet Beds — stylesheet
   Colours are tokens on :root. Dark scheme follows the system unless the page sets data-theme. */

:root {
  --bg: #f6f3ea;
  --surface: #fffdf7;
  --ink: #2b2a25;
  --muted: #6b675b;
  --line: #ddd6c4;
  --accent: #4f6b3a;
  --accent-ink: #f6f3ea;
  --warm: #b5712e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 36, 24, 0.06), 0 6px 18px rgba(40, 36, 24, 0.06);
  --max: 1040px;
  --gutter: 16px;
  --font-body: "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  --font-ui: "Helvetica Neue", Arial, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1f1a;
    --surface: #252821;
    --ink: #e6e2d4;
    --muted: #a6a18e;
    --line: #3a3e33;
    --accent: #9cbf7e;
    --accent-ink: #1d1f1a;
    --warm: #d9975a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  }
}

:root[data-theme="dark"] {
  --bg: #1d1f1a;
  --surface: #252821;
  --ink: #e6e2d4;
  --muted: #a6a18e;
  --line: #3a3e33;
  --accent: #9cbf7e;
  --accent-ink: #1d1f1a;
  --warm: #d9975a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--warm); }
a:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--font-body);
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }

p { margin: 0 0 1em; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
nav a:hover,
nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* main */
main { flex: 1 0 auto; padding-top: 28px; padding-bottom: 40px; }

.kicker {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6em;
}

.intro { max-width: 46rem; margin-bottom: 36px; }
.intro p:last-child { color: var(--ink); }

.date {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warm);
  margin-bottom: 0.4em;
}

/* cards */
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  margin-bottom: 36px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.card p:last-child { margin-bottom: 0; }
.card h2 { font-size: 1.25rem; }

/* panels & tables */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 28px;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  min-width: 520px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:last-child td { border-bottom: 0; }

.two-col {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
.checklist li {
  position: relative;
  padding: 9px 0 9px 26px;
  border-bottom: 1px dashed var(--line);
}
.checklist li:last-child { border-bottom: 0; }
.checklist li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

.prose-list {
  padding-left: 1.3em;
  margin: 0 0 0.5em;
  font-family: var(--font-ui);
  font-size: 0.97rem;
}
.prose-list li {
  margin-bottom: 12px;
  padding-left: 4px;
}
.prose-list li::marker { color: var(--accent); }

/* archive list on the journal page */
.archive {
  list-style: none;
  margin: 0;
  padding: 0;
}
.archive li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
}
.archive li:last-child { border-bottom: 0; }
.archive .date { margin-bottom: 0; }
@media (min-width: 720px) {
  .archive li { grid-template-columns: 9.5rem 1fr; }
}

.quote {
  border-left: 4px solid var(--accent);
  padding: 8px 0 8px 22px;
  margin: 8px 0 32px;
}
blockquote { margin: 0; }
blockquote p {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--muted);
  margin: 0;
}

/* notes page */
.note { padding-bottom: 8px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note h2 { scroll-margin-top: 80px; }
.toc {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin: 0 0 32px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toc ul { margin: 0; padding-left: 1.2em; }
.toc li { margin: 4px 0; }

/* about / prose */
.prose { max-width: 42rem; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }

/* 404 */
.lost { text-align: center; padding: 56px 0; }
.lost .code {
  font-family: var(--font-ui);
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.2em;
}
.lost p { color: var(--muted); }

/* footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--muted);
  padding: 24px 0 28px;
}
.site-footer p { margin-bottom: 0.6em; }
.small { font-size: 0.85rem; }
.site-footer a { color: var(--muted); }

/* wider screens */
@media (min-width: 720px) {
  body { font-size: 19px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid .card:first-child { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .panel { padding: 28px 30px; }
}

@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid .card:first-child { grid-column: auto; }
  .grid .card:first-child { grid-column: 1 / 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

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