/* ═══════════════════════════════════════════
   Siddhesh Sonar Blog — Light/Dark Theme
   Light = default · Dark = toggle
   ═══════════════════════════════════════════ */

/* ──────── Light Theme (Default) ──────── */
:root {
  --bg: #faf9f7;
  --surface: #f0efec;
  --surface-raised: #e8e7e3;
  --border: #ddd9d3;
  --border-subtle: #e8e5df;
  --text: #1a1918;
  --text-heading: #0d0d0c;
  --text-secondary: #555250;
  --text-tertiary: #8a8784;
  --accent: #c47a1a;
  --accent-dim: #a06315;
  --accent-subtle: rgba(196, 122, 26, 0.07);
  --link: #b06c15;
  --link-border: rgba(176, 108, 21, 0.25);
  --tag-bg: #f0ebe3;
  --tag-text: #8a6d3b;
  --tag-border: #e0d8cc;
  --code-bg: #f3f1ed;
  --code-border: #e0ddd6;
  --code-text: #3d3a36;
  --code-inline: #9e5a08;
  --icon-fill: #1a1918;
  --selection-bg: rgba(196, 122, 26, 0.18);
  --selection-color: #1a1918;
  --toggle-bg: var(--surface);
  --toggle-border: var(--border);
  --toggle-hover: var(--surface-raised);
  --max-width: 700px;
  color-scheme: light;
}

/* ──────── Dark Theme ──────── */
[data-theme="dark"] {
  --bg: #111110;
  --surface: #1a1a18;
  --surface-raised: #222220;
  --border: #2a2a27;
  --border-subtle: #1f1f1d;
  --text: #eeece8;
  --text-heading: #ffffff;
  --text-secondary: #a09f98;
  --text-tertiary: #706f68;
  --accent: #e8a54b;
  --accent-dim: #b8842e;
  --accent-subtle: rgba(232, 165, 75, 0.1);
  --link: #e8a54b;
  --link-border: rgba(232, 165, 75, 0.3);
  --tag-bg: #1e1d1a;
  --tag-text: #c4a46a;
  --tag-border: #2e2d28;
  --code-bg: #161614;
  --code-border: #2a2a27;
  --code-text: #d4d2cc;
  --code-inline: #e8a54b;
  --icon-fill: #eeece8;
  --selection-bg: rgba(232, 165, 75, 0.25);
  --selection-color: #fff;
  --toggle-bg: var(--surface);
  --toggle-border: var(--border);
  --toggle-hover: var(--surface-raised);
  color-scheme: dark;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* ──────── Theme Toggle ──────── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.theme-toggle:hover {
  background: var(--toggle-hover);
  border-color: var(--accent);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.theme-toggle:hover svg {
  color: var(--accent);
}
/* Show sun in dark, moon in light */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ──────── Nav ──────── */
nav {
  padding: 28px 0;
}
nav a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}
nav a:hover { color: var(--accent); }

/* ──────── Index Header ──────── */
.site-header {
  padding: 72px 0 44px;
}
.header-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.header-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--bg);
  stroke-width: 2.5;
}
.site-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-heading);
}
.site-header .tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 24px;
  line-height: 1.6;
}
.links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.links a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}
.links a:hover { color: var(--accent); }
.links a svg {
  width: 15px;
  height: 15px;
}

/* ──────── Divider ──────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin-bottom: 12px;
}

/* ──────── Post Cards (Index) ──────── */
.posts {
  padding: 24px 0 72px;
}
.post-card {
  padding: 24px 0;
}
.post-card + .post-card {
  border-top: 1px solid var(--border-subtle);
}
.post-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}
.post-card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--text);
  transition: color 0.2s ease;
  line-height: 1.4;
}
.post-card a:hover h2 {
  color: var(--accent);
}
.post-meta {
  color: var(--text-tertiary);
  font-size: 0.84rem;
  margin-bottom: 8px;
  font-weight: 400;
}
.post-description {
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.6;
}
.post-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--tag-border);
  transition: all 0.2s ease;
}

/* ──────── Post Header ──────── */
.post-header {
  padding: 56px 0 40px;
  margin-bottom: 40px;
}
.post-header h1 {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--text-heading);
}
.post-header .post-meta {
  color: var(--text-tertiary);
  font-size: 0.88rem;
  font-weight: 400;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.post-header .post-meta .sep { color: var(--border); }

/* ──────── Article Content ──────── */
.content {
  padding-bottom: 64px;
  font-size: 1.02rem;
}

/* Headings */
.content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 52px 0 18px;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 36px 0 14px;
  color: var(--text);
}
.content h4 {
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

/* Paragraphs */
.content p {
  margin-bottom: 18px;
  color: var(--text);
  line-height: 1.85;
}

/* Links */
.content a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--link-border);
  transition: border-color 0.2s ease;
}
.content a:hover {
  border-bottom-color: var(--accent);
}

/* Lists */
.content ul, .content ol {
  margin: 0 0 20px 0;
  padding-left: 24px;
}
.content ul { list-style: none; padding-left: 0; }
.content ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}
.content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-dim);
}
.content ol li {
  margin-bottom: 10px;
  padding-left: 4px;
}
.content ol li::marker {
  color: var(--accent-dim);
  font-weight: 600;
}

/* Bold & Italic */
.content strong {
  color: var(--text-heading);
  font-weight: 600;
}
.content em {
  color: var(--text-secondary);
  font-style: italic;
}

/* Inline code */
.content code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 0.85em;
  color: var(--code-inline);
  font-weight: 400;
}

/* Code blocks */
.content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 22px 24px;
  overflow-x: auto;
  margin: 24px 0;
  line-height: 1.6;
  position: relative;
}
.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.86rem;
  color: var(--code-text);
  font-weight: 400;
}

/* Blockquotes */
.content blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--accent-subtle);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.content blockquote p {
  margin-bottom: 0;
  line-height: 1.7;
}
.content blockquote p + p {
  margin-top: 12px;
}

/* Images */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 28px 0;
  border: 1px solid var(--border);
  display: block;
}
.content p > img {
  margin: 28px auto;
}
.content img + em,
.content p:has(> img) + p > em:only-child {
  display: block;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  font-size: 0.92rem;
}
.content thead {
  background: var(--surface-raised);
}
.content th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.content td {
  padding: 11px 16px;
  text-align: left;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.content tr:last-child td {
  border-bottom: none;
}
.content tbody tr {
  transition: background 0.15s ease;
}
.content tbody tr:hover {
  background: var(--surface);
}

/* Horizontal rule */
.content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

/* Definition-like bold starts */
.content p > strong:first-child {
  color: var(--accent);
}

/* ──────── Footer ──────── */
footer {
  padding: 36px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}
.footer-links a:hover { color: var(--accent); }
footer.center { text-align: center; }

/* ──────── Scrollbar ──────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ──────── Selection ──────── */
::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

/* ──────── Mobile ──────── */
@media (max-width: 640px) {
  .site-header { padding: 48px 0 32px; }
  .site-header h1 { font-size: 1.5rem; }
  .post-header h1 { font-size: 1.55rem; }
  .container { padding: 0 18px; }
  .content pre { padding: 16px 14px; border-radius: 8px; }
  .content table { font-size: 0.84rem; }
  .content th, .content td { padding: 8px 10px; }
  .theme-toggle { top: 14px; right: 14px; width: 36px; height: 36px; }
}
