/* DCK Boardshorts–inspired chat UI: light editorial ecommerce, ocean accent */

:root {
  --ink: #141414;
  --ink-soft: #353535;
  --muted: #6f6a64;
  --line: #e8e4dc;
  --line-strong: #d4cfc5;
  --canvas: #f7f5f0;
  --panel: #ffffff;
  --mist: #e8f1f4;
  --ocean: #1a4a5a;
  --ocean-hover: #234e61;
  --user-fill: #1a1a1a;
  --user-text: #faf9f7;
  --bot-fill: #ffffff;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 12px 40px rgba(20, 40, 50, 0.06);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.embed {
  background: var(--panel);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 900px;
  margin: 0 auto;
}

/* —— Header (store-style top bar) —— */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header--embed {
  position: relative;
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.site-header__inner--embed {
  justify-content: center;
  padding: 0.65rem 1rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}

.brand-lockup:hover .brand-lockup__primary {
  color: var(--ocean);
}

.brand-lockup--embed {
  cursor: default;
}

.brand-lockup__primary {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.brand-logo {
  display: inline-block;
  height: 26px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.brand-logo--embed {
  height: 22px;
  max-width: 120px;
}

.brand-lockup__secondary {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.brand-tagline {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  width: 100%;
  order: 3;
  flex-basis: 100%;
}

@media (min-width: 640px) {
  .brand-tagline {
    order: 0;
    flex-basis: auto;
    width: auto;
    margin-left: auto;
    margin-right: 1rem;
  }

  .site-header__inner {
    flex-wrap: nowrap;
  }

  .site-nav {
    order: 0;
  }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--ocean);
  border-bottom-color: var(--ocean);
}

.site-nav__sep {
  color: var(--line-strong);
  user-select: none;
}

.lang-switch {
  margin-left: 0.75rem;
  min-width: 116px;
  border: 1px solid #d8dce7;
  border-radius: 10px;
  padding: 0.35rem 2rem 0.35rem 0.6rem;
  background-color: #fff;
  color: #3f4f7a;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b78a5 50%), linear-gradient(135deg, #6b78a5 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 3px), calc(100% - 8px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(27, 39, 79, 0.08);
  cursor: pointer;
}

.site-header__inner--embed .lang-switch {
  margin-left: auto;
  min-width: 108px;
  font-size: 0.76rem;
  padding: 0.3rem 1.8rem 0.3rem 0.55rem;
}

/* —— Hero strip (collections / editorial band) —— */
.chat-hero {
  background: linear-gradient(135deg, var(--mist) 0%, var(--canvas) 55%);
  border-bottom: 1px solid var(--line);
}

.chat-hero__inner {
  padding: 1.35rem 1.25rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.chat-hero__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ocean);
}

.chat-hero__lead {
  margin: 0.45rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 36rem;
}

/* —— Chat shell —— */
.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem 1.25rem;
  min-height: 0;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  min-height: 320px;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  background: linear-gradient(180deg, #fbfaf8 0%, var(--panel) 24%);
  min-height: 200px;
}

.msg {
  max-width: 88%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
}

.msg--user {
  align-self: flex-end;
  background: var(--user-fill);
  color: var(--user-text);
  border-radius: var(--radius-md) var(--radius-sm) var(--radius-md) var(--radius-md);
  white-space: pre-wrap;
}

/* Rendered Markdown inside assistant bubbles */
.msg--bot .msg__md {
  white-space: normal;
}

.msg--bot .msg__md > :first-child {
  margin-top: 0;
}

.msg--bot .msg__md > :last-child {
  margin-bottom: 0;
}

.msg--bot .msg__md p {
  margin: 0 0 0.55em;
}

.msg--bot .msg__md ul,
.msg--bot .msg__md ol {
  margin: 0.4em 0 0.55em;
  padding-left: 1.35em;
}

.msg--bot .msg__md li {
  margin: 0.15em 0;
}

.msg--bot .msg__md a {
  color: var(--ocean);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg--bot .msg__md a:hover {
  color: var(--ocean-hover);
}

.msg--bot .msg__md strong {
  font-weight: 600;
}

.msg--bot .msg__md code {
  font-family: ui-monospace, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

.msg--bot .msg__md h1,
.msg--bot .msg__md h2,
.msg--bot .msg__md h3 {
  font-size: 1.05em;
  font-weight: 700;
  margin: 0.6em 0 0.35em;
}

.msg--bot {
  align-self: flex-start;
  background: var(--bot-fill);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.msg--meta {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  align-self: center;
  max-width: 100%;
  text-align: center;
  border: none;
  background: transparent;
  padding: 0.25rem 0.5rem;
}

.msg--error {
  border-color: #e85d5d;
  box-shadow: inset 0 0 1px rgba(232, 93, 93, 0.35);
}

/* —— Suggested questions —— */
.suggested-prompts {
  padding: 0.65rem 1rem 0.5rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.suggested-prompts--hidden {
  display: none;
}

.suggested-prompts__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.suggested-prompts__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.prompt-chip {
  appearance: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ocean);
  background: var(--mist);
  border: 1px solid rgba(26, 74, 90, 0.2);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  line-height: 1.25;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.prompt-chip:hover {
  background: #dce9ed;
  border-color: var(--ocean);
  color: var(--ocean-hover);
}

.prompt-chip:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 74, 90, 0.22);
}

.prompt-chip:focus:not(:focus-visible) {
  box-shadow: none;
}

.prompt-chip:focus-visible {
  box-shadow: 0 0 0 3px rgba(26, 74, 90, 0.22);
}

.prompt-chip:active {
  transform: scale(0.98);
}

/* —— Composer —— */
.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.composer textarea {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 168px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #faf9f7;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--ocean);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(26, 74, 90, 0.12);
}

.composer textarea::placeholder {
  color: var(--muted);
}

.send-btn {
  min-height: 48px;
  padding: 0 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--ocean);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.15s ease, transform 0.1s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--ocean-hover);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn__label {
  display: inline;
}

.send-icon {
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

@media (max-width: 480px) {
  .send-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .send-btn {
    width: 48px;
    padding: 0;
  }
}

/* —— Footer —— */
.site-footer {
  padding: 1rem 1.25rem 1.35rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.footer-quicklinks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
  font-size: 0.75rem;
  justify-content: center;
}

.footer-quicklinks__label {
  width: 100%;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

@media (min-width: 520px) {
  .footer-quicklinks__label {
    width: auto;
    margin-bottom: 0;
    margin-right: 0.25rem;
  }

  .footer-quicklinks {
    justify-content: center;
  }
}

.footer-quicklinks a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer-quicklinks a:hover {
  color: var(--ocean);
  border-bottom-color: var(--ocean);
}

.disclaimer {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.footer-copy {
  margin: 0.65rem 0 0;
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  opacity: 0.9;
}

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

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0.35rem 0;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Embed: tighter panel */
body.embed .chat-shell {
  padding: 0.65rem;
}

body.embed .chat-panel {
  border-radius: var(--radius-md);
  min-height: 260px;
}

body.embed .site-footer {
  padding: 0.65rem 0.85rem 0.85rem;
}

body.embed .footer-copy {
  margin-top: 0.5rem;
}

/* Popup-mode UI (smaller ecommerce-like widget) */
body.popup {
  background: transparent;
}

.app--popup {
  max-width: 420px;
  width: min(420px, calc(100vw - 16px));
  min-height: 560px;
  margin: 8px auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(20, 40, 50, 0.14);
  background: var(--panel);
}

body.popup .chat-shell {
  padding: 0.55rem;
}

body.popup .chat-panel {
  min-height: 360px;
  border-radius: 12px;
}

body.popup .site-footer {
  padding: 0.55rem 0.7rem 0.75rem;
}

body.popup .disclaimer {
  font-size: 0.66rem;
}
