/* Astro chat — natal chart audit MVP.
   Design language: Jyotish instrument on a night sky, not generic tarot/gradient mysticism.
   Signature motif: the North-Indian diamond chart square, echoed in the loader and bubble corners. */

@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #12172b;
  --bg-radial: #171d38;
  --surface: #1b2142;
  --surface-2: #242b54;
  --brass: #c99a5b;
  --brass-dim: #8a744a;
  --brass-soft: rgba(201, 154, 91, 0.16);
  --ivory: #f1ecdf;
  --ivory-dim: rgba(241, 236, 223, 0.58);
  --rose: #c97b6e;
  --rose-dim: #7c4f49;
  --danger: #e2897a;

  --font-display: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-bubble: 18px;
  --radius-card: 20px;
  --shadow-card: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, var(--bg-radial) 0%, var(--bg) 55%);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle constellation dust on the background, purely decorative */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(1px 1px at 12% 18%, var(--brass-dim), transparent),
    radial-gradient(1px 1px at 78% 12%, var(--brass-dim), transparent),
    radial-gradient(1.5px 1.5px at 34% 68%, var(--brass-dim), transparent),
    radial-gradient(1px 1px at 92% 55%, var(--brass-dim), transparent),
    radial-gradient(1px 1px at 60% 85%, var(--brass-dim), transparent),
    radial-gradient(1.5px 1.5px at 8% 82%, var(--brass-dim), transparent);
  background-repeat: no-repeat;
}

button, input {
  font-family: inherit;
  color: inherit;
}

a { color: var(--brass); }

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- shared screen scaffolding ---------- */

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 32px 20px;
}

.screen--active {
  display: flex;
}

.screen--center {
  justify-content: center;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--brass);
}

.mark__glyph {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.mark__label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
}

.card {
  background: var(--surface);
  border: 1px solid rgba(201, 154, 91, 0.18);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px 24px;
}

h1.title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--ivory);
}

p.subtitle {
  margin: 0 0 24px;
  color: var(--ivory-dim);
  font-size: 0.95rem;
}

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 6px;
}

.field {
  margin-bottom: 18px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="password"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid rgba(201, 154, 91, 0.25);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 1rem;
  color: var(--ivory);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: rgba(241, 236, 223, 0.35);
}

input:focus-visible {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  background: linear-gradient(180deg, #d7ad72, var(--brass));
  color: #1b1608;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:hover { box-shadow: 0 8px 22px -8px rgba(201, 154, 91, 0.55); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn--ghost {
  background: transparent;
  border: 1px solid rgba(201, 154, 91, 0.35);
  color: var(--brass);
}

.error-text {
  min-height: 1.2em;
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
}

.hint {
  color: var(--ivory-dim);
  font-size: 0.8rem;
  margin-top: 6px;
}

/* ---------- chat screen ---------- */

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(201, 154, 91, 0.16);
  position: sticky;
  top: 0;
  background: rgba(18, 23, 43, 0.92);
  backdrop-filter: blur(6px);
  z-index: 5;
}

.chat-header__glyph { width: 24px; height: 24px; color: var(--brass); }

.chat-header__text .name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
}

.chat-header__text .status {
  font-size: 0.72rem;
  color: var(--ivory-dim);
  letter-spacing: 0.04em;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble-row {
  display: flex;
  animation: bubble-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bubble-row--bot { justify-content: flex-start; }
.bubble-row--user { justify-content: flex-end; }

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 82%;
  padding: 13px 16px;
  font-size: 0.96rem;
  line-height: 1.55;
  border-radius: var(--radius-bubble);
}

.bubble--bot {
  background: var(--surface);
  border-left: 2px solid var(--brass);
  border-bottom-left-radius: 4px; /* echoes the diamond-chart angularity */
  color: var(--ivory);
}

.bubble--bot .bubble__title {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 6px;
}

.bubble--user {
  background: var(--rose);
  color: #2a1512;
  border-bottom-right-radius: 4px;
}

.spheres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 4px;
}

.sphere-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(201, 154, 91, 0.4);
  background: var(--brass-soft);
  color: var(--ivory);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.sphere-btn svg { width: 16px; height: 16px; color: var(--brass); flex-shrink: 0; }

.sphere-btn:hover {
  background: rgba(201, 154, 91, 0.28);
  border-color: var(--brass);
}

.sphere-btn:active { transform: translateY(1px); }

.sphere-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ---------- casting loader: the signature moment ----------
   A diamond (North-Indian rashi chart) traces its four triangles
   while the backend computes the chart. */

.casting {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  color: var(--ivory-dim);
  font-size: 0.85rem;
}

.casting__glyph {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.casting__glyph path {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 12;
  stroke-dashoffset: 12;
  animation: trace 1.4s ease-in-out infinite;
}

.casting__glyph path:nth-child(2) { animation-delay: 0.15s; }
.casting__glyph path:nth-child(3) { animation-delay: 0.3s; }
.casting__glyph path:nth-child(4) { animation-delay: 0.45s; }
.casting__glyph path:nth-child(5) { animation-delay: 0.6s; }

@keyframes trace {
  0% { stroke-dashoffset: 12; opacity: 0.25; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -12; opacity: 0.25; }
}

.chat-footer {
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(201, 154, 91, 0.14);
  font-size: 0.72rem;
  color: var(--ivory-dim);
  text-align: center;
}

/* ---------- responsive & accessibility floor ---------- */

@media (max-width: 380px) {
  .screen { padding: 24px 14px; }
  .card { padding: 22px 18px; }
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bubble-row { animation: none; }
  .casting__glyph path { animation: none; opacity: 0.8; }
}
