/* ============================================================
   LAYOUT — reset, tipografi dasar, grid aplikasi
   ============================================================ */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* subtle scanline / grid texture on the base background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 15% 8%, rgba(79, 227, 190, 0.06), transparent 40%),
    radial-gradient(circle at 85% 92%, rgba(239, 162, 63, 0.05), transparent 45%);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

p { margin: 0 0 var(--sp-4); color: var(--text-muted); }

a { color: var(--mint); text-decoration: none; }

code, pre { font-family: var(--font-mono); }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- App shell ---- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* ---- Sidebar (file-explorer style) ---- */
.sidebar {
  grid-row: 1 / -1;
  grid-column: 1;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) 0 var(--sp-4);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--sp-4);
}

.brand__mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--mint), var(--mint-dim));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #06211B;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.brand__text .name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); }
.brand__text .tag { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-faint); letter-spacing: 0.06em; }

.nav-group {
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-3);
}

.nav-group__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: var(--sp-2) var(--sp-3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.nav-link:hover { background: var(--panel); color: var(--text); }

.nav-link.active {
  color: var(--mint);
  background: rgba(79, 227, 190, 0.08);
  border-left: 2px solid var(--mint);
}

.nav-link__icon {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 18px;
  text-align: center;
  color: var(--text-faint);
}

.nav-link.active .nav-link__icon { color: var(--mint); }

.sidebar__foot {
  margin-top: auto;
  padding: var(--sp-4) var(--sp-5) 0;
}

/* overall progress meter in sidebar */
.progress-mini { padding: 0 var(--sp-5); }
.progress-mini__label {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-faint);
  margin-bottom: var(--sp-2);
}
.progress-track {
  height: 6px; border-radius: 4px; background: var(--panel-2);
  overflow: hidden; border: 1px solid var(--border-soft);
}
.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--mint-dim), var(--mint));
  width: 0%;
  transition: width var(--t-med) var(--ease);
}

/* ---- Topbar (editor tab bar) ---- */
.topbar {
  grid-row: 1; grid-column: 2;
  display: flex; align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  overflow-x: auto;
}

.topbar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); opacity: 0.7; }
.topbar__dot:nth-child(2) { background: var(--amber); }
.topbar__dot:nth-child(3) { background: var(--mint); }
.topbar__path { margin-left: var(--sp-3); white-space: nowrap; }
.topbar__path .sep { color: var(--text-faint); margin: 0 var(--sp-1); }
.topbar__path .current { color: var(--text); }

.sound-toggle {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sound-toggle:hover { border-color: var(--mint-dim); color: var(--mint); }
.sound-toggle.is-muted { color: var(--text-faint); }

.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); width: 34px; height: 34px;
  align-items: center; justify-content: center; cursor: pointer; margin-right: var(--sp-2);
}

/* ---- Main content ---- */
.main {
  grid-row: 2; grid-column: 2;
  overflow-y: auto;
  padding: var(--sp-7) var(--sp-6) var(--sp-8);
}

.page { max-width: var(--content-max); margin: 0 auto; }
.page[hidden] { display: none; }

.page-head { margin-bottom: var(--sp-6); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mint);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.eyebrow::before { content: "//"; color: var(--text-faint); }

.page-head h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
.page-head .lede { font-size: var(--fs-md); max-width: 62ch; }

section + section { margin-top: var(--sp-7); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 30% 0 0; z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--t-med) var(--ease);
    box-shadow: var(--shadow-panel);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { grid-column: 1; }
  .main { grid-column: 1; padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  .menu-toggle { display: inline-flex; }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 30;
  }
  .sidebar-scrim.show { display: block; }
}
