:root {
  --color-bg: #ffffff;
  --color-surface: #f6f6f7;
  --color-text: #1a1a1a;
  --color-text-muted: #5f6368;
  --color-accent: #2563eb;
  --color-accent-2: #2563eb;
  --color-border: #e5e7eb;
  --color-code-bg: #f1f2f4;
  --color-blockquote-border: #d1d5db;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-card-hover: 0 10px 24px rgba(16, 24, 40, 0.09);
  --glow-title: none;
  --glow-accent: none;
  --font-sans: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --content-width: 42rem;
  --list-width: 74rem;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --color-bg: #000000;
  --color-surface: #0c0c16;
  --color-text: #a6ffe0;
  --color-text-muted: #6fd9c7;
  --color-accent: #ff3df0;
  --color-accent-2: #00f6ff;
  --color-border: rgba(0, 246, 255, 0.28);
  --color-code-bg: #10101f;
  --color-blockquote-border: #b24bff;
  --shadow-card: 0 0 0 1px rgba(0, 246, 255, 0.08);
  --shadow-card-hover: 0 0 10px rgba(0, 246, 255, 0.55),
    0 0 28px rgba(255, 61, 240, 0.2);
  --glow-title: 0 0 6px rgba(0, 246, 255, 0.85), 0 0 22px rgba(0, 246, 255, 0.35);
  --glow-accent: 0 0 6px rgba(255, 61, 240, 0.75), 0 0 18px rgba(255, 61, 240, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --color-bg: #000000;
    --color-surface: #0c0c16;
    --color-text: #a6ffe0;
    --color-text-muted: #6fd9c7;
    --color-accent: #ff3df0;
    --color-accent-2: #00f6ff;
    --color-border: rgba(0, 246, 255, 0.28);
    --color-code-bg: #10101f;
    --color-blockquote-border: #b24bff;
    --shadow-card: 0 0 0 1px rgba(0, 246, 255, 0.08);
    --shadow-card-hover: 0 0 10px rgba(0, 246, 255, 0.55),
      0 0 28px rgba(255, 61, 240, 0.2);
    --glow-title: 0 0 6px rgba(0, 246, 255, 0.85), 0 0 22px rgba(0, 246, 255, 0.35);
    --glow-accent: 0 0 6px rgba(255, 61, 240, 0.75), 0 0 18px rgba(255, 61, 240, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

.site-header__inner {
  max-width: var(--list-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-accent-2);
  text-shadow: var(--glow-title);
}

.site-title:hover {
  text-decoration: none;
  opacity: 0.85;
}

.theme-toggle {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--color-accent-2);
  box-shadow: var(--shadow-card-hover);
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

main.main--list {
  max-width: var(--list-width);
}

/* Post list (index page) */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.post-card {
  padding: 1.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-accent-2);
}

.post-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.4;
}

.post-card__title a {
  color: var(--color-text);
}

.post-card__meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0 0 0.6rem;
}

.post-card__excerpt {
  margin: 0;
  color: var(--color-text-muted);
  flex-grow: 1;
}

.post-card__tags {
  margin-top: 1rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.76rem;
  color: var(--color-accent-2);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
}

.empty-state,
.error-state {
  color: var(--color-text-muted);
  padding: 2rem 0;
  grid-column: 1 / -1;
}

/* Post page */

.post-header {
  margin-bottom: 2rem;
}

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

.post-header__title {
  font-size: 2rem;
  line-height: 1.3;
  margin: 0 0 0.6rem;
  color: var(--color-text);
  text-shadow: var(--glow-title);
}

.post-header__meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.post-content {
  font-size: 1.05rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  line-height: 1.4;
  margin: 2rem 0 0.8rem;
  color: var(--color-accent-2);
  text-shadow: var(--glow-title);
}

.post-content h1 { font-size: 1.6rem; }
.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1.05rem; }

.post-content p,
.post-content ul,
.post-content ol {
  margin: 0 0 1.2rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.4rem;
}

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

.post-content img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin: 1.2rem 0;
}

.post-content blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--color-blockquote-border);
  color: var(--color-text-muted);
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.post-content pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.2rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.7rem;
  text-align: left;
}

.post-content th {
  background: var(--color-surface);
}

.site-footer {
  max-width: var(--list-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

/* Mobile */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .site-header__inner {
    padding: 1rem;
  }

  .post-header__title {
    font-size: 1.6rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content pre {
    padding: 0.85rem;
  }
}
