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

/* ===== Variables ===== */
:root {
  --color-bg: #f4f1eb;
  --color-text: #1a1a1a;
  --color-muted: #999;
  --color-rule: #e4e4e4;
  --color-rule-light: rgba(0, 0, 0, 0.10);
  --color-accent: #b5451b;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --max-width: 660px;
  --max-width-wide: 960px;
}

/* ===== Base ===== */
html {
  font-size: 18px;
}

body {
  font-family: var(--font-serif);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  padding: 0 2rem;
}

/* ===== Wrapper ===== */
.wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
}

.wrapper--wide {
  max-width: var(--max-width-wide);
}

/* ===== Links ===== */
a {
  color: inherit;
  text-decoration: none;
}

/* ===== Navigation ===== */
nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2rem 0;
  margin-bottom: 0;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.611rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s;
}

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

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.8rem;
  flex-shrink: 0;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.611rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.nav-links a.active {
  color: var(--color-accent);
}

/* ===== Home ===== */
.home-header {
  padding: 3.5rem 0 2.5rem;
  text-align: left;
}

.home-title {
  font-family: var(--font-serif);
  font-size: clamp(1.96rem, 3.5vw, 3.15rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.home-subtitle {
  font-family: var(--font-mono);
  font-size: 0.611rem;
  color: var(--color-muted);
  letter-spacing: 0.03em;
}

/* ===== Tool tags ===== */
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 2rem;
}

.tool-tag {
  font-family: var(--font-mono);
  font-size: 0.556rem;
  letter-spacing: 0.03em;
  color: var(--color-text);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  line-height: 1;
}

/* ===== Section labels ===== */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.556rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-top: 1.75rem;
  display: block;
}

hr.section-rule {
  border: none;
  border-top: 1px solid var(--color-rule-light);
  margin: 3rem 0 0;
}

/* ===== Essay list (home) ===== */
.essay-list {
  list-style: none;
  border-top: 1px solid var(--color-rule-light);
}

.essay-list--home {
  margin-top: 0.5rem;
}

.essay-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--color-rule);
}

.essay-list--home .essay-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-rule-light);
}

/* Icon scaffold — hidden until populated */
.essay-icon {
  display: none;
}

.essay-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.556rem;
  color: var(--color-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
  white-space: nowrap;
}

.essay-list--home .essay-date {
  margin-bottom: 0;
}

.essay-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
  transition: color 0.15s;
}

.essay-list--home .essay-title {
  font-weight: 400;
  font-size: 1rem;
}

.essay-title:hover {
  color: var(--color-accent);
}

.essay-desc {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.889rem;
  color: var(--color-muted);
  margin-top: 0.3rem;
  line-height: 1.6;
}

.essay-tag {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
}

/* ===== Page header (writing, stack, about) ===== */
.page-header {
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--color-rule);
  margin-bottom: 0;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* ===== Essay page ===== */
.essay-header {
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--color-rule);
  margin-bottom: 2.5rem;
}

.essay-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.essay-body {
  padding-bottom: 4rem;
}

.essay-body p {
  margin-bottom: 1.5rem;
  line-height: 1.85;
}

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

.essay-back {
  display: block;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-rule);
  font-family: var(--font-mono);
  font-size: 0.611rem;
  color: var(--color-muted);
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.essay-back:hover {
  color: var(--color-text);
}

/* ===== Stack page ===== */
.stack-list {
  list-style: none;
  border-top: 1px solid var(--color-rule);
  margin-bottom: 0;
}

.stack-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--color-rule);
}

.stack-intro {
  font-family: var(--font-serif);
  font-size: 0.944rem;
  color: #555;
  line-height: 1.75;
  padding: 1.5rem 0 0.5rem;
}

.stack-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}

.stack-category {
  font-family: var(--font-mono);
  font-size: 0.556rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.stack-desc {
  font-family: var(--font-serif);
  font-size: 0.944rem;
  color: #555;
  line-height: 1.75;
}

/* ===== About page ===== */
.about-body {
  padding: 3.5rem 0 0;
}

.about-body p {
  margin-bottom: 1.5rem;
  line-height: 1.85;
  max-width: 580px;
}

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

.about-body a {
  color: var(--color-accent);
}

.about-body a:hover {
  text-decoration: underline;
}

.about-note {
  font-style: italic;
  font-size: 0.833rem;
  color: #666;
}

/* ===== AI note (homepage) ===== */
.ai-note {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: #c0c0c0;
  letter-spacing: 0.03em;
  margin-top: 1.25rem;
}

/* ===== Footer ===== */
footer {
  padding: 3rem 0 2.5rem;
  margin-top: 4rem;
  border-top: 1px solid var(--color-rule-light);
}

.footer-cols {
  display: flex;
  gap: 4rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.footer-value {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

/* Simple footer (inner pages) */
.footer-simple {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.556rem;
  color: #c0c0c0;
  letter-spacing: 0.04em;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  html {
    font-size: 17px;
  }

  body {
    padding: 0 1.25rem;
  }

  nav {
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem 0 1.75rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

  .home-header {
    padding: 2rem 0 2rem;
  }

  .home-title {
    font-size: 2.4rem;
  }

  .essay-list--home .essay-item {
    grid-template-columns: 60px 1fr;
  }

  .essay-tag {
    display: none;
  }

  .essay-header h1 {
    font-size: 1.6rem;
  }

  .footer-cols {
    flex-direction: column;
    gap: 2rem;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}
