/* Design tokens — change the look of the whole site here. */
:root {
  --color-bg: #f5f7f4;
  --color-surface: #ffffff;
  --color-text: #1c2625;
  --color-muted: #55615e;
  --color-accent: #0e6b66;
  --color-accent-soft: #dcebe7;
  --color-border: #d8dfdb;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-heading: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 3rem;
  --space-6: 5rem;
  --radius: 14px;
  --radius-small: 6px;
  --max-width: 60rem;
  --text-width: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #111716;
    --color-surface: #18201f;
    --color-text: #e4ebe9;
    --color-muted: #9daba7;
    --color-accent: #62c6b8;
    --color-accent-soft: #1d3633;
    --color-border: #2a3431;
  }
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
}

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

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

main { flex: 1; }

img { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.15; font-weight: 600; font-optical-sizing: auto; }
h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); margin: 0 0 var(--space-3); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: var(--space-5) 0 var(--space-3); }
h3 { font-size: 1.3rem; margin: var(--space-4) 0 var(--space-2); }

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-3); }
.narrow { max-width: calc(var(--text-width) + 2 * var(--space-3)); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: var(--space-3); top: var(--space-3); background: var(--color-surface); padding: var(--space-2) var(--space-3); z-index: 10; }

/* Header */
.site-header .container { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-4); flex-wrap: wrap; }
.site-name { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 600; color: var(--color-text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; align-self: center; }
.logo { width: 1.75rem; height: 1.75rem; color: var(--color-accent); flex: none; }
.site-nav ul { display: flex; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--color-muted); text-decoration: none; padding-block: var(--space-1); }
.site-nav a:hover { color: var(--color-text); }
.site-nav a[aria-current="page"] { color: var(--color-text); box-shadow: inset 0 -2px 0 var(--color-accent); }

/* Home introduction */
.intro { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4) var(--space-5); align-items: center; padding-block: var(--space-5) var(--space-5); }
.intro-photo { width: 10rem; height: 10rem; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 6px var(--color-accent-soft); }
.intro h1 { margin-bottom: var(--space-2); }
.intro .tagline { font-family: var(--font-heading); font-size: 1.25rem; color: var(--color-muted); margin: 0 0 var(--space-3); }
.intro p { max-width: 36rem; margin: 0 0 var(--space-3); }
.intro p:last-child { margin-bottom: 0; }

@media (max-width: 40rem) {
  .intro { grid-template-columns: 1fr; padding-top: var(--space-4); }
  .intro-photo { width: 7rem; height: 7rem; }
}

/* Post list: newest first, each post with its year */
.post-list-header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; border-bottom: 2px solid var(--color-text); padding-bottom: var(--space-2); }
.post-list-header h2 { margin: 0; }
.post-list-header p { margin: 0; color: var(--color-muted); }

.post-list { list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.post-list li { display: grid; grid-template-columns: 5rem 1fr; gap: var(--space-3); padding-block: var(--space-4); border-bottom: 1px solid var(--color-border); }
.post-year { font-family: var(--font-heading); font-size: 1.5rem; line-height: 1.2; color: var(--color-muted); font-variant-numeric: lining-nums tabular-nums; }
.post-list h3 { margin: 0 0 var(--space-1); font-size: 1.4rem; }
.post-list h3 a { color: var(--color-text); text-decoration: none; }
.post-list h3 a:hover { color: var(--color-accent); text-decoration: underline; }
.post-list p { margin: 0; color: var(--color-muted); max-width: 38rem; }
.more-link { margin: 0 0 var(--space-6); }

@media (max-width: 30rem) {
  .post-list li { grid-template-columns: 1fr; gap: 0; }
  .post-year { font-size: 1rem; }
}

/* Home: latest posts as picture cards */
.post-cards { list-style: none; margin: var(--space-4) 0 var(--space-6); padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5) var(--space-4); }
.post-card { position: relative; display: flex; flex-direction: column; gap: var(--space-3); }
.post-card img, .post-card-tile { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: var(--radius); }
.post-card-tile { display: grid; place-items: center; background: var(--color-accent-soft); color: var(--color-accent); font-family: var(--font-heading); font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 600; font-variant-numeric: lining-nums; }
.post-card h3 { margin: 0 0 var(--space-1); font-size: 1.4rem; }
.post-card h3 a { color: var(--color-text); text-decoration: none; }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.post-card:hover h3 a { color: var(--color-accent); text-decoration: underline; }
.post-card h3 a:focus-visible { outline: none; }
.post-card h3 a:focus-visible::after { outline: 3px solid var(--color-accent); outline-offset: 6px; }
.post-card p { margin: 0; color: var(--color-muted); }
.post-card .post-card-date { font-size: 0.9rem; margin-bottom: var(--space-1); }
@media (max-width: 40rem) { .post-cards { grid-template-columns: 1fr; gap: var(--space-5); } }

/* Page and post content */
.page-header { padding-block: var(--space-5) var(--space-3); }
.page-header p { color: var(--color-muted); margin: 0; }

.prose { font-size: 1.125rem; line-height: 1.7; padding-bottom: var(--space-5); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--space-4); }
.prose li { margin-bottom: var(--space-2); }
.prose figure { margin: var(--space-5) 0; }
.prose figure img { border-radius: var(--radius-small); }
.prose figcaption { margin-top: var(--space-2); font-size: 0.95rem; color: var(--color-muted); }
@media (min-width: 62rem) { .prose .wide { margin-inline: -8rem; } }
.prose iframe { width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); }
.prose .demo { aspect-ratio: 4 / 3; }
.prose .audio { height: 166px; }
.prose .profile-photo { float: right; width: 9rem; height: 9rem; border-radius: 50%; object-fit: cover; margin: 0 0 var(--space-3) var(--space-4); box-shadow: 0 0 0 5px var(--color-accent-soft); }
@media (max-width: 30rem) { .prose .profile-photo { float: none; margin: 0 0 var(--space-4); } }

.prose .note { background: var(--color-accent-soft); border-radius: var(--radius-small); padding: var(--space-3) var(--space-4); font-size: 1rem; }
.prose h2 { font-size: 1.6rem; clear: both; }
.timeline { list-style: none; padding: 0; margin: 0 0 var(--space-3); border-left: 2px solid var(--color-accent-soft); }
.timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-3); padding-left: var(--space-4); margin-bottom: var(--space-3); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 0.6em; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); }
.timeline-when { color: var(--color-muted); font-size: 1rem; font-variant-numeric: tabular-nums; }
@media (max-width: 30rem) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

.contact-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-5); }
.contact-list dt { color: var(--color-muted); }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 30rem) { .contact-list { grid-template-columns: 1fr; gap: 0; } .contact-list dd { margin-bottom: var(--space-3); } }
.map { display: block; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: var(--space-6); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); border-top: 1px solid var(--color-border); padding-block: var(--space-4) var(--space-6); }
.post-nav a { text-decoration: none; display: block; }
.post-nav span { display: block; color: var(--color-muted); font-size: 0.9rem; }
.post-nav strong { font-family: var(--font-heading); font-weight: 600; font-size: 1.15rem; color: var(--color-text); }
.post-nav a:hover strong { color: var(--color-accent); }
.post-nav .newer { text-align: right; grid-column: 2; }

.site-footer { padding-block: var(--space-4); color: var(--color-muted); font-size: 0.95rem; border-top: 1px solid var(--color-border); }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.site-footer p { margin: 0; }
.site-footer ul { display: flex; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--color-muted); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
