/* Dark hacker/terminal theme - mbuelow.dev */
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg-dark: #050608;
  --bg-main: #0b0f16;
  --bg-sidebar: #080c12;
  --text: #e0e4e8;
  --text-muted: #88909a;
  --accent-green: #3dd68c;
  --accent-cyan: #34c4c4;
  --border: #1e262e;
  --link: var(--accent-cyan);
  --link-hover: var(--accent-green);
  --font-sans: system-ui, -apple-system, Segoe UI, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --sidebar-width: 220px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Nav toggle - visible only on mobile */
.nav-toggle {
  display: none;
  position: relative;
  top: auto;
  left: auto;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--accent-green);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 4px;
}

.nav-toggle:hover {
  background: var(--border);
}

/* Topbar: mobile only, hamburger + breadcrumb */
.topbar {
  display: none;
}

/* Sidebar - desktop */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .nav {
  flex: 1;
}

.sidebar-version {
  flex-shrink: 0;
  margin: 0 1.25rem;
  padding-top: 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section {
  margin: 0.85rem 1.25rem 0.15rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.85;
}

.nav-link {
  padding: 0.5rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--link-hover);
  background: rgba(61, 214, 140, 0.08);
}

.nav-link.active {
  color: var(--accent-green);
  border-left: 3px solid var(--accent-green);
  padding-left: calc(1.25rem - 3px);
}

/* Main content */
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1.5rem 2rem 3rem;
  max-width: 52rem;
  background: var(--bg-dark);
  overflow-y: auto;
}

/* Home page: terminal view (no header, full-height single unit) */
.main--home-terminal .page-header,
.main--home-terminal .breadcrumb {
  display: none;
}

.main--home-terminal {
  max-width: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
}

.main--home-terminal .content {
  flex: 1;
  min-height: 0;
  padding: 0;
  margin: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
}

.main--home-terminal .content .home-terminal {
  flex: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.home-terminal {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 1rem 1.25rem;
  margin: 0;
  background: var(--bg-dark);
}

.home-terminal-prompt {
  color: var(--accent-green);
}

.home-terminal-file-link {
  color: inherit;
  text-decoration: none;
}

.home-terminal-file-link:hover {
  text-decoration: underline;
}

.main--home-terminal .home-terminal pre {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  min-width: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.home-terminal-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background: var(--accent-green);
  animation: home-terminal-blink 1s step-end infinite;
  vertical-align: -0.1em;
}

@keyframes home-terminal-blink {
  50% { opacity: 0; }
}

/* Breadcrumb - IDE-style hierarchy */
.breadcrumb-desktop-wrap {
  display: block;
}

.breadcrumb-mobile-wrap {
  display: none;
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.breadcrumb-cli {
  color: var(--accent-green);
}

.breadcrumb-cli .breadcrumb-prompt {
  color: var(--accent-green);
  opacity: 0.95;
}

.breadcrumb-cli .breadcrumb-sep {
  margin: 0;
  color: var(--text-muted);
  opacity: 0.9;
}

.breadcrumb-cli .breadcrumb-link {
  color: var(--accent-green);
}

.breadcrumb-cli .breadcrumb-link:hover {
  color: var(--accent-green);
  opacity: 0.9;
  text-decoration: underline;
}

.breadcrumb-cli .breadcrumb-link:visited {
  color: var(--accent-green);
}

.breadcrumb-cli .breadcrumb-current {
  color: var(--accent-green);
}

.breadcrumb-sep {
  margin: 0 0.35rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.breadcrumb-link {
  color: var(--link);
  text-decoration: none;
}

.breadcrumb-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.breadcrumb-current {
  color: var(--accent-green);
}

/* Project list (index) */
.project-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.projects-intro {
  margin: 0 0 1.5rem 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.project-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.project-item-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.project-item-link:hover {
  text-decoration: none;
}

.project-item-link:hover .project-item-title {
  color: var(--accent-green);
  text-decoration: underline;
}

.project-item-link:hover .project-item-desc {
  text-decoration: none;
}

.content .project-item-link:hover {
  text-decoration: none;
}

.content .project-item-link:hover .project-item-title {
  text-decoration: underline;
}

.content .project-item-link:hover .project-item-desc {
  text-decoration: none;
}

.project-item-thumb {
  flex-shrink: 0;
  width: 6rem;
  height: 4rem;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.project-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.project-item-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

.project-item-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
}

.last-refreshed {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.content {
  font-size: 1rem;
}

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

.content a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.content code,
.content kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(61, 214, 140, 0.12);
  color: var(--accent-green);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.content pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}

.content pre code {
  background: none;
  color: var(--text);
  padding: 0;
}

.content h1, .content h2, .content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text);
}

.content h1 { font-size: 1.5rem; }
.content h2 { font-size: 1.25rem; }
.content h3 { font-size: 1.1rem; }

.content ul, .content ol {
  padding-left: 1.5em;
}

.content img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.content th,
.content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.content th {
  background: var(--bg-sidebar);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Terminal-style block (e.g. homepage banner) */
.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-green);
  margin-bottom: 1rem;
}

.terminal-prompt::before {
  content: "mbuelow@home:~$ ";
  opacity: 0.9;
}

/* Mobile: drawer */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1001;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    min-height: 4rem;
    box-sizing: border-box;
  }

  .nav-toggle {
    display: block;
  }

  .breadcrumb-mobile-wrap {
    display: block;
    flex: 1;
    min-width: 0;
  }

  .breadcrumb-mobile-wrap .breadcrumb {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .breadcrumb-desktop-wrap {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 4rem;
    left: 0;
    height: calc(100vh - 4rem);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
    padding-top: 1rem;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding: 1rem 1rem 2rem;
    margin-left: 0;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .home-terminal {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
}
