/* Avinash Gosavi – Jekyll blog (themes: set theme in _config.yml) */

:root,
body.theme-white {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-muted: #525150;
  --accent: #1976d2;
  --accent-soft: rgba(25, 118, 210, 0.12);
  --border: #e5e7eb;
  --border-header: #e5e7eb;
  --code-bg: #f3f4f6;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --max-width: 42rem;
  --space: 1.5rem;
}

/* 1. Off-white / warm paper */
body.theme-off-white {
  --bg: #fafaf9;
  --surface: #fafaf9;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --border-header: #e7e5e4;
  --code-bg: #f5f5f4;
}

/* 2. Light gray (more visible) */
body.theme-light-gray {
  --bg: #eef0f2;
  --surface: #e9ecef;
  --text: #212529;
  --text-muted: #495057;
  --border: #ced4da;
  --border-header: #ced4da;
  --code-bg: #dee2e6;
}

/* 3. Sepia / cream (read-mode style, WCAG-friendly contrast) */
body.theme-sepia {
  --bg: #f5efe0;
  --surface: #e8e0cc;
  --text: #352f2a;
  --text-muted: #5c5650;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.18);
  --border: #dfd8c8;
  --border-header: #d5ccb8;
  --code-bg: #ebe4d2;
}

/* 4. Soft blue-gray */
body.theme-soft-blue {
  --bg: #f6f8fa;
  --surface: #f6f8fa;
  --text: #24292f;
  --text-muted: #57606a;
  --border: #d0d7de;
  --border-header: #d0d7de;
  --code-bg: #eaeef2;
}

/* 5. Dark mode (warm dark, body lighter than header, reduced eye strain) */
body.theme-dark {
  --bg: #2a2620;
  --surface: #1e1b16;
  --text: #ede9e1;
  --text-muted: #a8a095;
  --accent: #d4b078;
  --accent-soft: rgba(212, 176, 120, 0.22);
  --border: #403a32;
  --border-header: #2d2822;
  --code-bg: #322e26;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Focus visible for accessibility (keyboard / a11y) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-header);
  background: var(--surface);
}

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

.header-left {
  flex: 1;
  min-width: 0;
}

.site-title {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--accent);
}

.site-tagline {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Nav */
.site-nav {
  margin-top: var(--space);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

/* Theme toggle – slider on the right */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.theme-toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-slider {
  width: 2.5rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--code-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.theme-slider-thumb {
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--text-muted);
  position: absolute;
  top: 50%;
  left: 0.15rem;
  transform: translateY(-50%);
  transition: transform 0.2s ease, background 0.2s ease;
}

.theme-slider.is-dark .theme-slider-thumb {
  transform: translate(1.1rem, -50%);
  background: var(--accent);
}

.theme-slider:hover .theme-slider-thumb {
  background: var(--accent);
}

/* Home */
.home .hero {
  margin-bottom: 2.5rem;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0;
}

.recent-posts h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.post-list-item {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.post-list-item:last-child {
  border-bottom: none;
}

.post-list-item a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 600;
}

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

.post-list-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.post-list-meta span + time::before,
.post-list-meta time + span::before {
  content: " · ";
}

.post-list-excerpt {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  line-height: 1.55;
}

.all-posts-link {
  margin: 1.5rem 0 0;
}

.all-posts-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.all-posts-link a:hover {
  text-decoration: underline;
}

/* Blog page */
.blog-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.search-box {
  margin-bottom: 1.5rem;
}

#post-search {
  width: 100%;
  max-width: 20rem;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

#post-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#post-search:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#post-search::placeholder {
  color: var(--text-muted);
}

.blog-list .post-list-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
}

.no-results {
  color: var(--text-muted);
  font-style: italic;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Post layout */
.post-header {
  margin-bottom: 1.5rem;
}

.post-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

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

.post-meta .post-author::after {
  content: " · ";
}

.post-meta .post-read-time::before {
  content: " · ";
}

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

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.25rem;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.post-content p {
  margin: 0 0 1rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

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

.post-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

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

.post-content a:hover {
  text-decoration: underline;
}

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

.post-content img,
.main img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border-radius: 8px;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

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

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

/* Code – Rouge output */
.post-content .highlight,
.post-content pre {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
}

.post-content .highlight pre {
  margin: 0;
  padding: 0;
  background: none;
}

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

.post-content pre code {
  padding: 0;
  background: none;
}

/* Rouge theme – light background */
.highlight .c { color: #6b7280; font-style: italic; }
.highlight .k { color: #0d9488; }
.highlight .n { color: #1d1d1f; }
.highlight .s { color: #059669; }
.highlight .s2 { color: #059669; }
.highlight .nb { color: #2563eb; }
.highlight .nf { color: #2563eb; }
.highlight .o { color: #525150; }
.highlight .p { color: #1d1d1f; }
.highlight .na { color: #2563eb; }
.highlight .nv { color: #7c3aed; }
.highlight .vi { color: #7c3aed; }
.highlight .ow { color: #0d9488; }
.highlight .nn { color: #2563eb; }

/* Rouge theme – dark (theme-dark only) */
body.theme-dark .highlight .c { color: #8b949e; font-style: italic; }
body.theme-dark .highlight .k { color: #7ee787; }
body.theme-dark .highlight .n { color: #e6edf3; }
body.theme-dark .highlight .s { color: #a5d6ff; }
body.theme-dark .highlight .s2 { color: #a5d6ff; }
body.theme-dark .highlight .nb { color: #79c0ff; }
body.theme-dark .highlight .nf { color: #d2a8ff; }
body.theme-dark .highlight .o { color: #8b949e; }
body.theme-dark .highlight .p { color: #e6edf3; }
body.theme-dark .highlight .na { color: #79c0ff; }
body.theme-dark .highlight .nv { color: #ffa657; }
body.theme-dark .highlight .vi { color: #ffa657; }
body.theme-dark .highlight .ow { color: #7ee787; }
body.theme-dark .highlight .nn { color: #79c0ff; }

/* About page – content left, image right */
.about-page {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  max-width: 52rem;
  margin: 0 auto;
}

.about-content {
  flex: 1;
  min-width: 0;
}

.about-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}

.about-content p {
  margin: 0 0 1rem;
  line-height: 1.7;
}

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

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

.about-image {
  flex-shrink: 0;
}

.about-image img {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  border-radius: 12px;
  margin: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body.theme-dark .about-image img {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .about-page {
    flex-direction: column;
    gap: 1.5rem;
  }
  .about-image img {
    max-width: 220px;
    margin: 0 auto;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.site-footer a:hover {
  text-decoration: underline;
}
