/* ============================================================
   KO2U — SPA Shell Styles
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg:        #0b0e14;
  --bg-alt:    #0f131c;
  --bg-card:   #141926;
  --border:    #1f2636;
  --text:      #e6e9f0;
  --dim:       #8b93a7;
  --accent:    #5eead4;
  --accent2:   #818cf8;
  --danger:    #f87171;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;
  --r: 12px;
  --nav-w: 220px;
  --top-h: 56px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   TOP BAR
   ============================================================ */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-h);
  background: rgba(11,14,20,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 200;
  gap: 16px;
}

.topbar-logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  flex-shrink: 0;
  margin-right: 8px;
}
.topbar-logo em { color: var(--accent); font-style: normal; }

/* hamburger — mobile only */
#sidebarToggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
#sidebarToggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

/* top-bar nav tabs (desktop — hidden on mobile) */
#topnav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
#topnav::-webkit-scrollbar { display: none; }

.tnav-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s;
  letter-spacing: .01em;
}
.tnav-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }
.tnav-btn.active { color: var(--accent); background: rgba(94,234,212,.1); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
#shell {
  display: flex;
  margin-top: var(--top-h);
  min-height: calc(100vh - var(--top-h));
}

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform .3s;
}

.sidebar-label {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--dim);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}
.sidebar-label:first-child { padding-top: 0; }

.nav-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--dim);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: color .2s, border-color .2s, background .2s;
}
.nav-btn .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-btn.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(94,234,212,.07);
  font-weight: 500;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
#content {
  flex: 1;
  min-width: 0;
  padding: 48px 48px 80px;
  overflow-y: auto;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  display: none;
  animation: fadeIn .3s ease;
}
.panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TYPOGRAPHY HELPERS
   ============================================================ */
.page-kicker {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.page-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}
.page-title .hl { color: var(--accent); }
.page-lead {
  font-size: 1.05rem;
  color: var(--dim);
  max-width: 640px;
  margin-bottom: 40px;
  line-height: 1.75;
}
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 16px;
  margin-top: 40px;
  font-family: var(--mono);
}
p { margin-bottom: 1em; color: var(--dim); }
p strong { color: var(--text); }

/* ============================================================
   CARDS / GRID
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-icon { font-size: 1.6rem; margin-bottom: 12px; }
.card h3 { font-size: .95rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.card p { font-size: .88rem; margin: 0; }

/* ============================================================
   NOTE CARDS (clickable)
   ============================================================ */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.note-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  transition: border-color .2s, transform .2s;
  cursor: pointer;
}
.note-card:hover { border-color: var(--accent2); transform: translateY(-2px); }
.note-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--accent2);
  background: rgba(129,140,248,.1);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 10px;
  letter-spacing: .04em;
}
.note-card h3 { font-size: .95rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.note-card p { font-size: .85rem; margin: 0 0 12px; }
.note-meta { font-size: .78rem; color: var(--dim); font-family: var(--mono); }

/* ============================================================
   PROCESS STEPS
   ============================================================ */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  max-width: 700px;
}
.steps::before {
  content: '';
  position: absolute;
  left: 22px; top: 12px; bottom: 12px;
  width: 2px;
  background: var(--border);
}
.step {
  display: flex;
  gap: 24px;
  padding: 0 0 36px;
  position: relative;
}
.step-num {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-body h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.step-body p { font-size: .88rem; margin: 0; }

/* ============================================================
   TECH CHIPS
   ============================================================ */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: .82rem;
  font-family: var(--mono);
  color: var(--text);
  transition: border-color .2s;
}
.chip:hover { border-color: var(--accent); }
.chip .sub { color: var(--dim); font-size: .75rem; margin-left: 6px; }

/* ============================================================
   CODE WINDOW
   ============================================================ */
.code-win {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin: 24px 0;
  max-width: 640px;
}
.code-bar {
  background: #161b22;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.r { background: #f87171; }
.dot.y { background: #fbbf24; }
.dot.g { background: #34d399; }
.code-fname { font-family: var(--mono); font-size: .78rem; color: var(--dim); margin-left: auto; }
.code-body {
  padding: 20px;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.7;
  color: #e6edf3;
  overflow-x: auto;
  white-space: pre;
}
.c-kw  { color: #ff7b72; }
.c-fn  { color: #d2a8ff; }
.c-type{ color: #79c0ff; }
.c-str { color: #a5d6ff; }
.c-num { color: #79c0ff; }
.c-cm  { color: #8b949e; }

/* ============================================================
   HERO PANEL
   ============================================================ */
.hero-wrap {
  min-height: calc(100vh - var(--top-h) - 128px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 760px;
}
.hero-kicker {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--accent);
  letter-spacing: .06em;
  margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 24px;
}
.hero-title .hl { color: var(--accent); }
.hero-sub {
  font-size: 1.1rem;
  color: var(--dim);
  max-width: 580px;
  line-height: 1.75;
  margin-bottom: 36px;
}
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 56px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .2s, transform .15s;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #0b0e14; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-stats {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.stat-val { display: block; font-size: 1.1rem; font-weight: 600; color: var(--text); font-family: var(--mono); }
.stat-lbl { display: block; font-size: .78rem; color: var(--dim); margin-top: 2px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 40px;
  max-width: 600px;
}
.contact-box h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; }
.contact-box p { margin-bottom: 24px; }
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0b0e14;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: .95rem;
  transition: opacity .2s;
}
.contact-email:hover { opacity: .85; }
.contact-meta {
  margin-top: 24px;
  font-size: .82rem;
  color: var(--dim);
  font-family: var(--mono);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-meta span::after { content: '·'; margin-left: 10px; }
.contact-meta span:last-child::after { content: ''; }

/* ============================================================
   FOOTER STRIP
   ============================================================ */
.footer-strip {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-strip .fl { font-family: var(--mono); font-size: .82rem; color: var(--dim); }
.footer-strip .fl em { color: var(--accent); font-style: normal; }
.footer-strip a { color: var(--dim); font-size: .82rem; }
.footer-strip a:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE — TABLET / MOBILE
   ============================================================ */
@media (max-width: 900px) {
  :root { --nav-w: 200px; }
  #content { padding: 32px 28px 60px; }
}

@media (max-width: 700px) {
  #topnav { display: none; }
  #sidebarToggle { display: flex; }

  #sidebar {
    position: fixed;
    left: 0; top: var(--top-h);
    height: calc(100vh - var(--top-h));
    transform: translateX(-100%);
    z-index: 150;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  #sidebar.open { transform: translateX(0); }
  #shell { flex-direction: column; }
  #content { padding: 24px 20px 60px; }
  .hero-title { font-size: 2rem; }
  .hero-stats { gap: 24px; }
  .card-grid { grid-template-columns: 1fr; }
  .note-grid { grid-template-columns: 1fr; }
}

/* sidebar overlay on mobile */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 140;
}
#sidebar-overlay.show { display: block; }
