/* ----- theme ----- */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1e22;
  --text: #d4d4d8;
  --text-heading: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #8b8b96;
  --text-body: #c4c4cc;
  --border: #3f3f46;
  --border-dotted: #52525b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --nav-hover: #f4f4f5;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-heading: #0a0a0a;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --text-body: #374151;
  --border: #e5e7eb;
  --border-dotted: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #2563eb;
  --nav-hover: #111827;
}

/* ----- reset & base ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ----- main container ----- */
.container {
  max-width: 640px;
  width: 100%;
  background: transparent;
}

/* ----- site header ----- */
header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.theme-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text-heading);
  border-color: var(--text-subtle);
  background: var(--border);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 1rem;
  height: 1rem;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

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

.subhead {
  font-size: 1rem;
  color: var(--text-subtle);
  line-height: 1.5;
}

.nav-links {
  display: flex;
  gap: 2rem;
  font-size: 0.95rem;
  font-weight: 450;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-subtle);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
  border-bottom: 2px solid transparent;
  line-height: 1.5;
}

.nav-links a:hover {
  color: var(--nav-hover);
  border-bottom-color: var(--accent);
}

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

/* ----- typography & spacing ----- */
h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  line-height: 1.2;
}

.site-title {
  color: inherit;
  text-decoration: none;
}

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

/* ----- blog post ----- */
.post {
  margin-bottom: 2.5rem;
}

.post-with-preview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.post-body {
  min-width: 0;
  flex: 1;
}

.post-preview-link {
  display: block;
  flex-shrink: 0;
}

.post-preview {
  display: block;
  width: 12rem;
  aspect-ratio: 14 / 9;
  height: auto;
  object-fit: cover;
  object-position: center;
}

.post-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
  color: var(--text-heading);
}

.post-title a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-title a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

.post-excerpt {
  font-size: 0.95rem;
  color: var(--text-body);
  margin-bottom: 0.25rem;
  line-height: 1.7;
}

.post-divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

.post-full .post-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.post-hero {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.25rem 0 0;
}

.post-content {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-body);
  line-height: 1.7;
}

.post-content p + p {
  margin-top: 1.25rem;
}

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
}

.post-content figure {
  margin: 1.5rem 0;
}

.post-content figure img {
  margin: 0;
}

.post-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-content h2,
.post-content h3 {
  color: var(--text-heading);
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 500;
}

.post-content ul,
.post-content ol {
  margin: 1rem 0 1rem 1.25rem;
}

.post-content li > ul,
.post-content li > ol {
  margin-top: 0.1rem;
  margin-bottom: 0;
}

.post-content li + li {
  margin-top: 0.1rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.post-content a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.post-back {
  margin-top: 2.5rem;
}

.post-back-top {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.post-back a {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.post-back a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.view-title {
  display: none;
}

.archive-intro {
  font-size: 0.95rem;
  color: var(--text-subtle);
  margin-bottom: 2rem;
}

[data-home-view="title"] .view-title {
  display: block;
}

[data-home-view="title"] .view-timeline {
  display: none;
}

.timeline-group + .timeline-group {
  margin-top: 2.5rem;
}

.timeline-year {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.timeline-row {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: baseline;
  padding: 0.55rem 0;
  padding-left: 1.25rem;
  text-decoration: none;
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.timeline-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.45;
}

.timeline-row:hover .timeline-title {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.view-switch {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.view-switch a {
  color: var(--text-subtle);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-dotted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.view-switch a:hover,
.view-switch a.active {
  color: var(--text-heading);
  border-bottom-color: var(--text-subtle);
}

.view-switch-sep {
  margin: 0 0.4rem;
  color: var(--text-muted);
}

main:has(.view-switch) + .footer {
  margin-top: 0.75rem;
  padding-top: 0;
  border-top: none;
}
.footer {
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  text-align: left;
}

.footer a {
  color: var(--text-subtle);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-dotted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer a:hover {
  color: var(--text-heading);
  border-bottom-color: var(--text-subtle);
}

/* ----- responsive ----- */
@media (max-width: 480px) {
  body {
    padding: 1.25rem 0.75rem;
  }

  .site-header {
    gap: 1rem;
  }

  .nav-links {
    gap: 1.25rem;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .post-title {
    font-size: 1.1rem;
  }

  .post-with-preview {
    gap: 0.85rem;
  }

  .post-preview {
    width: 7.5rem;
  }
}
