/*
 * Blog layout — matches tommenzi.es (numbered nav, tagline, footer)
 * Uses design tokens from styles.css
 */

.blog-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
}

.blog-sidebar {
  flex: 0 0 auto;
  width: min(260px, 100%);
  padding: var(--space-lg);
  background: var(--bg);
  border-right: 1px solid var(--rule);
}

.blog-site-title {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 400;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.blog-tagline {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  letter-spacing: 0.02em;
}

.blog-nav-list {
  list-style: none;
}

.blog-nav-list li {
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  flex-wrap: wrap;
}

.blog-nav-list .index-number {
  flex-shrink: 0;
}

.blog-nav-list a {
  font-size: var(--text-base);
  font-weight: 300;
  color: var(--text);
}

.blog-nav-list a:hover,
.blog-nav-list a.active {
  color: var(--accent);
}

.blog-footer {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--rule);
}

.blog-main {
  flex: 1 1 var(--content-width-wide);
  min-width: 0;
  padding: var(--space-xl) var(--space-lg);
}

.post-body {
  padding-left: 0;
  padding-right: 0;
}

.post-body h1:first-child {
  margin-bottom: var(--space-md);
}

.post-body p,
.post-body ul,
.post-body ol {
  margin-bottom: var(--space-md);
}

.post-body pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  padding: 0.1em 0.25em;
  border-radius: var(--radius-sm);
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-list-index {
  list-style: none;
  margin-top: var(--space-md);
}

.post-list-index li {
  margin-bottom: var(--space-lg);
}

.post-list-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  flex-wrap: wrap;
}

.post-list-lead {
  margin-top: var(--space-xs);
  margin-left: 2ch;
  font-size: var(--text-sm);
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.55;
}

.post-list-index .index-number {
  flex-shrink: 0;
}

.post-list-index a {
  font-weight: 300;
}

@media (max-width: 768px) {
  .blog-layout {
    flex-direction: column;
  }

  .blog-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: var(--space-sm) var(--space-md);
  }

  /* Strip sidebar to title-only — nav lives in the bottom sheet */
  .blog-tagline,
  .blog-nav,
  .blog-footer {
    display: none !important;
  }
}


/* ── Keyboard status bar (nano/vim style) ── */
.kb-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 2rem;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: 0;
  pointer-events: none;
  user-select: none;
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kb-bar--visible {
  transform: translateY(0);
}

.kb-pair {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 var(--space-sm);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.kb-pair:first-child {
  padding-left: 0;
}

.kb-key {
  font-family: var(--font-mono-tight);
  font-size: var(--text-xs);
  font-weight: 400;
  background: var(--accent);
  color: var(--bg);
  padding: 0.05em 0.4em;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.kb-label {
  font-family: var(--font-mono-tight);
  font-size: var(--text-xs);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Dim shortcuts that aren't available on the current page */
.kb-disabled .kb-key {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.18);
}

.kb-disabled .kb-label {
  color: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
  .kb-bar {
    display: none;
  }
}


/* ── Mobile bottom sheet nav ── */

.mobile-nav-pill {
  display: none;
}

.mobile-nav-overlay {
  display: none;
}

.mobile-nav-sheet {
  display: none;
}

@media (max-width: 768px) {
  /* Pill affordance — appears after scroll */
  .mobile-nav-pill {
    display: flex;
    align-items: center;
    position: fixed;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%) translateY(4rem);
    background: var(--bg-subtle);
    border: 1px solid var(--rule);
    border-radius: 2rem;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-pill--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  /* Scrim */
  .mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-nav-overlay--visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Sheet */
  .mobile-nav-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--rule);
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 0 var(--space-md) var(--space-xl);
    z-index: 70;
    max-height: 72vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.35s var(--ease-out), visibility 0s linear 0.35s;
  }

  .mobile-nav-sheet--open {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.35s var(--ease-out), visibility 0s linear 0s;
  }

  .mobile-nav-sheet-handle {
    width: 2.5rem;
    height: 3px;
    background: var(--rule);
    border-radius: 2px;
    margin: 0.75rem auto var(--space-md);
    flex-shrink: 0;
  }

  .mobile-nav-sheet-label {
    margin-bottom: var(--space-sm);
  }
}
