:root {
  --bg: #d9ecfb;
  --surface: #ffffff;
  --surface-soft: #eef6ff;
  --line: #b8d1e8;
  --text: #132333;
  --muted: #4f667a;
  --accent: #2c6c9c;
  --accent-soft: #c6e3f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background: radial-gradient(circle at top right, #f1f9ff 0%, var(--bg) 42%, #c6e3f8 100%);
}

a {
  color: #165f9a;
}

a:hover {
  color: #0f4a78;
}

.topbar {
  width: min(1500px, 96%);
  margin: 18px auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.brand-copy h1 a {
  color: inherit;
  text-decoration: none;
}

.brand-copy h1 a:hover {
  text-decoration: underline;
}

.brand-copy p {
  margin: 3px 0 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.top-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.top-meta strong {
  color: var(--text);
}

.home-summary-link {
  color: inherit;
  text-decoration: none;
}

.home-summary-link:hover {
  text-decoration: underline;
}

.app-layout {
  width: min(1500px, 96%);
  margin: 0 auto 28px auto;
  display: flex;
  gap: 14px;
  min-height: calc(100vh - 116px);
}

.sidebar {
  width: min(380px, 32vw);
  min-width: 300px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f5fbff 0%, #e7f3ff 100%);
}

.sidebar-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.sidebar-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-actions button,
.sidebar-actions a {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #214964;
  text-decoration: none;
  font-size: 0.82rem;
  padding: 7px 10px;
  cursor: pointer;
}

.sidebar-actions button:hover,
.sidebar-actions a:hover,
.sidebar-actions button:focus-visible,
.sidebar-actions a:focus-visible,
.sidebar-actions .is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #12364f;
  outline: none;
}

.timeline-list {
  overflow: auto;
  padding: 8px;
  min-height: 0;
}

.timeline-year {
  margin: 12px 8px 6px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.timeline-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 9px 8px;
}

.timeline-item:hover,
.timeline-item:focus-visible {
  border-color: var(--line);
  background: var(--surface-soft);
  outline: none;
}

.timeline-item.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.timeline-marker {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-radius: 999px;
  border: 1px solid #7897b5;
  background: #fff;
}

.timeline-item.is-active .timeline-marker {
  background: var(--accent);
  border-color: var(--accent);
}

.timeline-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.timeline-copy strong {
  font-size: 0.93rem;
  line-height: 1.3;
  font-weight: 600;
}

.timeline-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.viewer-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.viewer-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f3faff 0%, #e5f2ff 100%);
  padding: 12px 16px;
}

.viewer-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.viewer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.loading,
.error {
  margin: 0;
  color: var(--muted);
}

.email-entry,
.about-entry,
.post-list-entry {
  max-width: 900px;
  margin: 0 auto;
}

.entry-header h1,
.about-entry h1,
.post-list-entry h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.18;
}

.entry-meta {
  margin: 10px 0 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta-sep {
  margin: 0 7px;
}

.entry-content {
  margin-top: 18px;
}

.entry-content figure {
  margin: 0 0 12px 0;
}

.entry-content img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.entry-content figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.entry-content p,
.about-entry p {
  line-height: 1.62;
  margin: 0 0 1.05em 0;
  font-size: 1.02rem;
}

.post-list-intro {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.post-list-items {
  margin: 18px 0 0 0;
  padding: 0;
  list-style: none;
}

.post-list-item {
  border-top: 1px solid var(--line);
}

.post-list-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  padding: 12px 0;
}

.post-list-link:hover {
  color: #0f4a78;
}

.post-list-link strong {
  font-size: 1.02rem;
}

.post-list-date {
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.entry-links {
  line-height: 1.7;
}

.about-signoff {
  margin-top: 1.6em;
  font-weight: 600;
}

noscript p {
  width: min(920px, 92%);
  margin: 0 auto 24px auto;
  color: #6d3323;
  background: #fbeae4;
  border: 1px solid #ebc8bc;
  border-radius: 8px;
  padding: 9px 12px;
}

@media (max-width: 980px) {
  .app-layout {
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    max-height: none;
  }

  .timeline-list {
    max-height: 300px;
  }

  .viewer-body {
    min-height: 58vh;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .top-meta {
    border-radius: 10px;
    white-space: normal;
  }

  .viewer-body {
    padding: 14px;
  }

  .entry-content p,
  .about-entry p {
    font-size: 0.98rem;
  }

  .post-list-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
