/* davidmann.com: phase 4 base styles. Appearance only; no words (plan Q18). */

:root {
  --bg: #ffffff;
  --text: #1c1d21;
  --muted: #5d6270;
  --line: #e3e5ea;
  --card: #f5f6f8;
  --accent: #2f55dd;
  --draft-bg: #fff4d6;
  --draft-text: #6b4e00;
  --measure: 42rem;
  --wide: 68rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --text: #e7e8ec;
    --muted: #a0a5b1;
    --line: #2c2f36;
    --card: #1e2026;
    --accent: #8ea6ff;
    --draft-bg: #3a3014;
    --draft-text: #f3d27a;
  }
}

* { box-sizing: border-box; }

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -999px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 4px 8px; }

/* Header: name left, menu right */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 8px 24px; padding-top: 18px; padding-bottom: 14px;
}
.site-name { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

main { padding-top: 28px; padding-bottom: 48px; }

.draft-banner {
  background: var(--draft-bg); color: var(--draft-text);
  font-size: 0.85rem; padding: 6px 10px; border-radius: 4px; display: inline-block;
}

/* Text */
.prose { max-width: var(--measure); }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2em 0 0.6em; }
h3 { font-size: 1.05rem; line-height: 1.35; margin: 1.2em 0 0.3em; }
h2 a { color: var(--text); }
.lead { max-width: var(--measure); }
.meta { color: var(--muted); font-size: 0.85rem; margin: 0; }
.more, .counts { font-size: 0.95rem; }
.counts { color: var(--muted); }

/* Home intro */
.intro { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 760px) {
  .intro { grid-template-columns: minmax(0, 1fr) 220px; }
}
.home-section { border-top: 1px solid var(--line); margin-top: 32px; }

/* Lists of items */
.items { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.item-title { margin: 2px 0 4px; }
.summary { margin: 4px 0; }
.links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; margin: 4px 0 0; }
.date-pair { margin-right: 12px; }

.questions { max-width: var(--measure); padding-left: 1.2em; }
.questions li { margin: 6px 0; }
.question-group { font-size: 0.95rem; margin: 1em 0 0.2em; color: var(--muted); }

/* Cards */
.cards { list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
.card a { display: flex; flex-direction: column; gap: 4px; height: 100%;
  background: var(--card); border-radius: 6px; padding: 14px 16px; color: var(--text); }
.card a:hover { text-decoration: none; outline: 1px solid var(--line); }
.card span { color: var(--muted); font-size: 0.9rem; }

.photo-cards { list-style: none; padding: 0; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.photo-cards a { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.photo-cards span { color: var(--muted); font-size: 0.9rem; }

/* Photos */
.photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.headshot { aspect-ratio: 3 / 4; }
.story-photo { margin: 8px 0 20px; }
.prose img { max-width: 100%; max-height: 480px; width: auto; height: auto; border-radius: 6px; display: block; margin: 8px 0 12px; }
/* Tables in page text: lines, shaded header, striped rows; scroll sideways on narrow screens */
.prose table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse;
  font-size: 0.85rem; line-height: 1.4; margin: 12px 0 20px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--card); font-weight: 600; }
.prose th, .prose td { max-width: 16rem; }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--card) 55%, transparent); }
.prose td:empty { background: transparent; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0 16px; }
.photo-missing { background: var(--card); border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; }

/* Writing filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 8px 0 16px; font-size: 0.9rem; color: var(--muted); }
.filters label { display: flex; flex-direction: column; gap: 2px; }
.filters select { font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; }
.no-results { color: var(--muted); }

/* History */
.timeline { list-style: none; padding: 0; margin: 0; max-width: var(--measure);
  border-left: 2px solid var(--line); }
.timeline li { padding: 6px 0 14px 18px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.footer-inner { display: flex; justify-content: center; padding-top: 16px; padding-bottom: 24px; }
.contact-email { font-size: 1.05rem; }
