/* ==========================================================================
   BAP.DEV — Swiss / Neo-Brutalist Dashboard
   ========================================================================== */

:root {
  /* Strict Duotone Palette - Light Mode */
  --paper: #F1F1F1;
  --ink: #4443A1;

  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', Consolas, monospace;

  /* Grid */
  --border: 1px solid var(--ink);
  --header-h: 56px;
}

/* Dark Mode */
[data-theme="dark"] {
  --paper: #18183e;
  --ink: #F1F1F1;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Enable scrolling on inner pages */
body.page-body {
  overflow: auto;
  overflow-x: hidden;
}

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

strong {
  font-weight: 600;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* Hide scrollbar but keep functionality */
.panel-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 4px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: var(--ink);
}

/* ==========================================================================
   App Container — 100vh Dashboard
   ========================================================================== */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
  flex-shrink: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: var(--border);
  background: var(--paper);
}

@media (max-width: 768px) {
  .header {
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .header-logo {
    width: 100%;
    text-align: center;
    font-size: 1.25rem;
  }

  .header-meta {
    width: 100%;
    justify-content: center;
    font-size: 0.625rem;
    gap: 0.5rem;
  }
}

.header-logo {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.header-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.7;
}

#status-container {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.status-badge--online {
  background: var(--ink);
  color: var(--paper);
}

.status-badge--offline {
  background: transparent;
  color: var(--ink);
  opacity: 0.5;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot--online {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot--offline {
  animation: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

.separator {
  opacity: 0.4;
}

.accent {
  color: var(--ink);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}

.theme-toggle-icon {
  display: block;
  line-height: 1;
}

/* ==========================================================================
   Main Grid
   ========================================================================== */

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 7fr 5fr;
  min-height: 0; /* Critical for nested scroll */
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  
  body {
    overflow: auto;
  }
  
  .app {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }
}

/* ==========================================================================
   Panels
   ========================================================================== */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: var(--border);
  background: var(--paper);
}

.panel-link {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.panel-link:hover {
  opacity: 1;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ==========================================================================
   Hero Panel (Left)
   ========================================================================== */

.panel-hero {
  border-right: var(--border);
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (max-width: 900px) {
  .panel-hero {
    border-right: none;
    border-bottom: var(--border);
    padding: 1.5rem;
    min-height: 70vh;
  }
}

.hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 100%;
}

.ascii-art {
  display: block;
  width: fit-content;
  max-width: 100%;
}

.hero-title {
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.hero-title span {
  display: block;
}

.hero-description {
  font-size: 1rem;
  max-width: 480px;
  line-height: 1.65;
  opacity: 0.8;
}

.hero-description strong {
  font-weight: 700;
}

.hero-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 2rem;
  border-top: var(--border);
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .hero-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }
}

.roles {
  display: flex;
  gap: 2rem;
}

@media (max-width: 600px) {
  .roles {
    gap: 1rem;
    flex-wrap: wrap;
  }
}

.role {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.role-company {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.5;
}

.role-title {
  font-size: 0.875rem;
  font-weight: 600;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.875rem 1.5rem;
  border: var(--border);
  background: var(--paper);
  transition: all 0.15s ease;
}

.cta-button:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ==========================================================================
   Right Column
   ========================================================================== */

.right-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-projects {
  flex: 1;
  min-height: 0;
}

.panel-writing {
  flex: 1;
  min-height: 0;
  border-bottom: var(--border);
}

@media (max-width: 900px) {
  .right-column {
    display: contents;
  }
  
  .panel-projects,
  .panel-writing {
    min-height: auto;
    border-bottom: var(--border);
  }
}

/* ==========================================================================
   Project Items
   ========================================================================== */

.project-item {
  display: block;
  padding: 1.25rem;
  border-bottom: var(--border);
  transition: all 0.15s ease;
}

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

.project-item:hover {
  background: var(--ink);
  color: var(--paper);
}


.project-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.375rem;
}

.project-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.project-year {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  opacity: 0.5;
}

.project-desc {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  opacity: 0.7;
  margin-bottom: 0.75rem;
}

.project-kpis {
  display: flex;
  gap: 1.5rem;
}

.kpi {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}


.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.5;
}

/* ==========================================================================
   Article Items
   ========================================================================== */

.article-item {
  display: block;
  padding: 1rem 1.25rem;
  border-bottom: var(--border);
  transition: all 0.15s ease;
}

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

.article-item:hover {
  background: var(--ink);
  color: var(--paper);
}

.article-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.article-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  opacity: 0.5;
  flex-shrink: 0;
}

.article-item:hover .article-date {
  opacity: 0.8;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-top: var(--border);
  background: var(--paper);
}

.footer-links {
  display: flex;
  gap: 2rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links a {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.footer-links a:hover {
  opacity: 1;
}

.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.5;
}

/* ==========================================================================
   Inner Pages
   ========================================================================== */

.page-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page-header {
  flex-shrink: 0;
  padding: 2rem;
  border-bottom: var(--border);
}

.page-header .panel-label {
  margin-bottom: 1rem;
}

.page-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.page-content {
  flex: 1;
  padding: 2rem;
}

.page-content--project {
  /* No max-width constraint */
}

.page-footer {
  flex-shrink: 0;
  padding: 1rem 2rem;
  border-top: var(--border);
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.back-link:hover {
  opacity: 1;
}

/* ==========================================================================
   Prose
   ========================================================================== */

.prose {
  font-size: 1rem;
  line-height: 1.6;
}

.prose > * + * {
  margin-top: 1rem;
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-top: 2rem;
}

.prose h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 1.5rem;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose blockquote {
  border-left: 3px solid var(--ink);
  padding-left: 1.5rem;
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: color-mix(in srgb, var(--ink) 10%, var(--paper));
  padding: 0.125em 0.375em;
}

.prose pre {
  background: var(--ink);
  color: var(--paper);
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

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

/* ==========================================================================
   Project Single
   ========================================================================== */

.project-single-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-single-top {
  display: flex;
  justify-content: flex-start;
}

.project-single-content--single-col .prose {
  max-width: 42rem;
}

.project-single-content--single-col .prose p {
  text-wrap: balance;
}

.project-meta-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.project-meta-item {
  padding: 1rem 1.25rem;
  border: var(--border);
  background: color-mix(in srgb, var(--ink) 3%, var(--paper));
}

.project-single-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-single-meta {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  opacity: 0.6;
}

.project-single-desc {
  font-size: 1.125rem;
  line-height: 1.6;
  opacity: 0.8;
  max-width: 600px;
}

.project-single-kpis {
  display: flex;
  gap: 3rem;
  padding: 1.5rem 0;
  border-top: var(--border);
  border-bottom: var(--border);
  margin: 2rem 0;
}

.project-single-kpis .kpi-value {
  font-size: 2.5rem;
}

.project-single-kpis .kpi-label {
  font-size: 0.6875rem;
}

.project-sidebar {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
}

.project-sidebar-section {
  padding: 1rem 1.25rem;
  border: var(--border);
  background: color-mix(in srgb, var(--ink) 3%, var(--paper));
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tech-list li {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  padding: 0.375rem 0.75rem;
  border: var(--border);
  list-style: none;
  background: var(--paper);
}

.project-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.75rem 0;
  border-bottom: var(--border);
  transition: all 0.15s ease;
}

.project-link:last-child {
  border-bottom: none;
}

.project-link:hover {
  color: var(--ink);
  opacity: 0.7;
}

/* ==========================================================================
   List Pages
   ========================================================================== */

.list-grid {
  display: grid;
  gap: 0;
}

.list-item {
  display: block;
  padding: 1.5rem 2rem;
  border-bottom: var(--border);
  transition: all 0.15s ease;
}

.list-item:hover {
  background: var(--ink);
  color: var(--paper);
}

.list-item:hover .kpi-value {
  color: var(--paper);
}
