/* Fonts are self-hosted (latin subset from Google Fonts) so they load with the page. */
@font-face { font-family: "Alegreya"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/alegreya.woff2) format("woff2"); }
@font-face { font-family: "Alegreya"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/alegreya-italic.woff2) format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/courier-prime.woff2) format("woff2"); }

:root {
  --paper: #f7f5f0;
  --card: #fbfaf7;
  --tile: #ece8f4;
  --ink: #1d1b24;
  --muted: #6a6574;
  --rule: #ddd8ce;
  --accent: #3a2d8f;      /* indigo */
  --mark: #d9ec7a;        /* chartreuse, used sparingly */


  --serif: "Alegreya", Georgia, serif;
  --mono: "Courier Prime", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15131c;
    --card: #1b1924;
    --tile: #25213a;
    --ink: #ebe8f1;
    --muted: #9b96a6;
    --rule: #2f2b3b;
    --accent: #b3a8ff;
    --mark: #5a6620;
  }
}

/* ── Themes (cycle with the bottom-right button, or ?theme=name) ──
   --glow is a background layer fixed behind the page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--glow, none);
}

html[data-theme="silver"] {
  --paper: #eceef2; --card: #f8f9fb; --tile: #e3e2ee; --rule: #d3d7df;
  --ink: #1b1d26; --muted: #646876; --accent: #3a2d8f;
  --glow: linear-gradient(180deg, #f5f6f9 0%, #e7eaf0 100%);
}
html[data-theme="lavender"] {
  --paper: #eeecf5; --card: #faf9fd; --tile: #e4e0f2; --rule: #d9d4e8;
  --ink: #1d1a2b; --muted: #6a6480; --accent: #3a2d8f;
  --glow: radial-gradient(1100px 620px at 100% -10%, rgba(130, 105, 230, 0.13), transparent 65%),
          radial-gradient(900px 520px at -10% 110%, rgba(150, 130, 220, 0.10), transparent 65%);
}
html[data-theme="seaglass"] {
  --paper: #e8efee; --card: #f7faf9; --tile: #dbe8e6; --rule: #ccdad8;
  --ink: #17232a; --muted: #5a6b70; --accent: #1f5f6b; --mark: #c9e86a;
  --glow: radial-gradient(1100px 620px at 0% -10%, rgba(60, 180, 175, 0.16), transparent 65%),
          linear-gradient(180deg, transparent 50%, rgba(255, 255, 255, 0.35));
}
html[data-theme="aurora"] {
  --paper: #eef0f4; --card: #fafbfd; --tile: #e4e3f2; --rule: #d6d9e3;
  --ink: #1b1c27; --muted: #626679; --accent: #3a2d8f;
  --glow: radial-gradient(900px 520px at 8% -8%, rgba(64, 190, 190, 0.17), transparent 65%),
          radial-gradient(900px 520px at 96% -4%, rgba(120, 90, 230, 0.15), transparent 65%),
          radial-gradient(800px 420px at 50% 112%, rgba(190, 225, 80, 0.12), transparent 65%);
}
html[data-theme="glacier"] {
  --paper: #e9eef4; --card: #f8fafc; --tile: #dfe5f0; --rule: #d0d9e4;
  --ink: #18202c; --muted: #5d6879; --accent: #2c4a8f;
  --glow: linear-gradient(160deg, #f4f7fb 0%, #e4ebf3 55%, #e6e4f3 100%);
}
html[data-theme="periwinkle"] {
  --paper: #e8e9f6; --card: #f9f9fe; --tile: #dfdff3; --rule: #d3d4ea;
  --ink: #1b1b2e; --muted: #64658a; --accent: #3a2d8f;
  --glow: radial-gradient(1200px 640px at 50% -25%, rgba(255, 255, 255, 0.75), transparent 70%),
          linear-gradient(180deg, transparent 40%, rgba(120, 125, 220, 0.08));
}
html[data-theme="dusk"] {
  --paper: #eeebf3; --card: #fbfafd; --tile: #e6e0ef; --rule: #dbd5e5;
  --ink: #1e1a29; --muted: #6b6479; --accent: #4a2d8f;
  --glow: linear-gradient(180deg, #f3f1f8 0%, #ebe6f2 55%, #f1e9ec 100%);
}
html[data-theme="midnight"] {
  --paper: #15122a; --card: #1e1a38; --tile: #29244a; --rule: #332d57;
  --ink: #ece9f7; --muted: #a39dc0; --accent: #c6e85a; --mark: #4b5a1c;
  --glow: radial-gradient(1200px 600px at 15% -10%, rgba(64, 196, 196, 0.10), transparent 60%),
          radial-gradient(900px 500px at 100% 0%, rgba(110, 80, 220, 0.18), transparent 60%);
}
html[data-theme="deepsea"] {
  --paper: #0e1d22; --card: #14282e; --tile: #1b343b; --rule: #24434b;
  --ink: #e6f1f1; --muted: #93b0b3; --accent: #c6e85a; --mark: #3f5a1c;
  --glow: radial-gradient(1100px 600px at 5% -10%, rgba(60, 200, 190, 0.16), transparent 62%),
          radial-gradient(900px 520px at 105% 105%, rgba(90, 70, 200, 0.14), transparent 62%);
}
html[data-theme="twilight"] {
  --paper: #151933; --card: #1f2343; --tile: #2a2f57; --rule: #2f3460;
  --ink: #eceaf7; --muted: #a4a6c8; --accent: #9fdbe6; --mark: #2d4f63;
  --glow: linear-gradient(180deg, #1c2042 0%, #151432 55%, #110f22 100%),
          radial-gradient(900px 500px at 85% 0%, rgba(140, 100, 230, 0.16), transparent 60%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 80px 24px 56px;
}

/* ── Intro ───────────────────────────────────────── */

.intro {
  display: flex;
  gap: 48px;
  align-items: center;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--rule);
}

.photo {
  width: 220px;
  aspect-ratio: 1;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 2px;
}

h1 {
  font-weight: 500;
  font-size: 3.3rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}

.blurb { margin: 0; font-size: 1.05rem; }
.intro-text { flex: 1; min-width: 0; }

.blurb a {
  text-decoration: none;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-size: 100% 0.35em;
  background-position: 0 88%;
  background-repeat: no-repeat;
  transition: background-size 0.15s ease;
}
.blurb a:hover { background-size: 100% 0.9em; }

.links {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.links a, .links button {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 7px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.links a:hover, .links button:hover { border-color: var(--accent); color: var(--accent); }
.links button:active { background: var(--tile); }

.copied {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.copied.show { opacity: 1; }
.copied .note { display: block; }
.copied .addr { font-family: var(--mono); font-style: normal; font-size: 0.85rem; color: var(--ink); }

/* ── Sections ───────────────────────────────────── */

section { margin-top: 52px; }

h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.more-wrap { margin-top: 40px; text-align: center; }
.more {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 9px 22px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.more:hover { border-color: var(--accent); color: var(--accent); }

/* ── Cards ──────────────────────────────────────── */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }

.top {
  aspect-ratio: 2 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--rule);
  background: var(--tile);
}
.top.mark span {
  font-family: var(--mono);
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.top.logo { background: #fff; }
.top.logo img { max-width: 55%; max-height: 55%; object-fit: contain; }
.top picture { display: contents; }
.top.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .top.cover img { transform: scale(1.03); }

.body { padding: 16px 18px 20px; }

h3 {
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0;
  transition: color 0.15s ease;
}
.card.linked:hover h3 { color: var(--accent); }
.card.linked h3::after {
  content: " ↗";
  font-size: 0.8em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card.linked:hover h3::after { opacity: 1; }

.role {
  margin: 2px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
}
.dates {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.7rem;
  white-space: nowrap;
}

.text { margin: 10px 0 0; font-size: 0.86rem; line-height: 1.5; }
.text.draft { color: var(--muted); }


/* Whole-card link sits underneath; links inside the blurb sit on top of it. */
.card-link { position: absolute; inset: 0; z-index: 1; }
.card .text a {
  position: relative;
  z-index: 2;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.card .text a:hover { text-decoration-thickness: 2px; }

/* Two two-item sections side by side */
.pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 52px;
}
.pair-row section { margin-top: 0; }
.pair-row .grid { grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Card style: small square logo ──────────────── */

.cards-logo .card { padding: 20px 20px 22px; }
.cards-logo .body { padding: 0; }
.logo-sq {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #fff;
  display: grid;
  place-items: center;
}
.logo-sq img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo-sq.contain img { object-fit: contain; padding: 9px; }
.logo-sq.mark { background: var(--tile); }
.logo-sq.mark span { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); }

/* ── Card style: rows with logo on the left ────── */

.cards-row .grid { grid-template-columns: 1fr; gap: 12px; }
.cards-row .card { flex-direction: row; align-items: flex-start; gap: 20px; padding: 18px 20px; }
.cards-row .body { padding: 0; flex: 1; min-width: 0; }
.cards-row .logo-sq { width: 72px; height: 72px; margin: 0; flex-shrink: 0; }
.cards-row .text { max-width: 44em; }

/* ── Footer ─────────────────────────────────────── */

.footer {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--muted);
  font-style: italic;
}
.footer a { color: var(--ink); font-style: normal; text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { text-decoration-thickness: 2px; }

/* ── Smaller screens ────────────────────────────── */

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .pair-row { grid-template-columns: 1fr; }
  .cards-row .grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .page { padding: 40px 16px 48px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 24px; }
  .photo { width: 140px; }
  h1 { font-size: 2.4rem; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .cards-row .card { gap: 14px; padding: 14px; }
  .cards-row .logo-sq { width: 52px; height: 52px; }
  .pair-row { grid-template-columns: 1fr; gap: 0; }
  .pair-row .grid { grid-template-columns: 1fr; }
  .pair-row section + section { margin-top: 40px; }

  /* Compact list on phones: square logo on the left, text on the right */
  .card { flex-direction: row; align-items: flex-start; gap: 14px; padding: 14px; }
  .card:hover { transform: none; }
  .top {
    width: 56px;
    height: 56px;
    aspect-ratio: auto;
    flex-shrink: 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
  }
  .top.logo img { max-width: 70%; max-height: 70%; }
  .card:hover .top.cover img { transform: none; }
  .body { padding: 0; flex: 1; min-width: 0; }
  h3 { font-size: 1.05rem; }
  .text { margin-top: 6px; }

  .copied:empty { display: none; }
}

.theme-btn { position: fixed; right: 16px; bottom: 16px; z-index: 10; font-family: var(--mono); font-size: 0.72rem; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 2px; padding: 6px 12px; cursor: pointer; }
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
