/* ─────────────────────────────────────────────────────────────────────────
   Denty — Kensington luxury aesthetic
   Cream + ink palette · Fraunces serif display · DM Sans body
   No purple gradients, no AI-bot tropes
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --bg: #FAF6F0;            /* warm cream */
  --bg-soft: #F2EBE0;       /* soft sand */
  --bg-elevated: #FFFFFF;
  --ink: #1F1B16;           /* deep warm ink */
  --ink-soft: #5A5046;      /* muted brown */
  --ink-mute: #8C7F70;      /* tertiary text */
  --line: #E5DCCB;          /* warm divider */
  --line-soft: #EFE8DA;
  --accent: #B05A3E;        /* terracotta */
  --accent-deep: #8C4329;
  --accent-soft: rgba(176, 90, 62, 0.08);
  --shadow-soft: 0 1px 2px rgba(31, 27, 22, 0.04), 0 4px 16px rgba(31, 27, 22, 0.06);
  --shadow-lift: 0 12px 32px -8px rgba(31, 27, 22, 0.18), 0 4px 12px rgba(31, 27, 22, 0.08);
  --shadow-glow: 0 0 0 4px rgba(176, 90, 62, 0.12);

  /* Typography */
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Radii */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
}

/* ───── Reset ───── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
input { border: 0; background: transparent; outline: none; }

/* ─────────────────────────────────────────────────────────────────────────
   DEMO HOST PAGE
   (mock dental clinic site so widget appears in context)
   ────────────────────────────────────────────────────────────────────── */
.demo-host {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 56px);
  background:
    radial-gradient(circle at 20% 0%, rgba(176, 90, 62, 0.04), transparent 50%),
    radial-gradient(circle at 100% 80%, rgba(176, 90, 62, 0.05), transparent 50%),
    var(--bg);
}

.demo-host__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.demo-host__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.demo-host__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.demo-host__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.demo-host__nav {
  display: flex; align-items: center; gap: 32px;
}

.demo-host__nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s var(--ease-out);
}
.demo-host__nav a:hover { color: var(--ink); }

.demo-host__cta {
  padding: 10px 22px !important;
  background: var(--ink) !important;
  color: var(--bg) !important;
  border-radius: 999px;
  transition: transform 0.2s var(--ease-out);
}
.demo-host__cta:hover { transform: translateY(-1px); }

.demo-host__hero {
  padding: clamp(60px, 12vw, 140px) 0 clamp(40px, 8vw, 80px);
  max-width: 880px;
}

.demo-host__eyebrow {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 28px;
}

.demo-host__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 32px;
}
.demo-host__title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.demo-host__title span {
  display: block;
  color: var(--ink-soft);
  font-weight: 300;
}

.demo-host__lead {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 580px;
}

/* ─────────────────────────────────────────────────────────────────────────
   FLOATING LAUNCHER (closed state)
   ────────────────────────────────────────────────────────────────────── */
.denty-launcher {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px 14px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
  z-index: 999;
}
.denty-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -8px rgba(31, 27, 22, 0.22), 0 6px 16px rgba(31, 27, 22, 0.1);
}
.denty-launcher--hidden {
  transform: scale(0.6) translateY(20px);
  opacity: 0;
  pointer-events: none;
}

.denty-launcher__icon {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--bg);
  color: var(--ink);
  border-radius: 50%;
  flex-shrink: 0;
}
.denty-launcher__icon svg {
  width: 22px; height: 22px;
}

.denty-launcher__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.28;
  animation: dentyPulse 2.4s var(--ease-out) infinite;
  z-index: -1;
  filter: blur(2px);
}
@keyframes dentyPulse {
  0%, 100% { transform: scale(1); opacity: 0.28; }
  50% { transform: scale(1.4); opacity: 0; }
}

.denty-launcher__label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────
   CHAT PANEL
   ────────────────────────────────────────────────────────────────────── */
.denty-panel {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  z-index: 1000;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.4s var(--ease-out),
    opacity 0.3s var(--ease-out);
}
.denty-panel--open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.denty-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}

.denty-panel__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.denty-panel__avatar {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  flex-shrink: 0;
}
.denty-panel__avatar svg { width: 18px; height: 18px; }
.denty-panel__avatar-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 11px; height: 11px;
  background: #4F8B5E;       /* gentle green = "available" */
  border: 2px solid var(--bg);
  border-radius: 50%;
}

.denty-panel__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.denty-panel__role {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.denty-panel__status {
  display: inline-block;
  width: 5px; height: 5px;
  background: #4F8B5E;
  border-radius: 50%;
}

.denty-panel__close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-mute);
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.denty-panel__close:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

/* Transcript */
.denty-panel__transcript {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.denty-panel__transcript::-webkit-scrollbar { width: 6px; }
.denty-panel__transcript::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

/* Message bubbles */
.denty-msg {
  max-width: 85%;
  padding: 11px 16px;
  border-radius: var(--r-lg);
  font-size: 15px;
  line-height: 1.45;
  animation: dentyMsgIn 0.3s var(--ease-out) backwards;
  word-wrap: break-word;
}
@keyframes dentyMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.denty-msg--bot {
  align-self: flex-start;
  background: var(--bg-soft);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.denty-msg--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  border-bottom-right-radius: 6px;
}

.denty-msg__image {
  display: block;
  max-width: 100%;
  border-radius: var(--r-md);
  margin: 4px 0 0;
}

/* Welcome card — first impression matters */
.denty-welcome {
  align-self: flex-start;
  max-width: 92%;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--bg) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  border-bottom-left-radius: 6px;
  animation: dentyMsgIn 0.4s var(--ease-out) backwards;
}
.denty-welcome__greet {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 8px;
}
.denty-welcome__body {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Typing indicator */
.denty-panel__typing {
  align-self: flex-start;
  margin: 0 20px 8px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--r-lg);
  border-bottom-left-radius: 6px;
  display: inline-flex;
  gap: 4px;
}
.denty-panel__typing[hidden] { display: none; }
.denty-panel__typing span {
  width: 7px; height: 7px;
  background: var(--ink-mute);
  border-radius: 50%;
  animation: dentyDot 1.4s var(--ease-in-out) infinite;
}
.denty-panel__typing span:nth-child(2) { animation-delay: 0.15s; }
.denty-panel__typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dentyDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Composer */
.denty-panel__composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}

.denty-panel__attach {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-mute);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.denty-panel__attach:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.denty-panel__input {
  flex: 1;
  padding: 11px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  min-width: 0;
}
.denty-panel__input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.denty-panel__send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.denty-panel__send:hover { transform: scale(1.05); }
.denty-panel__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.denty-panel__mic {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-mute);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.denty-panel__mic:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────
   VOICE MODE OVERLAY
   Calm full-panel layer with a breathing orb at its centre.
   ────────────────────────────────────────────────────────────────────── */
.denty-voice {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 28px 28px 36px;
  z-index: 10;
  animation: dentyVoiceIn 0.3s var(--ease-out);
}
.denty-voice[hidden] { display: none; }
@keyframes dentyVoiceIn { from { opacity: 0; } to { opacity: 1; } }

.denty-voice__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-mute);
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.denty-voice__close:hover {
  background: var(--bg-elevated);
  color: var(--ink);
}

.denty-voice__core {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 32px;
  width: 100%;
}

/* The breathing orb */
.denty-voice__orb {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #C5876B 0%, var(--accent) 50%, var(--accent-deep) 100%);
  box-shadow: 0 12px 32px -8px rgba(176, 90, 62, 0.4), inset 0 -10px 20px rgba(0, 0, 0, 0.15);
  animation: orbBreathe 4s ease-in-out infinite;
}
@keyframes orbBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Three pulsing rings — only animate when listening or speaking */
.denty-voice__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.denty-voice--listening .denty-voice__ring,
.denty-voice--speaking .denty-voice__ring {
  animation: ringPulse 2.4s ease-out infinite;
}
.denty-voice--listening .denty-voice__ring--2,
.denty-voice--speaking .denty-voice__ring--2 { animation-delay: 0.6s; }
.denty-voice--listening .denty-voice__ring--3,
.denty-voice--speaking .denty-voice__ring--3 { animation-delay: 1.2s; }
@keyframes ringPulse {
  0%   { transform: scale(1); opacity: 0.45; }
  80%  { opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* Faster, more intense for thinking */
.denty-voice--thinking .denty-voice__orb {
  animation: orbThink 1.2s ease-in-out infinite;
}
@keyframes orbThink {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.1); }
}

.denty-voice__state {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.denty-voice__caption {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 280px;
  line-height: 1.5;
  min-height: 1.5em;
}

.denty-voice__action {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  box-shadow: 0 8px 20px -6px rgba(31, 27, 22, 0.35);
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.denty-voice__action:hover { transform: scale(1.04); }
.denty-voice--listening .denty-voice__action {
  background: var(--accent);
}

.denty-panel__footer {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  padding: 8px 16px 12px;
  background: var(--bg);
}

/* ─────────────────────────────────────────────────────────────────────────
   MOBILE
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .denty-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100vh;
    border-radius: 0;
  }
  .denty-launcher__label { display: none; }
  .denty-launcher {
    padding: 12px;
    border-radius: 50%;
  }
  .demo-host__nav { display: none; }
  .demo-host__nav .demo-host__cta { display: inline-block; }
  .demo-host__title { font-size: clamp(36px, 10vw, 56px); }
}

/* iOS — prevent zoom on input focus by ensuring 16px+ */
@media (max-width: 480px) {
  .denty-panel__input { font-size: 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
