/* ============================================
   DiplomaticRobot DevBlob — Stepland-Themed CSS
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-bg:           #0d1117;
  --color-surface:      #161b22;
  --color-surface-alt:  #1a2420;
  --color-primary:      #4ade80;
  --color-primary-dark: #16a34a;
  --color-accent:       #86efac;
  --color-text:         #e2e8f0;
  --color-text-muted:   #94a3b8;
  --color-border:       #2d3748;
  --color-glow:         rgba(74, 222, 128, 0.15);
  --color-timeline:     #4ade80;
}

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

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(74, 222, 128, 0.3);
  color: #fff;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

img {
  max-width: 100%;
  height: auto;
}

main {
  flex: 1;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.site-logo:hover {
  color: var(--color-primary);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

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

/* --- Hero Section --- */
.hero {
  position: relative;
  text-align: center;
  padding: 6rem 2rem 4rem;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--color-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-text);
  position: relative;
  z-index: 1;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 1rem auto 0;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.hero-subtitle a {
  color: var(--color-primary);
  font-weight: 500;
}

.hero-subtitle a:hover {
  color: var(--color-accent);
}

/* --- Timeline Section --- */
.timeline-section {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-timeline);
  transform: translateX(-50%);
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.3));
}

/* --- Year Marker --- */
.timeline-year-marker {
  position: relative;
  z-index: 2;
  margin: 2rem 0 1.5rem;
}

.year-label {
  display: inline-block;
  background: var(--color-primary);
  color: var(--color-bg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

/* --- Timeline Cards --- */
.timeline-card {
  position: relative;
  width: 44%;
  cursor: pointer;
  margin-bottom: 3rem;
}

.card-left {
  align-self: flex-start;
  margin-right: auto;
  margin-left: 0;
}

.card-right {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
}

.card-body {
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-card:hover .card-body {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 0 20px var(--color-glow);
}

/* Connector line from card to timeline */
.card-connector {
  position: absolute;
  top: 50%;
  width: 8%;
  height: 1px;
  background: var(--color-border);
}

.card-left .card-connector {
  right: -8%;
}

.card-right .card-connector {
  left: -8%;
}

/* Glowing dot on the timeline */
.card-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
  transform: translateY(-50%);
  z-index: 2;
}

.card-left .card-dot {
  right: -9%;
  transform: translateY(-50%) translateX(50%);
}

.card-right .card-dot {
  left: -9%;
  transform: translateY(-50%) translateX(-50%);
}

/* --- Card Content --- */
.card-date {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.tag {
  display: inline-block;
  background: var(--color-surface-alt);
  color: var(--color-accent);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.card-cta {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
}

.timeline-card:hover .card-cta {
  color: var(--color-accent);
}

/* --- Scroll Animation --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateX(var(--slide-dir, -30px));
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card-right {
  --slide-dir: 30px;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

/* --- Post Page --- */
.post-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.post-nav-top {
  margin-bottom: 2rem;
}

.back-link {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

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

.post-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

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

.reading-time {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  width: 100%;
}

.post-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* --- Post Content --- */
.post-content {
  line-height: 1.8;
  font-size: 1.05rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--color-text);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.post-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
}

.post-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
}

.post-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
}

.post-content p {
  margin-bottom: 1.2rem;
}

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

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

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

.post-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--color-surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--color-accent);
}

.post-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.6;
}

.post-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.post-content img {
  border-radius: 8px;
  margin: 1.5rem 0;
}

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

/* --- Rouge Syntax Highlighting (Dark Theme) --- */
.highlight {
  background: var(--color-surface);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.highlight pre {
  margin: 0;
  border: none;
}

/* Comments */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs {
  color: #6a737d;
  font-style: italic;
}

/* Keywords */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp,
.highlight .kr, .highlight .kt {
  color: #ff7b72;
}

/* Strings */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb,
.highlight .sc, .highlight .sd, .highlight .sh, .highlight .sx {
  color: #a5d6ff;
}

/* Numbers */
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh,
.highlight .mo {
  color: #79c0ff;
}

/* Functions / Methods */
.highlight .nf, .highlight .nx {
  color: #d2a8ff;
}

/* Variables, Names */
.highlight .n, .highlight .na, .highlight .nb, .highlight .nc,
.highlight .nd, .highlight .ni, .highlight .ne, .highlight .no,
.highlight .nv {
  color: #ffa657;
}

/* Operators */
.highlight .o, .highlight .ow {
  color: #ff7b72;
}

/* Punctuation */
.highlight .p {
  color: var(--color-text);
}

/* --- Post Footer --- */
.post-footer {
  border-top: 1px solid var(--color-border);
  padding-top: 2rem;
  margin-top: 3rem;
}

.post-nav-bottom {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.prev-post, .next-post {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.prev-post:hover, .next-post:hover {
  color: var(--color-primary);
}

.next-post {
  text-align: right;
  margin-left: auto;
}

.author-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.author-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.3rem;
}

.author-bio {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.author-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.author-links a {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 500;
}

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

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem;
  text-align: center;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-inner p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.footer-inner p a {
  color: var(--color-primary);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

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

/* --- Mobile Responsive (< 768px) --- */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero {
    padding: 4rem 1.5rem 3rem;
  }

  /* Timeline: single column, left-aligned */
  .timeline-section {
    padding: 2rem 1.5rem 4rem;
    align-items: stretch;
  }

  .timeline-line {
    left: 16px;
    transform: none;
  }

  .timeline-card {
    width: 100%;
    margin-left: 2.5rem;
    margin-right: 0;
  }

  .card-left, .card-right {
    align-self: stretch;
    margin-left: 2.5rem;
    margin-right: 0;
    --slide-dir: -30px;
  }

  .card-connector {
    left: -2rem !important;
    right: auto !important;
    width: 1.5rem;
  }

  .card-dot {
    left: -2.5rem !important;
    right: auto !important;
    transform: translateY(-50%);
  }

  .timeline-year-marker {
    align-self: flex-start;
    margin-left: 0.5rem;
  }

  /* Post page */
  .post-page {
    padding: 1.5rem 1.5rem 3rem;
  }

  .post-title {
    font-size: 1.7rem;
  }

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

  .post-nav-bottom {
    flex-direction: column;
  }

  .next-post {
    text-align: left;
    margin-left: 0;
  }

  /* Header */
  .header-inner {
    padding: 0.75rem 1.5rem;
  }

  .site-logo {
    font-size: 1.1rem;
  }

  .site-nav {
    gap: 1rem;
  }

  .site-nav a {
    font-size: 0.8rem;
  }
}

/* --- Small screens (< 480px) --- */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .card-title {
    font-size: 1rem;
  }
}
