/* DC Blueprints v1.1: routing, tools, new components, patterns, search.
   All values come from tokens.css. */

/* ---------- Pages (one section per route) ---------- */
.page[hidden] { display: none; }
.page { animation: page-in var(--duration-enter) var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
section.rule.page { padding-top: var(--s-7); }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-9);
  padding-top: var(--s-6);
  border-top: 1px solid var(--border);
}
.pager a {
  display: grid;
  gap: 2px;
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg);
  background: var(--card);
  text-decoration: none;
  transition: box-shadow 200ms var(--ease-out);
}
.pager a:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.pager a span { font-size: 13px; color: var(--muted-foreground); }
.pager a strong { font-size: 17px; }
.pager .next { text-align: right; grid-column: 2; }

.ov-head { font-size: 20px; font-weight: 700; margin: var(--s-8) 0 var(--s-4); }
.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--s-3);
}
.ov-grid a {
  align-content: start;
  display: grid;
  gap: var(--s-1);
  padding: var(--s-4) var(--s-5);
  background: var(--card);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: box-shadow 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.ov-grid a:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.ov-grid a:active { transform: scale(0.99); }
.ov-grid b { font-family: var(--mono); font-size: 12px; color: var(--accent-text); }
.ov-grid strong { font-size: 17px; }
.ov-grid span { font-size: 14px; color: var(--muted-foreground); }

/* ---------- Topbar tools ---------- */
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 40px;
  min-width: 220px;
  padding: 0 var(--s-2) 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--muted-foreground);
  font: 500 14px var(--font);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow 200ms var(--ease-out);
}
.search-btn:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.search-btn svg { width: 16px; height: 16px; }
.search-btn kbd,
.cmdk kbd {
  margin-left: auto;
  font: 600 11px var(--mono);
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted-foreground);
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-2);
  border: 0;
  background: none;
  color: var(--foreground);
  font: 600 14px var(--font);
  cursor: pointer;
}
.switch .knob {
  position: relative;
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background-color 200ms var(--ease-out);
}
.switch .knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--foreground);
  transition: transform 200ms var(--ease-out);
}
.switch[aria-checked="true"] .knob { background: var(--destructive); box-shadow: none; }
.switch[aria-checked="true"] .knob::after { transform: translateX(14px); background: var(--background); }

.stress-banner {
  display: none;
  position: fixed;
  left: 50%;
  bottom: var(--s-5);
  z-index: 45;
  width: max-content;
  max-width: calc(100vw - 32px);
  translate: -50% 0;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-lg);
  background: var(--destructive);
  color: var(--background);
  box-shadow: var(--shadow-lift);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
body.stress .stress-banner { display: block; }
body.stress [data-stress] {
  outline: 1px dashed color-mix(in srgb, var(--destructive) 60%, transparent);
  outline-offset: 2px;
}

/* ---------- Copy ---------- */
[data-copy],
[data-copy-tpl] { cursor: copy; }
button.swatch {
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
button.swatch:hover { box-shadow: var(--edge), 0 0 0 2px var(--border-strong); }
button.swatch:active { transform: scale(0.98); }
.space-row {
  padding: 4px 6px;
  margin-inline: -6px;
  border-radius: 8px;
  transition: background-color 150ms;
}
.space-row:hover { background: var(--surface-2); }
.radius-row .r { transition: border-color 150ms; }
.radius-row .r:hover { border-color: var(--foreground); }
.copy-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted-foreground);
  font: 600 12px var(--font);
  cursor: copy;
  transition: color 150ms;
}
.copy-chip::before { content: ""; position: absolute; inset: -6px; }
.copy-chip:hover { color: var(--foreground); }
.copy-chip svg { width: 14px; height: 14px; }
.copy-tip { font-size: 14px; color: var(--muted-foreground); margin: calc(var(--s-4) * -1) 0 var(--s-5); }
.row-copy { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }

/* ---------- Frames ---------- */
.frame { border-radius: var(--r-lg); overflow: hidden; background: var(--background); box-shadow: var(--edge); }
.frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--s-3);
  background: var(--surface-2);
}
.frame-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.frame-bar span { margin-left: var(--s-3); font: 500 11px var(--mono); color: var(--muted-foreground); }
.phone {
  width: min(300px, 100%);
  max-width: 100%;
  height: 520px;
  margin-inline: auto;
  padding: 10px;
  border-radius: 36px;
  background: var(--ink);
  box-shadow: var(--shadow-lift);
}
.phone-screen { position: relative; height: 100%; border-radius: 28px; overflow: hidden; background: var(--background); }

/* ---------- Navbar ---------- */
.nb {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: 64px;
  padding: 0 var(--s-5);
  border-bottom: 1px solid var(--border);
}
.nb .logo { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; font-size: 15px; white-space: nowrap; }
.nb .logo img { width: 26px; height: 26px; border-radius: 7px; }
.nb nav { display: flex; gap: var(--s-1); margin-inline: auto; min-width: 0; }
.nb nav a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  max-width: 160px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 150ms, background-color 150ms;
}
.nb nav a:hover,
.nb nav a[aria-current="page"] { color: var(--foreground); background: var(--card); }
.nb-m {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 var(--s-2) 0 var(--s-4);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}
.menu-btn svg { width: 22px; height: 22px; }
.m-menu {
  position: absolute;
  inset: 60px 0 0;
  display: grid;
  align-content: start;
  gap: var(--s-1);
  padding: var(--s-4);
  background: var(--background);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--duration-enter) var(--ease-out), transform var(--duration-enter) var(--ease-out), visibility 0s linear var(--duration-enter);
}
.m-menu.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.m-menu a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.m-menu a[aria-current="page"] { background: var(--card); }
.m-menu .btn { margin-top: var(--s-4); }
.m-body { display: grid; gap: var(--s-3); padding: var(--s-5) var(--s-4); }
.m-body .ln { height: 10px; border-radius: 5px; background: var(--surface-2); }

/* ---------- Tabs ---------- */
.tabs [role="tablist"] {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.tabs [role="tab"] {
  height: 44px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted-foreground);
  font: 600 14px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--popover); color: var(--foreground); box-shadow: var(--edge); }
.tabs [role="tabpanel"] { max-width: 60ch; padding: var(--s-5) var(--s-1) 0; font-size: 16px; color: var(--muted-foreground); }

/* ---------- Breadcrumbs / pagination ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0; padding: 0; list-style: none; font-size: 14px; }
.crumbs li { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--border-strong); }
.crumbs a { color: var(--muted-foreground); text-decoration: none; }
.crumbs a:hover { color: var(--foreground); text-decoration: underline; }
.crumbs [aria-current] { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pg { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); }
.pg button {
  min-width: 44px;
  height: 44px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--foreground);
  font: 600 14px var(--font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 150ms;
}
.pg button:hover:not([disabled]) { background: var(--surface-2); }
.pg button[aria-current="page"] { background: var(--primary); color: var(--primary-foreground); }
.pg button[disabled] { opacity: 0.35; cursor: not-allowed; }
.pg .gap { width: 32px; text-align: center; color: var(--muted-foreground); }

/* ---------- Project card ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-4); }
.pcard {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  transition: box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.pcard:hover { box-shadow: var(--edge), var(--shadow-lift); transform: translateY(-2px); }
.pcard:has(a:focus-visible) { outline: 2px solid var(--ring); outline-offset: 3px; }
.pcard a:focus-visible { outline: none; }
.pcard .img {
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(120% 95% at 30% 0%, color-mix(in srgb, var(--tint, var(--accent-line)) 35%, transparent), transparent 65%),
    var(--surface-2);
}
.pcard .body { display: grid; align-content: start; gap: var(--s-2); min-width: 0; padding: var(--s-4) var(--s-5) var(--s-5); }
.pcard .meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-width: 0; }
.pcard h4 { font-size: 18px; overflow-wrap: anywhere; }
.pcard p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 16px;
  color: var(--muted-foreground);
}
.pcard a.stretch { color: inherit; text-decoration: none; }
.pcard a.stretch::after { content: ""; position: absolute; inset: 0; }
.pcard .cat {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-text);
}

/* ---------- Badges ---------- */
.badges { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--s-2);
  max-width: 100%;
  height: 28px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.badge > span { overflow: hidden; text-overflow: ellipsis; }
.badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live { color: var(--accent-text); }
.badge.live::before { background: var(--accent-line); }
.badge.warn { color: var(--warning); }
.badge.paused { color: var(--muted-foreground); }
.badge.error { color: var(--destructive); }
.badge.plain { color: var(--foreground); }
.badge.plain::before { display: none; }

/* ---------- Data table ---------- */
.dtable-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--background); box-shadow: var(--edge); }
.dtable { width: 100%; min-width: 620px; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.dtable th {
  height: 44px;
  padding: 0 var(--s-4);
  background: var(--card);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}
.dtable td {
  height: 56px;
  padding: 0 var(--s-4);
  border-top: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dtable tbody tr { transition: background-color 150ms; }
.dtable tbody tr:hover { background: var(--card); }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable td strong { font-weight: 600; }

/* ---------- Overlays ---------- */
dialog.modal {
  width: min(440px, calc(100vw - 32px));
  padding: var(--s-5);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--popover);
  color: var(--foreground);
  box-shadow: var(--edge), var(--shadow-lift);
}
dialog.modal[open] { animation: modal-in var(--duration-enter) var(--ease-out) both; }
dialog.modal::backdrop { background: rgba(11, 13, 16, 0.5); animation: fade-in var(--duration-enter) var(--ease-out) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
dialog.modal h4 { margin-bottom: var(--s-2); padding-right: var(--s-7); font-size: 20px; }
dialog.modal p { margin-bottom: var(--s-5); font-size: 16px; color: var(--muted-foreground); }
dialog.modal .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); }
.x-btn { position: absolute; top: var(--s-2); right: var(--s-2); }

.dd-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 220px;
  padding: var(--s-1);
  border-radius: var(--r-md);
  background: var(--popover);
  box-shadow: var(--edge), var(--shadow-lift);
  transform-origin: top left;
  animation: menu-in var(--duration-exit) var(--ease-out) both;
}
.menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
.menu [role="menuitem"] {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  height: 44px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  font: 500 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.menu [role="menuitem"]:hover,
.menu [role="menuitem"]:focus-visible { background: var(--surface-2); outline: none; }
.menu [role="menuitem"] svg { width: 16px; height: 16px; color: var(--muted-foreground); }
.menu [role="menuitem"] kbd { margin-left: auto; font: 500 11px var(--mono); color: var(--muted-foreground); }
.menu hr { height: 1px; margin: var(--s-1) 0; border: 0; background: var(--border); }
.menu .danger,
.menu .danger svg { color: var(--destructive) !important; }

.tip-wrap { position: relative; display: inline-flex; }
.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--foreground);
  color: var(--background);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--duration-exit) var(--ease-out), transform var(--duration-exit) var(--ease-out);
}
.tip-wrap:hover .tip,
.tip-wrap:focus-within .tip { opacity: 1; transform: none; transition-delay: 300ms; }
.z-scale { display: grid; gap: 6px; }
.z-scale div {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-line) calc(var(--z) / 2), var(--card));
  font-size: 14px;
}
.z-scale code { background: var(--popover); }

/* ---------- Icons ---------- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
.icon-grid button {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-2) var(--s-3);
  border: 0;
  border-radius: var(--r-md);
  background: var(--background);
  color: var(--foreground);
  font: 500 12px var(--font);
  cursor: copy;
  transition: box-shadow 150ms;
}
.icon-grid button:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.icon-grid svg { width: 24px; height: 24px; }
.icon-grid span { color: var(--muted-foreground); }
.icon-sizes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-6); }
.icon-sizes figure { display: grid; gap: var(--s-2); margin: 0; }
.icon-sizes .pairing { display: inline-flex; align-items: center; font-weight: 600; }
.icon-sizes figcaption { font: 500 12px var(--mono); color: var(--muted-foreground); }

/* ---------- Patterns ---------- */
.pattern { margin-bottom: var(--s-7); }
.pattern-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-3); }
.pattern-head h3 { font-size: 20px; }
.pattern-head span { font-size: 14px; color: var(--muted-foreground); }
.pt { padding: clamp(24px, 4vw, 64px) clamp(16px, 4vw, 48px); }
.pt-hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: var(--s-7); }
.pt-hero h2 { margin: var(--s-3) 0 var(--s-4); font-size: clamp(30px, 4vw, 52px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; }
.pt-hero p { max-width: 44ch; margin-bottom: var(--s-5); color: var(--muted-foreground); }
.pt-visual {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-xl);
  background:
    radial-gradient(70% 70% at 70% 30%, color-mix(in srgb, var(--accent-line) 45%, transparent), transparent 70%),
    var(--card);
}
.pt-visual img { width: 30%; border-radius: 22%; box-shadow: var(--shadow-lift); }
.pt-title { max-width: 56ch; margin-bottom: var(--s-6); }
.pt-title h2 { margin: var(--s-2) 0 var(--s-3); font-size: clamp(26px, 3vw, 36px); font-weight: 700; letter-spacing: -0.03em; }
.pt-title p { color: var(--muted-foreground); }
.pt-services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.pt-services > div { display: grid; align-content: start; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-lg); background: var(--card); }
.pt-services .ic {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--s-2);
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
}
.pt-services .ic svg { width: 20px; height: 20px; }
.pt-services h4 { font-size: 18px; }
.pt-services p { font-size: 16px; color: var(--muted-foreground); }
.pt-case .facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
  margin: var(--s-5) 0;
  padding: var(--s-4) 0;
  border-block: 1px solid var(--border);
  font-size: 15px;
}
.pt-case .facts span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); }
.pt-case .shot {
  aspect-ratio: 16 / 8;
  margin-bottom: var(--s-6);
  border-radius: var(--r-xl);
  background:
    radial-gradient(90% 90% at 20% 10%, color-mix(in srgb, var(--accent-line) 30%, transparent), transparent 70%),
    var(--card);
}
.pt-case h2 { font-size: clamp(28px, 3.5vw, 44px); font-weight: 700; letter-spacing: -0.03em; margin-top: var(--s-4); }
.pt-case .cols { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s-6); }
.pt-case .cols h4 { font-size: 18px; }
.pt-case .cols p { color: var(--muted-foreground); }
.pt-contact { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-7); }
.pt-contact h2 { margin: var(--s-2) 0 var(--s-4); font-size: clamp(28px, 3.5vw, 44px); font-weight: 700; letter-spacing: -0.03em; }
.pt-contact p { margin-bottom: var(--s-5); color: var(--muted-foreground); }
.pt-contact .mail { font-size: 18px; font-weight: 700; color: var(--accent-text); text-decoration: none; overflow-wrap: anywhere; }
.pt-contact form { display: grid; gap: var(--s-4); padding: var(--s-5); border-radius: var(--r-xl); background: var(--card); }
.pt-contact form .field { max-width: none; }
.pt-contact form .btn { justify-self: start; }
.notes { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.notes span { padding: 4px 10px; border-radius: var(--r-pill); background: var(--card); font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.notes b { color: var(--accent-text); }

/* ---------- Changelog ---------- */
.log { display: grid; gap: var(--s-5); }
.log article { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--s-5); padding-bottom: var(--s-5); border-bottom: 1px solid var(--border); }
.log .when strong { display: block; font-size: 18px; }
.log .when span { font-size: 13px; color: var(--muted-foreground); }
.log ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; font-size: 16px; }

/* ---------- Command palette ---------- */
dialog.cmdk {
  width: min(560px, calc(100vw - 32px));
  max-height: min(480px, 70vh);
  margin-top: 12vh;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--popover);
  color: var(--foreground);
  box-shadow: var(--edge), var(--shadow-lift);
}
dialog.cmdk[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: modal-in var(--duration-enter) var(--ease-out) both; }
dialog.cmdk::backdrop { background: rgba(11, 13, 16, 0.45); }
.cmdk-in { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-4); border-bottom: 1px solid var(--border); }
.cmdk-in svg { flex: none; width: 18px; height: 18px; color: var(--muted-foreground); }
.cmdk-in input { flex: 1; min-width: 0; height: 56px; border: 0; background: transparent; color: var(--foreground); font: 500 17px var(--font); outline: none; }
.cmdk-list { margin: 0; padding: var(--s-2); overflow-y: auto; list-style: none; }
.cmdk-list li { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: var(--s-2) var(--s-3); border-radius: 10px; font-size: 15px; cursor: pointer; }
.cmdk-list li small { margin-left: auto; font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.cmdk-list li[aria-selected="true"] { background: var(--surface-2); }
.cmdk-list .empty { justify-content: center; color: var(--muted-foreground); cursor: default; }
.cmdk-foot { display: flex; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .search-btn { width: 44px; min-width: 0; height: 44px; padding: 0; justify-content: center; }
  .search-btn .lbl,
  .search-btn kbd { display: none; }
}
@media (max-width: 760px) {
  .switch .lbl { display: none; }
  .pt-hero,
  .pt-contact,
  .pt-case .cols,
  .pt-services { grid-template-columns: minmax(0, 1fr); }
  .pt-case .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nb nav { display: none; }
  .nb { justify-content: space-between; }
  .log article { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { grid-column: 1; }
}

/* ---------- AI check ---------- */
.ai-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-6); }
.ai-steps > div { display: grid; gap: var(--s-1); align-content: start; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--card); }
.ai-steps b { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: var(--s-2); border-radius: 50%; background: var(--primary); color: var(--primary-foreground); font-size: 14px; }
.ai-steps strong { font-size: 16px; }
.ai-steps span { font-size: 15px; color: var(--muted-foreground); }
.ai-panel { max-width: none !important; }
.ai-when { margin-bottom: var(--s-4); color: var(--muted-foreground); }
.ai-box { overflow: hidden; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--edge); }
.ai-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5); border-bottom: 1px solid var(--border); }
.ai-bar > span:first-child { font: 500 13px var(--mono); color: var(--muted-foreground); }
.ai-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ai-pre {
  max-height: 520px;
  margin: 0;
  padding: var(--s-5);
  overflow: auto;
  font: 13px/1.65 var(--mono);
  color: var(--foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-pre .ph { padding: 0 2px; border-radius: 4px; background: color-mix(in srgb, var(--accent-line) 28%, transparent); color: var(--foreground); }
.ai-pre .hd { font-weight: 700; color: var(--accent-text); }
.ai-where { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.ai-where .panel { display: grid; gap: var(--s-2); align-content: start; padding: var(--s-5); }
.ai-where p { font-size: 15px; color: var(--muted-foreground); }
@media (max-width: 760px) {
  .ai-steps,
  .ai-where { grid-template-columns: minmax(0, 1fr); }
  .ai-bar { padding-left: var(--s-4); }
  .ai-pre { padding: var(--s-4); max-height: 420px; }
}

/* ---------- Sources ---------- */
.audit-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.audit-sum div { padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--card); }
.audit-sum strong { display: block; font-size: 32px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.audit-sum span { font-size: 13px; color: var(--muted-foreground); }
.src-list { display: grid; gap: var(--s-2); }
.src { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-md); background: var(--card); }
.src .badge { align-self: start; }
.src h4 { margin-bottom: 4px; font-size: 16px; }
.src p { font-size: 15px; color: var(--muted-foreground); max-width: 75ch; }
.src .links { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); margin-top: var(--s-1); }
.src .links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-line) 50%, transparent);
  text-underline-offset: 4px;
}
.src .links a::after { content: " ↗"; white-space: pre; }
.src .links a:hover { text-decoration-color: currentColor; }
.cmp td { white-space: normal; height: auto; padding-block: var(--s-3); }
@media (max-width: 760px) {
  .src { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
}

/* ---------- Credits ---------- */
.lic-own { display: grid; gap: var(--s-2); margin-bottom: var(--s-2); }
.lic-own p { max-width: 70ch; color: var(--muted-foreground); }
.lic-own strong { color: var(--foreground); font-size: 18px; }
.lic td .badge { vertical-align: middle; }
.lic-notes { display: grid; gap: var(--s-3); }
.lic-notes p { max-width: 75ch; font-size: 15px; color: var(--muted-foreground); }
.lic-notes a,
#credits .rules a,
footer a { color: var(--accent-text); text-underline-offset: 3px; }
.lic-small { margin-top: var(--s-5); font-size: 14px; color: var(--muted-foreground); }

/* ---------- v1.4: media, charts, performance, mobile, Telugu, process ---------- */
.ratios { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-4); }
.ratios figure { display: grid; gap: var(--s-2); margin: 0; width: 160px; }
.ratios figure > div { width: 100%; border-radius: var(--r-md); background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--accent-line) 30%, var(--surface-2))); box-shadow: var(--edge); }
.ratios figcaption { display: grid; font-size: 13px; color: var(--muted-foreground); }
.ratios figcaption strong { font-size: 15px; color: var(--foreground); }
.chart-swatches { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: var(--s-2); }
.chart-swatches .chip { height: 56px; }
.chart-card { display: grid; gap: var(--s-3); width: 100%; max-width: 340px; padding: var(--s-4); border-radius: var(--r-lg); background: var(--card); text-align: left; }
.chart-card strong { font-size: 15px; }
.chart-card svg { width: 100%; height: auto; display: block; color: var(--foreground); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3); font-size: 12px; color: var(--muted-foreground); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.vitals { display: grid; gap: var(--s-5); }
.vital { display: grid; gap: var(--s-2); }
.v-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); }
.v-head strong { font-size: 18px; }
.v-head span { font-size: 14px; color: var(--muted-foreground); }
.v-bar { display: flex; height: 32px; overflow: hidden; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; }
.v-bar span { display: flex; align-items: center; padding: 0 var(--s-3); white-space: nowrap; overflow: hidden; }
.v-bar .g { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--foreground); }
.v-bar .n { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--foreground); }
.v-bar .p { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--foreground); }
.v-note { font-size: 13px; color: var(--muted-foreground); }
.v-note a,
.propose a,
.process a { color: var(--accent-text); text-underline-offset: 3px; }
.app-phone .phone-screen { display: grid; grid-template-rows: auto auto 1fr auto auto; }
.app-phone .safe { display: grid; place-items: center; height: 28px; font: 600 10px var(--mono); color: var(--accent-text); background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent-line) 20%, transparent) 0 6px, transparent 6px 12px); }
.app-phone .safe.bottom { height: 22px; }
.app-head { padding: var(--s-3) var(--s-4); font-size: 20px; }
.app-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.app-tabs span { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 56px; font-size: 11px; font-weight: 600; color: var(--muted-foreground); }
.app-tabs span.on { color: var(--foreground); }
.app-tabs svg { width: 22px; height: 22px; }
.te-demo { display: grid; gap: var(--s-3); max-width: 340px; text-align: left; }
.te { font-family: "Noto Sans Telugu", var(--font); font-size: 18px; }
.te-bad { font-family: "Nirmala UI", "Gautami", sans-serif; font-size: 18px; line-height: 1.1; }
.te-demo span { font: 500 12px var(--mono); color: var(--muted-foreground); }
.process ol { display: grid; gap: var(--s-3); margin: var(--s-3) 0 0; padding-left: 20px; font-size: 16px; }
.process ol strong { color: var(--foreground); }
.process { margin-bottom: var(--s-6); }
.propose { margin-top: var(--s-9); font-size: 15px; color: var(--muted-foreground); }
.propose:empty { display: none; }
.propose + .pager { margin-top: var(--s-4); }

/* Small buttons are 40px tall but keep a 44px tap area. */
.btn-sm { position: relative; }
.btn-sm::before { content: ""; position: absolute; inset: -2px; }
