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

:root {
  --black: #111;
  --gray: #888;
  --light: #ccc;
  --white: #fff;
  --bg: #fff;
  --text: #111;
  --code-bg: #f5f5f5;
  --pre-bg: #1a1a1a;
  --pre-text: #e5e5e5;
  --table-header-bg: #f9f9f9;
}

[data-theme="dark"] {
  --black: #fff;
  --gray: #888;
  --light: #444;
  --white: #111;
  --bg: #111;
  --text: #fff;
  --code-bg: #2a2a2a;
  --pre-bg: #0a0a0a;
  --pre-text: #e5e5e5;
  --table-header-bg: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --black: #fff;
    --gray: #888;
    --light: #444;
    --white: #111;
    --bg: #111;
    --text: #fff;
    --code-bg: #2a2a2a;
    --pre-bg: #0a0a0a;
    --pre-text: #e5e5e5;
    --table-header-bg: #1a1a1a;
  }
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  z-index: 100;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.theme-toggle:hover {
  opacity: 1;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text);
}

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

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

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

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon {
    display: none;
  }
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--gray);
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  padding: 48px 0 0;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.nav a {
  color: var(--gray);
  transition: color 0.2s;
}

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

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 64px 0;
}

/* Hero */
.hero {
  margin-bottom: 80px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero p {
  font-size: 14px;
  color: var(--gray);
}

/* Posts */
.posts {
  border-top: 1px solid var(--light);
  padding-top: 32px;
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 16px;
}

.post-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  transition: color 0.2s;
}

.post-list a:hover {
  color: var(--gray);
}

.post-title {
  font-size: 15px;
}

.post-date {
  font-size: 13px;
  color: var(--light);
  flex-shrink: 0;
}

.empty {
  color: var(--light);
  font-size: 14px;
  letter-spacing: 0.2em;
}

/* Footer */
.footer {
  padding: 48px 0;
  font-size: 12px;
  color: var(--light);
}

/* Post Page */
.post-main {
  justify-content: flex-start;
  padding-top: 48px;
}

.post-header {
  margin-bottom: 48px;
}

.post-meta {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 12px;
}

.post-category {
  margin-left: 12px;
  padding: 2px 8px;
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.post .post-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-content {
  font-size: 15px;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--light);
}

.post-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 16px 20px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content code {
  font-family: "SF Mono", Monaco, "Consolas", monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.post-content pre {
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 20px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 24px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-content blockquote {
  border-left: 2px solid var(--light);
  padding-left: 16px;
  margin: 24px 0;
  color: var(--gray);
  font-style: italic;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content strong {
  font-weight: 600;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.post-content th,
.post-content td {
  padding: 10px 12px;
  border: 1px solid var(--light);
  text-align: left;
}

.post-content th {
  background: var(--table-header-bg);
  font-weight: 600;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--light);
  font-size: 14px;
}

.post-nav a {
  color: var(--gray);
}

.post-nav a:hover {
  color: var(--black);
}

/* About Page */
.about-main {
  justify-content: center;
}

.about h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.about-desc {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 48px;
}

.about-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--black);
}

.about-content p {
  margin-bottom: 24px;
}

.about-meta {
  list-style: none;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--light);
}

.about-meta li {
  display: flex;
  gap: 24px;
  font-size: 14px;
  padding: 6px 0;
}

.about-key {
  flex-shrink: 0;
  width: 72px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  padding-top: 4px;
}

.about-val {
  color: var(--text);
}

.about-val a {
  border-bottom: 1px solid var(--light);
}

.about-val a:hover {
  border-bottom-color: var(--gray);
}

.about-links {
  list-style: none;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--light);
}

.about-links li {
  margin-bottom: 8px;
}

.about-links a {
  font-size: 14px;
  color: var(--gray);
}

.about-links a:hover {
  color: var(--black);
}

/* Site Hero */
.site-hero {
  margin-bottom: 40px;
}

.site-hero h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.site-hero p {
  font-size: 13px;
  color: var(--gray);
}

/* Featured Card (Painting Star) */
.featured-card {
  border: 1px solid var(--light);
  border-radius: 8px;
  padding: 28px 28px 24px;
  margin-bottom: 56px;
}

.featured-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 14px;
}

.featured-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.featured-desc {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 16px;
}

.featured-posts {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--light);
}

.featured-posts .section-label {
  margin-bottom: 16px;
}

.app-store-link a {
  font-size: 14px;
  color: var(--gray);
}

.app-store-link a:hover {
  color: var(--black);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blog-link {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--light);
}

.dev-blog-link {
  font-size: 13px;
  color: var(--gray);
}

.dev-blog-link:hover {
  color: var(--black);
}

/* Collapsible list */
.collapsible-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.collapsible-list.expanded {
  max-height: 3000px;
}

.expand-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray);
  padding: 4px 0;
  font-family: inherit;
  transition: color 0.2s;
}

.expand-btn:hover {
  color: var(--black);
}

.expand-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.expand-btn.expanded .expand-arrow {
  transform: rotate(180deg);
}

.blog-preview {
  margin-top: 40px;
  padding-top: 32px;
}

/* Archive Page */
.archive-main {
  justify-content: flex-start;
  padding-top: 48px;
}

.archive h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
}

.archive-category {
  margin-bottom: 48px;
}

.archive-category h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-year {
  margin-bottom: 40px;
}

.archive-year h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 16px;
}

.archive-list {
  list-style: none;
}

.archive-list li {
  margin-bottom: 12px;
}

.archive-list a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: 15px;
}

.archive-list a:hover {
  color: var(--gray);
}

.archive-date {
  color: var(--light);
  font-size: 13px;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 0 20px;
  }

  .main {
    padding: 60px 0;
  }

  .hero {
    margin-bottom: 60px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .post-list a {
    flex-direction: column;
    gap: 4px;
  }

  .post-date {
    font-size: 12px;
  }
}

/* ── Archive Filter Chips ─────────────────────── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--light);
  border-radius: 999px;
  color: var(--gray);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 14px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter-chip:hover {
  border-color: var(--gray);
  color: var(--text);
}

.filter-chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.filter-chip:focus-visible {
  outline: 2px solid var(--gray);
  outline-offset: 2px;
}

.archive-list li.is-hidden {
  display: none;
}

.archive-category.is-hidden {
  display: none;
}

.archive-empty-state {
  color: var(--light);
  font-size: 14px;
  letter-spacing: 0.08em;
  margin-top: 24px;
}

@media (max-width: 480px) {
  .filter-chips {
    gap: 6px;
    margin-bottom: 24px;
  }
  .filter-chip {
    font-size: 12px;
    padding: 5px 12px;
  }
}
