/* site/style.css - Editorial theme (light / dark / system) */

:root {
  --bg: #fafaf5;
  --surface: #f0f0ea;
  --fg: #1c1c1a;
  --fg-soft: #3d3d3a;
  --muted: #5c5c57;
  --rule: #e2e1da;
  --rule-strong: #1c1c1a;
  --accent: #14532d;
  --accent-hover: #0b3a1f;
  --code-bg: #f0f0ea;

  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 660px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --surface: #1d1d1b;
    --fg: #fafaf5;
    --fg-soft: #d9d9d2;
    --muted: #a3a39b;
    --rule: #2c2c29;
    --rule-strong: #fafaf5;
    --accent: #8fd1a5;
    --accent-hover: #b5e3c3;
    --code-bg: #1d1d1b;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131312;
  --surface: #1d1d1b;
  --fg: #fafaf5;
  --fg-soft: #d9d9d2;
  --muted: #a3a39b;
  --rule: #2c2c29;
  --rule-strong: #fafaf5;
  --accent: #8fd1a5;
  --accent-hover: #b5e3c3;
  --code-bg: #1d1d1b;
  color-scheme: dark;
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  padding: 8px 12px;
  background: var(--fg);
  color: var(--bg);
  z-index: 100;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 56px;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* Shared bits */

.label {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.label.accent {
  color: var(--accent);
}

.meta {
  font-size: 15px;
  color: var(--muted);
}

.display {
  margin: 0;
  font-size: clamp(44px, 9vw, 60px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  font-size: 22px;
  line-height: 1.5;
  color: var(--fg-soft);
}

.tag {
  display: inline-block;
  font-size: 14px;
  padding: 2px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.6;
}

.tag:hover,
.tag.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Header & footer */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.logo {
  font-size: 20px;
  font-style: italic;
  color: var(--fg);
  text-decoration: none;
}

.nav-main {
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-size: 16px;
}

.nav-main a {
  color: var(--muted);
  text-decoration: none;
}

.nav-main a:hover {
  color: var(--fg);
}

.search-btn {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.search-btn:hover {
  color: var(--fg);
}

.search-btn kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-left: 4px;
}

.site-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  font-size: 15px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}

.theme-switch {
  margin-left: auto;
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-switch button:hover {
  color: var(--fg);
}

.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
}

.theme-switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Home */

.intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 56px;
}

.series-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--rule-strong);
  padding-top: 20px;
  margin-bottom: 56px;
}

.series-title {
  font-size: 26px;
  line-height: 1.3;
  color: var(--fg);
  text-decoration: none;
}

.series-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.series-block p {
  margin: 0;
  font-size: 17px;
  color: var(--muted);
}

.year-group {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-bottom: 48px;
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-title {
  font-size: 23px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}

.entry-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.entry-desc {
  margin: 0;
  font-size: 17px;
  color: var(--fg-soft);
}

.more {
  font-size: 17px;
  margin: 0;
}

/* Catalog */

.page-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.page-header h1 {
  margin: 0;
  font-size: 48px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-status {
  margin: 0 0 32px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-card[hidden],
.year-group[hidden] {
  display: none;
}

.post-link {
  text-decoration: none;
}

.post-link h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--fg);
}

.post-link:hover h3 {
  color: var(--accent);
  text-decoration: underline;
}

.post-excerpt {
  margin: 0;
  font-size: 17px;
  color: var(--fg-soft);
}

/* Post */

.post-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  padding: 8px 0 32px;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 46px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.post-subtitle {
  margin: 0;
  font-size: 21px;
  font-style: italic;
  color: var(--fg-soft);
}

.post-hero {
  margin: 0 0 40px;
}

.post-hero img {
  display: block;
  width: 100%;
  border-radius: 4px;
}

.post-footer {
  margin-top: 56px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
}

.post-nav .next-post {
  text-align: right;
}

.post-nav-title {
  font-size: 20px;
  line-height: 1.3;
  color: var(--fg);
}

.post-nav a:hover .post-nav-title {
  color: var(--accent);
  text-decoration: underline;
}

/* Long-form content */

.prose > * + * {
  margin-top: 1.1em;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table,
.prose figure {
  margin-bottom: 0;
}

.prose h2 {
  margin: 2em 0 0;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 1.6em 0 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

.prose h4 {
  margin: 1.4em 0 0;
  font-size: 20px;
  font-weight: 500;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.3em;
}

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 24px;
  border-left: 2px solid var(--rule-strong);
  font-style: italic;
  color: var(--fg-soft);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code-bg);
  padding: 18px 20px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 14px;
}

.prose img {
  display: block;
  border-radius: 4px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5em 0;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 16px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.prose th {
  font-weight: 500;
}

/* About */

.about-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px 24px;
}

.about-list dt {
  font-weight: 500;
}

.about-list dd {
  margin: 0;
  color: var(--fg-soft);
}

@media (max-width: 560px) {
  .about-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .about-list dd {
    margin-bottom: 12px;
  }
}

/* 404 */

.error-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 48px 0;
}

.error-page p {
  margin: 0;
}

/* Command palette */

.cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 9, 0.45);
  z-index: 50;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.cmd-palette {
  width: 100%;
  max-width: 600px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.cmd-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 19px;
  padding: 16px 20px;
}

.cmd-input:focus {
  outline: none;
}

.cmd-results {
  max-height: 55vh;
  overflow-y: auto;
}

.cmd-result {
  display: block;
  padding: 12px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.cmd-result:hover,
.cmd-result:focus {
  background: var(--surface);
}

.cmd-result-title {
  color: var(--fg);
  font-size: 18px;
  line-height: 1.35;
}

.cmd-result-meta {
  color: var(--muted);
  font-size: 14px;
}

.no-results {
  padding: 16px 20px;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 560px) {
  body {
    font-size: 19px;
  }

  .page {
    padding-top: 32px;
    gap: 40px;
  }

  .post-nav .next-post {
    text-align: left;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
