/* Nicci — So Design's AI brand adviser (nicci.ai). Tokens: brand.css */

html, body { margin: 0; padding: 0; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.adv-body {
  background: var(--so-paper);
  color: var(--so-ink);
  font-family: var(--font-sans);
  font-weight: var(--fw-normal);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-weight: var(--fw-medium); letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--so-coral); outline-offset: 2px; }

.adv-wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ── Header: [ so ] logo on deep navy ─────────────────────────────────── */
.adv-header { background: var(--so-navy-deep); color: var(--so-white); }
.adv-header-row { display: flex; align-items: center; gap: 28px; min-height: 84px; }
.adv-logo { font-size: 40px; }
/* Family endorsement: [ nicci ] is part of the [ so ] family. */
.adv-family { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, 0.72); text-decoration: none; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.adv-family .so-logo { font-size: 22px; letter-spacing: 0.02em; text-transform: none; color: var(--so-white); }
.adv-family:hover { color: var(--so-white); }
.adv-title { margin: 0; font-size: var(--text-lg); font-weight: var(--fw-medium); color: var(--so-white); display: flex; flex-direction: column; gap: 2px; }
.adv-title span { font-size: 0.72rem; font-weight: var(--fw-normal); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.adv-title strong { font-weight: var(--fw-medium); }
.adv-title::after { content: ''; display: block; width: 32px; height: 2px; margin-top: 6px; background: var(--so-coral); }

.adv-main { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; padding-top: 28px; padding-bottom: 48px; align-items: start; }

/* ── Stage / avatar on slate navy ──────────────────────────────────────── */
.adv-stage { position: sticky; top: 20px; background: var(--so-navy); color: var(--so-white); border-radius: var(--radius-lg); padding: 16px; }
.adv-avatar { --level: 0; position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-md); overflow: hidden; background: var(--so-navy-deep); }
.adv-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.adv-avatar[data-state="idle"] img { animation: adv-breathe 6s ease-in-out infinite; }
@keyframes adv-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.008); } }
.adv-ring { position: absolute; inset: 0; border-radius: var(--radius-md); pointer-events: none; box-shadow: inset 0 0 0 3px var(--so-coral); opacity: 0; transition: opacity 200ms; }
.adv-avatar[data-state="speaking"] .adv-ring { opacity: 1; animation: adv-speak 0.9s ease-in-out infinite; }
.adv-avatar[data-state="thinking"] .adv-ring { opacity: 1; animation: adv-pulse 1.4s ease-in-out infinite; }
.adv-avatar[data-state="listening"] .adv-ring { opacity: 0.6; box-shadow: inset 0 0 0 2px var(--so-white); }
@keyframes adv-speak { 0%, 100% { box-shadow: inset 0 0 0 3px var(--so-coral); } 50% { box-shadow: inset 0 0 0 6px var(--so-coral); } }
@keyframes adv-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.adv-status {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: var(--fw-medium); letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(34, 46, 59, 0.78); color: var(--so-white); backdrop-filter: blur(4px);
}
.adv-avatar[data-state="speaking"] .adv-status { background: var(--so-coral); }

.adv-stage-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.adv-name { font-weight: var(--fw-medium); font-size: var(--text-xl); }
.adv-role { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); margin-top: 2px; }
.adv-icon-btn { width: 40px; height: 40px; border-radius: var(--radius-full); border: 1px solid var(--so-line-dark); background: transparent; color: var(--so-white); cursor: pointer; }
.adv-icon-btn:hover { border-color: var(--so-white); }
.adv-icon-btn[aria-pressed="true"] { border-color: var(--so-coral); color: var(--so-coral); }
.adv-live { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.adv-meter { flex: 1; height: 4px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.adv-meter span { display: block; height: 100%; width: 0; background: var(--so-white); transition: width 80ms linear; }
.adv-end-btn {
  border: 0; border-radius: var(--radius-sm); padding: 10px 16px; font-family: inherit; font-weight: var(--fw-semibold);
  font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; background: var(--so-coral); color: var(--so-white); cursor: pointer;
}
.adv-end-btn:hover { filter: brightness(0.93); }
.adv-caption { margin: 12px 0 0; font-size: var(--text-sm); line-height: 1.55; color: rgba(255, 255, 255, 0.9); max-height: 9.5em; overflow-y: auto; }
.adv-caption:empty { display: none; }
.adv-disclaimer { margin: 14px 0 0; font-size: 0.74rem; line-height: 1.5; color: rgba(255, 255, 255, 0.62); }

/* ── Cards / form on paper ─────────────────────────────────────────────── */
.adv-card { background: var(--so-white); border-radius: var(--radius-lg); padding: 28px; border: 1px solid var(--so-line); }
.adv-card-head h2, .adv-chat-head h2 { margin: 0 0 4px; font-size: var(--text-3xl); font-weight: var(--fw-medium); letter-spacing: -0.015em; color: var(--so-ink); }
.adv-card-head p, .adv-chat-head p { margin: 0 0 22px; color: var(--so-muted); font-size: var(--text-base); }
.adv-card-head h2::after { content: ''; display: block; width: 48px; height: 1px; margin: 12px 0 14px; background: var(--so-ink); }
.adv-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.adv-field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.adv-field label, .adv-field legend { display: block; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--so-ink); margin-bottom: 8px; padding: 0; }
.adv-field label i, .adv-field legend i { width: 16px; color: var(--so-navy); margin-right: 4px; }
.adv-field .req { color: var(--so-coral); }
.adv-field input:not([type=checkbox]):not([type=file]), .adv-field textarea, .adv-field select {
  width: 100%; border: 1px solid var(--so-line); border-radius: var(--radius-md); padding: 11px 14px;
  font: inherit; font-size: var(--text-base); color: var(--so-ink); background: var(--so-white); resize: vertical;
}
.adv-field input:focus, .adv-field textarea:focus, .adv-field select:focus { outline: none; border-color: var(--so-navy); box-shadow: 0 0 0 3px var(--so-coral-dim); }
.adv-field small { display: block; margin-top: 6px; font-size: var(--text-xs); color: var(--so-muted); }

.adv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.adv-chip { position: relative; margin: 0 !important; cursor: pointer; font-weight: var(--fw-normal) !important; }
.adv-chip input { position: absolute; opacity: 0; }
.adv-chip span { display: inline-block; padding: 7px 14px; border: 1px solid var(--so-line); border-radius: var(--radius-full); font-size: var(--text-sm); color: var(--so-ink); background: var(--so-white); }
.adv-chip input:checked + span { background: var(--so-navy); border-color: var(--so-navy); color: var(--so-white); }
.adv-chip input:focus-visible + span { outline: 2px solid var(--so-coral); outline-offset: 2px; }

.adv-more { margin: 0 0 18px; border: 1px dashed var(--so-line); border-radius: var(--radius-lg); padding: 14px 16px 0; }
.adv-more summary { cursor: pointer; font-weight: var(--fw-medium); font-size: var(--text-sm); margin-bottom: 14px; }
.adv-more summary span { font-weight: var(--fw-normal); color: var(--so-muted); }

.adv-error { color: var(--so-danger); font-size: var(--text-sm); margin: 0 0 12px; }
.adv-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.adv-hint { margin: 10px 0 0; text-align: right; font-size: var(--text-xs); color: var(--so-muted); }
.adv-muted { color: var(--so-muted); }

/* Buttons follow so.design's "LET'S TALK": navy, caps, tracked. */
.adv-btn-primary {
  display: inline-flex; align-items: center; gap: 8px; background: var(--so-navy); color: var(--so-white); border: 0;
  border-radius: var(--radius-sm); padding: 13px 22px; font-family: inherit; font-weight: var(--fw-semibold);
  font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.adv-btn-primary:hover:not(:disabled) { background: var(--so-navy-hover); }
.adv-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.adv-btn-ghost {
  background: transparent; border: 1px solid var(--so-line); border-radius: var(--radius-sm); padding: 10px 16px;
  font-family: inherit; font-weight: var(--fw-medium); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--so-ink); cursor: pointer; white-space: nowrap;
}
.adv-btn-ghost:hover { border-color: var(--so-navy); }

/* ── Conversation ─────────────────────────────────────────────────────── */
.adv-chat { display: flex; flex-direction: column; padding: 22px; }
.adv-chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.adv-chat-head h2 { font-size: var(--text-2xl); }
.adv-chat-head p { margin-bottom: 12px; }
.adv-thread { display: flex; flex-direction: column; gap: 16px; max-height: 62vh; min-height: 280px; overflow-y: auto; padding: 12px 2px; border-top: 1px solid var(--so-line); }
.adv-msg { display: flex; gap: 10px; align-items: flex-start; }
.adv-msg-user { justify-content: flex-end; }
.adv-mini { width: 34px; height: 34px; border-radius: var(--radius-full); object-fit: cover; flex-shrink: 0; }
.adv-bubble { max-width: 85%; padding: 12px 16px; border-radius: var(--radius-lg); font-size: var(--text-base); line-height: 1.55; overflow-wrap: anywhere; }
.adv-msg-user .adv-bubble { background: var(--so-navy); color: var(--so-white); border-bottom-right-radius: var(--radius-sm); }
.adv-msg-agent .adv-bubble { background: var(--so-paper); color: var(--so-ink); border-bottom-left-radius: var(--radius-sm); }
.adv-spoken { margin: 0; }
.adv-notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--so-line); font-size: var(--text-sm); }
.adv-notes h4 { margin: 10px 0 4px; font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.adv-notes p { margin: 6px 0; }
.adv-notes ul, .adv-notes ol { margin: 6px 0; padding-left: 20px; }
.adv-notes li { margin: 3px 0; }
.adv-typing { display: inline-flex; gap: 5px; align-items: center; padding: 16px; }
.adv-typing span { width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--so-faint); animation: adv-dot 1.2s infinite ease-in-out; }
.adv-typing span:nth-child(2) { animation-delay: 0.15s; }
.adv-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes adv-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.adv-summary { margin: 4px 0 14px; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--so-paper); border-left: 3px solid var(--so-coral); }
.adv-summary h3 { margin: 0 0 8px; font-size: var(--text-lg); }
.adv-summary-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.adv-followups { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.adv-followup { background: var(--so-white); border: 1px solid var(--so-line); border-radius: var(--radius-full); padding: 7px 13px; font-family: inherit; font-size: var(--text-sm); color: var(--so-ink); cursor: pointer; text-align: left; }
.adv-followup:hover { border-color: var(--so-navy); }

.adv-ask { display: flex; gap: 10px; align-items: flex-end; }
.adv-ask textarea { flex: 1; min-width: 0; border: 1px solid var(--so-line); border-radius: var(--radius-md); padding: 11px 14px; font: inherit; font-size: var(--text-base); resize: none; }
.adv-ask textarea:focus { outline: none; border-color: var(--so-navy); box-shadow: 0 0 0 3px var(--so-coral-dim); }
.adv-ask .adv-btn-primary { padding: 13px 16px; }

@media (prefers-reduced-motion: reduce) {
  .adv-avatar img, .adv-avatar[data-state="idle"] img, .adv-ring, .adv-typing span { animation: none !important; transition: none !important; transform: none !important; }
}

@media (max-width: 900px) {
  .adv-main { grid-template-columns: 1fr; gap: 18px; padding-top: 16px; }
  .adv-stage { position: static; display: grid; grid-template-columns: 120px 1fr; gap: 0 14px; padding: 12px; }
  .adv-avatar { grid-row: span 3; }
  .adv-stage-meta { margin-top: 0; }
  .adv-caption, .adv-live { grid-column: 1 / -1; }
  .adv-disclaimer { grid-column: 2; margin-top: 6px; }
  .adv-header-row { min-height: 68px; gap: 18px; }
  .adv-logo { font-size: 32px; }
}
@media (max-width: 600px) {
  .adv-card { padding: 18px; }
  .adv-card-head h2 { font-size: var(--text-2xl); }
  .adv-grid-2 { grid-template-columns: 1fr; gap: 0; }
  .adv-bubble { max-width: 92%; }
  .adv-thread { max-height: none; }
  .adv-title span { display: none; }
  .adv-family > span:not(.so-logo) { display: none; }
  .adv-status { font-size: 0.6rem; left: 4px; right: 4px; bottom: 4px; padding: 2px 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
