* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #fff;
  --text: #222;
  --text-light: #555;
  --text-muted: #888;
  --text-faint: #aaa;
  --link: #0055cc;
  --link-hover: #003d99;
  --code-bg: #f4f4f4;
  --border: #ddd;
  --border-light: #eee;
  --th-bg: #f8f8f8;
  --tooltip-bg: #222;
  --tooltip-text: #fff;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #ddd;
  --text-light: #aaa;
  --text-muted: #888;
  --text-faint: #666;
  --link: #6cb4ff;
  --link-hover: #9cccff;
  --code-bg: #2a2a2a;
  --border: #444;
  --border-light: #333;
  --th-bg: #2a2a2a;
  --tooltip-bg: #ddd;
  --tooltip-text: #1a1a1a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding: 3rem 1.5rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

nav {
  margin-bottom: 2rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}

nav a {
  margin-right: 1.2rem;
  color: var(--text-light);
}

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

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-muted);
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--text);
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.about-center {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
}

.about-center .profile-photo {
  width: 280px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: cover;
}

.about-text {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-photo {
  width: 200px;
  border-radius: 8px;
}

h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1rem;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.3rem;
}

.home-layout {
  display: flex;
  gap: 3rem;
  max-width: 1060px;
  margin: 0 auto;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
}

.sidebar .post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

.sidebar .post-list time {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: block;
  font-variant-numeric: tabular-nums;
}

.sidebar .post-list a,
.sidebar .post-list span {
  font-size: 0.9rem;
}

.home-layout main {
  max-width: none;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.post-list {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

.post-list li {
  margin-bottom: 0.8rem;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.post-list time {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.post-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.post-header time {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.copy-email {
  cursor: pointer;
  border-bottom: 1px dashed var(--link);
  color: var(--link);
  transition: color 0.2s;
}

.copy-email:hover {
  color: var(--link-hover);
}

.copy-tooltip {
  position: absolute;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  pointer-events: none;
  animation: fade-out 2s forwards;
}

@keyframes fade-out {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
}

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-light);
  margin: 1.2rem 0;
}

code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 1.2rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
  text-align: left;
}

th {
  background: var(--th-bg);
}

hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 2rem 0;
}

.back-link {
  display: inline-block;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

@media (max-width: 700px) {
  .home-layout {
    flex-direction: column;
    gap: 2rem;
  }

  .sidebar {
    width: 100%;
  }

  body {
    padding: 2rem 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .about-center {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}
