:root {
  --ink: #1a1a1a;
  --ink-soft: #6b6b6b;
  --paper: #ffffff;
  --paper-soft: #fafaf9;
  --line: #ececec;
  --line-strong: #d8d8d5;
  --accent: #0f7b6c;
  --accent-dark: #0a5c51;
  --accent-soft: #e6f4f1;
  --serif: Georgia, Cambria, "Times New Roman", serif;
  --sans: "Work Sans", system-ui, sans-serif;
  --mono: "SF Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

a { color: inherit; text-decoration: none; }

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

.wrap { max-width: 1312px; margin: 0 auto; padding: 0 64px; }

/* Header */
.site-header {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 64px;
}
.site-header-inner {
  max-width: 1312px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
}
.site-header .wordmark {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-right: 48px;
}
.site-nav { display: flex; gap: 32px; flex-grow: 1; }
.site-nav a { font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.site-nav a.current { color: var(--ink); }
.header-right { display: flex; align-items: center; gap: 20px; }
.btn-pill {
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-pill:hover { background: var(--accent-dark); }

/* Footer */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding: 40px 64px;
}
.site-footer-inner {
  max-width: 1312px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-footer, .site-footer a { font-size: 14px; color: var(--ink-soft); }
.site-footer .links { display: flex; gap: 24px; }

/* Home layout */
.featured {
  padding: 0 64px;
  border-bottom: 1px solid var(--line);
}
.featured-inner {
  max-width: 1312px;
  margin: 0 auto;
  padding: 64px 0 56px;
  display: flex;
  gap: 56px;
  align-items: center;
}
.featured-copy { flex: 1 1 0; display: flex; flex-direction: column; gap: 18px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.featured-title { font-family: var(--serif); font-size: 44px; line-height: 1.18; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.featured-dek { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: #4a4a4a; margin: 0; }
.image-slot {
  border-radius: 12px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.main-columns { display: flex; gap: 64px; max-width: 1312px; margin: 0 auto; padding: 56px 64px 0; align-items: flex-start; }
.post-list { flex: 1 1 0; display: flex; flex-direction: column; }
.post-card { display: flex; gap: 32px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.post-card-body { flex-grow: 1; display: flex; flex-direction: column; gap: 10px; }
.byline { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.avatar {
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.post-title { font-family: var(--serif); font-size: 26px; line-height: 1.3; font-weight: 700; margin: 0; }
.post-title:hover { color: var(--accent); }
.post-excerpt { font-size: 16px; line-height: 1.6; color: var(--ink-soft); margin: 0; max-width: 620px; }
.meta-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.tag-pill { font-size: 13px; background: var(--accent-soft); color: var(--accent); padding: 4px 12px; border-radius: 999px; font-weight: 500; }
.thumb { width: 200px; height: 140px; border-radius: 8px; object-fit: cover; }
.featured-thumb { width: 480px; height: 320px; border-radius: 12px; object-fit: cover; }

/* Sidebar */
.sidebar { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 40px; }
.subscribe-box { background: var(--paper-soft); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.subscribe-box h3 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 700; }
.subscribe-box p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.subscribe-form { display: flex; gap: 8px; }
.subscribe-form input {
  flex-grow: 1; min-width: 0; font-family: var(--sans); font-size: 14px;
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 8px;
}
.sidebar h3.label { margin: 0 0 16px; font-size: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.topic-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.topic-pill {
  font-size: 14px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  transition: all 0.15s;
}
.topic-pill:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.ranked-list { display: flex; flex-direction: column; gap: 18px; }
.ranked-list a { display: flex; gap: 14px; align-items: baseline; }
.ranked-list .num { font-family: var(--serif); font-size: 20px; color: var(--line-strong); font-weight: 700; }
.ranked-list .title { font-size: 15px; font-weight: 500; line-height: 1.4; }

/* Article */
.article-header { width: 760px; max-width: 100%; margin: 0 auto; padding: 64px 24px 0; display: flex; flex-direction: column; gap: 22px; }
.article-header h1 { margin: 0; font-family: var(--serif); font-size: 48px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.article-dek { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.5; color: #4a4a4a; }
.article-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.article-meta .who { display: flex; align-items: center; gap: 14px; }
.article-meta .who .name { font-size: 15px; font-weight: 600; }
.article-meta .who .when { font-size: 14px; color: var(--ink-soft); }
.share-icons { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.icon-btn:hover { background: var(--paper-soft); }
.cover-wrap { width: 1000px; max-width: 100%; margin: 40px auto 0; padding: 0 24px; }
.cover-wrap .image-slot { height: 460px; }
.cover-wrap img { width: 100%; height: 460px; object-fit: cover; border-radius: 12px; }

.article-body { width: 760px; max-width: 100%; margin: 0 auto; padding: 48px 24px 0; }
.article-body p, .article-body ul, .article-body ol {
  font-family: var(--serif); font-size: 20px; line-height: 1.8; color: #242424; margin: 0 0 26px;
}
.article-body h2 { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.3; margin: 44px 0 18px; }
.article-body h3 { font-family: var(--serif); font-size: 24px; font-weight: 700; line-height: 1.3; margin: 36px 0 16px; }
.article-body a { color: var(--accent); text-decoration: underline; }
.article-body a:hover { color: var(--accent-dark); }
.article-body code {
  font-family: var(--mono); font-size: 0.85em; background: var(--paper-soft); padding: 2px 6px; border-radius: 4px;
}
.article-body pre {
  background: #f6f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 24px 28px;
  overflow-x: auto; margin: 0 0 26px;
}
.article-body pre code {
  font-family: var(--mono); font-size: 14.5px; line-height: 1.7; color: #24292e; background: none; padding: 0;
  white-space: pre;
}
.article-body blockquote {
  margin: 8px 0 26px; padding: 4px 0 4px 28px; border-left: 3px solid var(--accent);
}
.article-body blockquote p {
  font-size: 24px; font-style: italic; margin: 0;
}
.article-body img { border-radius: 10px; margin: 0 0 26px; }

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 26px;
  font-family: var(--sans);
  font-size: 15px;
}
.article-body th, .article-body td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.article-body th { font-weight: 600; border-bottom: 2px solid var(--line-strong); }
.article-body td { color: #333; }

.author-bio {
  width: 760px; max-width: 100%; margin: 56px auto 0; padding: 32px 24px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; gap: 20px; align-items: flex-start;
}
.author-bio .name { font-size: 17px; font-weight: 700; }
.author-bio p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }

.related { width: 1000px; max-width: 100%; margin: 56px auto 0; padding: 0 24px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.related-grid a { display: flex; flex-direction: column; gap: 12px; }
.related-grid .title { font-family: var(--serif); font-size: 18px; font-weight: 700; line-height: 1.35; }
.related-grid .thumb { height: 140px; width: 100%; }

/* Topics index */
.page-header { max-width: 1312px; margin: 0 auto; padding: 56px 64px 32px; }
.page-header h1 { font-family: var(--serif); font-size: 40px; margin: 0 0 12px; }
.page-header p { color: var(--ink-soft); font-size: 17px; margin: 0; }

@media (max-width: 900px) {
  .wrap, .site-header, .featured, .main-columns, .site-footer, .page-header { padding-left: 24px; padding-right: 24px; }
  .main-columns { flex-direction: column; }
  .sidebar { width: 100%; }
  .featured-inner { flex-direction: column; align-items: stretch; }
  .featured .image-slot, .featured .featured-thumb { width: 100% !important; height: 240px !important; }
  .article-header h1 { font-size: 34px; }
}

/* Below ~600px a multi-column table no longer fits the article column, so
   each row becomes its own card and cells stack with their header as a label. */
@media (max-width: 600px) {
  .article-body table,
  .article-body thead,
  .article-body tbody,
  .article-body tr,
  .article-body td {
    display: block;
    width: 100%;
  }
  .article-body thead { display: none; }
  .article-body tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 16px;
    padding: 4px 0;
  }
  .article-body td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
  }
  .article-body td:last-child { border-bottom: none; }
  .article-body td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    margin-bottom: 4px;
  }
}
