:root {
  color-scheme: light;
  --bg-page: #f6f3ec;
  --bg-surface: #fdfbf7;
  --bg-subtle: #efeae0;
  --bg-code: #f1ede4;
  --border: #e5dfd2;
  --border-strong: #d4cbb9;

  --text-main: #1e2420;
  --text-muted: #434b46;
  --text-soft: #5d6660;

  --green-main: #1e6b4e;
  --green-hover: #16523b;
  --green-soft: #e4efe9;
  --green-line: #c4d9ce;

  --red-secondary: #c04a3e;
  --red-hover: #9f392f;
  --red-soft: #f9e8e6;

  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --max-width: 760px;
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-main);
  line-height: 1.6;
  background:
    radial-gradient(circle at 12% 0%, rgba(30, 107, 78, 0.045), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(192, 74, 62, 0.04), transparent 38%),
    var(--bg-page);
}

a {
  color: var(--green-main);
  text-decoration: none;
  transition: color var(--transition);
}

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

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  padding: 2.75rem 0 1.75rem;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.brand-dot-green {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--green-main);
}

.brand-dot-red {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--red-secondary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.header-nav a {
  color: var(--text-muted);
}

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

.site-intro {
  margin-top: 1.35rem;
}

.site-intro h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.5vw, 2.3rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

.site-intro p {
  margin: 0.65rem 0 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.35rem 0 0.5rem;
}

.tag-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.32rem 0.72rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--green-main);
  color: var(--green-main);
  background: var(--green-soft);
}

.filter-btn.is-active {
  background: var(--green-main);
  border-color: var(--green-main);
  color: #fdfbf7;
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Timeline */
.timeline-main {
  padding: 2rem 0 3.5rem;
}

.month-group {
  margin-bottom: 2.25rem;
}

.month-heading {
  margin: 0 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.timeline-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.65rem;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  bottom: 0.75rem;
  left: 5px;
  width: 2px;
  background: linear-gradient(to bottom, var(--green-line), var(--border));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-node {
  position: absolute;
  left: -1.65rem;
  top: 1.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-main);
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--green-main);
  transition: transform var(--transition);
}

.timeline-item[data-accent="secondary"] .timeline-node {
  background: var(--red-secondary);
  box-shadow: 0 0 0 1px var(--red-secondary);
}

.timeline-card {
  display: block;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.timeline-item:hover .timeline-node {
  transform: scale(1.18);
}

.timeline-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-main);
  box-shadow: 0 6px 18px rgba(30, 36, 32, 0.05);
}

.timeline-item[data-accent="secondary"] .timeline-card:hover {
  border-color: var(--red-secondary);
}

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-soft);
}

.entry-date {
  color: var(--text-muted);
  font-weight: 500;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--green-soft);
  color: var(--green-main);
}

.status-badge--secondary {
  background: var(--red-soft);
  color: var(--red-secondary);
}

.hardware-pill {
  color: var(--text-soft);
}

.entry-title {
  margin: 0.45rem 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-main);
}

.timeline-card:hover .entry-title {
  color: var(--green-main);
}

.timeline-item[data-accent="secondary"] .timeline-card:hover .entry-title {
  color: var(--red-secondary);
}

.entry-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.entry-footer {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chip {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.14rem 0.52rem;
  border-radius: var(--radius-sm);
}

.read-more {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--green-main);
}

.timeline-item[data-accent="secondary"] .read-more {
  color: var(--red-secondary);
}

.empty-state {
  display: none;
  padding: 2rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.empty-state.is-visible {
  display: block;
}

/* Single Post Page */
.post-main {
  padding: 2rem 0 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--green-main);
}

.post-article {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.35rem, 3.5vw, 2.35rem);
}

.post-header {
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0.6rem 0 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3.5vw, 2.2rem);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

.post-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.post-content {
  margin-top: 1.65rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-main);
}

.post-content h2,
.post-content h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.3;
  margin: 1.9rem 0 0.7rem;
  color: var(--text-main);
}

.post-content h2 {
  font-size: 1.42rem;
}

.post-content h3 {
  font-size: 1.18rem;
}

.post-content p {
  margin: 0 0 1.1rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.15rem;
  padding-left: 1.35rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content blockquote {
  margin: 1.4rem 0;
  padding: 0.75rem 1.1rem;
  border-left: 3px solid var(--green-main);
  background: var(--green-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-main);
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--bg-code);
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  color: var(--text-main);
}

.post-content pre {
  margin: 1.35rem 0;
  padding: 1rem 1.15rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.55;
}

.post-content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.post-nav {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.95rem 1.05rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition);
}

.post-nav-card:hover {
  border-color: var(--green-main);
  transform: translateY(-1px);
}

.post-nav-card--next {
  text-align: right;
  grid-column: 2;
}

.post-nav-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-soft);
}

.post-nav-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-main);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .site-header {
    padding: 2rem 0 1.4rem;
  }

  .timeline-list {
    padding-left: 1.35rem;
  }

  .timeline-node {
    left: -1.35rem;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-card--next {
    grid-column: auto;
    text-align: left;
  }
}
