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

:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --surface-hi: #eaecf0;
  --border: rgba(17, 18, 22, 0.09);
  --border-strong: rgba(17, 18, 22, 0.16);
  --ink: #111216;
  --ink-muted: #5c616e;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font-family: inherit;
  color: inherit;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}

.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==========================================================================
   SLEEK AIRY TOP NAVBAR (MATCHING LANDING PAGE)
   ========================================================================== */

.topbar {
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  padding-right: 14px;
  border-right: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface);
  transition: color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease);
}

.back-link:hover {
  color: var(--ink);
  background: var(--surface-hi);
}

.brand-badge {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* HORIZONTAL PILL PACK SWITCHER RAIL */
.pack-rail {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 10px;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.pack-rail::-webkit-scrollbar {
  display: none;
}

.pack-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.pack-tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.pack-tab.is-active {
  color: #ffffff;
  background: var(--ink);
  font-weight: 600;
}

.pack-num {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.65;
}

.pack-tab.is-active .pack-num {
  opacity: 0.78;
}

/* RIGHT CONTROLS */
.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.exp-mode {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.exp-mode-btn {
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}

.exp-mode-btn:hover {
  color: var(--ink);
}

.exp-mode-btn.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(17, 18, 22, 0.11);
}

.bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  white-space: nowrap;
  transition: background 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

.bar-btn:hover {
  background: var(--surface-hi);
  transform: translateY(-1px);
}

.bar-btn:active {
  transform: scale(0.98);
}

.bar-btn.is-primary {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 18, 22, 0.14);
}

.bar-btn.is-primary:hover {
  background: #23262f;
  box-shadow: 0 4px 12px rgba(17, 18, 22, 0.2);
}

.bar-btn.is-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 11.5px;
}

/* ==========================================================================
   FULL-BLEED INLINE STAGE
   ========================================================================== */

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f8f9fb;
}

.stage-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #ffffff;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}

.stage-frame.is-ready {
  opacity: 1;
}

/* ==========================================================================
   AIRY WHITE "GET PACK" SLIDE-OVER DRAWER
   ========================================================================== */

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(490px, 94vw);
  background: #ffffff;
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 48px rgba(17, 18, 22, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms var(--ease);
  z-index: 30;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.drawer-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.icon-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  background: var(--surface);
  flex-shrink: 0;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.icon-close:hover {
  color: var(--ink);
  background: var(--surface-hi);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grab-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cli-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: #f8f9fb;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cli-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px 5px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
}

.cli-cmd {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
}

.grab-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.grab-card.is-featured {
  background: #f8f9fb;
  border-color: var(--border-strong);
}

.grab-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.grab-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.grab-sub code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}

/* Collapsible Raw Files Section */
.raw-details {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
}

.raw-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
  transition: color 140ms var(--ease);
}

.raw-summary::-webkit-details-marker {
  display: none;
}

.raw-summary:hover {
  color: var(--ink);
}

.raw-details[open] .raw-chev {
  transform: rotate(90deg);
}

.raw-chev {
  transition: transform 150ms var(--ease);
}

.raw-inner {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.drawer-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: #fafbfc;
}

.file-tab {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: background 130ms var(--ease), color 130ms var(--ease);
}

.file-tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.file-tab.is-active {
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
}

.drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.drawer-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.drawer-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-view {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: #e2e8f5;
  background: #111216;
  tab-size: 2;
}

/* ==========================================================================
   MOBILE RESPONSIVE (2-ROW CLEAN HEADER)
   ========================================================================== */

@media (max-width: 820px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px 6px;
    gap: 8px;
  }

  .brand {
    border-right: none;
    padding-right: 0;
  }

  .brand-title {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
    border-left: none;
    padding-left: 0;
    gap: 6px;
  }

  .exp-mode-btn[data-mode='split'] {
    display: none;
  }

  .pack-rail {
    order: 3;
    flex-basis: 100%;
    padding: 6px 0 2px;
    border-top: 1px solid var(--border);
    mask-image: none;
    -webkit-mask-image: none;
  }
}
