:root {
  --bg: #f5f3ef;
  --panel: #fffdfa;
  --text: #1d1a15;
  --muted: #6c665c;
  --border: #e4e0d7;
  --accent: #b3701f;
  --accent-soft: rgba(179, 112, 31, 0.12);
  --radius: 12px;
  --maxw: 70rem;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Terminal stays dark in both themes — the signature element. */
  --term-bg: #10141b;
  --term-header: #171c24;
  --term-text: #d3dae4;
  --term-muted: #7e8797;
  --term-amber: #e0a24e;
  --term-green: #7fc08a;
  --term-red: #e0796f;
  --term-border: #232a34;
}

[data-theme="dark"] {
  --bg: #0e1116;
  --panel: #161a21;
  --text: #e7eaef;
  --muted: #8b93a1;
  --border: #252b34;
  --accent: #e0a24e;
  --accent-soft: rgba(224, 162, 78, 0.15);
}

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
}

.brand-mark {
  color: var(--accent);
}

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

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.15s ease;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: inline;
}

/* Main */
main.container {
  flex: 1 0 auto;
  padding-top: 2.25rem;
  padding-bottom: 3rem;
}

.section {
  scroll-margin-top: 4.75rem;
}

/* Portfolio two-pane layout */
.portfolio {
  display: grid;
  grid-template-columns: 18rem 1fr;
  gap: 3rem;
  align-items: start;
}

/* Sidebar cards */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.card-title::before {
  content: "// ";
  color: var(--accent);
}

.avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.profile-role {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin: 0.2rem 0 0;
}

.profile-tagline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.55rem 0 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.1rem 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--term-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--term-green) 25%, transparent);
}

.social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.social a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  transition: color 0.15s ease;
  word-break: break-all;
}

.social a:hover {
  color: var(--accent);
}

.stack-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stack-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}

.interest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.interest-list li::before {
  content: "> ";
  color: var(--accent);
}

/* Terminal — signature element */
.terminal-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.terminal {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.55);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
}

.term-dots {
  display: inline-flex;
  gap: 0.4rem;
}

.term-dots i {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: #3a424f;
}

.term-dots i:nth-child(1) {
  background: #e0685f;
}
.term-dots i:nth-child(2) {
  background: #e0b24e;
}
.term-dots i:nth-child(3) {
  background: #7fc08a;
}

.term-titlebar {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--term-muted);
}

.term-body {
  padding: 1.1rem 1.15rem 0.5rem;
  height: 27rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
}

.term-log {
  margin: 0;
}

.term-line {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--term-text);
}

.term-banner {
  margin: 0 0 0.9rem;
  color: var(--term-amber);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre;
  overflow-x: auto;
}

.term-muted {
  color: var(--term-muted);
}

.term-amber {
  color: var(--term-amber);
}

.term-green {
  color: var(--term-green);
}

.term-red {
  color: var(--term-red);
}

.term-kw {
  color: var(--term-amber);
  font-weight: 600;
}

.term-link {
  color: var(--term-amber);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.term-link:hover {
  color: #f2be74;
}

.term-echo {
  color: var(--term-text);
}

.term-project {
  padding-bottom: 0.3rem;
}

.term-help {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.term-help-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem;
}

.term-coffee {
  margin: 0;
  color: var(--term-amber);
  line-height: 1.4;
  white-space: pre;
}

.term-prompt-inline .term-user {
  color: var(--term-green);
}
.term-prompt-inline .term-path {
  color: var(--term-amber);
}

.term-form {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.2rem 0 0.7rem;
  position: sticky;
  bottom: 0;
  background: var(--term-bg);
}

.term-prompt {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  white-space: nowrap;
}

.term-prompt .term-user {
  color: var(--term-green);
}

.term-prompt .term-path {
  color: var(--term-amber);
}

.term-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--term-text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  caret-color: var(--term-amber);
}

/* Quick commands */
.quick-cmds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.quick-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.quick-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Sections */
.section {
  margin-top: 3rem;
}

.section-head {
  margin-bottom: 1.25rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  margin: 0;
}

.section-title::before {
  content: "# ";
  color: var(--accent);
}

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

.project-card {
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.project-links {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.project-link {
  color: var(--muted);
  display: inline-flex;
  transition: color 0.15s ease;
}

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

.project-summary {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.9rem;
}

.tech-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

/* Post lists */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.post-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.post-link {
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

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

.post-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.empty-note {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* Page head (list/single) */
.page-head {
  margin-bottom: 2rem;
}

.page-title {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.page-intro {
  color: var(--muted);
}

.page-intro p {
  margin: 0;
}

/* Single post */
.post-header {
  margin-bottom: 2rem;
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.15s ease;
}

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

.post-title-lg {
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.9rem 0 0.6rem;
}

.post-meta {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

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

.prose {
  font-size: 1.05rem;
  color: var(--text);
  max-width: 44rem;
}

.prose p {
  margin: 0 0 1.15rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
}

.prose pre {
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}

.prose pre code {
  border: 0;
  padding: 0;
  background: none;
}

/* Footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 60rem) {
  .portfolio {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .term-body {
    height: 22rem;
  }
}

@media (max-width: 40rem) {
  .project-list {
    grid-template-columns: 1fr;
  }

  .nav {
    gap: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
