/* CSS Variables - Catppuccin Mocha */
:root {
  --base:     #1e1e2e;
  --mantle:   #181825;
  --crust:    #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --text:     #cdd6f4;
  --lavender: #b4befe;
  --blue:     #89b4fa;
  --sapphire: #74c7ec;
  --sky:      #89dceb;
  --teal:     #94e2d5;
  --green:    #a6e3a1;
  --yellow:   #f9e2af;
  --peach:    #fab387;
  --red:      #f38ba8;
  --mauve:    #cba6f7;
  --pink:     #f5c2e7;

  --bg-primary:    var(--base);
  --bg-secondary:  var(--mantle);
  --text-primary:  var(--text);
  --text-secondary: var(--subtext0);
  --border:   var(--surface1);
  --accent:   var(--mauve);
  --code-bg:  var(--crust);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: "JetBrains Mono", monospace;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  text-transform: lowercase;
}

/* Preserve case in code */
code, pre, kbd, samp,
.highlight, .highlight * {
  text-transform: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; color: var(--lavender); }
h2 { font-size: 1.5rem; margin-top: 2.5rem; }
h3 { font-size: 1.2rem; margin-top: 2rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}

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

/* Header Navigation */
header {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mauve);
  border: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand:hover {
  color: var(--lavender);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

nav a {
  border: none;
  color: var(--subtext1);
  transition: color 0.2s;
}

nav a:hover,
nav a.active {
  color: var(--mauve);
}

/* Hero Section */
.hero {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  gap: 2rem;
}

.hero-text {
  flex: 1;
}

.hero-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--lavender);
  letter-spacing: -0.03em;
}

.hero-tagline {
  font-size: 1rem;
  color: var(--subtext0);
  margin: 0;
  line-height: 1.6;
}

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

.hero-image img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--mauve);
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-image {
    order: -1;
  }
}

/* Sections */
section {
  margin-bottom: 4rem;
}

section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  color: var(--lavender);
  border-left: 3px solid var(--mauve);
  padding-left: 0.75rem;
}

/* About Section */
.about p {
  color: var(--text-secondary);
}

/* Projects Section */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-top: 2px solid var(--card-accent, var(--surface1));
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  transition: border-color 0.2s, transform 0.15s;
}

.project-card:hover {
  border-top-color: var(--card-accent, var(--mauve));
  border-color: var(--card-accent, var(--mauve));
  transform: translateY(-2px);
}

.project-card[data-domain="data"]      { --card-accent: var(--blue); }
.project-card[data-domain="fullstack"] { --card-accent: var(--green); }
.project-card[data-domain="ml"]        { --card-accent: var(--mauve); }
.project-card[data-domain="robotics"]  { --card-accent: var(--peach); }

.project-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--card-accent, var(--subtext0));
  border: 1px solid var(--card-accent, var(--surface1));
  border-radius: 3px;
  padding: 0.1em 0.5em;
  margin-bottom: 0.65rem;
  letter-spacing: 0.04em;
}

.project-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.project-title a {
  color: var(--text);
  border: none;
  transition: color 0.2s;
}

.project-title a:hover {
  color: var(--card-accent, var(--mauve));
}

.project-desc {
  flex: 1;
  font-size: 0.87rem;
  color: var(--subtext0);
  margin: 0 0 1.2rem 0;
  line-height: 1.65;
}

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  border-top: 1px solid var(--surface0);
  padding-top: 0.75rem;
}

.project-tech {
  font-size: 0.75rem;
  color: var(--overlay1);
  line-height: 1.5;
}

.project-link {
  font-size: 0.8rem;
  color: var(--card-accent, var(--subtext0));
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s;
}

.project-link:hover {
  color: var(--card-accent, var(--lavender));
}

@media (max-width: 640px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* Blog Preview Section */
.post-list {
  list-style: none;
  padding-left: 0;
}

.post-list li {
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.post-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-width: 100px;
  flex-shrink: 0;
}

.post-list a {
  border: none;
  color: var(--text-primary);
  transition: color 0.2s;
}

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

/* View All Links */
.view-all {
  margin-top: 1.5rem;
}

.view-all a {
  color: var(--subtext0);
  font-size: 0.95rem;
}

.view-all a:hover {
  color: var(--lavender);
}

/* Contact Section */
.contact a {
  border: none;
  color: var(--text-primary);
  margin-right: 1rem;
  transition: color 0.2s;
}

.contact a:hover {
  color: var(--mauve);
}

/* Blog Post Styles */
.post-header {
  margin-bottom: 3rem;
}

.post-title {
  margin-bottom: 0.5rem;
  color: var(--lavender);
}

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

.post-meta span {
  margin-right: 1rem;
}

.post-content {
  margin-bottom: 4rem;
}

.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
  color: var(--text-secondary);
}

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

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 6px;
  border: 1px solid var(--surface1);
  box-shadow: 0 0 0 4px var(--surface0);
  cursor: zoom-in;
}

.post-content figure {
  margin: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.post-content figure img {
  margin: 0;
}

.post-content figcaption {
  font-size: 0.78rem;
  color: var(--subtext0);
  text-align: center;
  max-width: 80%;
  line-height: 1.5;
  padding-top: 0.5rem;
  border-top: 1px solid var(--surface0);
}

@media (max-width: 640px) {
  .post-content img {
    margin: 1.25rem auto;
    box-shadow: 0 0 0 2px var(--surface0);
  }
}

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 27, 0.93);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  cursor: zoom-out;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--surface1);
  box-shadow: 0 0 0 4px var(--surface0);
  cursor: zoom-out;
  animation: lightbox-in 0.15s ease;
}

.lightbox-hint {
  font-size: 0.72rem;
  color: var(--subtext0);
  opacity: 0.5;
  letter-spacing: 0.03em;
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.blog-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 6px;
  gap: 2rem;
  transition: border-color 0.2s;
}

.blog-card:hover {
  border-color: var(--mauve);
}

.blog-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  flex: 2;
}

.blog-title a {
  color: var(--text-primary);
  border: none;
  text-decoration: none;
  transition: color 0.2s;
}

.blog-title a:hover {
  color: var(--mauve);
}

.blog-meta {
  font-size: 0.95rem;
  color: var(--subtext0);
  margin-bottom: 0.5rem;
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.blog-excerpt {
  color: var(--subtext0);
  margin: 0;
  flex: 3;
}

@media (max-width: 700px) {
  .blog-card {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
  }
  .blog-meta {
    flex-direction: row;
    gap: 1.5rem;
    min-width: 0;
  }
}

/* Code Blocks */
code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: var(--text-primary);
}

pre {
  background-color: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--surface0);
  border-radius: 6px;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Syntax Highlighting - Catppuccin Mocha */
.highlight {
  background-color: var(--crust);
  color: var(--text);
  border-radius: 6px;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt {
  color: var(--red);
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .si,
.highlight .sh,
.highlight .sx {
  color: var(--green);
}

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cp,
.highlight .cs {
  color: var(--overlay0);
  font-style: italic;
}

.highlight .nf,
.highlight .nb {
  color: var(--blue);
}

.highlight .mi,
.highlight .mf,
.highlight .mo,
.highlight .mh {
  color: var(--peach);
}

.highlight .nc,
.highlight .nn {
  color: var(--yellow);
}

.highlight .o,
.highlight .ow {
  color: var(--sky);
}

.highlight .na,
.highlight .ni {
  color: var(--sapphire);
}

/* Experience Timeline */
.timeline {
  position: relative;
  margin: 2rem 0;
  padding: 1rem 0;
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  display: grid;
  grid-template-columns: 150px 18px 1fr;
  align-items: start;
  gap: 1.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

/* Each item (except the last) draws the line from its own marker center
   down to the next item's marker center. Adding a new item automatically
   gets a connector because of :not(:last-child). */
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(150px + 1.5rem + 9px - 1px); /* date-col + gap + half-marker - half-line */
  top: calc(1.5rem + 9px);                /* marker center (margin-top + half height) */
  bottom: calc(-2.5rem - 1.5rem - 9px);  /* reach next item's marker center */
  width: 2px;
  background: var(--surface1);
  z-index: 0;
}

.timeline-date-left {
  text-align: right;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.date-month {
  font-size: 0.75rem;
  color: var(--subtext0);
  letter-spacing: 0.08em;
}

.date-year {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
}

.date-time {
  font-size: 0.7rem;
  color: var(--overlay0);
}

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 1.5rem;
  background: var(--mauve);
  border-radius: 50%;
  border: 3px solid var(--surface1);
  box-shadow: 0 0 0 3px var(--base);
  flex-shrink: 0;
}

.timeline-content {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  position: relative;
}

/* Arrow pointing left toward the marker.
   top: calc(1.5rem + 9px) = marker margin-top + half marker height,
   which is constant regardless of content length. */
.timeline-content::before {
  content: '';
  position: absolute;
  left: -9px;
  top: calc(1.5rem + 9px);
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 9px solid var(--surface1);
}

.timeline-content::after {
  content: '';
  position: absolute;
  left: -7px;
  top: calc(1.5rem + 9px);
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 8px solid var(--mantle);
}

.timeline-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--lavender);
  font-weight: 600;
}

.timeline-content p {
  margin-bottom: 0;
  color: var(--subtext0);
  line-height: 1.65;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .timeline::before {
    left: 0;
  }

  .timeline-item {
    grid-template-columns: 18px 1fr;
    gap: 1rem;
  }

  .timeline-date-left {
    display: none;
  }

  .timeline-content::before,
  .timeline-content::after {
    display: none;
  }
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--mauve);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

footer a {
  color: var(--subtext0);
  border: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--lavender);
}

/* Responsive Design */
@media (max-width: 640px) {
  body {
    padding: 1.5rem 1rem;
  }

  .hero-name {
    font-size: 2rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.3rem; }

  nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.9rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

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

  .project-item {
    padding: 1rem;
  }
}

/* TIL preview on homepage — single column */
.til-preview-grid {
  columns: 1 !important;
}

/* The More You Know - Masonry Card Grid */
.tmyk-intro {
  color: var(--subtext0);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.tmyk-grid {
  columns: 2;
  column-gap: 1.5rem;
  margin-top: 1.5rem;
}

.tmyk-card {
  break-inside: avoid;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-top: 2px solid var(--card-accent, var(--surface1));
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s, transform 0.15s;
}

.tmyk-card:hover {
  border-top-color: var(--card-accent, var(--mauve));
  border-color: var(--card-accent, var(--mauve));
  transform: translateY(-2px);
}

.tmyk-card[data-cat="concept"]     { --card-accent: var(--mauve); }
.tmyk-card[data-cat="tip"]         { --card-accent: var(--teal); }
.tmyk-card[data-cat="syntax"]      { --card-accent: var(--green); }
.tmyk-card[data-cat="insight"]     { --card-accent: var(--blue); }
.tmyk-card[data-cat="gotcha"]      { --card-accent: var(--red); }
.tmyk-card[data-cat="rabbit hole"] { --card-accent: var(--peach); }
.tmyk-card[data-cat="tool"]        { --card-accent: var(--sapphire); }
.tmyk-card[data-cat="math"]        { --card-accent: var(--yellow); }

.tmyk-card.wide {
  column-span: all;
}

.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--card-accent, var(--subtext0));
  border: 1px solid var(--card-accent, var(--surface1));
  border-radius: 3px;
  padding: 0.1em 0.5em;
  margin-bottom: 0.65rem;
  letter-spacing: 0.04em;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.card-body {
  font-size: 0.87rem;
  color: var(--subtext0);
  margin: 0;
  line-height: 1.65;
}

.card-body p {
  margin: 0;
}

.card-body code {
  font-size: 0.82em;
  background: var(--surface0);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--green);
  text-transform: none;
}

@media (max-width: 640px) {
  .tmyk-grid {
    columns: 1;
  }
  .tmyk-card.wide {
    column-span: unset;
  }
}

/* Print Styles */
@media print {
  body {
    background-color: white;
    color: black;
    max-width: 100%;
    text-transform: none;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  nav,
  footer {
    display: none;
  }
}
