@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #21262d;
  --fg: #e6edf3;
  --accent: #58a6ff;
  --accent2: #3fb950;
  --muted: #8b949e;
  --border: #30363d;
  --danger: #f85149;
}

/* ─── Light theme ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #fafaf9;
  --bg2: #f0ede8;
  --bg3: #e8e4de;
  --fg: #1c1917;
  --accent: #2563eb;
  --accent2: #16a34a;
  --muted: #78716c;
  --border: #d6d3cf;
  --danger: #dc2626;
}

[data-theme="light"] body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Keep monospace for code/terminal elements in light mode */
[data-theme="light"] pre,
[data-theme="light"] code,
[data-theme="light"] .demo-terminal,
[data-theme="light"] .stream-output,
[data-theme="light"] .step-log,
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] .terminal-title {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Hide blinking cursor in light mode */
[data-theme="light"] .hero-title .cursor { display: none; }

/* Show/hide helpers */
.dark-only { display: block; }
.light-only { display: none; }
[data-theme="light"] .dark-only { display: none; }
[data-theme="light"] .light-only { display: block; }

/* ─── Neumorphic pill toggle ─────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 148px;
  height: 50px;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
  flex-shrink: 0;
  /* dark neumorphic */
  background: var(--bg2);
  box-shadow: 4px 4px 8px #080c11, -3px -3px 6px #1e2530;
  transition: background 0.35s, box-shadow 0.35s;
}

[data-theme="light"] .theme-toggle {
  box-shadow: 5px 5px 12px #c0bdb8, -4px -4px 10px #ffffff;
}

/* Sliding knob */
.tgl-knob {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #b0ada8;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.5), -1px -1px 3px rgba(255,255,255,0.07);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.35s, box-shadow 0.35s;
  z-index: 1;
}

[data-theme="light"] .tgl-knob {
  left: 103px;
  background: #f5f2ee;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.18), -2px -2px 5px rgba(255,255,255,0.95);
}

.tgl-icon {
  font-size: 17px;
  line-height: 1;
  color: #3a3a3a;
  pointer-events: none;
  user-select: none;
}

[data-theme="light"] .tgl-icon {
  color: #666;
}

/* Labels */
.tgl-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s;
}

.tgl-label-dark {
  right: 14px;
  color: var(--muted);
  opacity: 1;
}

.tgl-label-light {
  left: 14px;
  color: var(--muted);
  opacity: 0;
}

[data-theme="light"] .tgl-label-dark  { opacity: 0; }
[data-theme="light"] .tgl-label-light { opacity: 1; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ─── Navigation ───────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 2rem;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: nowrap;
}

.nav-brand {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
}

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

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover {
  color: var(--fg);
  border-color: var(--border);
}

/* push toggle (and everything after it) to the right on desktop */
.theme-toggle {
  margin-left: auto;
}

/* ─── Layout ────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  padding-top: 68px;
}

/* ─── Section headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-header .label {
  color: var(--accent2);
  white-space: nowrap;
}

.section-header .rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  padding: 6rem 0 4rem;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-prompt {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 0.5rem;
}

.hero-prompt span {
  color: var(--accent2);
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.hero-title .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

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

.hero-subtitle {
  color: var(--muted);
  font-size: 16px;
  max-width: 640px;
  margin-bottom: 2.5rem;
  line-height: 1.9;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font-family: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  outline: none;
}

.btn:hover {
  background: var(--bg3);
  border-color: var(--muted);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.btn-primary:hover {
  background: #79beff;
  border-color: #79beff;
  color: var(--bg);
}

.btn-run {
  background: var(--accent2);
  border-color: var(--accent2);
  color: var(--bg);
  font-weight: 700;
  padding: 0.6rem 1.5rem;
  font-size: 15px;
}

.btn-run:hover:not(:disabled) {
  background: #56d364;
  border-color: #56d364;
}

.btn-run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Demo Section ───────────────────────────────────────────── */
.demo-section {
  padding: 4rem 0;
}

.demo-terminal {
  background: var(--bg2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.terminal-bar {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red   { background: #f85149; }
.dot-yellow { background: #d29922; }
.dot-green  { background: #3fb950; }

.terminal-title {
  color: var(--muted);
  font-size: 13px;
  margin-left: 0.5rem;
}

.terminal-body {
  padding: 1.5rem;
}

.demo-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.demo-input-row textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  padding: 0.75rem 1rem;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.6;
}

.demo-input-row textarea::placeholder {
  color: var(--muted);
}

.demo-input-row textarea:focus {
  border-color: var(--accent);
}

.demo-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.result-item:first-child {
  border-top: none;
}

.result-label {
  color: var(--accent);
  font-size: 13px;
  padding-top: 2px;
  white-space: nowrap;
}

.result-label::before {
  content: '▸ ';
  color: var(--accent2);
}

.result-value {
  color: var(--fg);
  font-size: 15px;
  line-height: 1.7;
  min-height: 1.7em;
}

.result-value.placeholder {
  color: var(--muted);
}

.result-value.loading::after {
  content: '█';
  animation: blink 0.8s step-end infinite;
  color: var(--accent);
}

.result-value.error {
  color: var(--danger);
}

.demo-token-row {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.demo-token-row label {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.demo-token-row input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 0.35rem 0.75rem;
  outline: none;
  width: 280px;
  transition: border-color 0.15s;
}

.demo-token-row input:focus {
  border-color: var(--accent);
  color: var(--fg);
}

/* ─── Posts List ─────────────────────────────────────────────── */
.posts-section {
  padding: 4rem 0;
}

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  transition: color 0.15s;
}

.post-list-item:last-child {
  border-bottom: 1px solid var(--border);
}

.post-list-item:hover {
  color: var(--accent);
}

.post-list-item:hover .post-arrow {
  transform: translateX(4px);
}

.post-title-text {
  font-size: 16px;
}

.post-meta-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.post-date {
  color: var(--muted);
  font-size: 13px;
}

.post-arrow {
  color: var(--accent2);
  transition: transform 0.15s;
}

.view-all-row {
  margin-top: 1.5rem;
  text-align: right;
}

/* ─── Demos Page — card grid ─────────────────────────────────── */
.demos-page {
  padding: 4rem 0;
}

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.demo-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  position: relative;
  min-height: 180px;
}

.demo-card:hover {
  background: var(--bg3);
  transform: translateY(-3px);
}

/* Tech-specific hover border color */
.demo-card.has-tech-streamlit:hover { border-color: #ff4b4b; }
.demo-card.has-tech-gradio:hover    { border-color: #ff7c00; }
.demo-card.has-tech-dash:hover      { border-color: #4a90d9; }
.demo-card.has-tech-jupyter:hover   { border-color: #f37626; }
.demo-card.has-tech-fastapi:hover   { border-color: #05d9a0; }
.demo-card.has-tech-ws:hover        { border-color: #a78bfa; }
.demo-card.has-tech-diffusion:hover { border-color: #e879f9; }
.demo-card.has-tech-cli:hover       { border-color: #f9c846; }
.demo-card.has-tech-yolo:hover      { border-color: #00c896; }

.demo-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.demo-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
}

.demo-status {
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-live { color: var(--accent2); }
.status-soon { color: var(--muted); }
.status-wip  { color: #e8a838; }

.demo-card-tech {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2em 0.55em;
  border: 1px solid;
  width: fit-content;
}

/* Tech tag text + border colors */
.tech-streamlit { color: #ff4b4b; border-color: #ff4b4b55; }
.tech-gradio    { color: #ff7c00; border-color: #ff7c0055; }
.tech-dash      { color: #4a90d9; border-color: #4a90d955; }
.tech-jupyter   { color: #f37626; border-color: #f3762655; }
.tech-fastapi   { color: #05d9a0; border-color: #05d9a055; }
.tech-ws        { color: #a78bfa; border-color: #a78bfa55; }
.tech-diffusion { color: #e879f9; border-color: #e879f955; }
.tech-cli       { color: #f9c846; border-color: #f9c84655; }
.tech-yolo      { color: #00c896; border-color: #00c89655; }

.demo-card-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  flex: 1;
}

.demo-card-related {
  display: block;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s;
}

.demo-card-related:hover {
  opacity: 0.75;
}

.demo-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.demo-card-last-run {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.demo-card-arrow {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.15s, transform 0.15s;
  white-space: nowrap;
}

.demo-card:hover .demo-card-arrow {
  color: var(--fg);
  transform: translateX(3px);
}

/* ─── /now page ──────────────────────────────────────────────── */
.now-page {
  padding: 4rem 0;
  max-width: 680px;
}

.now-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2.5rem;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.now-meta a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.now-body h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2rem 0 0.75rem;
}

.now-body p, .now-body li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
}

.now-body ul {
  padding-left: 1.25rem;
}

.now-body li {
  margin-bottom: 0.25rem;
}

/* ─── Demo Project Sub-page ──────────────────────────────────── */
.demo-project-page {
  padding: 4rem 0;
}

.demo-project-header {
  margin-bottom: 0;
}

.demo-project-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.demo-project-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--fg);
  font-weight: 700;
}

.demo-embed-placeholder {
  border: 1px dashed var(--border);
  background: var(--bg2);
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-embed-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
}

.demo-embed-icon {
  font-size: 2rem;
  opacity: 0.3;
}

.demo-embed-label {
  font-size: 13px;
  color: var(--muted);
}

.demo-embed-status {
  font-size: 12px;
  color: var(--border);
  letter-spacing: 0.08em;
}

.demo-project-meta {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 680px;
}

.demo-project-desc {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

.demo-meta-row {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  font-size: 13px;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.demo-meta-key {
  color: var(--muted);
  min-width: 90px;
  flex-shrink: 0;
}

.demo-meta-val {
  color: var(--fg);
}

/* ─── Blog Page ──────────────────────────────────────────────── */
.blog-page {
  padding: 4rem 0;
}

.blog-page h1 {
  color: var(--fg);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.blog-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 3rem;
}

/* ─── Post Page ──────────────────────────────────────────────── */
.post-page {
  padding: 4rem 0;
}

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

.post-back {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

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

.post-page h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--fg);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.post-date-meta {
  color: var(--muted);
  font-size: 13px;
}

.post-content {
  max-width: 720px;
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3 {
  color: var(--fg);
  margin: 2.5rem 0 1rem;
  line-height: 1.3;
}

.post-content h2 {
  font-size: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.post-content h3 {
  font-size: 1.05rem;
  color: var(--accent);
}

.post-content p {
  color: var(--fg);
  margin-bottom: 1.25rem;
}

.post-content code {
  background: var(--bg3);
  color: var(--accent2);
  padding: 0.15em 0.4em;
  font-family: inherit;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.post-content pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
  font-size: 15px;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--muted);
}

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

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

.post-content a {
  color: var(--accent);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content strong {
  color: var(--fg);
  font-weight: 700;
}

/* ─── Footer ─────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container {
    padding: 0 1rem;
  }

  nav {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
    row-gap: 0;
    min-height: unset;
  }

  /* Row 1: brand stretches, toggle sits right */
  .nav-brand {
    flex: 1;
  }

  .theme-toggle {
    margin-left: 0; /* toggle naturally follows brand on row 1 */
    order: 2;
  }

  /* Row 2: links span full width */
  .nav-links {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem 0 0.5rem;
    border-top: 1px solid var(--border);
    gap: 0;
    justify-content: flex-start;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  main {
    padding-top: 110px; /* taller nav on mobile (2 rows) */
  }

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

  .demo-project-title-row {
    gap: 0.75rem;
  }

  .result-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .demo-input-row {
    flex-direction: column;
  }

  .demo-input-row .btn-run {
    width: 100%;
  }

  .demo-token-row input {
    width: 100%;
  }

  .post-meta-inline {
    display: none;
  }
}

/* ─── Lifestyle tag badges ───────────────────────────────────── */
.lifestyle-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15em 0.55em;
  border: 1px solid;
  flex-shrink: 0;
}

.tag-reflection { color: var(--accent);  border-color: #58a6ff44; }
.tag-holiday    { color: #e879f9;         border-color: #e879f944; }
.tag-tip        { color: var(--accent2);  border-color: #3fb95044; }
.tag-daily      { color: var(--muted);    border-color: var(--border); }

/* ─── Research & Code Review demos ─────────────────────────── */
.step-log {
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.step-item::before {
  content: "› ";
}

.step-item.done {
  color: var(--accent2);
}

.post-saved-badge {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.3rem 0.8rem;
  background: var(--accent2);
  color: #000;
  font-size: 0.8rem;
  border-radius: 4px;
  text-decoration: none;
}

.post-saved-badge:hover {
  opacity: 0.85;
}

.stream-output {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 1rem;
  min-height: 4rem;
  max-height: 480px;
  overflow-y: auto;
}
