@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
  /* Dark palette */
  --bg-main: #000000;
  --bg-tile: #0a0a0a;
  --border-color: #3a3a3a;
  --separator-color: #2a2a2a;
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #d0d0d0;
  --text-muted: #888888;
  
  /* Accent colors */
  --link-color: #5fb4b4;
  --link-hover: #7fcfcf;
  --orange-link: #f5a623;
  --orange-hover: #ffc04d;
}

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

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

a:visited {
  color: var(--link-color);
}

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

html, body {
  height: 100%;
}

body {
  font-family: "IBM Plex Mono", "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-weight: 400;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   PAGE WRAPPER - MARGINS
   ============================================ */

.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 30px;
}

/* ============================================
   TOP NAVIGATION BAR
   ============================================ */

.top-nav {
  padding: 10px 0;
  margin-bottom: 12px;
}

.top-nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 13px;
  text-transform: lowercase;
  transition: color 0.15s ease;
}

.top-nav a:hover {
  color: var(--link-hover);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
  padding: 16px 0 0;
  margin-bottom: 0;
  text-align: center;
}

.hero-name {
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.6;
  margin: 0 auto 16px;
  min-height: 1.6em;
}

.scramble-text {
  color: var(--link-color);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.hero-links {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.hero-links a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s ease;
}

.hero-links a:hover {
  color: var(--link-hover);
}

/* ============================================
   INTRO SUMMARY
   ============================================ */

.intro-summary {
  text-align: center;
  padding: 16px 20px 16px;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-bottom: 1px solid var(--separator-color);
}

.intro-summary p {
  margin: 0;
}

.intro-summary strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   MAIN LAYOUT - TILED
   ============================================ */

.main-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   TILES / SECTIONS
   ============================================ */

.tile {
  padding: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-tile);
}

.tile-header {
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 10px;
  color: var(--text-primary);
  text-transform: capitalize;
}

/* ============================================
   ABOUT SECTION
   ============================================ */

.about-section {
  overflow: hidden; /* For float clearing */
}

.profile-image {
  width: 150px;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border-color);
  float: left;
  margin-right: 16px;
  margin-bottom: 8px;
}

.about-content h2 {
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.about-content p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}

.about-content a {
  color: var(--link-color);
  text-decoration: none;
}

.about-content a:hover {
  color: var(--link-hover);
}

.about-links {
  margin-top: 8px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.about-links a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 12px;
}

.about-links a:hover {
  color: var(--link-hover);
}

/* ============================================
   RESEARCH & PROJECTS SECTIONS
   ============================================ */

.item-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.item {
  padding: 10px 0;
  position: relative;
}

.item:first-child {
  padding-top: 0;
}

.item:last-child {
  padding-bottom: 0;
}

/* Separator between items - centered line that doesn't touch edges */
.item + .item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--separator-color);
}

.item-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.item-title {
  font-size: 13px;
}

.item-title a {
  color: var(--link-color);
  text-decoration: none;
}

.item-title a:hover {
  color: var(--link-hover);
}

.item-tags {
  font-size: 11px;
  color: var(--text-muted);
}

.item-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-left: 16px;
}

/* Item logos */
.item-logo-right {
  float: right;
  width: 100px;
  height: auto;
  margin-left: 12px;
  margin-bottom: 8px;
}

.item-logos-right {
  float: right;
  display: flex;
  gap: 8px;
  margin-left: 12px;
  margin-bottom: 8px;
}

.item-logo-small {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

/* Poster gallery */
.poster-gallery {
  display: flex;
  gap: 12px;
  margin: 12px 0 4px 16px;
}

.poster-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.poster-item img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  transition: border-color 0.2s ease;
}

.poster-item a:hover img {
  border-color: var(--link-color);
}

.poster-caption {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
}

/* Mod sub-items */
.mod-list {
  margin-top: 6px;
  margin-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mod-item {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 16px;
}

.mod-game {
  color: var(--text-muted);
  font-size: 10px;
}

.mod-link {
  color: var(--orange-link) !important;
  font-size: 10px;
}

.mod-link:hover {
  color: var(--orange-hover) !important;
}

.mod-downloads {
  color: var(--text-muted);
  font-size: 10px;
}

/* ============================================
   RIGHT SIDEBAR - RECENT POSTS
   ============================================ */

.sidebar-tile {
  padding: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-tile);
}

.sidebar-header {
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 10px;
  color: var(--text-primary);
  text-transform: capitalize;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-item {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--separator-color);
}

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

.post-category {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.post-category .sep {
  margin: 0 3px;
}

.post-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.post-date {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.post-title {
  font-size: 11px;
}

.post-title a {
  color: var(--link-color);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--link-hover);
}

.sidebar-more {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.sidebar-more a {
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
}

.sidebar-more a:hover {
  color: var(--text-secondary);
}

/* ============================================
   BLOG PAGE
   ============================================ */

.blog-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 20px 30px;
}

.blog-header {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-item {
  padding: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-tile);
}

.blog-item-category {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.blog-item-category .sep {
  margin: 0 3px;
}

.blog-item-title {
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 4px;
}

.blog-item-title a {
  color: var(--link-color);
  text-decoration: none;
}

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

.blog-item-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.blog-item-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 8px;
}

.blog-item-more {
  font-size: 11px;
}

.blog-item-more a {
  color: var(--link-color);
  text-decoration: none;
}

.blog-item-more a:hover {
  color: var(--link-hover);
}

/* ============================================
   CONTENT PAGES (Projects, Research, Contact)
   ============================================ */

.page-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 20px 30px;
}

.page-header {
  margin-bottom: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.page-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.page-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.page-content h2 {
  font-size: 16px;
  font-weight: 400;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text-primary);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--separator-color);
}

.page-content h3 {
  font-size: 14px;
  font-weight: 400;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.page-content p {
  margin-bottom: 8px;
}

.page-content a {
  color: var(--link-color);
  text-decoration: none;
}

.page-content a:hover {
  color: var(--link-hover);
}

.page-content ul, .page-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.page-content li {
  margin-bottom: 4px;
}

.page-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.page-content code {
  background: #292a2b;
  border: 1px solid var(--border-color);
  padding: 2px 5px;
  font-size: 12px;
  color: #e6e6e6;
}

.page-content pre {
  background: #292a2b;
  border: 1px solid var(--border-color);
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
}

.page-content pre code {
  border: none;
  padding: 0;
  color: #e6e6e6;
}

/* ---- Panda Syntax Theme (Rouge) ---- */
.highlight { background: #292a2b; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #676b79; font-style: italic; } /* comments */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: #ff75b5; } /* keywords */
.highlight .kt, .highlight .nc, .highlight .nn { color: #ffb86c; } /* types, classes, namespaces */
.highlight .na, .highlight .nf, .highlight .nb { color: #6fc1ff; } /* attributes, functions, builtins */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sh { color: #19f9d8; } /* strings */
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #ffb86c; } /* numbers */
.highlight .o, .highlight .p { color: #e6e6e6; } /* operators, punctuation */
.highlight .n, .highlight .nv, .highlight .vi, .highlight .vg { color: #e6e6e6; } /* names, variables */
.highlight .ow { color: #ff75b5; } /* operator words (and, or, not) */
.highlight .cp { color: #ffb86c; } /* preprocessor */
.highlight .err { color: #ff2c6d; } /* errors */

.page-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px auto;
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

/* ============================================
   PIPELINE DIAGRAM (inline HTML/CSS)
   ============================================ */

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0;
  align-items: center;
  margin: 20px 0;
}

.pipeline-grid.row2 {
  margin-top: 0;
}

.pipeline-box {
  padding: 18px 12px;
  border: 2px solid;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.pipeline-box .box-label {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.pipeline-box .box-sub {
  display: block;
  font-size: 11px;
  opacity: 0.7;
}

.pipeline-arrow {
  text-align: center;
  font-size: 18px;
  color: var(--text-muted);
  padding: 0 6px;
}

.pipeline-arrow-down {
  text-align: center;
  font-size: 18px;
  color: var(--text-muted);
  padding: 8px 0;
  display: flex;
  justify-content: flex-end;
  padding-right: calc(50% / 3 + 20px);
}

.pipeline-arrow-down-center {
  text-align: center;
  font-size: 18px;
  color: var(--text-muted);
  padding: 6px 0;
}

.pb-source  { border-color: #9F1D20; background: rgba(159,29,32,0.08); color: #9F1D20; }
.pb-parser  { border-color: #C45A2C; background: rgba(196,90,44,0.08); color: #C45A2C; }
.pb-ast     { border-color: #E8A838; background: rgba(232,168,56,0.08); color: #E8A838; }
.pb-compile { border-color: #3B6EA5; background: rgba(59,110,165,0.08); color: #3B6EA5; }
.pb-asm     { border-color: #2D8659; background: rgba(45,134,89,0.08);  color: #2D8659; }
.pb-exe     { border-color: #555555; background: rgba(85,85,85,0.08);   color: #999999; }

@media (max-width: 600px) {
  .pipeline-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .pipeline-arrow {
    transform: rotate(90deg);
  }
}

/* Orange links */
.orange-link,
.game-link-orange {
  color: var(--orange-link) !important;
  font-size: 11px;
  margin-left: 6px;
}

.orange-link:hover,
.game-link-orange:hover {
  color: var(--orange-hover) !important;
}

/* Image gallery */
.image-gallery,
.mod-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.image-gallery img,
.mod-gallery img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  background: var(--bg-tile);
  padding: 3px;
}

.mod-gallery-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 6px;
}

/* ============================================
   CONTACT PAGE
   ============================================ */

.contact-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.contact-content p {
  margin-bottom: 6px;
}

.contact-content a {
  color: var(--link-color);
}

/* ============================================
   WEBRING WIDGET
   ============================================ */

.webring-widget {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 6px;
  background: var(--bg-tile);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.webring-widget a,
.webring-widget span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 9px;
  transition: color 0.15s ease;
}

.webring-widget a:hover {
  color: var(--text-secondary);
}

.webring-widget .webring-nav {
  padding: 4px 6px;
  font-size: 8px;
}

.webring-widget .webring-center {
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.webring-widget svg {
  width: 12px;
  height: 12px;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  padding: 10px 0;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-text {
  margin-top: 2px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

/* Hidden state before JS fires */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate="slide-left"] {
  transform: translateX(-32px);
}

[data-animate="slide-right"] {
  transform: translateX(32px);
}

[data-animate="fade"] {
  transform: none;
}

/* Visible state after IntersectionObserver triggers */
[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delays for sequential elements */
[data-animate][data-delay="1"] { transition-delay: 0.1s; }
[data-animate][data-delay="2"] { transition-delay: 0.2s; }
[data-animate][data-delay="3"] { transition-delay: 0.3s; }
[data-animate][data-delay="4"] { transition-delay: 0.4s; }
[data-animate][data-delay="5"] { transition-delay: 0.5s; }
[data-animate][data-delay="6"] { transition-delay: 0.6s; }

/* SVG chart container */
.svg-chart-wrap {
  margin: 16px 0;
}

.svg-chart-wrap svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Animated SVG bars - grow from bottom */
.svg-chart-wrap .bar-grow {
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.svg-chart-wrap.is-visible .bar-grow {
  transform: scaleY(1);
}

/* Animated SVG bars - grow from left (horizontal) */
.svg-chart-wrap .bar-grow-h {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.svg-chart-wrap.is-visible .bar-grow-h {
  transform: scaleX(1);
}

/* SVG line draw animation */
.svg-chart-wrap .line-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.5s ease;
}

.svg-chart-wrap.is-visible .line-draw {
  stroke-dashoffset: 0;
}

/* SVG dot pop-in */
.svg-chart-wrap .dot-pop {
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.svg-chart-wrap.is-visible .dot-pop {
  transform: scale(1);
}

/* Staggered SVG delays */
.svg-chart-wrap.is-visible .delay-1 { transition-delay: 0.1s; }
.svg-chart-wrap.is-visible .delay-2 { transition-delay: 0.2s; }
.svg-chart-wrap.is-visible .delay-3 { transition-delay: 0.3s; }
.svg-chart-wrap.is-visible .delay-4 { transition-delay: 0.4s; }
.svg-chart-wrap.is-visible .delay-5 { transition-delay: 0.5s; }
.svg-chart-wrap.is-visible .delay-6 { transition-delay: 0.6s; }
.svg-chart-wrap.is-visible .delay-7 { transition-delay: 0.7s; }
.svg-chart-wrap.is-visible .delay-8 { transition-delay: 0.8s; }
.svg-chart-wrap.is-visible .delay-9 { transition-delay: 0.9s; }
.svg-chart-wrap.is-visible .delay-10 { transition-delay: 1.0s; }
.svg-chart-wrap.is-visible .delay-11 { transition-delay: 1.1s; }
.svg-chart-wrap.is-visible .delay-12 { transition-delay: 1.2s; }

/* Row slide-in for table rows */
.svg-chart-wrap .row-slide {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.svg-chart-wrap.is-visible .row-slide {
  opacity: 1;
  transform: none;
}

/* Card slide-up */
.svg-chart-wrap .card-slide {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.svg-chart-wrap.is-visible .card-slide {
  opacity: 1;
  transform: none;
}

/* Block scale-in for treemap */
.svg-chart-wrap .block-scale {
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.svg-chart-wrap.is-visible .block-scale {
  transform: scale(1);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  [data-animate],
  .svg-chart-wrap .bar-grow,
  .svg-chart-wrap .bar-grow-h,
  .svg-chart-wrap .line-draw,
  .svg-chart-wrap .dot-pop,
  .svg-chart-wrap .row-slide,
  .svg-chart-wrap .card-slide,
  .svg-chart-wrap .block-scale {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
  }
  
  .about-section {
    text-align: left;
  }
  
  .profile-image {
    width: 100px;
  }
  
  .about-links {
    justify-content: flex-start;
  }
  
  .top-nav ul {
    justify-content: center;
  }
  
  .page-wrapper {
    padding: 15px 20px;
  }
  
  .item-header {
    flex-direction: column;
    gap: 2px;
  }
  
  .item + .item::before {
    left: 10px;
    right: 10px;
  }
}
