/* AnandAvo public chat — /anandavo (ChatGPT / Google-style shell) */

/* Lock page scroll so the composer dock stays on-screen; only .aa-main scrolls. */
html:has(body.aa-chat) {
  height: 100%;
}
body.aa-chat {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.aa-chat {
  --aa-ink: #0c1612;
  --aa-forest: #13221c;
  --aa-panel: #182820;
  --aa-leaf: #3d7a5f;
  --aa-leaf-bright: #5a9e7a;
  --aa-spice: #c4782a;
  --aa-spice-soft: #e8a85c;
  --aa-mist: #e8efe9;
  --aa-mist-dim: rgba(232, 239, 233, 0.68);
  --aa-line: rgba(232, 239, 233, 0.12);
  --aa-user: #243830;
  --aa-serif: "Instrument Serif", Georgia, serif;
  --aa-sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  --aa-ease: cubic-bezier(0.22, 1, 0.36, 1);
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--aa-ink);
  color: var(--aa-mist);
  font-family: var(--aa-sans);
  -webkit-font-smoothing: antialiased;
}

.aa-chat .drawer,
.aa-chat .drawer-overlay {
  display: none !important;
}

.aa-skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--aa-mist);
  color: var(--aa-ink);
  font-weight: 600;
}
.aa-skip:focus { left: 1rem; top: 1rem; }

.aa-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.aa-app {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 70% 18%, rgba(196, 120, 42, 0.16), transparent 55%),
    radial-gradient(700px 480px at 15% 90%, rgba(61, 122, 95, 0.22), transparent 55%),
    var(--aa-ink);
}

/* —— Top bar —— */
.aa-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--aa-ease);
}
.aa-app:not([data-empty="true"]) .aa-top {
  border-bottom-color: var(--aa-line);
  background: rgba(12, 22, 18, 0.72);
  backdrop-filter: blur(10px);
}
.aa-top-brand img {
  height: 24px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.aa-top-name {
  font-family: var(--aa-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: #fff;
}
.aa-top-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.aa-quota {
  font-size: 0.78rem;
  color: var(--aa-mist-dim);
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--aa-line);
  border-radius: 999px;
}
.aa-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--aa-line);
  border-radius: 8px;
  background: transparent;
  color: var(--aa-mist);
  cursor: pointer;
}
.aa-icon-btn:hover {
  background: rgba(232, 239, 233, 0.06);
}

/* —— Main —— */
.aa-main {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.aa-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.aa-chat-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.aa-app[data-artifact="open"] .aa-workspace {
  gap: 0;
}

/* Artifact catalog canvas */
.aa-artifact {
  width: min(420px, 42vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--aa-line);
  background: rgba(18, 34, 28, 0.92);
  backdrop-filter: blur(12px);
  animation: aaIn 0.35s var(--aa-ease) both;
}
.aa-artifact[hidden] {
  display: none !important;
}
.aa-artifact-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--aa-line);
}
.aa-artifact-titles {
  flex: 1;
  min-width: 0;
}
.aa-artifact-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aa-mist-dim);
}
.aa-artifact-title {
  margin: 0;
  font-family: var(--aa-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.35rem;
  color: #fff;
  line-height: 1.2;
}
.aa-artifact-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.aa-artifact-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1.25rem;
  overscroll-behavior: contain;
}

.aa-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.aa-cat-pill {
  appearance: none;
  border: 1px solid var(--aa-line);
  background: rgba(232, 239, 233, 0.05);
  color: var(--aa-mist);
  font-family: var(--aa-sans);
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
}
.aa-cat-pill:hover,
.aa-cat-pill.is-active {
  border-color: rgba(90, 158, 122, 0.55);
  background: rgba(61, 122, 95, 0.22);
}

.aa-acc {
  border: 1px solid var(--aa-line);
  border-radius: 10px;
  margin: 0 0 0.55rem;
  background: rgba(12, 22, 18, 0.35);
  overflow: hidden;
}
.aa-acc > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.aa-acc > summary::-webkit-details-marker { display: none; }
.aa-acc > summary::after {
  content: '+';
  color: var(--aa-mist-dim);
  font-weight: 400;
}
.aa-acc[open] > summary::after { content: '–'; }
.aa-acc-count {
  color: var(--aa-mist-dim);
  font-weight: 500;
  font-size: 0.8rem;
}
.aa-acc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.aa-acc-table th,
.aa-acc-table td {
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--aa-line);
  text-align: left;
  vertical-align: middle;
}
.aa-acc-table th {
  color: var(--aa-mist-dim);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.aa-food-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.aa-food-act {
  appearance: none;
  border: 1px solid var(--aa-line);
  background: transparent;
  color: var(--aa-leaf-bright);
  font-family: var(--aa-sans);
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.aa-food-act:hover {
  background: rgba(61, 122, 95, 0.2);
  border-color: rgba(90, 158, 122, 0.45);
}

.aa-open-catalog {
  appearance: none;
  margin-top: 0.55rem;
  border: 1px solid rgba(90, 158, 122, 0.45);
  background: rgba(61, 122, 95, 0.18);
  color: var(--aa-mist);
  font-family: var(--aa-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}
.aa-open-catalog:hover {
  background: rgba(61, 122, 95, 0.28);
}

@media (max-width: 899px) {
  .aa-app[data-artifact="open"] .aa-workspace {
    position: relative;
  }
  .aa-artifact {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 20;
    border-left: none;
    border-top: 1px solid var(--aa-line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  }
}

.aa-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem 1rem;
  animation: aaIn 0.7s var(--aa-ease) both;
}
.aa-app:not([data-empty="true"]) .aa-empty {
  display: none;
}
@keyframes aaIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.aa-empty-name {
  margin: 0 0 0.5rem;
  font-family: var(--aa-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  line-height: 1;
  color: #fff;
  letter-spacing: -0.02em;
}
.aa-empty-line {
  margin: 0 0 1.35rem;
  max-width: 22em;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--aa-mist-dim);
}

.aa-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 36rem;
  margin: 0 0 1.35rem;
}
.aa-skill {
  appearance: none;
  border: 1px solid rgba(232, 239, 233, 0.16);
  background: linear-gradient(165deg, rgba(232, 239, 233, 0.08), rgba(232, 239, 233, 0.02));
  color: #fff;
  font-family: var(--aa-sans);
  font-size: 0.84rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.95rem;
  border-radius: 0.85rem;
  cursor: pointer;
  transition: background 0.2s var(--aa-ease), border-color 0.2s var(--aa-ease), transform 0.2s var(--aa-ease);
}
.aa-skill:hover {
  background: linear-gradient(165deg, rgba(232, 239, 233, 0.14), rgba(232, 239, 233, 0.05));
  border-color: rgba(232, 239, 233, 0.32);
  transform: translateY(-1px);
}
.aa-skill:focus-visible {
  outline: 2px solid var(--aa-accent, #7cb892);
  outline-offset: 2px;
}
.aa-skill-label {
  display: block;
  white-space: nowrap;
}
.aa-try-label {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aa-mist-dim);
}

.aa-suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  max-width: 42rem;
}
.aa-chip {
  appearance: none;
  border: 1px solid var(--aa-line);
  background: rgba(232, 239, 233, 0.04);
  color: var(--aa-mist);
  font-family: var(--aa-sans);
  font-size: 0.88rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--aa-ease), border-color 0.2s var(--aa-ease);
  text-align: left;
}
.aa-chip:hover {
  background: rgba(232, 239, 233, 0.09);
  border-color: rgba(232, 239, 233, 0.28);
}

/* —— Thread —— */
.aa-thread {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 1.5rem) 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.aa-msg {
  display: grid;
  gap: 0.45rem;
  animation: aaIn 0.35s var(--aa-ease) both;
}
.aa-msg-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aa-mist-dim);
}
.aa-msg--user .aa-msg-role { color: var(--aa-spice-soft); }
.aa-msg-body {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.98rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.aa-msg--user .aa-msg-body {
  background: var(--aa-user);
  border: 1px solid var(--aa-line);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aa-msg--assistant .aa-msg-body {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  color: var(--aa-mist);
}
.aa-msg--assistant .aa-msg-body .aa-msg-text {
  white-space: pre-wrap;
}
.aa-msg--assistant .aa-msg-body .aa-table-wrap {
  white-space: normal;
  overflow-x: auto;
  margin: 0.65rem 0 0.85rem;
  border: 1px solid var(--aa-line);
  border-radius: 10px;
}
.aa-msg--assistant .aa-msg-body .aa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.4;
}
.aa-msg--assistant .aa-msg-body .aa-table th,
.aa-msg--assistant .aa-msg-body .aa-table td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--aa-line);
  vertical-align: top;
}
.aa-msg--assistant .aa-msg-body .aa-table th {
  color: var(--aa-spice-soft);
  font-weight: 600;
  background: rgba(24, 40, 32, 0.65);
}
.aa-msg--assistant .aa-msg-body .aa-table tr:last-child td {
  border-bottom: 0;
}
.aa-msg-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-top: 0.45rem;
}
.aa-act {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--aa-mist-dim);
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.aa-act:hover {
  color: var(--aa-mist);
  background: rgba(255, 255, 255, 0.06);
}
.aa-act.is-active {
  color: var(--aa-leaf-bright);
}
.aa-act:disabled {
  opacity: 0.55;
  cursor: default;
}
.aa-feedback-thanks {
  font-size: 0.72rem;
  color: var(--aa-mist-dim);
  margin-left: 0.35rem;
}
.aa-feedback-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.15rem;
}
.aa-chip--quiet {
  opacity: 0.9;
  font-size: 0.75rem;
}
.aa-copy {
  appearance: none;
  border: 1px solid var(--aa-line);
  background: transparent;
  color: var(--aa-mist-dim);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}
.aa-copy:hover {
  color: var(--aa-mist);
  border-color: var(--aa-leaf-bright);
}
.aa-msg--pending .aa-msg-body {
  color: var(--aa-mist-dim);
}
.aa-msg-cites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.aa-cite {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--aa-line);
  color: var(--aa-mist-dim);
}
.aa-clarify {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}
.aa-err {
  color: #f0a8a0;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* —— Composer —— */
.aa-dock {
  flex-shrink: 0;
  /* Lift composer ~12px off the viewport bottom so it isn’t flush with the edge. */
  padding: 0.75rem clamp(1rem, 3vw, 1.5rem) calc(1rem + 12px);
  background: linear-gradient(180deg, transparent, rgba(12, 22, 18, 0.92) 28%);
  z-index: 2;
}
.aa-composer {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.65rem 0.65rem 0.65rem 1rem;
  background: var(--aa-panel);
  border: 1px solid var(--aa-line);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s var(--aa-ease), box-shadow 0.2s var(--aa-ease);
}
.aa-composer:focus-within {
  border-color: rgba(90, 158, 122, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32), 0 0 0 3px rgba(61, 122, 95, 0.18);
}
.aa-composer textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font-family: var(--aa-sans);
  font-size: 1rem;
  line-height: 1.45;
  max-height: 160px;
  padding: 0.45rem 0;
}
.aa-composer textarea::placeholder {
  color: rgba(232, 239, 233, 0.42);
}
.aa-send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--aa-leaf);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s var(--aa-ease), opacity 0.2s var(--aa-ease);
}
.aa-send:hover:not(:disabled) {
  background: var(--aa-leaf-bright);
}
.aa-send:disabled {
  opacity: 0.35;
  cursor: default;
}
.aa-disclaimer {
  width: min(720px, 100%);
  margin: 0.55rem auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(232, 239, 233, 0.45);
}

@media (max-width: 520px) {
  .aa-skills { max-width: 100%; gap: 0.45rem; }
  .aa-skill { flex: 1 1 calc(50% - 0.45rem); padding: 0.65rem 0.7rem; }
  .aa-suggestions { flex-direction: column; align-items: stretch; }
  .aa-chip { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .aa-empty, .aa-msg { animation: none !important; }
}
