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

:root {
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --color-bg: #fdfdfd;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-border: #e0e0e0;
  --color-link: #1a1a1a;
  --color-link-hover: #555;
  --color-pre-bg: #f5f5f5;
  --max-width: 960px;
  --sidebar-width: 200px;
}

html {
  font-size: 18px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

a {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}

a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-muted);
}

/* header */

.site-header {
  margin-bottom: 2rem;
}

.site-title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: none;
}

/* layout */

.site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: 3rem;
}

/* Let the main column shrink below its content's intrinsic width so a long
   line inside a <pre> scrolls within the box instead of blowing out the grid. */
.content {
  min-width: 0;
  overflow-wrap: break-word;
}

/* main content */

.content h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.column-header time {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* images */

.column-hero {
  margin-bottom: 1.5rem;
}

.column-hero picture,
.column-hero img {
  display: block;
  width: 100%;
  height: auto;
}

.column-body picture,
.column-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
}

.column-body {
  margin-top: 1.5rem;
}

.column-body h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.column-body h3 {
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.column-body p {
  margin-bottom: 1rem;
  text-indent: 1em;
}

.column-body blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.content ul,
.content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.content li > ul,
.content li > ol {
  margin-bottom: 0;
}

.content ul { list-style-type: disc; }
.content ul ul { list-style-type: circle; }
.content ul ul ul { list-style-type: square; }
.content ul ul ul ul { list-style-type: disc; }

.column-body pre {
  background: var(--color-pre-bg);
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;   /* soft-wrap long lines (these fences hold prose) */
  overflow-wrap: anywhere; /* break a hypothetical unbroken token too */
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.column-body code {
  font-size: 0.85em;
}

.column-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* subjects index */

.subject-group {
  margin-bottom: 2rem;
}

.subject-group h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.subject-group ul {
  list-style: none;
  padding-left: 0;
}

.subject-group li {
  margin-bottom: 0.3rem;
}

.subject-group time {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-left: 0.5rem;
}

/* sidebar */

.sidebar {
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.sidebar h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.sidebar .year-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.3rem;
}

.sidebar a {
  border-bottom: none;
  color: var(--color-muted);
}

.sidebar a:hover {
  color: var(--color-text);
}

/* footer */

.site-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.footer-nav {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  display: flex;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--color-muted);
  border-bottom: none;
}

.footer-nav a:hover {
  color: var(--color-text);
}

/* dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1a;
    --color-text: #e0e0e0;
    --color-muted: #999;
    --color-border: #333;
    --color-link: #e0e0e0;
    --color-link-hover: #bbb;
    --color-pre-bg: #2a2a2a;
  }
}

/* responsive */

@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .site-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    order: 1;
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
  }
}
