/* Style guide page. Uses only tokens from /tokens.css. */
* { box-sizing: border-box; }
html { background: var(--surface); color: var(--ink); font: var(--w-regular) var(--t-body)/var(--l-body) var(--font); -webkit-font-smoothing: antialiased; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

.ic { width: var(--icon); height: var(--icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.rail-ic { width: var(--icon-rail); height: var(--icon-rail); }
.ic.big { width: 24px; height: 24px; color: var(--muted); }

/* ── shell ── */
.shell { display: grid; grid-template-columns: var(--rail-w) var(--sidebar-w) minmax(0, 1fr) var(--context-w); min-height: 100vh; }
.rail { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3) 0; background: var(--sidebar-tint); }
.rail-gap { flex: 1; }
.rail-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r-control); background: none; color: var(--muted); cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.rail-btn:hover, .rail-btn.on { background: var(--select); color: var(--ink); }
.rail-btn.brand span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-control); background: var(--navy); color: var(--on-navy); font-weight: var(--w-semibold); }

.sidebar { display: flex; flex-direction: column; gap: 2px; padding: var(--s4) var(--s3); background: var(--sidebar-tint); border-right: 1px solid var(--line); overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s2) var(--s2); font-size: var(--t-title); }
.side-label { padding: var(--s4) var(--s2) var(--s1); font-size: var(--t-ui); color: var(--faint); }
.side-item { display: flex; align-items: center; gap: var(--s2); min-height: var(--control); padding: 0 var(--s2); border-radius: var(--r-control); font-size: var(--t-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item .ic { color: var(--muted); }
.side-item:hover { background: var(--wash); }
.side-item.on { background: var(--select); }
.side-item.muted { color: var(--muted); }
.side-item .dot { width: 6px; height: 6px; margin-left: auto; border-radius: var(--r-pill); background: var(--navy); }

.work { display: flex; flex-direction: column; gap: var(--s4); width: 100%; max-width: calc(var(--read-w) + 2 * var(--s5)); margin: 0 auto; padding: var(--s5); }
.crumbs { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-ui); color: var(--muted); }
.tool-head { display: grid; gap: var(--s2); padding-top: var(--s4); }
.tool-head h1 { font-size: var(--t-title); line-height: var(--l-title); font-weight: var(--w-semibold); }
.tool-head > p { color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s1); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: var(--t-meta); color: var(--muted); }

.composer { border: 1px solid var(--line); border-radius: var(--r-composer); background: var(--surface); box-shadow: var(--shadow-float); }
.drop { display: grid; justify-items: center; gap: var(--s1); padding: var(--s6) var(--s4); text-align: center; border-bottom: 1px dashed var(--line); }
.drop strong { font-weight: var(--w-semibold); }
.meta { font-size: var(--t-meta); color: var(--faint); }
.composer-bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); }
.grow { flex: 1; }
.run { display: grid; place-items: center; width: var(--control); height: var(--control); border: 0; border-radius: var(--r-pill); background: var(--navy); color: var(--on-navy); cursor: pointer; transition: background var(--fast) var(--ease), transform var(--fast) var(--ease); }
.run:hover { background: var(--navy-hover); }
.run:active { transform: scale(.94); }

.worked { display: flex; align-items: center; gap: 6px; font-size: var(--t-ui); color: var(--faint); }
.result { display: grid; gap: var(--s3); }
.result strong { font-weight: var(--w-semibold); }
.actions, .row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.note { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); border-radius: var(--r-control); font-size: var(--t-ui); line-height: var(--l-ui); }
.note .ic { margin-top: 1px; }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warn { background: var(--warn-bg); color: var(--warn); }

.context { padding: 56px var(--s4) var(--s4) 0; display: flex; flex-direction: column; gap: var(--s3); }
.float { padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-float); }
.ctx-label { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) 0 var(--s1); font-size: var(--t-ui); color: var(--faint); }
.ctx-label:first-child { padding-top: 0; }
.ctx-item { display: flex; align-items: center; gap: var(--s2); padding: 5px 0; font-size: var(--t-ui); color: var(--ink); }
.ctx-item .ic { color: var(--muted); }
.ctx-item.faint { color: var(--faint); }
.ctx-item.link:hover { color: var(--link); }
.sponsor { background: var(--wash); box-shadow: none; }

.tabbar { display: none; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: var(--control); padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); font-size: var(--t-ui); font-weight: var(--w-medium); cursor: pointer; transition: background var(--fast) var(--ease); }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.primary:hover { background: var(--navy-hover); }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--r-control); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--select); color: var(--ink); }
.icon-btn.sm { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: var(--t-ui); color: var(--muted); }
.chip.on { background: var(--select); border-color: transparent; color: var(--ink); font-weight: var(--w-medium); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--s2); border-radius: var(--r-pill); font-size: var(--t-meta); font-weight: var(--w-medium); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.field { display: grid; gap: var(--s1); font-size: var(--t-ui); color: var(--muted); }
.field input, .field select { height: var(--control); min-width: 180px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); font-size: var(--t-body); color: var(--ink); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* guide */
.guide { max-width: 1040px; margin: 0 auto; padding: var(--s7) var(--s5); display: grid; gap: var(--s4); border-top: 1px solid var(--line); }
.guide h2 { font-size: var(--t-hero); line-height: var(--l-hero); font-weight: var(--w-semibold); }
.guide h3 { padding-top: var(--s5); font-size: var(--t-ui); font-weight: var(--w-medium); color: var(--faint); }
.lead { font-size: var(--t-read); line-height: var(--l-read); color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.swatch { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; font-size: var(--t-meta); }
.swatch i { display: block; height: 56px; }
.swatch span { display: block; padding: var(--s2); }
.type { display: grid; gap: var(--s3); }
.t-hero { font-size: var(--t-hero); line-height: var(--l-hero); font-weight: var(--w-semibold); }
.t-title { font-size: var(--t-title); line-height: var(--l-title); font-weight: var(--w-semibold); }
.t-read { font-size: var(--t-read); line-height: var(--l-read); }
.t-body strong { font-weight: var(--w-semibold); }
.t-ui { font-size: var(--t-ui); font-weight: var(--w-medium); }
.t-meta { font-size: var(--t-meta); color: var(--muted); }
.t-hindi { font-size: var(--t-read); color: var(--muted); }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.icons div { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--r-control); font-size: var(--t-meta); color: var(--muted); }
.icons div:hover { background: var(--wash); color: var(--ink); }

/* tablet: rail + work; sidebar and context fold away */
@media (max-width: 1280px) { .shell { grid-template-columns: var(--rail-w) var(--sidebar-w) minmax(0, 1fr); } .context { grid-column: 3; padding: 0 var(--s5) var(--s5); max-width: calc(var(--read-w) + 2 * var(--s5)); margin: 0 auto; width: 100%; } }
@media (max-width: 1000px) { .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); } .sidebar { display: none; } .context { grid-column: 2; } }
/* phone: bottom tab bar */
@media (max-width: 640px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 64px; }
  .rail { display: none; }
  .context { grid-column: 1; padding: 0 var(--s4) var(--s4); }
  .work { padding: var(--s4); }
  .field input, .field select { font-size: var(--t-read); }
  .tabbar { position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); height: 60px; border-top: 1px solid var(--line); background: var(--surface); }
  .tabbar a { display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 11px; color: var(--faint); }
  .tabbar a.on { color: var(--navy); }
}
.rail, .sidebar { position: sticky; top: 0; height: 100vh; align-self: start; }
.chip, .badge, .btn { white-space: nowrap; }
.composer-bar { overflow-x: auto; scrollbar-width: none; }
.composer-bar .run, .composer-bar .icon-btn { flex: none; }
.composer-bar .run { position: sticky; right: 0; box-shadow: 0 0 0 6px var(--surface); }
