/* Quilt styleguide — page chrome + the seed component layer (atoms/molecules)
   built ENTIRELY on quilt.css custom properties. The .q-* component rules below
   are the start of Quilt's Phase-2 component library, mirrored from Nightstand. */

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

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--size-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- page layout ---- */
.sg-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: var(--space-3) var(--space-5);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-default);
}
.sg-brand { font-family: var(--font-mono); font-size: var(--size-h3); font-weight: 600; }
.sg-brand .thread { color: var(--accent-fg); }
.sg-tag { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--size-small); }

.sg-main { max-width: 960px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7); }
.sg-section { margin-bottom: var(--space-7); }
.sg-section > h2 {
  font-family: var(--font-mono); font-size: var(--size-small); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--space-4);
  padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-default);
}
.sg-section > h3 {
  font-size: var(--size-body); color: var(--text-muted); font-weight: 600;
  margin: var(--space-5) 0 var(--space-3);
}
.sg-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }

/* swatches */
.sw { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.sw .chip { height: 56px; }
.sw .meta { padding: var(--space-2); font-family: var(--font-mono); font-size: var(--size-micro); }
.sw .meta .name { color: var(--text-primary); }
.sw .meta .val { color: var(--text-muted); }

/* type specimen */
.spec { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-default); }
.spec .label { font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); width: 90px; flex-shrink: 0; }

/* spacing + radius demos */
.box-accent { background: var(--accent-bg); border: 1px solid var(--accent-fg); }
.space-demo { display: flex; align-items: flex-end; gap: var(--space-2); }
.space-demo .bar { width: 28px; background: var(--accent-fg); }
.radius-demo { width: 64px; height: 64px; background: var(--bg-raised); border: 1px solid var(--border-focus); }

/* ============================================================
   Quilt component seed — atoms & molecules (the real deliverable)
   ============================================================ */

/* atom: button */
.q-btn {
  border: 1px solid var(--border-default); background: var(--bg-raised); color: var(--text-primary);
  border-radius: var(--radius-md); padding: 7px 14px; cursor: pointer; font: inherit; font-size: var(--size-body);
  transition: background var(--motion-base), border-color var(--motion-base);
}
.q-btn:hover { background: var(--bg-hover); border-color: var(--border-focus); }
.q-btn--primary { background: var(--button-primary-bg); border-color: var(--button-primary-border); color: var(--button-primary-fg); }
.q-btn--primary:hover { background: var(--button-primary-fg); color: var(--bg-base); }
.q-btn--ghost { background: transparent; }
.q-btn--danger { color: var(--button-danger-fg); border-color: var(--button-danger-border); }
.q-btn--danger:hover { background: var(--danger-bg); border-color: var(--danger-fg); }
.q-btn--small { padding: 4px 10px; font-size: var(--size-small); }

/* atom: input / textarea / label */
.q-label {
  display: block; font-size: var(--size-micro); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: var(--space-2);
}
.q-input, .q-textarea {
  background: var(--bg-base); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 8px 10px; color: var(--text-primary); font-family: var(--font-mono); font-size: var(--size-body);
  outline: none; width: 100%;
}
.q-input:focus, .q-textarea:focus { border-color: var(--border-focus); }
.q-textarea { font-family: var(--font-sans); resize: vertical; min-height: 60px; }

/* atom: status dot + pill */
.q-dot { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; background: var(--status-unknown); }
.q-dot--pass { background: var(--status-pass); }
.q-dot--fail { background: var(--status-fail); }
.q-pill {
  display: inline-block; padding: 3px 9px; border-radius: var(--radius-full); font-family: var(--font-mono);
  font-size: var(--size-micro); text-transform: uppercase; letter-spacing: 0.05em;
}
.q-pill--pass { background: rgba(125,217,125,0.1); color: var(--status-pass); }
.q-pill--fail { background: rgba(232,138,138,0.1); color: var(--status-fail); }
.q-pill--unknown { background: rgba(125,128,137,0.1); color: var(--status-unknown); }

/* molecule: cred-row */
.q-credrow {
  display: flex; align-items: center; gap: var(--space-3); padding: 9px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: var(--size-body); cursor: pointer; transition: background var(--motion-fast);
}
.q-credrow:hover { background: var(--credrow-hover); }
.q-credrow .name { flex: 1; }

/* molecule: field */
.q-field { margin-bottom: var(--space-4); }

/* organism: entity-col */
.q-col { background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; max-width: 320px; }
.q-col-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border-default); display: flex;
  justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: var(--size-body); font-weight: 600;
}
.q-col-head .count { color: var(--text-muted); font-weight: 400; }
.q-col-body { padding: var(--space-2); }

/* organism: toast */
.q-toast {
  display: inline-block; background: var(--bg-raised); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 10px 16px; font-family: var(--font-mono); font-size: var(--size-small);
  box-shadow: var(--elevation-overlay);
}
