/* ==========================================================
   Zed One Dark — Personal Homepage Theme
   Inspired by the Zed editor's default dark theme
   ========================================================== */

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

/* --- CSS Variables --- */
:root {
  /* Surfaces */
  --chrome: #21252a;
  --editor: #282c33;
  --border: #1a1c22;

  /* Syntax accent colors */
  --blue: #62adee;
  --green: #97c279;
  --red: #df6b75;
  --purple: #bc74d2;
  --orange: #d19965;
  --teal: #56b5c2;
  --yellow: #e4bf7a;
  --gray: #5b6370;

  /* Text hierarchy */
  --text-primary: #d7d9df;
  --text-secondary: #aab2bf;
  --text-muted: #6d737d;

  /* Sizing */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-ui: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --line-number-width: 3.5rem;
  --content-max-width: 52rem;
}

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

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

body {
  font-family: var(--font-ui);
  background: var(--chrome);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Title Bar --- */
.title-bar {
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.traffic-lights {
  display: flex;
  gap: 0.4rem;
}

.traffic-lights span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}

.traffic-lights .red { background: var(--red); }
.traffic-lights .yellow { background: var(--yellow); }
.traffic-lights .green { background: var(--green); }

.title-bar .path {
  color: var(--text-secondary);
}

/* --- Tab Bar (Navigation) --- */
.tab-bar {
  background: var(--chrome);
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-bar a {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.tab-bar a:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-bar a.active {
  color: var(--text-primary);
  background: var(--editor);
  border-bottom: 2px solid var(--blue);
  margin-bottom: -1px;
}

.tab-bar a.tab-intro {
  color: var(--green);
  font-style: italic;
}

/* --- Global Search (tab bar) --- */
.tab-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-search-icon {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gray);
  white-space: nowrap;
}

.tab-search input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  width: 10rem;
  padding: 0.3rem 0;
}

.tab-search input::placeholder {
  color: var(--gray);
}

.search-results {
  display: none;
  position: fixed;
  top: 5.5rem;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  max-height: 24rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.search-results.visible {
  display: block;
}

.search-group-title {
  padding: 0.4rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  border-bottom: 1px solid var(--border);
  background: var(--editor);
}

.search-result-item {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.search-result-item:hover {
  background: rgba(98, 173, 238, 0.08);
  color: var(--text-primary);
  text-decoration: none;
}

.search-result-item .sr-title {
  color: var(--blue);
}

.search-result-item .sr-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.search-no-results {
  padding: 1rem;
  color: var(--gray);
  text-align: center;
}

/* --- Editor Area --- */
.editor {
  background: var(--editor);
  flex: 1;
  display: flex;
  padding: 2rem 1rem;
}

.editor-content {
  max-width: var(--content-max-width);
  width: 100%;
}

/* --- Year filter pills --- */
.year-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.year-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.year-pill:hover {
  border-color: var(--blue);
  color: var(--text-secondary);
}

.year-pill.active {
  background: rgba(98, 173, 238, 0.15);
  border-color: var(--blue);
  color: var(--blue);
}

/* --- Line-numbered content --- */
.lines {
  counter-reset: line;
}

.line {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.1rem 0;
}

.line::before {
  counter-increment: line;
  content: counter(line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  width: var(--line-number-width);
  flex-shrink: 0;
  text-align: right;
  user-select: none;
  opacity: 0.6;
}

.line:has(h1)::before { font-size: 1.75rem; }
.line:has(h2)::before { font-size: 1.25rem; }
.line:has(h3)::before { font-size: 1.05rem; }

.line-content {
  flex: 1;
  min-width: 0;
}

.line-content h1,
.line-content h2,
.line-content h3,
.line-content p {
  margin: 0;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-mono);
  font-weight: 600;
}

h1 {
  font-size: 1.75rem;
  color: var(--purple);
  margin-bottom: 0.25rem;
}

h1::before {
  content: '// ';
  color: var(--gray);
}

h2 {
  font-size: 1.25rem;
  color: var(--purple);
  margin-top: 0;
  margin-bottom: 0;
}

h2::before {
  content: none;
}

h3 {
  font-size: 1.05rem;
  color: var(--teal);
  margin-top: 0;
  margin-bottom: 0;
}

h3::before {
  content: none;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* --- Links --- */
a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--teal);
  text-decoration: underline;
}

/* --- Blockquotes (like markdown >) --- */
blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* --- Code / Inline code --- */
code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--orange);
}

/* --- Hero / Intro --- */
.hero-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.hero-title::before {
  content: none;
}

.cursor {
  display: inline-block;
  width: 0.6rem;
  height: 1.2em;
  background: var(--blue);
  margin-left: 0.2rem;
  vertical-align: baseline;
  position: relative;
  top: 0.15em;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.subtitle {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.subtitle .kw { color: var(--purple); }
.subtitle .sep { color: var(--gray); }
.subtitle .str { color: var(--green); }

/* --- Highlight classes (syntax coloring) --- */
.kw { color: var(--purple); }     /* keyword */
.fn { color: var(--blue); }       /* function */
.str { color: var(--green); }     /* string */
.num { color: var(--orange); }    /* number */
.ty { color: var(--teal); }       /* type */
.cm { color: var(--gray); font-style: italic; } /* comment */
.err { color: var(--red); }       /* error/important */
.warn { color: var(--yellow); }   /* warning/constant */

/* --- Social / Icon Links --- */
.social-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.social-links a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
}

.social-links a:hover {
  color: var(--blue);
  border-color: var(--blue);
  text-decoration: none;
  background: rgba(98, 173, 238, 0.08);
}

/* --- Cards (Projects / Publications) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.card {
  background: var(--chrome);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--gray);
  transform: translateY(-2px);
}

.card-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 0.4rem;
}

.card-title a {
  color: inherit;
}

.card-title a:hover {
  text-decoration: underline;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Badges / Tags --- */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  margin-top: 0.4rem;
}

.badge-pdf { background: rgba(223, 107, 117, 0.15); color: var(--red); }
.badge-code { background: rgba(151, 194, 121, 0.15); color: var(--green); }
.badge-doi { background: rgba(86, 181, 194, 0.15); color: var(--teal); }
.badge-lang { background: rgba(188, 116, 210, 0.15); color: var(--purple); }
.badge-stars { background: rgba(228, 191, 122, 0.15); color: var(--yellow); }
.badge-video { background: rgba(223, 107, 117, 0.15); color: var(--red); }

/* --- Publication List --- */
.pub-list {
  list-style: none;
}

.pub-list li {
  border-left: 3px solid var(--border);
  padding: 1rem 0 1rem 1.25rem;
  margin-bottom: 0.25rem;
  transition: border-color 0.2s;
}

.pub-list li:hover {
  border-left-color: var(--blue);
}

.pub-title {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--blue);
  font-size: 0.95rem;
}

.pub-title a { color: inherit; }
.pub-title a:hover { text-decoration: underline; }

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.2rem 0;
}

.pub-authors .me {
  color: var(--green);
  font-weight: 500;
}

.pub-venue {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pub-venue .venue-name { color: var(--purple); }
.pub-venue .venue-year { color: var(--orange); }

/* --- Status Bar --- */
.status-bar {
  background: var(--chrome);
  border-top: 1px solid var(--border);
  padding: 0.35rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-bar a {
  color: var(--text-muted);
}

.status-bar a:hover {
  color: var(--blue);
  text-decoration: none;
}

.status-left, .status-right {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .editor {
    padding: 1rem 0.5rem;
  }

  .line::before {
    display: none;
  }

  .line {
    gap: 0;
  }

  h1 { font-size: 1.4rem; }
  .hero-title { font-size: 1.5rem; }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .title-bar {
    font-size: 0.7rem;
  }

  .tab-search {
    display: none;
  }
}

/* --- Section Spacer --- */
.section-spacer {
  height: 2rem;
}

/* --- Photo --- */
.profile-photo {
  width: 8rem;
  height: 8rem;
  border-radius: 6px;
  border: 2px solid var(--border);
  object-fit: cover;
  float: right;
  margin: 0 0 1rem 1.5rem;
}

/* Placeholder when no photo yet */
.photo-placeholder {
  width: 8rem;
  height: 8rem;
  border-radius: 6px;
  border: 2px dashed var(--gray);
  float: right;
  margin: 0 0 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gray);
}

/* --- OpenCode TUI Intro (uses site theme variables) --- */
.oc {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--editor);
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: opacity 0.6s ease;
  overflow: hidden;
}

.oc.oc-fadeout {
  opacity: 0;
}

/* Top bar */
.oc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 1rem;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}

.oc-topbar-left {
  color: var(--blue);
  font-weight: 600;
}

.oc-topbar-center {
  color: var(--text-secondary);
}

.oc-topbar-right {
  color: var(--gray);
}

/* Main area */
.oc-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Chat panel */
.oc-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
}

/* Panel headers */
.oc-panel-header {
  padding: 0.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--editor);
}

.oc-panel-header-bottom {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.oc-panel-label {
  color: var(--blue);
  font-weight: 500;
}

.oc-model-badge {
  background: var(--chrome);
  color: var(--green);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.68rem;
  border: 1px solid var(--green);
}

/* Messages area */
.oc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.oc-msg {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.oc-msg-role {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.oc-msg-role-user {
  color: var(--blue);
}

.oc-msg-role-assistant {
  color: var(--purple);
}

.oc-msg-body {
  color: var(--text-primary);
  line-height: 1.55;
  padding-left: 0.25rem;
}

.oc-msg-body .oc-bold {
  color: var(--text-primary);
  font-weight: 600;
}

.oc-msg-body .oc-dim {
  color: var(--gray);
}

.oc-msg-body .oc-green {
  color: var(--green);
}

.oc-msg-body .oc-yellow {
  color: var(--yellow);
  font-weight: 600;
}

.oc-msg-body .oc-teal {
  color: var(--teal);
}

.oc-msg-body .oc-red {
  color: var(--red);
}

/* Tool call blocks */
.oc-tool {
  background: var(--chrome);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  margin: 0.3rem 0;
  font-size: 0.78rem;
}

.oc-tool-header {
  color: var(--purple);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.oc-tool-body {
  color: var(--text-muted);
}

.oc-tool-body .oc-file {
  color: var(--blue);
}

.oc-tool-result {
  color: var(--green);
  font-size: 0.72rem;
  margin-top: 0.2rem;
}

/* Spinner */
.oc-spinner {
  display: inline-block;
}

.oc-spinner::after {
  content: '⠋';
  animation: oc-braille 0.8s steps(1) infinite;
}

@keyframes oc-braille {
  0%   { content: '⠋'; }
  12%  { content: '⠙'; }
  25%  { content: '⠹'; }
  37%  { content: '⠸'; }
  50%  { content: '⠼'; }
  62%  { content: '⠴'; }
  75%  { content: '⠦'; }
  87%  { content: '⠧'; }
}

/* Input area */
.oc-input-area {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--editor);
}

.oc-input-border {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  background: var(--chrome);
}

.oc-input-label {
  color: var(--green);
  margin-right: 0.4rem;
  font-weight: 600;
}

.oc-input-text {
  color: var(--text-primary);
  flex: 1;
}

.oc-input-cursor {
  display: inline-block;
  width: 0.5rem;
  height: 1.1em;
  background: var(--blue);
  animation: blink 1s step-end infinite;
}

.oc-input-hints {
  display: flex;
  gap: 1.25rem;
  padding: 0.3rem 0.2rem 0;
  font-size: 0.65rem;
  color: var(--gray);
}

/* Sidebar */
.oc-sidebar {
  width: 16rem;
  display: flex;
  flex-direction: column;
  background: var(--editor);
}

.oc-file-tree {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  overflow-y: auto;
}

.oc-file-tree div {
  padding: 0.1rem 0;
  color: var(--text-muted);
}

.oc-file-tree .oc-ft-dir {
  color: var(--blue);
}

.oc-file-tree .oc-ft-active {
  color: var(--text-primary);
  background: rgba(98, 173, 238, 0.1);
  margin: 0 -0.75rem;
  padding: 0.1rem 0.75rem;
}

.oc-info {
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
}

.oc-info div {
  padding: 0.1rem 0;
}

.oc-info-key {
  color: var(--gray);
}

.oc-info-val {
  color: var(--text-muted);
}

/* Status bar */
.oc-statusbar {
  display: flex;
  gap: 1.5rem;
  padding: 0.25rem 1rem;
  background: var(--chrome);
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--gray);
}

.oc-status-ok {
  color: var(--green);
}

.oc-skip {
  position: absolute;
  top: 2.2rem;
  right: 1rem;
  z-index: 10;
  background: var(--editor);
  border: 2px solid var(--green);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  animation: oc-skip-pulse 1.1s ease-in-out infinite;
}

@keyframes oc-skip-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(152, 195, 121, 0.7);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 10px rgba(152, 195, 121, 0);
    opacity: 0.6;
  }
}

.oc-skip:hover {
  animation: none;
  background: var(--green);
  color: var(--editor);
  opacity: 1;
}

/* Responsive: hide sidebar on narrow screens */
@media (max-width: 640px) {
  .oc-sidebar { display: none; }
  .oc-chat { border-right: none; }
}

/* --- Utility --- */
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}
