/* UI App Shells gallery — page chrome + shared tokens */

:root {
  --ink: #1a2332;
  --ink-muted: #5a6578;
  --ink-faint: #8b95a8;
  --surface: #f0f3f7;
  --surface-raised: #ffffff;
  --accent: #0d7a6f;
  --accent-soft: #e4f4f2;
  --accent-deep: #085c54;
  --border: #d5dce6;
  --border-strong: #b8c2d0;
  --shell-dark: #15202b;
  --shell-dark-raised: #1c2a38;
  --shell-dark-muted: #9aabbc;
  --shell-radius: 12px;
  --shell-shadow: 0 1px 2px rgb(26 35 50 / 0.06), 0 8px 24px rgb(26 35 50 / 0.06);
  --motion: 200ms ease;
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  --max: 72rem;
  --rail-w: 14.5rem;
  --rail-mini: 4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #d9ebe8 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #e2e8f2 0%, transparent 50%),
    var(--surface);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding-block: 2rem 2.5rem;
}

@media (max-width: 40rem) {
  .page {
    width: min(100% - 1.25rem, var(--max));
    padding-block: 1.25rem 2rem;
  }

  .wb-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .wb-nav__spacer {
    flex: 0 0 0.75rem;
  }
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  max-width: 46rem;
  color: var(--ink-muted);
}

.page-header code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 0.8125rem;
  font-weight: 600;
}

.toc a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.pattern {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--shell-radius) + 4px);
  background: rgb(255 255 255 / 0.55);
  backdrop-filter: blur(6px);
}

@media (max-width: 40rem) {
  .pattern {
    padding: 1rem;
  }
}

.pattern__meta {
  margin-bottom: 1.25rem;
}

.pattern__meta h2 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.pattern__meta .slug {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.pattern__meta p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.pattern__stage {
  position: relative;
  border-radius: var(--shell-radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e8edf3;
  box-shadow: var(--shell-shadow);
  min-height: 26rem;
}

.pattern__stage--tall {
  min-height: 30rem;
}

/* Shared shell primitives */
.shell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
}

.shell-btn:hover {
  background: var(--accent-deep);
}

.shell-btn--ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--ink);
}

.shell-btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.shell-btn--soft {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.shell-btn--soft:hover {
  background: #d4ebe7;
}

.shell-btn--dark {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  border-color: rgb(255 255 255 / 0.15);
}

.shell-btn--dark:hover {
  background: rgb(255 255 255 / 0.18);
}

.shell-btn--icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.shell-avatar {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.shell-avatar--dark {
  background: rgb(255 255 255 / 0.14);
  color: #fff;
}

.shell-glyph {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
}

.shell-glyph--dark {
  background: rgb(255 255 255 / 0.12);
  color: #fff;
}

.shell-glyph--plain {
  background: transparent;
  color: inherit;
}

.shell-main-demo {
  padding: 1.15rem 1.25rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.shell-main-demo h3 {
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.shell-main-demo p {
  margin: 0;
  max-width: 36rem;
}

.shell-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.shell-kpi {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.shell-kpi strong {
  display: block;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.shell-kpi span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 40rem) {
  .shell-kpi-row {
    grid-template-columns: 1fr;
  }
}

.shell-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
  max-width: 18rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.shell-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.shell-search input::placeholder {
  color: var(--ink-faint);
}

.shell-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.65rem;
  font-weight: 800;
}

.shell-badge--warn {
  background: #fffaeb;
  color: #b54708;
}

.shell-badge--live {
  background: #ecfdf3;
  color: #067647;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
