/* =====================================================================
   Producteca Design System — component styles
   ===================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Layout shell ---- */
.ds-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.ds-side {
  background: var(--white);
  border-right: 1px solid var(--ink-100);
  padding: 28px 20px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.ds-side .logo {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px 22px;
  border-bottom: 1px solid var(--ink-100);
  margin-bottom: 16px;
}
.ds-side .logo svg { width: 132px; height: auto; }
.ds-side .logo .tag {
  margin-top: 6px;
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.ds-nav { display: flex; flex-direction: column; gap: 2px; }
.ds-nav .group-label {
  font: 600 10px/1 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 16px 10px 6px;
}
.ds-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-700);
  text-decoration: none;
  font-size: 14px;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.ds-nav a:hover { background: var(--ink-100); color: var(--ink-1000); }
.ds-nav a.active { background: rgba(0,86,216,0.09); color: var(--brand-blue); font-weight: 600; }
.ds-nav a .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ink-300); }
.ds-nav a.active .dot { background: var(--brand-blue); }

.ds-main { padding: 40px 56px 120px; max-width: 1280px; }

/* ---- Section framing ---- */
section.ds-section { padding: 40px 0 64px; border-bottom: 1px dashed var(--ink-200); }
section.ds-section:last-of-type { border-bottom: 0; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-display-sm);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink-1000);
  margin: 0;
}
.sec-head .kicker {
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brand-blue);
}
.sec-head .lede {
  max-width: 540px;
  color: var(--ink-500);
  font-size: 15px;
  line-height: 1.55;
}

/* ---- Hero ---- */
.hero {
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
  background: var(--grad-aurora);
  color: #fff;
  padding: 56px 56px 48px;
  min-height: 420px;
  isolation: isolate;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--grain-svg);
  mix-blend-mode: overlay; opacity: 0.9;
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(6px);
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(48px, 7vw, 112px);
  letter-spacing: -0.035em;
  line-height: 0.95;
  margin: 24px 0 20px;
  color: #fff;
}
.hero h1 em { font-style: normal; color: #FFFFFF; font-weight: 500; }
.hero p { max-width: 560px; font-size: 16px; opacity: 0.9; }
.hero .meta {
  position: absolute; right: 56px; bottom: 40px;
  display: flex; gap: 28px;
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.hero .meta b { display: block; font-weight: 600; font-size: 14px; letter-spacing: 0; text-transform: none; margin-top: 4px; }

/* ---- Cards (generic) ---- */
.card {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card h4 {
  margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--ink-1000);
}
.card p.desc { margin: 0; color: var(--ink-500); font-size: 13px; }

/* ---- Color palette ---- */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 14px;
}
.swatch {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--ink-100);
  background: var(--white);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.swatch:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.swatch .chip { height: 90px; }
.swatch .body { padding: 10px 12px 12px; }
.swatch .name { font-size: 13px; font-weight: 600; color: var(--ink-1000); }
.swatch .meta { font: 400 11px/1.4 var(--font-mono); color: var(--ink-500); margin-top: 2px; text-transform: uppercase; }

.palette-row { display: grid; gap: 8px; grid-template-columns: 160px 1fr; align-items: center; margin-bottom: 10px; }
.palette-row > span { font-size: 13px; color: var(--ink-500); font-weight: 500; }
.palette-row .ramp { display: grid; grid-template-columns: repeat(10,1fr); height: 44px; border-radius: var(--r-sm); overflow: hidden; }
.palette-row .ramp b { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; font: 500 10px/1 var(--font-mono); color: rgba(255,255,255,0.8); }
.palette-row .ramp b.dark { color: rgba(0,0,0,0.55); }

/* ---- Gradient showcase ---- */
.gradient-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}
.grad-card {
  border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 16/10;
  position: relative;
  border: 1px solid var(--ink-100);
}
.grad-card::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--grain-svg);
  mix-blend-mode: overlay; opacity: 0.8; pointer-events: none;
}
.grad-card .tag {
  position: absolute; left: 14px; top: 14px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 500 11px/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
}
.grad-card .tag.dark { color: var(--ink-1000); background: rgba(255,255,255,0.7); }
.grad-card .name {
  position: absolute; left: 14px; bottom: 12px;
  color: #fff; font-size: 13px; font-weight: 600;
}
.grad-card .name.dark { color: var(--ink-1000); }

/* ---- Typography showcase ---- */
.type-stack { display: grid; gap: 16px; }
.type-row {
  display: grid; grid-template-columns: 180px 1fr; gap: 20px;
  align-items: baseline;
  padding: 20px 0; border-top: 1px solid var(--ink-100);
}
.type-row:first-child { border-top: 0; }
.type-row .label {
  font: 500 11px/1.4 var(--font-body);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-500);
}
.type-row .label b { display: block; color: var(--ink-1000); font-size: 13px; letter-spacing: 0; text-transform: none; margin-bottom: 2px; }
.type-row .spec { color: var(--ink-1000); }

.display-xl { font-family: var(--font-display); font-weight: 300; font-size: var(--t-display-xl); line-height: 0.92; letter-spacing: -0.035em; }
.display-lg { font-family: var(--font-display); font-weight: 300; font-size: var(--t-display-lg); line-height: 0.95; letter-spacing: -0.03em; }
.display-md { font-family: var(--font-display); font-weight: 400; font-size: var(--t-display-md); line-height: 1; letter-spacing: -0.025em; }
.display-sm { font-family: var(--font-display); font-weight: 400; font-size: var(--t-display-sm); line-height: 1.05; letter-spacing: -0.02em; }
.h1 { font-family: var(--font-display); font-weight: 500; font-size: var(--t-h1); letter-spacing: -0.015em; line-height: 1.15; }
.h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--t-h2); letter-spacing: -0.01em; line-height: 1.2; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--t-h3); line-height: 1.3; }
.body-lg { font-family: var(--font-body); font-size: var(--t-body-lg); line-height: 1.55; }
.body    { font-family: var(--font-body); font-size: var(--t-body);    line-height: 1.55; }
.body-sm { font-family: var(--font-body); font-size: var(--t-body-sm); line-height: 1.55; }
.micro   { font-family: var(--font-body); font-size: var(--t-micro); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font: 500 14px/1 var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-blue); color: #fff; box-shadow: var(--sh-blue); }
.btn-primary:hover { background: var(--brand-blue-ink); }
.btn-secondary { background: var(--white); color: var(--brand-blue); border-color: rgba(0,86,216,0.2); }
.btn-secondary:hover { border-color: var(--brand-blue); background: rgba(0,86,216,0.04); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-1000); }
.btn-on-dark { background: rgba(255,255,255,0.16); color: #fff; backdrop-filter: blur(6px); }
.btn-on-dark:hover { background: rgba(255,255,255,0.26); }
.btn-pill-icon { padding: 10px; width: 40px; height: 40px; justify-content: center; }
.btn svg { width: 16px; height: 16px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* ---- Form ---- */
.field { display: grid; gap: 6px; }
.field label { font: 500 12px/1 var(--font-body); color: var(--ink-700); }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--ink-1000);
  font: 400 14px/1.3 var(--font-body);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(0,86,216,0.14);
}
.textarea { min-height: 96px; resize: vertical; font-family: var(--font-body); }
.checkbox, .radio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox input, .radio input { accent-color: var(--brand-blue); width: 16px; height: 16px; }

/* ---- Badges / chips / tags ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font: 600 11px/1.4 var(--font-body); letter-spacing: 0.02em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.9; }
.badge-blue    { background: rgba(0,86,216,0.10);  color: var(--brand-blue-deep); }
.badge-lilac   { background: rgba(183,155,217,0.26); color: #5a3b8a; }
.badge-neutral { background: var(--ink-100); color: var(--ink-700); }
.badge-success { background: rgba(18,166,107,0.13); color: #0a6b46; }
.badge-warning { background: rgba(231,165,43,0.18); color: #7a5312; }
.badge-danger  { background: rgba(214,72,91,0.14); color: #8d2334; }

/* ---- Stat card / KPI ---- */
.kpi {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-100);
  padding: 18px 20px 20px;
  position: relative; overflow: hidden;
}
.kpi .label { font-size: 12px; color: var(--ink-500); font-weight: 500; }
.kpi .value {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 48px; line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink-1000);
  margin: 8px 0 6px;
}
.kpi .trend { font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.kpi.blue { background: var(--brand-blue); color: #fff; border-color: transparent; }
.kpi.blue .label { color: rgba(255,255,255,0.82); }
.kpi.blue .value { color: #fff; }
.kpi.lilac { background: var(--brand-lilac); color: #2a1844; border-color: transparent; }
.kpi.lilac .label { color: rgba(42,24,68,0.68); }
.kpi.lilac .value { color: #2a1844; }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; opacity: 0.9; }

/* ---- Dot pattern (signature) ---- */
.dot-pattern {
  --dot: var(--brand-blue);
  background-image: radial-gradient(circle at center, var(--dot) 1.8px, transparent 2px);
  background-size: 22px 22px;
}
.dots-fade {
  mask-image: radial-gradient(70% 100% at 30% 100%, #000 0%, transparent 80%);
}

/* ---- Tabs (pill) ---- */
.tabs {
  display: inline-flex; padding: 4px;
  background: var(--ink-100); border-radius: var(--r-pill);
  gap: 2px;
}
.tabs .tab {
  padding: 7px 16px; border-radius: var(--r-pill);
  font: 500 13px/1 var(--font-body);
  color: var(--ink-500); cursor: pointer; border: 0; background: transparent;
  transition: all var(--dur) var(--ease-out);
}
.tabs .tab:hover { color: var(--ink-1000); }
.tabs .tab.active { background: var(--white); color: var(--brand-blue); box-shadow: var(--sh-sm); }

/* ---- Nav bar (brand style) ---- */
.brand-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.12); backdrop-filter: blur(10px);
  border-radius: var(--r-pill);
  border: 1px solid rgba(255,255,255,0.28);
}
.brand-nav .pill-group { display: inline-flex; background: rgba(255,255,255,0.12); border-radius: var(--r-pill); padding: 4px; gap: 2px; }
.brand-nav .pill-group a { padding: 7px 14px; border-radius: var(--r-pill); color: #fff; text-decoration: none; font: 500 13px/1 var(--font-body); }
.brand-nav .pill-group a.active { background: #fff; color: var(--brand-blue); }

/* ---- Table ---- */
.tbl { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--ink-100); }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--ink-100); }
.tbl th { font-weight: 600; color: var(--ink-500); background: var(--ink-25); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; }

/* ---- Showcase helpers ---- */
.stack { display: grid; gap: var(--s-4); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }

/* ---- Spacing / radius visualizer ---- */
.spacer-row { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.spacer-row .unit { display: grid; justify-items: center; gap: 6px; }
.spacer-row .bar { background: var(--brand-blue); border-radius: 3px; width: 28px; }
.spacer-row .name { font: 500 11px/1 var(--font-mono); color: var(--ink-500); }

.radii-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radii-row .box {
  width: 92px; height: 92px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-violet) 100%);
  display: grid; place-items: end center;
  color: #fff; font: 500 11px/1.1 var(--font-mono); padding: 8px; text-align: center;
}

/* ---- Iconography placeholder ---- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px,1fr)); gap: 10px; }
.icon-tile {
  aspect-ratio: 1;
  background: var(--white); border: 1px solid var(--ink-100);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--brand-blue);
}
.icon-tile svg { width: 22px; height: 22px; }
.icon-tile:hover { border-color: var(--brand-blue); box-shadow: var(--sh-sm); }

/* ---- Product frame ---- */
.frame {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-md);
}
.frame .frame-top {
  padding: 12px 16px; border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; gap: 12px;
  background: var(--ink-25);
  font: 500 13px/1 var(--font-body); color: var(--ink-700);
}
.frame .frame-top .dots { display: inline-flex; gap: 5px; }
.frame .frame-top .dots i { width: 10px; height: 10px; border-radius: 999px; background: var(--ink-200); display: inline-block; }

/* ---- Tweaks panel ---- */
#tweaks-toggle-surface { display: none; } /* kept for edit-mode protocol */
.tweaks-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--ink-100);
  width: 280px;
  padding: 16px 18px;
  display: none;
  font-family: var(--font-body);
}
.tweaks-panel.open { display: block; }
.tweaks-panel h5 {
  font: 600 11px/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-500); margin: 0 0 12px;
}
.tweaks-panel .tweak-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--ink-100); }
.tweaks-panel .tweak-row:first-of-type { border-top: 0; }
.tweaks-panel label { font-size: 13px; color: var(--ink-700); }
.tweaks-panel .seg { display: inline-flex; background: var(--ink-100); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.tweaks-panel .seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: var(--r-pill); font: 500 12px/1 var(--font-body); color: var(--ink-500); cursor: pointer; }
.tweaks-panel .seg button.active { background: var(--white); color: var(--brand-blue); box-shadow: var(--sh-sm); }

/* ---- Accent theme overrides ---- */
.accent-violet { --brand-blue: #6F5FC9; --brand-blue-ink: #51419d; --brand-blue-deep: #342879; }
.accent-ink    { --brand-blue: #141B3A; --brand-blue-ink: #0A1230; --brand-blue-deep: #0A1230; }

/* ---- Utilities ---- */
.muted { color: var(--ink-500); }
.center { display: grid; place-items: center; }
.only-dark { display: none; }
.theme-dark .only-dark { display: block; }
.theme-dark .only-light { display: none; }
.theme-dark .ds-side { background: var(--white); border-right-color: var(--ink-200); }
.theme-dark body, .theme-dark.ds-shell, .theme-dark .ds-main { background: var(--ink-50); }
.theme-dark .card, .theme-dark .kpi, .theme-dark .tbl, .theme-dark .frame { background: var(--white); border-color: var(--ink-200); }
.theme-dark .tbl th { background: var(--ink-100); }
.theme-dark .icon-tile { background: var(--white); border-color: var(--ink-200); }
.theme-dark .input, .theme-dark .select, .theme-dark .textarea { background: var(--white); border-color: var(--ink-200); color: var(--ink-1000); }

/* ---- Section headline marker ---- */
.section-mark {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-blue);
  margin-bottom: 18px;
}
.section-mark::before { content: ""; width: 18px; height: 2px; background: var(--brand-blue); display: inline-block; }
