/* ============================================
   divyam.dev — Design System
   Cactus Dark inspired · Monospace terminal aesthetic
   ============================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --bg:          #1d1f21;
  --bg-alt:      #282a2e;
  --bg-hover:    #2a2d31;
  --fg:          #c9cacc;
  --fg-dim:      #6c7a89;
  --fg-bright:   #e8e8e8;
  --accent:      #bd93f9;
  --accent-dim:  #9d73d9;
  --accent-glow: rgba(189, 147, 249, 0.15);
  --border:      #373b41;
  --code-bg:     #1a1c1e;

  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
  --font-size:   15px;
  --line-height: 1.7;
  --max-width:   720px;
  --content-pad: 1.5rem;

  --transition:  150ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-mono);
  font-weight: 400;
  line-height: var(--line-height);
  color: var(--fg);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

/* --- Layout --- */
.site-wrapper {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-pad);
  flex: 1;
}

main {
  padding: 2rem 0 4rem;
}

/* --- Links --- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}

a:hover {
  color: var(--fg-bright);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--fg-bright);
  line-height: 1.3;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }

p {
  margin-bottom: 1.2rem;
}

strong {
  font-weight: 700;
  color: var(--fg-bright);
}

em {
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--fg-dim);
  font-style: italic;
}

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

li {
  margin-bottom: 0.3rem;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* --- Header --- */
.site-header {
  padding: 2.5rem 0 1rem;
}

.site-header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

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

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

.site-nav a {
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), color var(--transition);
}

.site-nav a:hover,
.site-nav a.active {
  border-bottom-color: var(--accent);
}

.nav-separator {
  color: var(--fg-dim);
  margin: 0 0.6rem;
  user-select: none;
  font-size: 0.85rem;
}

/* --- Homepage --- */
.home-bio {
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
  color: var(--fg);
  max-width: 600px;
}

.home-bio p {
  margin-bottom: 1rem;
}

.social-line {
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.social-line a {
  color: var(--fg);
  border-bottom: 1px dashed var(--fg-dim);
  transition: color var(--transition), border-color var(--transition);
}

.social-line a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Section Headings --- */
.section-heading {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Post List --- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-item {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.4rem 0;
  margin: 0;
  transition: background-color var(--transition);
}

.post-list-item:hover {
  background-color: var(--accent-glow);
  margin: 0 -0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
}

.post-date {
  color: var(--fg-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  min-width: 7rem;
  flex-shrink: 0;
}

.post-title-link {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.post-title-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.post-list-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.post-list-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-list-tag {
  color: var(--accent-dim);
  font-size: 0.8rem;
}

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

/* --- Tags Cloud --- */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.tag-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: var(--accent);
  transform: translateY(-2px);
}

.tag-item.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

button.tag-item {
  cursor: pointer;
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.tag-count {
  color: var(--fg-dim);
  font-size: 0.8rem;
}

/* Year group */
.year-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-bright);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.25rem;
}

.year-heading:first-child {
  margin-top: 0;
}

/* --- Project List --- */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-item {
  padding: 0.4rem 0;
  font-size: 0.95rem;
}

.project-name {
  color: var(--fg);
  border-bottom: 1px dashed var(--fg-dim);
  transition: color var(--transition), border-color var(--transition);
}

.project-name:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.project-desc {
  color: var(--fg-dim);
}

.project-desc::before {
  content: ': ';
}

/* --- Footer --- */
.site-footer {
  padding: 2rem 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0;
}

.footer-links a {
  color: var(--fg-dim);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

.social-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.social-icons a {
  color: var(--fg-dim);
  transition: color var(--transition);
  display: inline-flex;
  align-items: center;
}

.social-icons a:hover {
  color: var(--accent);
}

.social-icons svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* --- Single Post --- */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  color: var(--accent);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.post-meta {
  color: var(--fg-dim);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-meta .separator {
  color: var(--border);
}

.post-tags {
  display: inline-flex;
  gap: 0.4rem;
}

.post-tag {
  color: var(--accent-dim);
  font-size: 0.8rem;
}

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

/* Blog body content */
.post-content {
  font-size: 0.95rem;
}

.post-content h2::before {
  content: '# ';
  color: var(--accent);
  font-weight: 400;
}

.post-content h3::before {
  content: '## ';
  color: var(--accent);
  font-weight: 400;
}

.post-content a {
  border-bottom: 1px solid var(--accent-dim);
}

.post-content a:hover {
  border-bottom-color: var(--accent);
}

.post-content img {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

/* --- Series Navigation --- */
.series-nav {
  background: var(--bg-alt);
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2.5rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

.series-nav p {
  margin-bottom: 0.8rem;
  color: var(--fg-bright);
}

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

.series-list li {
  margin-bottom: 0.4rem;
  padding-left: 0;
}

.current-series-item {
  color: var(--accent);
  font-weight: 500;
}

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  color: var(--fg-bright);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.2rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
  position: relative;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--fg);
}

/* --- Code Syntax Highlighting (Chroma) --- */
.highlight {
  position: relative;
  margin: 1.5rem 0;
}

.highlight pre {
  margin: 0;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--fg-bright);
  font-weight: 700;
}

/* --- Back Link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  transition: color var(--transition);
}

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

/* --- About Page --- */
.about-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.about-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
}

.about-content h1 {
  margin-bottom: 0.25rem;
}

.about-tagline {
  color: var(--fg-dim);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* --- Archive Page (Writing) --- */
.archive-year {
  margin-bottom: 2.5rem;
}

/* --- Page Title --- */
.page-title {
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  :root {
    --font-size: 14px;
    --content-pad: 1.2rem;
  }

  .site-header-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-list-item {
    flex-direction: column;
    gap: 0.15rem;
  }

  .post-date {
    min-width: auto;
  }

  .about-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-avatar {
    width: 120px;
    height: 120px;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- Projects Page --- */
.projects-intro {
  color: var(--fg-dim);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color var(--transition), background-color var(--transition), transform var(--transition);
  color: var(--fg);
  text-decoration: none;
}

.project-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateX(4px);
  color: var(--fg);
}

.project-card-inner {
  flex: 1;
}

.project-card-name {
  font-size: 1rem;
  color: var(--accent);
  margin: 0 0 0.3rem;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin: 0;
  line-height: 1.5;
}

.project-card-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.project-card-tag {
  font-size: 0.72rem;
  color: var(--fg-dim);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.project-card-arrow {
  color: var(--fg-dim);
  font-size: 1.2rem;
  margin-left: 1rem;
  transition: color var(--transition), transform var(--transition);
}

.project-card:hover .project-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* --- Resume Page --- */
.resume-page {
  max-width: 100%;
}

.resume-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.resume-name {
  color: var(--fg-bright);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.resume-tagline {
  color: var(--fg-dim);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.resume-contact {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.resume-contact a {
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: border-color var(--transition), background-color var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.resume-contact a svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.resume-contact a:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.resume-section {
  margin-bottom: 2.5rem;
}

.resume-section-title {
  font-size: 1.1rem;
  color: var(--accent);
  margin: 0 0 1.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resume-entry {
  margin-bottom: 1.5rem;
}

.resume-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.resume-entry-title {
  font-size: 1rem;
  color: var(--fg-bright);
  margin: 0;
}

.resume-entry-org {
  font-size: 0.9rem;
  color: var(--fg-dim);
}

.resume-entry-date {
  font-size: 0.8rem;
  color: var(--fg-dim);
  white-space: nowrap;
}

.resume-entry-details {
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--fg);
  margin: 0;
}

.resume-entry-details li {
  margin-bottom: 0.25rem;
}

.resume-skills {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resume-skill-group {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.9rem;
}

.resume-skill-label {
  color: var(--fg-bright);
  font-size: 0.85rem;
  min-width: 6rem;
  flex-shrink: 0;
  margin: 0;
}

.resume-skill-items {
  color: var(--fg);
}

.resume-tech-stack {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.resume-entry-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
}

.resume-entry-links a {
  color: var(--accent-dim);
}

.resume-entry-links a:hover {
  color: var(--accent);
}

.resume-download {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.resume-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  transition: background-color var(--transition), border-color var(--transition);
}

.resume-download-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Responsive (Projects & Resume) --- */
@media (max-width: 600px) {
  .project-card {
    padding: 1rem;
  }

  .resume-entry-header {
    flex-direction: column;
  }

  .resume-skill-group {
    flex-direction: column;
    gap: 0.2rem;
  }

  .resume-skill-label {
    min-width: auto;
  }
}

/* --- 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(--fg-dim);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

main {
  animation: fadeIn 0.4s ease-out;
}

/* --- Table of Contents --- */
.post-toc {
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 2rem;
  font-size: 0.9em;
}

.toc-title {
  font-weight: 700;
  color: var(--fg-bright);
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.5rem;
}

.post-toc summary::marker {
  color: var(--accent);
}

.post-toc nav#TableOfContents {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}

.post-toc nav#TableOfContents ul {
  list-style-type: none;
  padding-left: 1rem;
  margin: 0;
}

.post-toc nav#TableOfContents > ul {
  padding-left: 0;
}

.post-toc nav#TableOfContents li {
  margin-bottom: 0.25rem;
}

.post-toc nav#TableOfContents a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-toc nav#TableOfContents a:hover {
  color: var(--accent);
  text-decoration: underline;
}
