/* ============================================
   Gruvbox Neovim Theme
   Warm, nerdy, minimal — inspired by gruvbox.nvim
   ============================================ */

:root {
  /* Gruvbox dark palette */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-body: 'JetBrains Mono', monospace;

  --gb-bg: #282828;
  --gb-bg0-h: #1d2021;
  --gb-bg1: #3c3836;
  --gb-bg2: #504945;
  --gb-bg3: #665c54;
  --gb-fg: #ebdbb2;
  --gb-fg1: #d5c4a1;
  --gb-fg2: #bdae93;
  --gb-fg3: #a89984;
  --gb-fg4: #928374;
  --gb-red: #fb4934;
  --gb-green: #b8bb26;
  --gb-yellow: #fabd2f;
  --gb-blue: #83a598;
  --gb-purple: #d3869b;
  --gb-aqua: #8ec07c;
  --gb-orange: #fe8019;

  --accent: var(--gb-aqua);
  --accent-dim: var(--gb-blue);
  --accent-warm: var(--gb-yellow);
  --accent-glow: rgba(142, 192, 124, 0.10);
  --accent-subtle: rgba(142, 192, 124, 0.05);
  --text-primary: var(--gb-fg);
  --text-secondary: var(--gb-fg1);
  --text-muted: var(--gb-fg4);
  --bg: var(--gb-bg0-h);
  --bg-card: var(--gb-bg);
  --border: var(--gb-bg2);
  --border-light: var(--gb-bg1);
  --radius: 2px;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- Global ---- */

body {
  font-family: var(--font-mono) !important;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 1.4em;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow-y: auto;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono) !important;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

a {
  color: var(--gb-blue);
  text-decoration: none;
  transition: color 0.15s ease;
  border-bottom: 1px solid transparent;
}

a:hover, a:focus {
  color: var(--gb-aqua);
  border-bottom-color: var(--gb-aqua);
  text-decoration: none;
}

code, pre code {
  font-family: var(--font-mono) !important;
}

code {
  background: var(--gb-bg1);
  color: var(--gb-orange);
  border-radius: var(--radius);
  padding: 0.15rem 0.4rem;
  font-size: 0.92em;
  border: 1px solid var(--border);
}

pre {
  border-radius: var(--radius);
  border: 1px solid var(--gb-bg3);
  background: #1d2021 !important;
  color: #ebdbb2 !important;
  padding: 1.6rem !important;
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.container {
  max-width: 72rem;
}

/* ---- Navigation ---- */

.navigation {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 5rem;
  display: flex;
  align-items: center;
}

.navigation .navigation-title {
  font-family: var(--font-mono) !important;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-transform: lowercase;
}

.navigation .navigation-title::before {
  content: ':e ';
  color: var(--gb-aqua);
  font-weight: 400;
}

.navigation .navigation-list .navigation-link {
  font-family: var(--font-mono) !important;
  font-weight: 400;
  font-size: 1.3rem;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 0.4rem 0;
  position: relative;
  border-bottom: none;
}

.navigation .navigation-list .navigation-link::before {
  content: ':';
  color: var(--gb-fg4);
  font-weight: 400;
}

.navigation .navigation-list .navigation-link:hover,
.navigation .navigation-list .navigation-link:focus {
  color: var(--gb-yellow);
  text-decoration: none;
  border-bottom: none;
}

.navigation .navigation-list .navigation-link:hover::before {
  color: var(--gb-yellow);
}

/* ---- Hero / Homepage ---- */

.hero {
  padding-top: 2rem;
  padding-bottom: 1rem;
}

.hero .about {
  display: flex;
  align-items: flex-start;
  gap: 4rem;
  text-align: left;
}

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

.hero .avatar img {
  width: 14rem;
  height: 14rem;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--gb-bg3);
  filter: grayscale(15%) sepia(5%);
  transition: filter 0.3s ease;
}

.hero .avatar img:hover {
  filter: grayscale(0%) sepia(0%);
}

.hero .hero-text {
  flex: 1;
}

.hero .hero-text h1 {
  font-size: 2.8rem;
  line-height: 1.2;
  margin: 0 0 0.3rem 0;
  letter-spacing: -0.02em;
  color: var(--gb-fg);
}

.hero .hero-text h1::before {
  content: '> ';
  color: var(--gb-yellow);
  font-weight: 400;
}

.hero .hero-text .role {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--gb-aqua);
  margin: 0 0 1.6rem 0;
  letter-spacing: 0.01em;
}

.hero .hero-text .role::before {
  content: '-- ';
  color: var(--gb-fg4);
}

.hero .hero-text .role::after {
  content: ' --';
  color: var(--gb-fg4);
}

.hero .hero-text .bio {
  font-size: 1.3rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 2rem 0;
  max-width: 52rem;
  padding: 1.2rem 1.6rem;
  border-left: 3px solid var(--gb-yellow);
  background: var(--gb-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.hero .hero-text .bio::before {
  content: '" ';
  color: var(--gb-fg4);
  font-style: italic;
}

.hero .hero-text .bio::after {
  content: '"';
  color: var(--gb-fg4);
  font-style: italic;
}

/* Social links */
.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.social-links li {
  display: inline-block;
}

.social-links li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: var(--radius);
  background: var(--gb-bg);
  border: 1px solid var(--border);
  color: var(--gb-fg4);
  font-size: 1.4rem;
  transition: all 0.15s ease;
}

.social-links li a:hover {
  background: var(--gb-bg1);
  border-color: var(--gb-yellow);
  color: var(--gb-yellow);
  text-decoration: none;
}

.social-links li a i {
  font-size: 1.4rem !important;
}

/* ---- News / Timeline ---- */

.news-section {
  padding-top: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.02em;
}

.section-title::before {
  content: '-- ';
  color: var(--gb-fg4);
  font-weight: 400;
}

.section-title::after {
  content: ' --';
  color: var(--gb-fg4);
  font-weight: 400;
}

.news-timeline {
  position: relative;
  padding-left: 0;
  border-left: none;
  max-height: 48vh;
  overflow-y: scroll;
  padding-right: 0.5rem;
}

.news-timeline::-webkit-scrollbar {
  width: 6px;
}

.news-timeline::-webkit-scrollbar-track {
  background: var(--gb-bg1);
}

.news-timeline::-webkit-scrollbar-thumb {
  background: var(--gb-bg3);
  border-radius: 2px;
}

.news-item {
  position: relative;
  padding: 0.5rem 0;
  display: flex;
  gap: 2rem;
  align-items: baseline;
  border-bottom: 1px solid var(--border-light);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item::before {
  display: none;
}

.news-date {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--gb-fg4);
  white-space: nowrap;
  min-width: 9rem;
  flex-shrink: 0;
}

.news-text {
  font-size: 1.3rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.news-link {
  font-weight: 600;
  margin-left: 0.4rem;
  color: var(--gb-blue);
  border-bottom: none;
}

.news-link:hover {
  color: var(--gb-aqua);
}

/* ---- Content pages ---- */

.content article header {
  margin-top: 1rem;
}

.content {
  margin-top: 0;
  display: block !important;
  flex-direction: unset;
}

.content article header h1 {
  font-size: 2.6rem;
  letter-spacing: -0.02em;
}

.content article header h1::before {
  content: '# ';
  color: var(--gb-yellow);
  font-weight: 400;
}

.content article p {
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 1.35rem;
}

.content article h2 {
  margin-top: 3.5rem;
  font-size: 1.8rem;
}

.content article h2::before {
  content: '## ';
  color: var(--gb-yellow);
  font-weight: 400;
}

.content article h3 {
  margin-top: 2.5rem;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.content article h3::before {
  content: '### ';
  color: var(--gb-yellow);
  font-weight: 400;
}

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

.list ul {
  margin: 2rem 0;
}

.list ul li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

.list ul li:last-child {
  border-bottom: none;
}

.list ul li .date {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--gb-fg4);
}

.list ul li .title {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: none;
}

.list ul li .title:hover {
  color: var(--gb-yellow);
}

/* ---- Publications page ---- */

.content .page h3 {
  font-size: 1.6rem;
  color: var(--gb-orange);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.content .page h3::before {
  content: '### ';
  color: var(--gb-yellow);
  font-weight: 400;
}

/* ---- Footer (vim statusline) ---- */

.footer {
  font-size: 1.15rem !important;
  color: var(--gb-fg2);
  border-top: none;
  padding: 0 !important;
  font-family: var(--font-mono) !important;
  background: var(--gb-bg1);
  margin: 0;
  line-height: 1;
}

.footer .container {
  display: flex;
  align-items: center;
  padding: 0.45rem 2rem;
  gap: 0;
  max-width: 100%;
}

.footer a {
  color: var(--gb-fg3);
  border-bottom: none;
}

.footer a:hover {
  color: var(--gb-yellow);
}

.vim-mode {
  background: var(--gb-aqua);
  color: #282828;
  font-weight: 700;
  padding: 0.15rem 0.8rem;
  margin-right: 1rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.vim-file {
  color: var(--gb-fg2);
  font-weight: 500;
  margin-right: 1rem;
}

.vim-spacer {
  flex: 1;
}

.vim-info {
  color: var(--gb-fg4);
  margin-right: 1.5rem;
}

.vim-pos {
  color: var(--gb-fg4);
  font-size: 1.05rem;
}

/* dark is default, no overrides needed */

/* ---- Blockquote styling ---- */

blockquote {
  border-left: 3px solid var(--gb-yellow);
  background: var(--gb-bg);
  padding: 1rem 1.6rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 2rem 0;
  font-style: italic;
  color: var(--gb-fg2);
}

blockquote p {
  margin: 0;
}

/* ---- Iframe embeds ---- */

iframe {
  border-radius: var(--radius);
  border: 1px solid var(--border) !important;
  margin: 1rem 0.5rem;
}

/* ---- Table styling ---- */

table {
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 1.3rem;
}

table td, table th {
  border-color: var(--border);
  padding: 0.8rem 1.4rem;
}

/* ---- Metrics blog tables ---- */

table.metrics, table.matrix, table.contingency {
  border: none !important;
  border-collapse: collapse !important;
}

table.metrics td, table.metrics th,
table.matrix td, table.matrix th,
table.contingency td, table.contingency th {
  border: 1px solid var(--gb-bg2) !important;
  padding: 0.8rem 1.4rem !important;
}

table.metrics th, table.matrix th, table.contingency th {
  background: var(--gb-bg1);
}

table.metrics td, table.matrix td, table.contingency td {
  background: var(--gb-bg);
}

table.metrics td:empty, table.matrix td:empty, table.contingency td:empty,
table.metrics th:empty, table.matrix th:empty, table.contingency th:empty {
  border: none !important;
  background: transparent;
}

.caption {
  font-size: 1.15rem;
  color: var(--gb-fg4);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ---- D3 charts ---- */

.viz-wrapper {
  display: flex !important;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4.5rem;
}

.viz-wrapper svg {
  display: inline-block;
  flex-shrink: 0;
  overflow: visible;
}

.viz-wrapper svg text {
  fill: var(--text-primary) !important;
}

.viz-wrapper svg line,
.viz-wrapper svg path.domain {
  stroke: var(--gb-fg4) !important;
}

/* ---- Slider styling ---- */

input[type="range"].slider {
  accent-color: var(--gb-yellow);
}

/* ---- Selection highlight ---- */

::selection {
  background: var(--gb-yellow);
  color: var(--gb-fg);
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: var(--gb-bg1);
}

::-webkit-scrollbar-thumb {
  background: var(--gb-bg3);
  border-radius: 2px;
}

/* ---- Responsive ---- */

@media only screen and (max-width: 768px) {
  .hero .about {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
  }

  .hero .avatar img {
    width: 10rem;
    height: 10rem;
  }

  .hero .hero-text h1 {
    font-size: 2.2rem;
  }

  .hero .hero-text .role {
    font-size: 1.3rem;
  }

  .hero .hero-text .bio {
    font-size: 1.2rem;
    text-align: left;
  }

  .social-links {
    justify-content: center;
  }

  .news-item {
    flex-direction: column;
    gap: 0.2rem;
  }

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

  .content article header h1 {
    font-size: 2rem;
  }

}

/* ---- Light mode: Gruvbox light (toggle) ---- */
body.colorscheme-light {
  --gb-bg: #fbf1c7;
  --gb-bg0-h: #f2e5bc;
  --gb-bg1: #ebdbb2;
  --gb-bg2: #d5c4a1;
  --gb-bg3: #bdae93;
  --gb-fg: #3c3836;
  --gb-fg1: #504945;
  --gb-fg2: #665c54;
  --gb-fg3: #7c6f64;
  --gb-fg4: #928374;
  --gb-red: #cc241d;
  --gb-green: #98971a;
  --gb-yellow: #d79921;
  --gb-blue: #458588;
  --gb-purple: #b16286;
  --gb-aqua: #689d6a;
  --gb-orange: #d65d0e;

  --accent: var(--gb-aqua);
  --accent-dim: var(--gb-blue);
  --accent-warm: var(--gb-yellow);
  --accent-glow: rgba(104, 157, 106, 0.12);
  --accent-subtle: rgba(104, 157, 106, 0.06);
  --text-primary: var(--gb-fg);
  --text-secondary: var(--gb-fg1);
  --text-muted: var(--gb-fg4);
  --bg: var(--gb-bg0-h);
  --bg-card: var(--gb-bg);
  --border: var(--gb-bg2);
  --border-light: var(--gb-bg1);
}

body.colorscheme-light .footer {
  background: var(--gb-fg2);
  color: var(--gb-bg1);
}

body.colorscheme-light .vim-mode {
  background: var(--gb-aqua);
  color: var(--gb-fg);
}

body.colorscheme-light .footer a {
  color: var(--gb-bg2);
}

/* ---- Float container / color scheme toggle ---- */

.float-container {
  position: fixed;
  top: 0;
  right: 1.6rem;
  height: 5rem;
  display: flex;
  align-items: center;
  z-index: 200;
}

@media only screen and (max-width: 768px) {
  .float-container {
    right: 6rem;
  }
}

.colorscheme-toggle {
  cursor: pointer;
  color: var(--gb-fg4);
  font-size: 0.7rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-family: var(--font-mono);
}

.colorscheme-toggle:hover {
  opacity: 1;
  color: var(--gb-yellow);
}

/* ---- Vim mode variants ---- */

.vim-mode--normal {
  background: var(--gb-aqua);
  color: #282828;
}

.vim-mode--command {
  background: var(--gb-yellow);
  color: #282828;
}

.vim-mode--search {
  background: var(--gb-orange);
  color: #282828;
}

/* ---- Vim toggle ---- */

.vim-toggle {
  cursor: pointer;
  color: var(--gb-fg4);
  font-size: 1.05rem;
  margin-right: 1.5rem;
  transition: color 0.15s ease;
  user-select: none;
}

.vim-toggle:hover {
  color: var(--gb-yellow);
}

/* ---- Vim command line ---- */

.vim-cmdline {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  background: var(--gb-bg);
  border-top: 1px solid var(--gb-bg2);
  padding: 0.4rem 1rem;
  z-index: 1000;
  font-family: var(--font-mono);
  font-size: 1.3rem;
}

.vim-cmd-prompt {
  color: var(--gb-yellow);
  font-weight: 700;
  margin-right: 0.3rem;
}

.vim-cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--gb-fg);
  font-family: var(--font-mono);
  font-size: 1.3rem;
  caret-color: var(--gb-yellow);
}

/* ---- Vim search overlay ---- */

.vim-search-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  background: var(--gb-bg);
  border-top: 1px solid var(--gb-bg2);
  padding: 0.4rem 1rem;
  z-index: 1000;
  font-family: var(--font-mono);
  font-size: 1.3rem;
}

.vim-search-prompt {
  color: var(--gb-orange);
  font-weight: 700;
  margin-right: 0.3rem;
}

.vim-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--gb-fg);
  font-family: var(--font-mono);
  font-size: 1.3rem;
  caret-color: var(--gb-orange);
}

.vim-search-input::placeholder {
  color: var(--gb-fg4);
  opacity: 0.5;
}

.vim-search-hl {
  background: var(--gb-yellow);
  color: #282828;
  border-radius: 2px;
  padding: 0 2px;
}

/* ---- Vim help overlay ---- */

.vim-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 32, 33, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.vim-help-box {
  background: var(--gb-bg);
  border: 1px solid var(--gb-bg3);
  border-radius: 4px;
  padding: 2.5rem 3rem;
  max-width: 48rem;
  width: 90%;
  font-family: var(--font-mono);
}

.vim-help-box h3 {
  font-size: 1.6rem;
  color: var(--gb-aqua);
  margin: 0 0 1.5rem 0;
  font-weight: 700;
}

.vim-help-box table {
  width: 100%;
  border: none !important;
  border-collapse: collapse;
}

.vim-help-box table tr td {
  padding: 0.4rem 1rem;
  border: none !important;
  background: transparent;
  font-size: 1.25rem;
}

.vim-help-box table tr td:first-child {
  white-space: nowrap;
  color: var(--gb-fg2);
  width: 15rem;
}

.vim-help-box table tr td:last-child {
  color: var(--gb-fg4);
}

.vim-help-box kbd {
  background: var(--gb-bg1);
  border: 1px solid var(--gb-bg3);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--gb-yellow);
}

.vim-help-close {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: var(--gb-fg4);
  text-align: center;
}

/* ---- Vim comment in changelog ---- */

.vim-comment {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--gb-fg4);
  font-style: italic;
  margin-bottom: 1.2rem;
  opacity: 0.7;
}
