/* Shared design foundation; source and synchronization documented in docs/dadoo-design-system.md. */
html:root {
  --control-height: 48px;
  --motion-hover: 380ms;
  --motion-ease: cubic-bezier(.2,.8,.2,1);
  --bg: #f5f5f7;
  --paper: var(--bg);
  --header: #ffffff;
  --surface: #ffffff;
  --white: var(--surface);
  --soft: #eeeeef;
  --section-band: #eeeef1;
  --ink: #1d1d1f;
  --deep: var(--ink);
  --text: #65656b;
  --muted: var(--text);
  --primary: #1c5d62;
  --teal: var(--primary);
  --on-primary: #ffffff;
  --line: #d8dcdf;
  --border: var(--line);
  --line-strong: #a6b1b0;
  --control-radius: 22px;
  --panel-radius: 20px;
  --glass-surface: color-mix(in srgb, var(--surface) 68%, transparent);
  --glass-content: color-mix(in srgb, var(--surface) 96%, transparent);
  --glass-edge: rgb(255 255 255 / 85%);
  --glass-border: color-mix(in srgb, var(--ink) 14%, transparent);
  --glass-reflection: linear-gradient(
    155deg,
    rgb(255 255 255 / 55%),
    rgb(255 255 255 / 4%) 48%,
    rgb(255 255 255 / 18%)
  );
  --glass-shadow:
    inset 0 1px 0 var(--glass-edge), 0 6px 16px rgb(23 53 42 / 7%),
    0 1px 3px rgb(23 53 42 / 6%);
  --glass-floating-shadow:
    inset 0 1px 0 var(--glass-edge), 0 12px 36px rgb(22 65 56 / 10%);
  --glass-control-reflection: linear-gradient(
    180deg,
    rgb(255 255 255 / 48%),
    rgb(255 255 255 / 2%) 52%,
    rgb(22 65 56 / 2%)
  );
  --glass-primary-reflection: linear-gradient(155deg, rgb(255 255 255 / 12%), transparent 65%);
  --glass-primary-base: var(--primary);
  --glass-clear: rgb(255 255 255 / 18%);
  --glass-menu: rgb(255 255 255 / 69%);
  --glass-action-start: #216d73;
  --glass-rim: rgb(255 255 255 / 88%);
  --glass-primary-shadow:
    inset 0 1px 0 rgb(255 255 255 / 38%), inset 0 -1px 0 rgb(0 0 0 / 12%),
    0 4px 12px color-mix(in srgb, var(--primary) 18%, transparent);
  --chat-background: var(--bg);
  --chat-panel: var(--surface);
  --chat-incoming: var(--surface);
  --chat-outgoing: #e1f0e9;
  --chat-ink: var(--ink);
  --chat-muted: var(--text);
  --chat-accent: var(--primary);
  --chat-on-accent: var(--on-primary);
  --chat-hover: var(--soft);
  --chat-selected: var(--soft);
  --chat-line: var(--line);
  color-scheme: light;
  scroll-padding-block: 96px 120px;
}
html[data-theme="dark"]:root {
  --bg: #111113;
  --paper: var(--bg);
  --header: #1c1c1e;
  --surface: #1c1c1e;
  --white: var(--surface);
  --soft: #2b2b2e;
  --section-band: #19191c;
  --ink: #f5f5f7;
  --deep: var(--ink);
  --text: #a1a1a6;
  --muted: var(--text);
  --primary: #79dfc8;
  --teal: var(--primary);
  --on-primary: #182c2a;
  --glass-primary-base: var(--primary);
  --glass-clear: rgb(235 235 240 / 7%);
  --glass-menu: rgb(35 35 38 / 76%);
  --glass-action-start: #91ead6;
  --glass-rim: rgb(255 255 255 / 40%);
  --line: #3b3b3f;
  --border: var(--line);
  --line-strong: #82828a;
  --chat-outgoing: #304e43;
  --glass-edge: rgb(255 255 255 / 17%);
  --glass-border: color-mix(in srgb, var(--ink) 12%, transparent);
  --glass-reflection: linear-gradient(
    155deg,
    rgb(255 255 255 / 9%),
    transparent 50%,
    rgb(255 255 255 / 3%)
  );
  --glass-control-reflection: linear-gradient(
    180deg,
    rgb(255 255 255 / 7%),
    rgb(255 255 255 / 2%) 52%,
    rgb(0 0 0 / 3%)
  );
  --glass-shadow:
    inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 rgb(0 0 0 / 20%),
    0 4px 16px rgb(0 0 0 / 20%);
  --glass-floating-shadow:
    inset 0 1px 0 var(--glass-edge), 0 12px 36px rgb(0 0 0 / 26%);
  color-scheme: dark;
}
/* Approved optical material: the translucent backing, fine rim and label are
   separate layers. Only the backing refracts; text and icons stay crisp. */
html:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control) {
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: 0 6px 16px rgb(23 53 42 / 7%), 0 1px 3px rgb(23 53 42 / 6%), 0 0 0 .5px var(--glass-border);
  --control-material: var(--glass-clear);
  --control-optics: var(--glass-optics, blur(2px) saturate(1.2));
  transition: color 220ms ease, box-shadow 220ms ease;
}
html:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control)::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse at var(--glass-x,35%) var(--glass-y,15%), rgb(255 255 255 / var(--glass-light,0)), transparent 66%), var(--control-material);
  -webkit-backdrop-filter: var(--control-optics);
  backdrop-filter: var(--control-optics);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 38%), inset 0 -1px 1px rgb(12 48 34 / 8%);
  transition: opacity 220ms ease;
}
html:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control)::after {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(from var(--glass-angle,225deg),#ffffff08 0deg,var(--glass-rim) 58deg,#ffffff19 115deg,#8da99745 155deg,#ffffff10 185deg,var(--glass-rim) 238deg,#ffffff18 295deg,#ffffff08 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  mask-composite: exclude;
}
html:root body :is(.button.primary) {
  --control-material: linear-gradient(155deg,color-mix(in srgb,var(--glass-action-start) 86%,transparent),color-mix(in srgb,var(--primary) 91%,transparent));
  --control-optics: blur(6px) saturate(1.4);
  color: var(--on-primary);
}
@media (hover:hover) {
  html:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control):hover:not(:disabled) {
    --glass-light: .12;
    background: transparent;
    box-shadow: 0 6px 16px rgb(23 53 42 / 10%), 0 1px 3px rgb(23 53 42 / 7%), 0 0 0 .5px var(--glass-border);
  }
}
html:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control):active:not(:disabled) { --glass-light: .25; }
html[data-theme="dark"]:root body :is(.button.primary,.button.outlined,.button.subtle,.utility-button,.library-link,.copy-control) {
  box-shadow: 0 7px 20px #0004,0 1px 3px #0003,0 0 0 .5px var(--glass-border);
}

/* Match Dadoo's readable fallback for reduced transparency and contrast. */
@supports not (backdrop-filter: blur(1px)) {
  html:root body :is(.button,.utility-button,.library-link,.copy-control) { --control-material:var(--surface); }
  html:root body .button.primary { --control-material:var(--primary); }
}
@media(prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active) {
  html:root,html[data-theme]:root { --glass-clear:var(--surface);--glass-menu:var(--surface); }
  html:root body :is(.button,.utility-button,.library-link,.copy-control) { --control-optics:none;border-color:var(--line-strong); }
  html:root body .button.primary { --control-material:var(--primary); }
  html:root body .site-header { backdrop-filter:none;-webkit-backdrop-filter:none;background:var(--surface); }
}
