/* Colours. Dark-mode values follow. */
:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --border: #d8dee4;
  --link: #0b57a4;
  --hover: #f6f8fa;
  --accent: #1d3f73;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --text: #e6e8eb;
    --muted: #9aa2ad;
    --border: #2c323a;
    --link: #7fb0ff;
    --hover: #161b22;
    --accent: #a9c1ee;
    color-scheme: dark;
  }
}

/* Heading font: Source Serif 4 (SIL Open Font License, see assets/fonts/OFL.txt) */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.container {
  max-width: 46rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

a { color: var(--link); }
img { max-width: 100%; height: auto; }
address { font-style: normal; }

h1, h2, h3, .site-title { font-family: "Source Serif 4", Georgia, "Times New Roman", serif; font-weight: 600; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; }
h1 { font-size: 2rem; margin: 0 0 1rem; color: var(--accent); }
h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
@media (max-width: 30rem) { h1 { font-size: 1.6rem; } }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--bg); }

/* Header */
.site-header { border-bottom: 1px solid var(--border); padding-top: 1.25rem; padding-bottom: 1rem; text-wrap: balance; }
.site-title { color: var(--accent); font-size: 1.2rem; text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-top: 0.5rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

/* Main */
main { padding-top: 2rem; padding-bottom: 3rem; }
main li + li { margin-top: 0.5rem; }

/* Home page photos (_data/photos.yml), stacked so only the active one shows */
.carousel { margin: 0 0 1.5rem; }
.carousel-photos { position: relative; display: grid; border-radius: 0.5rem; overflow: hidden; background: var(--border); }
.carousel-photos img { display: none; grid-area: 1 / 1; width: 100%; aspect-ratio: 1600 / 727; object-fit: cover; }
.carousel-photos img.is-active, .carousel-photos img.is-leaving { display: block; }
.carousel-photos img.is-active { z-index: 1; }
.carousel-captions { display: grid; margin-top: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.carousel-captions > span { grid-area: 1 / 1; visibility: hidden; }
.carousel-captions > span.is-active { visibility: visible; }
.carousel .is-entering { animation: carousel-fade 1s ease; }
@keyframes carousel-fade { from { opacity: 0; } }

.carousel-controls { position: absolute; right: 0.5rem; bottom: 0.5rem; z-index: 2; display: flex; padding: 0 0.25rem; border-radius: 1rem; background: rgba(0, 0, 0, 0.45); }
.carousel-controls button { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; background: none; color: #fff; cursor: pointer; }
.carousel-dot::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }
.carousel-dot[aria-current="true"]::before, .carousel-dot:hover::before { background: #fff; }
.carousel-toggle svg { width: 0.85rem; height: 0.85rem; fill: currentColor; stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.carousel-controls button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 50%; }

@media (prefers-reduced-motion: reduce) {
  .carousel .is-entering { animation: none; }
  .carousel-photos img.is-leaving { display: none; }
}

/* News feed, laid out like a Bluesky timeline */
.feed {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.45;
}
.feed li + li { margin-top: 0; }
.feed-status { padding: 1rem; color: var(--muted); }

.post { display: flex; gap: 0.75rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); cursor: pointer; overflow-wrap: anywhere; }
.post:first-child { border-top: 0; }
.post:hover { background: var(--hover); }
.post-avatar-link { flex: none; align-self: flex-start; }
.post-avatar { display: block; width: 2.625rem; height: 2.625rem; border-radius: 50%; object-fit: cover; background: var(--border); }
.post-body { flex: 1; min-width: 0; }

.post-header { display: flex; align-items: center; gap: 0.3rem; min-width: 0; white-space: nowrap; }
.post-author { display: flex; gap: 0.3rem; min-width: 0; color: inherit; text-decoration: none; }
.post-author:hover .post-name { text-decoration: underline; }
.post-name { flex: none; max-width: 70%; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.post-handle { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.post-handle, .post-dot, .post-time { color: var(--muted); }
.post-time { flex: none; text-decoration: none; }
.post-time:hover { text-decoration: underline; }
.post-text { margin-top: 0.15rem; }
.post-text:empty { display: none; }

.post-images { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; margin-top: 0.6rem; border-radius: 0.6rem; overflow: hidden; }
.post-images[data-count="1"] { grid-template-columns: 1fr; }
.post-images[data-count="3"] a:first-child { grid-row: span 2; }
.post-images a { display: block; }
.post-images img { display: block; width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; }
.post-images[data-count="1"] img { height: auto; max-height: 30rem; }

.post-card { display: block; margin-top: 0.6rem; border: 1px solid var(--border); border-radius: 0.6rem; overflow: hidden; color: inherit; text-decoration: none; }
.post-card img { display: block; width: 100%; aspect-ratio: 1.91; object-fit: cover; border-bottom: 1px solid var(--border); }
.post-card-text { display: block; padding: 0.6rem 0.75rem; }
.post-card-title { display: block; font-weight: 600; }
.post-card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 0.875rem; }
.post-card-domain { display: block; margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.8rem; }

.post-quote { margin-top: 0.6rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.6rem; }
.post-quote-avatar { flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; object-fit: cover; background: var(--border); }

.post-video { position: relative; display: block; margin-top: 0.6rem; border-radius: 0.6rem; overflow: hidden; }
.post-video img { display: block; width: 100%; max-height: 30rem; object-fit: cover; }
.post-video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: auto;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.post-actions { display: flex; gap: 2.5rem; margin-top: 0.5rem; color: var(--muted); font-size: 0.85rem; }
.post-action { display: inline-flex; align-items: center; gap: 0.3rem; min-width: 2.5rem; }
.post-action svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0.25rem 0; }
