@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Playfair+Display:wght@700&family=Cormorant+Garamond:ital@1&display=swap');

:root {
  --bg: #f7f5f0;
  --fg: #1a1a1a;
  --fg-secondary: #6b6560;
  --accent: #b45309;
  --border: #e0ddd5;
  --card-bg: #ffffff;
  --blockquote-bg: #f0ece4;
  --blockquote-border: #b45309;
  --code-bg: #ece8e0;
  --header-bg: #f7f5f0;
  --link-hover: #92400e;
  --content-width: clamp(700px, 75vw, 1200px);
}

[data-theme="dark"] {
  --bg: #0a0a0f;
  --fg: #e0daf0;
  --fg-secondary: #8a80a0;
  --accent: #f0abfc;
  --border: #2a2040;
  --card-bg: #12101e;
  --blockquote-bg: #15122a;
  --blockquote-border: #a855f7;
  --code-bg: #1a1530;
  --header-bg: #0a0a0f;
  --link-hover: #c084fc;
}

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

html {
  font-size: clamp(19px, 1.5vw, 24px);
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

header {
  background: var(--header-bg);
  padding: 2.5rem 2.5rem 1.5rem;
  transition: background 0.3s ease;
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-title a {
  color: var(--fg);
  text-decoration: none;
}

.site-subtitle {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--fg-secondary);
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-style: italic;
  margin-top: 0.5rem;
}

#theme-toggle {
  background: #f7f5f0;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

[data-theme="dark"] #theme-toggle {
  background: #f7f5f0;
}

[data-theme="light"] #theme-toggle,
:root:not([data-theme]) #theme-toggle {
  background: #0a0a0f;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.5rem 0;
  width: 100%;
  flex: 1;
}

.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 3rem;
  font-size: 1.05rem;
}

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

/* --- Index --- */

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-top: 2rem;
}

.post-card {
  padding-bottom: 3rem;
}

.post-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card a:hover .post-title {
  color: var(--accent);
}

.post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.6rem;
  transition: color 0.2s ease;
}

.post-excerpt {
  color: var(--fg-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 0.7rem;
}

.post-date {
  color: var(--fg-secondary);
  font-size: 0.95rem;
  font-style: italic;
}

/* --- Article --- */

article h1.post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin-bottom: 0.3rem;
}

article h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  margin: 3.5rem 0 1.2rem;
  color: var(--fg);
}

article h3 {
  font-size: clamp(1.2rem, 1.7vw, 1.5rem);
  margin: 3rem 0 1rem;
}

article p {
  margin-bottom: 1.5rem;
  text-align: justify;
  hyphens: auto;
}

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

article li {
  margin-bottom: 0.4rem;
}

article blockquote {
  background: var(--blockquote-bg);
  border-left: 4px solid var(--blockquote-border);
  margin: 2.5rem 0;
  padding: 2rem 2.5rem;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  transition: background 0.3s ease, border-color 0.3s ease;
}

article blockquote p {
  margin-bottom: 1.2rem;
}

article blockquote p:last-child {
  margin-bottom: 0;
}

article code {
  background: var(--code-bg);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
}

article figure {
  margin: 2.5rem 0;
  text-align: center;
}

article figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

article em {
  font-style: italic;
}

article strong {
  font-weight: 700;
}

article hr {
  border: none;
  border-top: 1px solid var(--border);
  width: 40%;
  margin: 2.5rem auto;
}

.toc {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2rem 2.5rem;
  margin-bottom: 3rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.toc h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--fg-secondary);
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc li {
  margin-bottom: 0.5rem;
}

.toc a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.05rem;
}

.toc a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

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

footer {
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.9rem;
  color: var(--fg-secondary);
}

@media (max-width: 600px) {
  html { font-size: 17px; }
  header { padding: 1.5rem 1.2rem; }
  .header-inner { align-items: flex-start; }
  .site-title { line-height: 1; }
  .site-subtitle { font-size: 1rem; }
  #theme-toggle { width: 28px; height: 28px; margin-top: 0.15rem; }
  main { padding: 1.5rem 1.2rem; }
  .post-list { gap: 2rem; }
  .post-card { padding-bottom: 2rem; }
  article blockquote { padding: 1.2rem 1.5rem; }
  .toc { padding: 1.2rem 1.5rem; }
}
