/* ============================================================================
   AmitHegde.com - palette & typography adapted from devproxy.net
   System font stacks, Tailwind-gray neutrals, purple accents, dark mode
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #e5e7eb;
  --bg-nav: rgba(255, 255, 255, 0.8);
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border-primary: #e5e7eb;
  --border-secondary: #d1d5db;
  --code-bg: #f3f4f6;
  --code-border: #e5e7eb;
  --code-text: #7c3aed;
  --code-block-text: #374151;
  --accent-300: #d8b4fe;
  --accent-400: #c084fc;
  --accent-500: #a855f7;
  --accent-600: #9333ea;
  --glow: rgba(168, 85, 247, 0.08);

  --syn-comment: #6b7280;
  --syn-keyword: #9333ea;
  --syn-string: #059669;
  --syn-number: #b45309;
  --syn-func: #2563eb;
  --syn-type: #0e7490;
}

.dark {
  --bg-primary: #030712;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-nav: rgba(3, 7, 18, 0.8);
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;
  --border-primary: #1f2937;
  --border-secondary: #374151;
  --code-bg: #111827;
  --code-border: #1f2937;
  --code-text: #d8b4fe;
  --code-block-text: #d1d5db;

  --syn-comment: #6b7280;
  --syn-keyword: #d8b4fe;
  --syn-string: #34d399;
  --syn-number: #fcd34d;
  --syn-func: #93c5fd;
  --syn-type: #67e8f9;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
}

main.container {
  padding-top: 3.5rem;
  padding-bottom: 4rem;
}

.container {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

a:hover {
  color: var(--accent-300);
}

:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: rgba(168, 85, 247, 0.25);
}

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-nav);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-primary);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.75rem;
}

.site-title {
  display: inline-flex;
  align-items: center;
  color: var(--text-primary);
}

.site-title .logo {
  display: block;
}

.site-title:hover {
  opacity: 0.85;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-link:hover {
  color: var(--accent-400);
  background-color: var(--bg-secondary);
}

.theme-toggle .icon-moon {
  display: none;
}

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

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

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border-primary);
  padding: 1.25rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Home -------------------------------------------------------------------- */

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

.post-item {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.5rem;
  margin: 0;
  border: 1px solid var(--border-primary);
  border-radius: 0.75rem;
  background-color: var(--bg-primary);
  transition: border-color 0.15s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
}

.post-item:hover {
  border-color: var(--accent-500);
  box-shadow: 0 0 24px var(--glow), 0 4px 16px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.post-item h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

.post-link {
  color: var(--text-primary);
}

.post-link:hover {
  color: var(--accent-400);
}

.post-link:hover h2 {
  color: var(--accent-400);
}

.post-item time {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-item .post-categories {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Post -------------------------------------------------------------------- */

.post-header {
  padding: 1.5rem 0 2rem;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.post-categories {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.category-badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-400);
  background-color: rgba(147, 51, 234, 0.12);
  border-radius: 9999px;
}

.category-badge:hover {
  color: var(--accent-300);
}

.review-banner {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent-500);
  border-radius: 0.5rem;
  background-color: var(--glow);
  font-size: 0.875rem;
}

.post-nav {
  margin-top: 3rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.post-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.post-nav svg {
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.post-nav a:hover svg {
  transform: translateX(-3px);
}

/* Prose ------------------------------------------------------------------- */

.post-body {
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin: 2em 0 0.75em;
}

.post-body h1 { font-size: 1.625rem; }
.post-body h2 { font-size: 1.375rem; }
.post-body h3 { font-size: 1.1875rem; }
.post-body h4,
.post-body h5,
.post-body h6 { font-size: 1rem; }

.post-body p {
  margin: 0 0 1.25em;
}

.post-body a {
  color: var(--accent-400);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(168, 85, 247, 0.4);
}

.post-body a:hover {
  color: var(--accent-300);
  text-decoration-color: var(--accent-300);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25em;
  padding-left: 1.5em;
}

.post-body li {
  margin-bottom: 0.375em;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border-primary);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 2.5em 0;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 3px solid var(--accent-500);
  color: var(--text-muted);
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9375rem;
}

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

.post-body th {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}

/* Inline code & code blocks (rouge) ---------------------------------------- */

code,
kbd,
samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.post-body code {
  padding: 0.15em 0.4em;
  font-size: 0.875em;
  color: var(--code-text);
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 0.375rem;
}

.highlight {
  margin: 1.5em 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--code-border);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.highlight pre {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--code-block-text);
}

.highlight code {
  padding: 0;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: 0;
}

/* rouge token colors */
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs,
.highlight .cd { color: var(--syn-comment); font-style: italic; }
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt, .highlight .ow,
.highlight .nt { color: var(--syn-keyword); font-weight: 500; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd,
.highlight .s2, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss,
.highlight .sa, .highlight .dl { color: var(--syn-string); }
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh,
.highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { color: var(--syn-number); }
.highlight .nf, .highlight .fm, .highlight .na { color: var(--syn-func); }
.highlight .nc, .highlight .no, .highlight .nd, .highlight .ni,
.highlight .ne, .highlight .nl, .highlight .nn, .highlight .nx,
.highlight .nv, .highlight .py, .highlight .vc, .highlight .vg,
.highlight .vi { color: var(--syn-type); }
.highlight .nb, .highlight .bp { color: var(--syn-func); font-weight: 500; }
.highlight .o, .highlight .p, .highlight .pi { color: var(--text-secondary); }
.highlight .gd { color: #fb2c36; }
.highlight .gi { color: #00c758; }
.highlight .err { color: #fb2c36; background-color: rgba(251, 44, 54, 0.1); }
.highlight .gh, .highlight .gu { font-weight: 600; color: var(--text-primary); }
.highlight .w { color: var(--text-secondary); }

/* Misc -------------------------------------------------------------------- */

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.category-section {
  margin-bottom: 2rem;
}

.category-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-400);
}

.category-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-section li {
  padding: 0.25rem 0;
}

.center-content {
  text-align: center;
  padding-top: 4rem;
}

.center-content h1 {
  margin: 0;
  font-size: 4.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background-image: linear-gradient(
    to right,
    var(--accent-400),
    var(--accent-500),
    var(--accent-600)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.center-content h2 {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 640px) {
  main.container {
    padding-top: 1.75rem;
  }

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

  .footer-inner {
    justify-content: center;
    gap: 1rem;
  }
}
