/* Personal site. Self-hosted, no web fonts: the server's CSP allows nothing
   from other origins, and nothing here needs it. */

:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --ink: #1d2521;
  --muted: #5b6660;
  --line: #ddd6c8;
  --accent: #2f6b55;
  --accent-ink: #f6f3ec;
  --shadow: 0 1px 2px rgba(29, 37, 33, .06), 0 6px 20px rgba(29, 37, 33, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;

  /* Game card art */
  --art-bg: #e9e4d8;
  --h1: #d9e6f0; --h2: #a9c6de; --h3: #6f9fc6; --h4: #e8a25a;
  --hit: #d9573c; --miss: #b9b2a3;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121715;
    --surface: #181f1c;
    --ink: #e9ece8;
    --muted: #9aa79f;
    --line: #2a332f;
    --accent: #6fbf9b;
    --accent-ink: #0f1a15;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --art-bg: #1f2925;
    --h1: #1d3442; --h2: #285a7a; --h3: #3f84b8; --h4: #d98a3f;
    --hit: #e0674c; --miss: #4a554f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121715; --surface: #181f1c; --ink: #e9ece8; --muted: #9aa79f; --line: #2a332f;
  --accent: #6fbf9b; --accent-ink: #0f1a15;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --art-bg: #1f2925; --h1: #1d3442; --h2: #285a7a; --h3: #3f84b8; --h4: #d98a3f; --hit: #e0674c; --miss: #4a554f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }

.wrap { width: min(1040px, 100%); margin: 0 auto; padding: 0 16px; }

/* ----------------------------------------------------------- masthead */

.masthead {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: 28px;
}
.name {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.15;
}
.tagline { margin: 4px 0 14px; color: var(--muted); font-size: 16px; }

.tabs {
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  padding: 10px 14px 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.tabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 480px) {
  .tabs { gap: 0; }
  .tabs a { padding: 10px 6px 12px; font-size: 13.5px; }
}

/* -------------------------------------------------------------- panels */

main.wrap { padding-top: 36px; padding-bottom: 56px; min-height: 60vh; }
.panel[hidden] { display: none; }
.panel + .panel { margin-top: 56px; }        /* only matters without JS */
.js .panel + .panel { margin-top: 0; }

h1 { font-family: var(--serif); font-size: clamp(28px, 4vw, 34px); font-weight: 600; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 6px; line-height: 1.3; }
.lede { color: var(--muted); max-width: 64ch; margin: 0 0 26px; }
.prose { max-width: 66ch; }
.prose p { margin: 0 0 1em; }

/* A section's "coming soon" line disappears by itself once real content is
   added to it, so filling in a section is a one-step edit. */
.pending { color: var(--muted); font-style: italic; }
.prose:has(p:not(.pending)) .pending,
.panel:has(.entry, .gallery figure, .bake) .pending { display: none; }

/* --------------------------------------------------------------- about */

.about { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 640px) { .about { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.portrait { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }
@media (max-width: 640px) { .portrait { width: 120px; height: 120px; } }
.monogram {
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--serif); font-size: 56px; letter-spacing: .02em;
}
@media (max-width: 640px) { .monogram { font-size: 38px; } }
.links { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.links:empty { display: none; }
.links a { font-weight: 600; }

/* ------------------------------------------------------------ research */

.entries { display: grid; gap: 18px; max-width: 760px; }
.entry {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.entry-meta { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.entry .authors { color: var(--muted); font-size: 15px; margin: 0 0 8px; }
.entry p { margin: 0 0 8px; }
.entry-links { display: flex; gap: 14px; font-weight: 600; font-size: 15px; }

/* ------------------------------------------------- photography, baking */

.gallery {
  columns: 3 260px; column-gap: 14px;
}
.gallery figure { break-inside: avoid; margin: 0 0 14px; }
.gallery img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }

.bakes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.bake { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.bake img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.bake-body { padding: 14px 16px 16px; }
.bake-body p { margin: 0; color: var(--muted); font-size: 15px; }

/* --------------------------------------------------------------- games */

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.game {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.game:hover { transform: translateY(-2px); border-color: var(--accent); }
.game:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.game-art { width: 100%; height: auto; display: block; }
.game-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.game-body p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.go { color: var(--accent); font-weight: 700; font-size: 15px; margin-top: 6px; }

.art-bg { fill: var(--art-bg); }
.art-bg.felt { fill: #1f4d3c; }
.h1 { fill: var(--h1); } .h2 { fill: var(--h2); } .h3 { fill: var(--h3); } .h4 { fill: var(--h4); }
.hit { fill: var(--hit); } .miss { fill: var(--miss); }
.c4-frame { fill: #2a5c7a; }
.c4-holes circle { fill: var(--art-bg); }
.red { fill: #e34948; } .yel { fill: #f3c969; }
.ring { fill: #8fb6dd; stroke: #ffffff; stroke-width: 1.5; }
.card { fill: #fbfdfc; }
.slot-curves path { fill: none; stroke-width: 2.5; }
.sc-a { stroke: var(--h2); } .sc-b { stroke: var(--h3); } .sc-c { stroke: var(--h4); }
.axis { stroke: var(--miss); stroke-width: 1.5; }
.art-bg.sea { fill: #173a4a; }
.ping { fill: none; stroke: #8fb6dd; stroke-width: 2; stroke-dasharray: 5 4; }
.ping-dot { fill: #8fb6dd; }
.glow { fill: rgba(232, 162, 90, .35); }
.sub { fill: #f3c969; }
.dice { fill: #fbfdfc; }
.dice.hidden-die { fill: #24506e; }
.pip { fill: #10241d; }
.q { font: 700 20px var(--sans); fill: rgba(255, 255, 255, .8); }
.card-t { font: 700 13px var(--sans); fill: #10241d; }
.card-t.red-t { fill: #cc2f3e; }

/* -------------------------------------------------------------- footer */

.footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 32px; color: var(--muted); font-size: 14px; }
.admin-link { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 4px; margin: -8px -4px; }
.admin-link:hover { color: var(--accent); text-decoration: underline; }

/* ------------------------------------------------------------ lightbox */

.lightbox {
  max-width: min(94vw, 1200px); max-height: 92vh; padding: 0; border: 0;
  background: transparent; color: #fff; overflow: visible;
}
.lightbox::backdrop { background: rgba(8, 10, 9, .86); }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 8px; margin: 0 auto; }
.lightbox p { text-align: center; margin: 10px 0 0; font-size: 15px; }
.lightbox button {
  position: absolute; top: -14px; right: -14px;
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: #fff; color: #111; font-size: 24px; line-height: 1; cursor: pointer;
}

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