:root {
  color-scheme: light dark;
  --paper: #f4f0e7;
  --ink: #171812;
  --muted: #626457;
  --line: rgba(23, 24, 18, 0.14);
  --panel: rgba(255, 255, 250, 0.7);
  --accent: #0c695d;
  --accent-soft: rgba(12, 105, 93, 0.12);
  --warn: #a64f35;
  --shadow: 0 18px 54px rgba(29, 31, 22, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(12, 105, 93, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(12, 105, 93, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 88% 8%, rgba(166, 79, 53, 0.16), transparent 26%),
    var(--paper);
  background-size: 42px 42px, 42px 42px, auto, auto;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 70px;
}

.page-shell.narrow {
  width: min(780px, calc(100% - 32px));
}

.hero {
  min-height: 34vh;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.home-link,
.date,
.top-nav a,
.section-head p,
.tag-page-head p,
.tag-page-head span {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  text-decoration: none;
}

.hero h1 {
  margin: 16px 0 0;
  font-size: clamp(64px, 14vw, 148px);
  line-height: 0.84;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.42;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-top: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.tag-cloud,
.note-card,
.tag-page-head {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tag-cloud {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

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

.tags a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-decoration: none;
}

.tags span {
  color: var(--muted);
}

.feed {
  display: grid;
  gap: 14px;
}

.note-card {
  padding: 20px;
}

.note-card header {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.note-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.note-body {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.75;
}

.note-body p {
  margin: 0 0 1em;
}

.note-body p:last-child {
  margin-bottom: 0;
}

.note-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.source {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.top-nav {
  margin-bottom: 18px;
}

.tag-page-head {
  margin-bottom: 14px;
  padding: 20px;
}

.tag-page-head p,
.tag-page-head h1,
.tag-page-head span {
  margin: 0;
}

.tag-page-head h1 {
  margin: 8px 0;
  font-size: clamp(42px, 8vw, 84px);
  line-height: 0.9;
  letter-spacing: 0;
}

@media (max-width: 880px) {
  .page-shell {
    padding-top: 34px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .note-card footer {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12140f;
    --ink: #f2efe5;
    --muted: #b6b2a4;
    --line: rgba(242, 239, 229, 0.15);
    --panel: rgba(20, 23, 17, 0.76);
    --accent: #6bc1af;
    --accent-soft: rgba(107, 193, 175, 0.12);
    --warn: #e18f72;
    --shadow: 0 18px 54px rgba(0, 0, 0, 0.24);
  }
}
