:root {
  --bg: #ddebd7;
  --heading: #1b1f1d;
  --body: #4f5a53;
  --muted: #7a827c;
  --nav: #7d746d;
  --nav-active: #1b1f1d;
  --accent: #a0587c;
  --font: "Inter", sans-serif;
  --font-nav: "Cormorant Garamond", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  overscroll-behavior-y: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 3rem 0 5rem;
  display: grid;
  grid-template-columns: 90px minmax(0, 760px);
  column-gap: 2rem;
  align-items: start;
}

.side-nav {
  position: sticky;
  top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
  padding-top: 0.15rem;
}

.side-link {
  text-decoration: none;
  color: var(--nav);
  font-family: var(--font-nav);
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.25s ease;
}

.side-link:hover {
  color: var(--heading);
}

.side-link.active {
  color: var(--nav-active);
}

.page {
  width: 100%;
}

.site-header {
  margin-bottom: 5rem;
}

.site-name {
  display: inline-block;
  text-decoration: none;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.intro {
  margin-bottom: 5rem;
  max-width: 38rem;
}

.intro-line {
  margin: 0;
  color: var(--body);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.section {
  margin-top: 5rem;
}

.section-head {
  margin-bottom: 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.section-head h2 {
  margin: 0;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-head a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.essay-list {
  display: grid;
  gap: 0.15rem;
}

.essay-item {
  display: block;
  padding: 0.65rem 0;
  text-decoration: none;
}

.essay-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.55rem;
}

.essay-title {
  color: var(--heading);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  transition: color 0.34s cubic-bezier(.22, .61, .36, 1);
}

.essay-dots {
  position: relative;
  height: 0.7em;
  align-self: center;
  transform: translateY(0.08em);
}

.essay-dots::before,
.essay-dots::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 8px 8px;
  background-position: left center;
  background-repeat: repeat-x;
}

.essay-dots::before {
  background-image: radial-gradient(circle, rgba(27, 31, 29, 0.4) 1.15px, transparent 1.25px);
}

.essay-dots::after {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 1) 1.15px, transparent 1.25px);
  opacity: 0;
  transition: opacity 0.34s cubic-bezier(.22, .61, .36, 1);
}

.essay-meta {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.34s cubic-bezier(.22, .61, .36, 1);
}

.essay-item:hover .essay-title,
.essay-item:hover .essay-meta {
  color: #111311;
}

.essay-item:hover .essay-dots::after {
  opacity: 1;
}

.notes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2.5rem;
  align-items: start;
}

.notes-tree {
  display: grid;
  gap: 0.55rem;
}

.notes-branch {
  margin: 0;
}

.notes-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--heading);
  font: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.notes-toggle::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.8rem;
  transition:
    transform 0.42s cubic-bezier(.22, .61, .36, 1),
    color 0.22s ease;
}

.notes-branch.is-open > .notes-toggle::before {
  transform: rotate(90deg);
}

.notes-label {
  color: var(--heading);
  font-weight: 500;
  transition: color 0.22s ease;
}

.notes-toggle:hover .notes-label,
.notes-toggle:hover::before {
  color: #111311;
}

.notes-panel {
  overflow: hidden;
  height: 0;
  margin-top: 0;
  margin-left: 0.35rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(27, 31, 29, 0.12);
  transition:
    height 0.42s cubic-bezier(.22, .61, .36, 1),
    margin-top 0.42s cubic-bezier(.22, .61, .36, 1);
}

.notes-branch.is-open > .notes-panel {
  margin-top: 0.5rem;
}

.notes-panel-inner {
  padding: 0;
}

.notes-leaf {
  display: block;
  text-decoration: none;
  color: var(--body);
  padding: 0.15rem 0;
  transition: color 0.22s ease;
  cursor: default;
}

.notes-leaf:hover {
  color: #111311;
}

.note-preview {
  position: sticky;
  top: 3rem;
  min-height: 120px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition:
    opacity 0.28s cubic-bezier(.22, .61, .36, 1),
    transform 0.28s cubic-bezier(.22, .61, .36, 1);
}

.note-preview.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.note-preview-inner {
  padding-top: 0.15rem;
}

.note-preview-date {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.45rem;
}

.note-preview-title {
  color: var(--heading);
  font-size: 0.98rem;
  font-weight: 500;
  margin-bottom: 0.45rem;
}

.note-preview-body {
  color: var(--body);
  font-size: 0.96rem;
  line-height: 1.5;
}

.post-page {
  max-width: 38rem;
}

.post-title {
  margin: 0.4rem 0 1.25rem;
  color: var(--heading);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 500;
}

.post-body {
  color: var(--body);
  font-size: 1.02rem;
}

.post-body p {
  margin: 1.2rem 0;
}

@media (max-width: 980px) {
  .notes-layout {
    grid-template-columns: 1fr;
  }

  .note-preview {
    display: none;
  }
}

@media (max-width: 800px) {
  .page-shell {
    width: min(760px, calc(100% - 1.5rem));
    grid-template-columns: 1fr;
    row-gap: 1.5rem;
    padding-top: 2.5rem;
  }

  .side-nav {
    position: static;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    padding-top: 0;
  }

  .site-header {
    margin-bottom: 3rem;
  }

  .intro {
    margin-bottom: 4rem;
  }

  .section {
    margin-top: 4rem;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .essay-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .essay-dots {
    display: none;
  }
}
