/* ============================================================
   BR Atelier UI Kit — component styles
   Builds on colors_and_type.css. Includes glass surfaces,
   buttons, badges, fields, cards, sidebar, topbar.
   ============================================================ */

.app {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}
.app::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(280px 220px at 80% -10%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(360px 280px at 10% 90%, rgba(170, 200, 230, .35), transparent 65%);
  z-index: -2;
  pointer-events: none;
  transition: opacity .4s var(--ease);
}
.app::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: var(--grain-opacity, .025);
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: overlay;
}

.container-br { width: min(1280px, 100% - 48px); margin: 0 auto; }

/* ── Section + section head ── */
.section { padding: clamp(48px, 6vw, 96px) 0; }
.section-head {
  display: grid;
  grid-template-columns: minmax(140px, 240px) 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.section-head .idx {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .04em;
}
.section-head .eyebrow { margin-top: 4px; display: block; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.024em;
  margin: 0 0 12px;
}
.section-head .lede {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 56ch;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  width: min(1280px, 100% - 48px);
  margin: 0 auto;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}
.topbar-brand .glyph {
  width: 22px; height: 22px;
  background: var(--ink);
  color: var(--ink-foreground);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.topbar-nav { display: flex; gap: 22px; margin-left: 24px; }
.topbar-nav a {
  position: relative;
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0;
  transition: color .2s var(--ease);
  cursor: pointer;
}
.topbar-nav a:hover { color: var(--text); }
.topbar-nav a.active { color: var(--text); }
.topbar-nav a.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: -2px;
  height: 1.5px; background: var(--accent);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.search-pill {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-subtle);
  cursor: text;
  transition: all .2s var(--ease);
}
.search-pill:hover { border-color: var(--border-strong); color: var(--text); }
.search-pill kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 4px;
}
.avatar-accent {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-inset);
}
.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Hero ── */
.hero { padding: 64px 0 56px; }
.hero-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 24px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(56px, 11vw, 168px);
  line-height: .88;
  letter-spacing: -.035em;
  margin: 0;
  color: var(--text);
}
.hero-foot {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 64px;
  align-items: end;
  margin-top: 64px;
}
.hero-lede {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--text);
  max-width: 32ch;
}
.hero-lede em { font-style: italic; color: var(--text-muted); }
.hero-now {
  border-top: 1px solid var(--hairline);
  padding-top: 18px;
}
.hero-now-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 8px;
}
.hero-now-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hero-now-name {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.024em;
}
.hero-now-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 12px;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hero-now-badge .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.hero-now-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
  max-width: 50ch;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 22px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  letter-spacing: -.005em;
  white-space: nowrap;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 14px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 48px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 20px -8px color-mix(in oklab, var(--accent) 65%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 28px -8px color-mix(in oklab, var(--accent) 70%, transparent); }
.btn-ink {
  background: var(--ink);
  color: var(--ink-foreground);
  box-shadow: var(--shadow-1);
}
.btn-ink:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-quiet {
  background: transparent;
  color: var(--text-muted);
  padding: 0 8px;
}
.btn-quiet:hover { color: var(--text); }
.btn-danger {
  background: transparent;
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 28%, transparent);
}
.btn-danger:hover { background: color-mix(in oklab, var(--accent) 8%, transparent); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-solid { background: var(--accent); color: var(--accent-foreground); border-color: transparent; }
.badge-ink { background: var(--ink); color: var(--ink-foreground); border-color: transparent; }
.badge-success { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); border-color: transparent; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── Fields ── */
.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}
.field {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s var(--ease);
}
.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input {
  flex: 1;
  background: transparent;
  border: 0; outline: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}
.field input::placeholder { color: var(--text-subtle); }
.field .ico { color: var(--text-subtle); width: 16px; height: 16px; margin-right: 10px; }
.field .affix {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
  padding: 2px 8px;
  background: var(--surface-3);
  border-radius: 6px;
}

/* ── Cards ── */
.glass-card {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), var(--shadow-inset);
  transition: all var(--dur) var(--ease);
}
.glass-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-pad { padding: 22px; }

.stat-card { padding: 24px; position: relative; }
.stat-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: clamp(40px, 4.2vw, 56px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  color: var(--text);
}
.stat-card .trend {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.stat-card .spark {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: 16px;
}

.case-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.case-card .img {
  height: 200px;
  background:
    repeating-linear-gradient(45deg, color-mix(in oklab, var(--accent) 12%, transparent) 0 14px, transparent 14px 28px),
    color-mix(in oklab, var(--accent) 4%, var(--surface-3));
  border-bottom: 1px solid var(--border);
}
.case-card .body { padding: 18px 22px 22px; }
.case-card .meta { display: flex; gap: 8px; margin-bottom: 10px; }
.case-card .title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.015em;
  margin: 0 0 6px;
}
.case-card .desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 14px;
}
.case-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-1), var(--shadow-inset);
}
.sidebar .section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 14px 10px 8px;
}
.sidebar .item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all .15s var(--ease);
  margin-left: 2px;
}
.sidebar .item:hover { background: var(--surface-2); color: var(--text); }
.sidebar .item.active {
  background: var(--surface-3);
  color: var(--text);
  margin-left: 0;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.sidebar .item.active .ico { color: var(--accent); }
.sidebar .item .ico { width: 14px; height: 14px; background: currentColor; }
.sidebar .item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}
.sidebar-foot { margin-top: auto; padding-top: 14px; }

/* ── BrandCard ── */
.brand-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-1), var(--shadow-inset);
  overflow: hidden;
}
.brand-card.compact { padding: 12px; }
.brand-card .pulse {
  position: absolute; top: 18px; right: 18px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.brand-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.brand-card .glyph {
  width: 28px; height: 28px;
  background: var(--ink); color: var(--ink-foreground);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
}
.brand-card.compact .glyph { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.brand-card .tagline {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.015em;
  color: var(--text);
}
.brand-card.compact .tagline { font-size: 13px; }
.brand-card .tagline mark { background: transparent; color: var(--accent); font-style: italic; }
.brand-card .desc { font-size: 13px; color: var(--text-muted); margin: 10px 0 0; line-height: 1.5; }
.brand-card .divider { height: 1px; background: var(--hairline); margin: 16px -22px; }
.brand-card .footer { display: flex; justify-content: space-between; align-items: center; }
.brand-card .sig .name { font-family: var(--font-display); font-size: 13px; font-weight: 500; display: block; }
.brand-card .sig .meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); margin-top: 2px; display: block; }
.brand-card .pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  transition: all .15s var(--ease);
  cursor: pointer;
}
.brand-card .pill:hover { background: var(--surface-3); border-color: var(--border-strong); }

/* ── Tweaks ── */
.tweaks {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 296px;
  background: var(--surface-3);
  backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--blur-sat));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3), var(--shadow-inset);
  padding: 18px;
  z-index: 60;
}
.tweaks h4 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 500;
  margin: 2px 0 0;
}
.tweaks-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.tweaks-kbd { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }
.tweaks-row { margin-bottom: 14px; }
.tweaks-row > .field-label { margin-bottom: 6px; }
.seg {
  display: flex;
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.seg button {
  flex: 1; height: 28px;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s var(--ease);
}
.seg button.active {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-1);
}
.swatch-row { display: flex; gap: 8px; }
.swatch-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: var(--shadow-inset);
  transition: all .15s var(--ease);
}
.swatch-btn.active { border-color: var(--text); }

/* ── Section: Foundations ── */
.specimen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.swatch-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 10px;
}
.swatch-block { height: 80px; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: var(--shadow-inset); }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: 13px; }
.table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.table thead th.num { text-align: right; }
.table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--hairline);
}
.table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13px; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.row-flex { display: flex; align-items: center; gap: 14px; }
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600;
  color: var(--text);
}

.lucide {
  width: 16px; height: 16px;
  background: currentColor;
  display: inline-block;
}

.anchor { display: block; height: 1px; }
