/* =============================================================
   Taghvimam design-system docs — chrome & specimen styles
   Depends on assets/app.css (tokens). Docs pages link both files.
   ============================================================= */

/* ── docs shell ───────────────────────────────────────────── */
.ds-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100dvh; }

.ds-side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  border-inline-end: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 14px 28px;
}
.ds-side .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 14px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ds-side .brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--btn-bg); color: var(--btn-fg);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.ds-side .brand b { font-size: 15px; }
.ds-side .brand small { display: block; font-size: 11px; color: var(--faint); font-weight: 500; }

.ds-nav { display: flex; flex-direction: column; gap: 2px; }
.ds-nav .grp { font-size: 11.5px; font-weight: 700; color: var(--faint); padding: 16px 10px 6px; }
.ds-nav a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--muted); line-height: 1.5;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.ds-nav a:hover { background: var(--surface-1); color: var(--fg); }
.ds-nav a.active { background: var(--brand-container); color: var(--on-brand-container); font-weight: 700; }
.ds-nav a.sub { padding-inline-start: 26px; font-size: 12.5px; }
.ds-nav .pglink { font-weight: 600; color: var(--fg); }

/* ── topbar ───────────────────────────────────────────────── */
.ds-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(18px, 4vw, 44px);
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.ds-top .ttl { font-size: 14px; font-weight: 700; }
.ds-top .crumb { font-size: 12px; color: var(--faint); }
.ds-top .spacer { flex: 1; }
.ds-top .pgtabs { display: flex; gap: 4px; }

/* ── content column ───────────────────────────────────────── */
.ds-main { min-width: 0; }
.ds-content {
  max-width: 880px;
  margin: 0 auto;
  padding: 34px clamp(18px, 4vw, 44px) 90px;
}
.ds-content > section { margin-bottom: 58px; scroll-margin-top: 76px; }
.ds-content h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.ds-content h2 {
  font-size: 21px; font-weight: 800; margin: 0 0 4px;
  padding-top: 10px; scroll-margin-top: 76px;
}
.ds-content h2 .no { color: var(--brand); font-size: 15px; font-weight: 700; margin-inline-end: 8px; }
.ds-content h3 { font-size: 15.5px; font-weight: 700; margin: 22px 0 8px; }
.ds-content .lede { font-size: 15px; color: var(--muted); margin-bottom: 26px; max-width: 62ch; }
.ds-content p { margin-bottom: 12px; max-width: 70ch; }
.ds-content section > p:first-of-type { margin-top: 10px; }

/* ── specimen frame ───────────────────────────────────────── */
.spec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 18px 22px;
  margin: 14px 0 8px;
}
.spec.col { flex-direction: column; align-items: stretch; gap: 14px; }
.spec.on-bg { background: var(--bg); }
.spec > figure { margin: 0; display: grid; gap: 8px; justify-items: center; }
.spec > figure figcaption { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.spec-gapnote { font-size: 12px; color: var(--faint); margin: 0 0 18px; }

/* forced states for docs illustration (mirror real :hover) */
.st-hover.primary { background: color-mix(in oklch, var(--btn-bg) 90%, var(--btn-fg)) !important; box-shadow: var(--shadow-1); }
.st-hover.icon-btn { background: var(--surface-2); color: var(--fg); }
.st-hover.chip { background: var(--surface-1); }
.st-focus { outline: 2px solid var(--focus) !important; outline-offset: 2px; }

/* ── code block ───────────────────────────────────────────── */
.code {
  direction: ltr; text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  margin: 12px 0 6px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.3px; line-height: 1.75;
  overflow-x: auto; tab-size: 2;
  color: var(--fg);
  white-space: pre;
}
.code .tg { color: color-mix(in oklch, var(--brand) 78%, var(--fg)); }
.code .at { color: var(--ok); }
.code .cm { color: var(--faint); }
.codecap { font-size: 11.5px; color: var(--faint); margin-bottom: 14px; }

/* ── tables ───────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; margin: 14px 0 6px; font-size: 13.2px; }
.tbl th {
  text-align: start; font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-1);
  padding: 8px 12px; border: 1px solid var(--border);
}
.tbl td { padding: 9px 12px; border: 1px solid var(--border); vertical-align: top; line-height: 1.7; }
.tbl .tk { font-size: 11.5px; }
.tk {
  direction: ltr; display: inline-block; unicode-bidi: isolate;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .92em; color: var(--link); white-space: nowrap;
}
.tbl .sw-mini {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 4px; border: 1px solid var(--border-strong);
  vertical-align: -2px; margin-inline-end: 7px;
}

/* ── color swatch cards ───────────────────────────────────── */
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; margin: 14px 0; }
.sw {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface);
}
.sw .c { height: 58px; }
.sw .m { padding: 8px 10px; }
.sw .m b { display: block; font-size: 12.5px; }
.sw .m code {
  direction: ltr; display: block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px; color: var(--faint); margin-top: 2px;
}

/* ── do / don't ───────────────────────────────────────────── */
.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.dodont .card {
  border-radius: var(--r-md); padding: 14px 16px;
  border: 1px solid;
}
.dodont .do {
  background: color-mix(in oklch, var(--ok) 6%, var(--surface));
  border-color: color-mix(in oklch, var(--ok) 32%, var(--border));
}
.dodont .dont {
  background: color-mix(in oklch, var(--holiday) 5%, var(--surface));
  border-color: color-mix(in oklch, var(--holiday) 28%, var(--border));
}
.dodont h4 {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; margin: 0 0 8px;
}
.dodont .do h4 { color: var(--ok); }
.dodont .dont h4 { color: var(--holiday); }
.dodont ul { display: grid; gap: 6px; }
.dodont li { font-size: 12.8px; color: var(--muted); line-height: 1.7; padding-inline-start: 14px; position: relative; }
.dodont li::before { content: ''; position: absolute; inset-inline-start: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.dodont .demo { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── note callout ─────────────────────────────────────────── */
.note {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 15px;
  margin: 14px 0;
  font-size: 13px; color: var(--muted); line-height: 1.75;
}
.note svg { width: 17px; height: 17px; color: var(--brand); flex: none; margin-top: 2px; }
.note b { color: var(--fg); }

/* ── components library page ─────────────────────────────── */
.cidx { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.cidx a {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.cidx a:hover { color: var(--brand); border-color: var(--brand); }

.cgroup {
  padding-top: 26px; margin-bottom: 2px;
  border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.cgroup b { font-size: 12.5px; font-weight: 800; }
.cgroup span { font-size: 11.5px; color: var(--faint); }

.cmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -4px 0 4px; font-size: 11.5px; color: var(--faint); }

.ds-content .lnk {
  color: var(--link); font-weight: 700; text-decoration: none;
  border-bottom: 1px solid color-mix(in oklch, var(--link) 38%, transparent);
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.ds-content .lnk:hover { color: var(--brand); border-bottom-color: var(--brand); }

.pgfoot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; }
.pgfoot a {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.pgfoot a:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
.pgfoot a small { font-size: 11px; color: var(--faint); font-weight: 600; }
.pgfoot a b { font-size: 14px; }
.pgfoot a.next { align-items: flex-end; text-align: end; }

/* living-specimen helpers (docs demos only) */
.spec .ccheck[aria-checked="false"] svg { display: none; }

.ds-side a:focus-visible, .cidx a:focus-visible, .pgfoot a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── card grid (hub) ──────────────────────────────────────── */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.hub-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}
.hub-card:hover { border-color: var(--brand); box-shadow: var(--shadow-1); transform: translateY(-2px); }
.hub-card .ic {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-container); color: var(--on-brand-container);
  display: grid; place-items: center;
}
.hub-card .ic svg { width: 19px; height: 19px; }
.hub-card b { font-size: 14.5px; }
.hub-card span { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.hub-card .go { font-size: 12.5px; font-weight: 700; color: var(--link); margin-top: auto; }

/* ── mini window-class frames (patterns) ──────────────────── */
.win-demo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.win {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg); overflow: hidden;
  display: flex; flex-direction: column;
}
.win .bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 5px 8px; display: flex; justify-content: space-between; }
.win .bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.win .body { flex: 1; display: flex; min-height: 110px; }
.win .navcol { background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; padding: 6px; }
.win .navcol.wide { width: 46px; }
.win .navcol.full { width: 60px; align-items: stretch; }
.win .nb { border-radius: 6px; background: var(--surface-2); height: 12px; }
.win .nb.on { background: var(--brand); }
.win .nb.lbl { height: 8px; width: 70%; background: var(--surface-3); border-radius: 4px; margin: 2px 4px 0; }
.win .grid-ph { flex: 1; padding: 7px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; align-content: start; }
.win .cell { aspect-ratio: 1.35; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; }
.win .cell.hol { border-color: color-mix(in oklch, var(--holiday) 45%, var(--border)); }
.win .cell.today { background: var(--brand-container); border-color: transparent; }
.win .botnav { display: flex; border-top: 1px solid var(--border); background: var(--surface); padding: 4px; gap: 3px; justify-content: space-around; }
.win .botnav .nb { width: 14px; height: 14px; border-radius: 5px; }
.win .botnav .fab { position: static; width: 20px; height: 20px; border-radius: 7px; background: var(--btn-bg); }
.win-cap { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 7px; font-weight: 500; }
.win-wrap { display: grid; gap: 4px; }

/* ── misc ─────────────────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; vertical-align: -1px; }

.type-specimen { border-inline-start: none; }
.type-row { display: flex; align-items: baseline; gap: 18px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.type-row:last-child { border-bottom: 0; }
.type-row .meta { font-size: 11px; color: var(--faint); min-width: 190px; direction: ltr; text-align: left; font-family: ui-monospace, Menlo, monospace; line-height: 1.7; }

.radius-demo { display: flex; gap: 14px; flex-wrap: wrap; }
.radius-demo > div { display: grid; gap: 8px; justify-items: center; }
.radius-demo .box { width: 84px; height: 60px; background: var(--brand-container); border: 1.5px solid var(--brand); }

.space-strip { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.space-strip > div { display: grid; gap: 7px; justify-items: center; }
.space-strip .bar { background: color-mix(in oklch, var(--brand) 30%, var(--surface)); border: 1px solid var(--brand); border-radius: 3px; }
.space-strip .lb { font-size: 10.5px; color: var(--faint); direction: ltr; font-family: ui-monospace, Menlo, monospace; }

/* static overrides: render fixed/overlay components inside specimens */
.spec .fab { position: static; }
.spec .dpop { position: static; width: 272px; }
.spec .dialog-backdrop { position: static; opacity: 1; pointer-events: auto; padding: 0; backdrop-filter: none; background: transparent; }
.spec .dialog { transform: none; max-height: none; width: 100%; max-width: 480px; }

/* responsive docs */
@media (max-width: 960px) {
  .ds-shell { grid-template-columns: 1fr; }
  .ds-side { display: none; }
  .dodont { grid-template-columns: 1fr; }
  .win-demo { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .tbl { font-size: 12.3px; }
  .tbl th, .tbl td { padding: 7px 9px; }
  .cidx a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; }
  .pgfoot { grid-template-columns: 1fr; }
}
