/* ============================================================
   App Shell — Sidebar Layout (Stripe / Linear style)
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sand-50);
  border-right: 1px solid var(--hairline);
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-2);
}
.sidebar__brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--plum-800);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.sidebar__brand-mark::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  background: var(--ember-500);
  border-radius: 2px;
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
}
.sidebar__brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 18px;
  color: var(--neutral-900);
}
.sidebar__brand-sub {
  font-size: 11px;
  color: var(--neutral-500);
  letter-spacing: 0.04em;
}

.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--neutral-400);
  padding: var(--space-2) var(--space-3);
  margin-bottom: 2px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--neutral-700);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.sidebar__item:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}
.sidebar__item.is-active {
  background: var(--plum-800);
  color: var(--sand-50);
}
.sidebar__item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neutral-300);
  flex-shrink: 0;
}
.sidebar__item.is-active .sidebar__item-dot {
  background: var(--ember-500);
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--neutral-500);
  line-height: 1.5;
}

/* ---------- MAIN ---------- */
.main {
  padding: var(--space-9) var(--space-10);
  max-width: 1280px;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--space-9);
}
.page-header__crumb {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ember-600);
  font-weight: 600;
}
.page-header__title {
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--neutral-900);
}
.page-header__desc {
  max-width: 680px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--neutral-600);
}

.section {
  margin-bottom: var(--space-12);
}
.section__head {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.section__title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--neutral-900);
}
.section__desc {
  font-size: 14px;
  color: var(--neutral-500);
  max-width: 480px;
}

.subsection { margin-bottom: var(--space-9); }
.subsection__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--neutral-400);
  margin-bottom: var(--space-4);
}

/* ---------- CARD wrapper for showcasing components ---------- */
.demo {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: flex-start;
}
.demo--column { flex-direction: column; align-items: stretch; }
.demo--grid {
  display: grid;
  gap: var(--space-5);
}
.demo--bg-sand { background: var(--sand-100); }
.demo--bg-cream { background: var(--sand-50); }

.demo__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--neutral-400);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

/* ---------- Code block ---------- */
.codeblock {
  background: var(--plum-900);
  color: var(--sand-100);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  position: relative;
}
.codeblock .c-token-comment { color: rgba(255,252,246,.45); font-style: italic; }
.codeblock .c-token-property { color: var(--ember-300); }
.codeblock .c-token-value { color: var(--sand-200); }
.codeblock__copy {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,252,246,.08);
  border: 1px solid rgba(255,252,246,.16);
  color: var(--sand-100);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.codeblock__copy:hover { background: rgba(255,252,246,.16); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .main { padding: var(--space-7) var(--space-5); }
}
