@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&display=swap');

:root {
  --bg: #ffffff;
  --surface: #f3f2f0;
  --fg: #111111;
  --fg-muted: #777777;
  --border: #dedede;
  --font-display: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

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

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

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.75;
  min-height: 100vh;
}

.wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 2.5rem);
}

/* ─── Header ─────────────────────────────────────────── */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 2rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.03em;
}

.site-title:hover {
  color: var(--fg-muted);
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
}

.site-header nav a {
  font-size: 0.82rem;
  color: var(--fg-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.15s;
}

.site-header nav a:hover,
.site-header nav a.active {
  color: var(--fg);
}

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

.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.site-footer a {
  color: var(--fg-muted);
  text-decoration: none;
}

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

/* ─── Index / Article listing ─────────────────────────── */

.listing-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  margin-bottom: 2.5rem;
}

.articles {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-top: 2rem;
}

.article-item a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.article-item time {
  display: block;
  font-size: 0.78rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  line-height: 1.75;
}

.article-item h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: normal;
  color: var(--fg);
  margin-bottom: 0.35rem;
  line-height: 1.75;
  transition: color 0.15s;
}

.article-item a:hover h2 {
  color: var(--fg-muted);
}

.article-item p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.75;
}

.tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tag {
  font-size: 0.68rem;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  letter-spacing: 0.06em;
  line-height: 1.75;
}

/* ─── Article page ────────────────────────────────────── */

.article-header {
  margin-bottom: 2.5rem;
}

.article-header time {
  display: block;
  font-size: 0.78rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
  line-height: 1.75;
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: normal;
  line-height: 1.3;
  margin-bottom: 0.9rem;
}

.article-header .tags {
  margin-top: 0;
}

/* ─── Article content ─────────────────────────────────── */

.article-content {
  font-size: 1rem;
  line-height: 1.75;
}

.article-content > * + * {
  margin-top: 1.5rem;
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: normal;
  margin-top: 2.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  line-height: 1.75;
}

.article-content h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: normal;
  font-style: italic;
  margin-top: 2rem;
  color: var(--fg);
  line-height: 1.75;
}

.article-content a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s;
}

.article-content a:hover {
  text-decoration-color: var(--fg);
}

.article-content figure {
  margin: 2.5rem 0;
}

.article-content img {
  width: 100%;
  height: auto;
  display: block;
}

.article-content figcaption {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-style: italic;
  margin-top: 0.6rem;
  text-align: center;
  line-height: 1.75;
}

.article-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
  color: var(--fg-muted);
  font-style: italic;
}

.article-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.83em;
  background: var(--surface);
  padding: 0.1em 0.35em;
  border: 1px solid var(--border);
}

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.article-content ul,
.article-content ol {
  padding-left: 1.5rem;
}

.article-content li + li {
  margin-top: 1.5rem;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
  text-align: left;
  line-height: 1.75;
}

.article-content th {
  color: var(--fg-muted);
  font-weight: normal;
  font-style: italic;
}

/* ─── Image zoom ─────────────────────────────────────── */

.article-content img {
  cursor: zoom-in;
}

.zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  cursor: zoom-out;
}

.zoom-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.zoom-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

/* ─── About page ──────────────────────────────────────── */

.about-content {
  font-size: 1rem;
  line-height: 1.75;
}

.about-content > * + * {
  margin-top: 1.2rem;
}

.about-content h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: normal;
  font-style: italic;
  color: var(--fg-muted);
  margin-top: 2rem;
  line-height: 1.75;
}

.about-content a {
  color: var(--fg);
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s;
}

.about-content a:hover {
  text-decoration-color: var(--fg);
}
