@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Orbitron:wght@700;900&display=swap');

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: #f5f5f5;
  color: #1f1f1f;
}

body {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  line-height: 1.65;
  min-height: 100vh;
  background: #f5f5f5;
  color: #1f1f1f;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul, menu { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; }

/* ===== Layout Shell ===== */
.site-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #ffffff;
  border-right: 1.5px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: width 0.3s ease;
}

.sidebar > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px 16px;
  cursor: pointer;
  list-style: none;
  border-bottom: 1.5px solid #f0f0f0;
  user-select: none;
}
.sidebar > summary::-webkit-details-marker { display: none; }

.sidebar-brand {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: #1f1f1f;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle-icon {
  font-size: 18px;
  color: #888;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Search */
.sidebar-search {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #1f1f1f;
  outline: none;
  min-width: 0;
}

.search-input::placeholder { color: #aaa; }

.search-btn {
  font-size: 15px;
  color: #666;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 6px;
  transition: background 0.2s;
}
.search-btn:hover { background: #ebebeb; }

/* Nav Menu */
.nav-menu {
  padding: 10px 0 16px;
  display: flex;
  flex-direction: column;
}

.nav-menu li { width: 100%; }

.nav-link {
  display: flex;
  align-items: center;
  padding: 11px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #1f1f1f;
  border-left: 3px solid transparent;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  min-height: 44px;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus {
  background: #f5f5f5;
  border-left-color: #1f1f1f;
  color: #1f1f1f;
}

.nav-label { flex: 1; }

/* scroll offset for fixed sidebar */
section[id] { scroll-margin-top: 24px; }

/* ===== Main Area ===== */
.main-area {
  margin-left: 240px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 0;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.page-section { }
.page-article { }

/* ===== Hero ===== */
.hero-block {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 0 48px;
  max-width: 720px;
}

.hero-eyebrow {
  margin-bottom: 18px;
}

.eyebrow-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 4px 10px;
  border-bottom: 2px solid #1f1f1f;
}

.hero-h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #1f1f1f;
  margin-bottom: 20px;
}

.hero-desc {
  font-size: 16px;
  color: #555;
  line-height: 1.7;
  max-width: 560px;
}

/* ===== Content Layout: Aside + Main ===== */
.content-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

/* ===== Aside ===== */
.content-aside {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.aside-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border-bottom: 3px solid #1f1f1f;
}

.aside-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #1f1f1f;
  margin-bottom: 12px;
  margin-top: 6px;
}

.aside-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aside-link {
  display: flex;
  align-items: center;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #444;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.15s, color 0.15s;
  min-height: 40px;
  line-height: 1.4;
}

.aside-link:hover {
  background: #f5f5f5;
  color: #1f1f1f;
}

.aside-desc-card { }

.aside-desc-text {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  margin-top: 6px;
}

/* ===== Bento Content (page.content sections) ===== */
.bento-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: 16px;
}

/* All section children of bento-content become bento cards */
.bento-content > section {
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border-bottom: 3px solid #1f1f1f;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  overflow: hidden;
  grid-column: span 2;
}

.bento-content > section:hover {
  transform: scale(1.015);
  box-shadow: 0 8px 20px rgba(0,0,0,0.10);
}

/* Vary card sizes for bento asymmetry */
.bento-content > section:nth-child(1) { grid-column: span 4; }
.bento-content > section:nth-child(2) { grid-column: span 2; }
.bento-content > section:nth-child(3) { grid-column: span 2; }
.bento-content > section:nth-child(4) { grid-column: span 3; }
.bento-content > section:nth-child(5) { grid-column: span 1; }
.bento-content > section:nth-child(6) { grid-column: span 2; }
.bento-content > section:nth-child(7) { grid-column: span 2; }

/* Section inner typography */
.bento-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1f1f1f;
  margin-bottom: 12px;
  line-height: 1.3;
}

.bento-content h3 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
  margin: 16px 0 8px;
}

.bento-content p {
  font-size: 15px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 10px;
}

.bento-content ul, .bento-content ol {
  padding-left: 18px;
  margin-bottom: 10px;
}

.bento-content li {
  font-size: 15px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 4px;
  list-style: disc;
}

.bento-content a {
  color: #1f1f1f;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s;
}
.bento-content a:hover { opacity: 0.65; }

.bento-content strong { font-weight: 700; color: #1f1f1f; }

.bento-content small {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

/* ===== Footer ===== */
.site-footer {
  background: #ffffff;
  border-top: 1.5px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 60px;
}

.footer-brand-col {
  flex: 1;
  min-width: 140px;
}

.footer-brand-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: #1f1f1f;
  letter-spacing: 0.05em;
}

.footer-nav {
  flex: 2;
  display: flex;
  justify-content: center;
}

.footer-nav-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #666;
  padding: 6px 10px;
  border-radius: 8px;
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.footer-nav-link:hover {
  background: #f5f5f5;
  color: #1f1f1f;
}

.footer-copy-col {
  flex: 1;
  min-width: 180px;
  text-align: right;
}

.footer-copy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #aaa;
  line-height: 1.5;
}

/* ===== Scroll Reveal Animation ===== */
@media (prefers-reduced-motion: no-preference) {
  .bento-content > section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s ease, transform 0.45s ease, box-shadow 0.22s ease;
  }

  .bento-content > section.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .bento-content > section:nth-child(1) { transition-delay: 0.05s; }
  .bento-content > section:nth-child(2) { transition-delay: 0.10s; }
  .bento-content > section:nth-child(3) { transition-delay: 0.15s; }
  .bento-content > section:nth-child(4) { transition-delay: 0.20s; }
  .bento-content > section:nth-child(5) { transition-delay: 0.25s; }
  .bento-content > section:nth-child(6) { transition-delay: 0.30s; }
  .bento-content > section:nth-child(7) { transition-delay: 0.35s; }

  .aside-card,
  .hero-block {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .aside-card.is-visible,
  .hero-block.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bento-content > section,
  .aside-card,
  .hero-block {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .bento-content > section:hover { transform: none; }
  html { scroll-behavior: auto; }
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
    min-width: 200px;
  }
  .main-area {
    margin-left: 200px;
  }
  .content-layout {
    grid-template-columns: 180px 1fr;
  }
  .bento-content {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-content > section:nth-child(1) { grid-column: span 2; }
  .bento-content > section:nth-child(2) { grid-column: span 1; }
  .bento-content > section:nth-child(3) { grid-column: span 1; }
  .bento-content > section:nth-child(4) { grid-column: span 2; }
  .bento-content > section:nth-child(5) { grid-column: span 2; }
  .bento-content > section:nth-child(6) { grid-column: span 1; }
  .bento-content > section:nth-child(7) { grid-column: span 1; }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-width: unset;
    border-right: none;
    border-bottom: 1.5px solid #e0e0e0;
    overflow: visible;
    z-index: 200;
  }

  .sidebar:not([open]) .sidebar-search,
  .sidebar:not([open]) .nav-menu {
    display: none;
  }

  .sidebar[open] .sidebar-search,
  .sidebar[open] .nav-menu {
    display: flex;
  }

  .sidebar[open] .nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 12px 12px;
    gap: 4px;
  }

  .sidebar[open] .nav-menu li { width: auto; }

  .nav-link {
    padding: 8px 14px;
    border-left: none;
    border-radius: 8px;
    font-size: 13px;
    min-height: 44px;
    border-bottom: 2px solid transparent;
  }
  .nav-link:hover { border-bottom-color: #1f1f1f; }

  .main-area {
    margin-left: 0;
    margin-top: 0;
    padding-top: 60px;
  }

  .sidebar[open] ~ .main-area {
    padding-top: 0;
  }

  .wrap {
    padding: 0 16px 32px;
  }

  .hero-block {
    min-height: 60vh;
    padding: 40px 0 32px;
  }

  .hero-h1 {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
  }

  .content-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .content-aside {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .aside-card {
    flex: 1;
    min-width: 140px;
  }

  .bento-content {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .bento-content > section,
  .bento-content > section:nth-child(n) {
    grid-column: span 1;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 16px;
  }

  .footer-copy-col { text-align: left; }

  .footer-nav-list { justify-content: flex-start; }

  section[id] { scroll-margin-top: 70px; }
}

@media (max-width: 480px) {
  .sidebar > summary {
    padding: 14px 16px 12px;
  }
  .brand-text { font-size: 11px; }
  .hero-h1 { font-size: 1.5rem; }

  .search-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
}
