/* ============================================================
   ATTIO — BASE STYLES + PAGE CHROME
   Light-first, whisper-soft shadows, tight letter-spacing.
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-page-bg);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-sm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'ss03', 'cv11';
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--blue-200); color: var(--black-100); }

/* Headings inherit Inter Display */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  letter-spacing: var(--ls-md);
  margin: 0;
}

/* ---------- App shell ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--color-page-bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-5) var(--space-4);
  border-right: 1px solid var(--color-stroke-subtle);
  overflow-y: auto;
  background: var(--color-surface);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-6);
}
.sidebar-brand .mark {
  width: 24px; height: 24px;
  background: var(--black-100);
  color: #fff;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.sidebar-brand .name {
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-md);
  font-size: var(--text-base);
}
.sidebar-brand .badge-env {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.nav-group {
  margin-bottom: var(--space-5);
}
.nav-group-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-1);
  font-weight: var(--fw-semibold);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast);
  cursor: pointer;
  font-weight: var(--fw-medium);
}
.nav-item > span:first-child {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.nav-item.active {
  background: var(--color-accent-soft-bg);
  color: var(--color-accent);
}
.nav-item .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  line-height: 1.3;
}
.nav-item .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-stroke-strong);
}
.nav-item.active .dot { background: var(--color-accent); }

/* ---------- Main column ---------- */
.main {
  padding: var(--space-12) var(--space-16);
  max-width: 1120px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--color-stroke-subtle);
  margin-bottom: var(--space-12);
}
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-weight: var(--fw-medium);
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  line-height: var(--lh-heading-lg);
  letter-spacing: var(--ls-lg);
  color: var(--color-text-primary);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-3);
  max-width: 720px;
}
.page-subtitle {
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--color-text-tertiary);
  max-width: 640px;
  letter-spacing: var(--ls-sm);
  margin: 0;
  font-weight: var(--fw-medium);
}
.page-meta {
  flex-shrink: 0;
  min-width: 220px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  line-height: 1.7;
}
.page-meta > div { margin-bottom: 4px; white-space: nowrap; }
.page-meta strong { color: var(--color-text-secondary); font-weight: var(--fw-medium); }

/* ---------- Section ---------- */
.section {
  margin-bottom: var(--space-16);
  padding-top: var(--space-4);
  scroll-margin-top: var(--space-8);
}
.section-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
  font-weight: var(--fw-medium);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-sm);
  line-height: var(--lh-heading-sm);
  letter-spacing: var(--ls-md);
  color: var(--color-text-primary);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-3);
}
.section-lede {
  font-size: var(--text-base);
  color: var(--color-text-tertiary);
  max-width: 680px;
  margin: 0 0 var(--space-10);
  line-height: 1.6;
  letter-spacing: var(--ls-sm);
}
.subsection-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-sm);
  margin: var(--space-10) 0 var(--space-4);
}
.subsection-title:first-child { margin-top: 0; }

/* horizontal rule */
.hr {
  height: 1px;
  background: var(--color-stroke-subtle);
  border: 0;
  margin: var(--space-12) 0;
}

/* ---------- Panel (DS primitive) ---------- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-layer-1);
}
.panel-pad { padding: var(--space-6); }

/* ---------- Spec table ---------- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-layer-1);
}
.spec-table th,
.spec-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-stroke-subtle);
  vertical-align: middle;
}
.spec-table th {
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--color-text-muted);
  font-weight: var(--fw-semibold);
  background: var(--color-surface-sunken);
}
.spec-table td.mono,
.spec-table code {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
}
.spec-table td.v { color: var(--color-text-primary); font-weight: var(--fw-medium); }
.spec-table tr:last-child td { border-bottom: 0; }

/* ---------- Utility type ---------- */
.mono { font-family: var(--font-mono); }
.caps { text-transform: uppercase; letter-spacing: var(--ls-caps); font-size: 11px; font-weight: var(--fw-semibold); }

/* Attio-style emphasis: same font, same weight — only the color shifts
   from primary (near-black) to tertiary (medium gray #505967). */
.hl, .serif {
  color: var(--color-text-tertiary);
  font-style: normal;
  font-family: inherit;
  font-weight: inherit;
  background: none;
  padding: 0;
}
.muted { color: var(--color-text-muted); }
.dim   { color: var(--color-text-subtle); }
.primary { color: var(--color-text-primary); }
.accent  { color: var(--color-accent); }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: var(--space-8) var(--space-6); }
  .page-title { font-size: var(--text-heading-md); line-height: var(--lh-heading-md); }
  .section-title { font-size: var(--text-heading-xs); line-height: var(--lh-heading-xs); }
  .grid-3, .grid-4, .grid-6 { grid-template-columns: repeat(2, 1fr); }
}
