/* ==========================================================================
   Astro Tantra Mantra — mobile-first stylesheet
   Palette: ivory #FAF8F2 · navy #172447 · teal #176B67 · gold #E8B95E
   Type:    Spectral (headings) · DM Sans (body)
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ivory: #FAF8F2;
  --ivory-deep: #F2EEE3;
  --navy: #172447;
  --navy-soft: #33406B;
  --navy-muted: #55618A;
  --teal: #176B67;
  --teal-dark: #11524F;
  --teal-tint: #E7F1EF;
  --gold: #E8B95E;
  --gold-soft: rgba(232, 185, 94, 0.45);
  --gold-faint: rgba(232, 185, 94, 0.18);
  --white: #FFFFFF;
  --error: #A8321E;

  --font-display: "Spectral", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --shadow-sm: 0 2px 8px rgba(23, 36, 71, 0.06);
  --shadow-md: 0 10px 30px -12px rgba(23, 36, 71, 0.22);
  --shadow-lg: 0 24px 60px -20px rgba(23, 36, 71, 0.28);

  --radius: 14px;
  --radius-lg: 22px;

  --header-h: 64px;
  --ease: cubic-bezier(0.22, 0.72, 0.28, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
}

p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- accessibility ---------- */
.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 100;
  background: var(--navy);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  font-weight: 500;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .wrap { padding: 0 36px; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 248, 242, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(23, 36, 71, 0.08);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy);
  min-width: 0;
}

.brand-mark { width: 38px; height: 38px; flex: 0 0 auto; }

.brand-divider {
  width: 1px;
  height: 26px;
  background: var(--gold);
  flex: 0 0 auto;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-nav a {
  color: var(--navy-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 2px;
  border-bottom: 1px solid transparent;
}
.header-nav a:hover { color: var(--navy); border-bottom-color: var(--gold); }

.header-nav .nav-cta {
  color: var(--teal);
  font-weight: 700;
}

@media (max-width: 600px) {
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 0.94rem; }
  .brand-divider { height: 20px; }
  .header-nav a:not(.nav-cta) { display: none; }
  .header-nav { gap: 0; }
}

@media (min-width: 768px) {
  :root { --header-h: 80px; }
  .brand-mark { width: 46px; height: 46px; }
  .brand-divider { height: 32px; }
  .brand-name { font-size: 1.3rem; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: 28px 0 8px;
  overflow: hidden;
}

.hero-copy { position: relative; z-index: 2; max-width: 34rem; }

.hero h1 {
  font-size: clamp(2.15rem, 9.2vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.022em;
  margin-bottom: 16px;
  text-wrap: balance;
}

.hero-sub {
  font-size: 1.02rem;
  color: var(--navy-soft);
  max-width: 30rem;
  margin-bottom: 24px;
  text-wrap: pretty;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--teal);
  color: #FFFFFF;
  border: 1px solid var(--teal);
  border-radius: 10px;
  padding: 15px 26px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 20px -10px rgba(23, 107, 103, 0.7);
  transition: background-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-primary:active { transform: translateY(1px); }

.btn-primary .arrow { transition: transform 0.18s var(--ease); }
.btn-primary:hover .arrow { transform: translateX(3px); }

.hero-note {
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--navy-muted);
}

/* hero art — hidden on small screens, shown on desktop */
.hero-art { display: none; }

@media (min-width: 900px) {
  .hero {
    padding: 52px 0 40px;
    min-height: 560px;
    display: flex;
    align-items: center;
  }

  .hero .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
    gap: 40px;
    align-items: center;
  }

  .hero-copy { max-width: 35rem; }

  .hero h1 { font-size: clamp(3rem, 4.3vw, 4.1rem); margin-bottom: 22px; }

  .hero-sub { font-size: 1.16rem; margin-bottom: 32px; }

  .btn-primary { padding: 17px 34px; font-size: 1.08rem; }

  .hero-art {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    min-height: 540px;
  }
}

/* decorative scene behind Tara */
.hero-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.tara-stage {
  position: relative;
  z-index: 2;
  width: min(96%, 490px);
  aspect-ratio: 1;
}
.tara-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tara-glide { opacity: 0; }
@media screen and (max-width: 899px) {
  .hero-art { display: grid; position: relative; place-items: center; margin: 12px auto 0; width: min(56vw, 200px); }
}
@media (prefers-reduced-motion: no-preference) {
  .tara-glide { animation: taraArrive 2s ease-out both; }
  .tara-perched { animation: taraLand 2s ease-out both; }
}
@keyframes taraArrive {
  0% { opacity: 0; transform: translate(14%, -16%) rotate(-8deg) scale(.82); }
  18% { opacity: 1; }
  68% { opacity: 1; transform: translate(1%, -4%) rotate(-3deg) scale(.98); }
  84%, 100% { opacity: 0; transform: translateY(0); }
}
@keyframes taraLand {
  0%, 67% { opacity: 0; transform: translateY(-4%) scale(.98); }
  84% { opacity: 1; transform: translateY(1%) scale(1); }
  100% { opacity: 1; transform: translateY(0); }
}
.twinkle { animation: twinkle 4.5s ease-in-out infinite; transform-origin: center; }
.twinkle:nth-of-type(2) { animation-delay: 1.4s; }
.twinkle:nth-of-type(3) { animation-delay: 2.6s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.86); }
}

/* ---------- conversation dock ---------- */
.dock {
  margin: 22px 0 0;
  background: var(--white);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

@media (min-width: 900px) {
  .dock { margin: 8px 0 56px; }
}

.dock-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.dock-tara {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ivory);
  border: 1px solid var(--gold-soft);
  object-fit: contain;
  padding: 4px;
}

.dock-greeting {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--navy);
}

.starters {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.chip {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--navy);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.chip:hover { background: var(--gold-faint); border-color: var(--gold); }
.chip:active { background: rgba(232, 185, 94, 0.28); }

/* mobile: chips drop to their own row */
@media (max-width: 759px) {
  .dock-head {
    flex-wrap: wrap;
    row-gap: 10px;
    padding: 12px 14px 14px;
  }
  .dock-greeting { font-size: 0.98rem; }
  .starters {
    width: 100%;
    padding-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .starters::-webkit-scrollbar { display: none; }
}

/* ---------- chat panel ---------- */
.chat-panel[hidden] { display: none; }

.chat-panel {
  border-top: 1px solid rgba(23, 36, 71, 0.08);
  background: var(--ivory);
  padding: 14px 16px 16px;
}

.chat-notice[hidden] { display: none; }

.chat-notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #FDF4E3;
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #6B4A12;
  margin-bottom: 12px;
}
.chat-notice strong { font-weight: 700; }

.log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px 2px 10px;
  scroll-behavior: smooth;
}

.msg { display: flex; gap: 10px; align-items: flex-start; }

.msg-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: var(--white);
}

.bubble {
  max-width: min(100%, 46rem);
  border-radius: 14px;
  padding: 12px 15px;
  font-size: 0.97rem;
  line-height: 1.62;
}

.msg-tara .bubble {
  background: var(--white);
  border: 1px solid rgba(23, 36, 71, 0.09);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.msg-user {
  flex-direction: row-reverse;
}

.msg-user .bubble {
  background: var(--teal);
  color: #FFFFFF;
  border-top-right-radius: 4px;
}

.bubble p + p { margin-top: 9px; }

.bubble .sample-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B4A12;
  background: #FDF4E3;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.bubble .msg-cta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(23, 36, 71, 0.08);
}

.bubble .msg-cta button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* typing indicator */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--navy-muted);
  animation: typing 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 typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------- composer ---------- */
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--white);
  border: 1px solid rgba(23, 36, 71, 0.16);
  border-radius: 12px;
  padding: 8px;
  margin-top: 6px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.composer:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 103, 0.14);
}

.composer textarea {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  resize: none;
  min-height: 44px;
  max-height: 132px;
  padding: 10px 8px;
  font-size: 0.98rem;
  line-height: 1.5;
  outline: none;
}

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

.btn-send {
  flex: 0 0 auto;
  background: var(--teal);
  color: #FFFFFF;
  border: 0;
  border-radius: 9px;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), opacity 0.16s var(--ease);
}
.btn-send:hover:not(:disabled) { background: var(--teal-dark); }
.btn-send:disabled { opacity: 0.55; cursor: not-allowed; }

.composer-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--navy-muted);
}

.kundli-link {
  margin-top: 12px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- how it works ---------- */
.how {
  padding: 44px 0 8px;
}

.how h2 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin-bottom: 8px;
}

.how-lead { color: var(--navy-soft); margin-bottom: 22px; max-width: 34rem; }

.how-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .how { padding: 64px 0 24px; }
  .how-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

.how-card {
  background: var(--white);
  border: 1px solid rgba(23, 36, 71, 0.08);
  border-radius: var(--radius);
  padding: 20px;
}

.how-card .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-tint);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.how-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.how-card p { font-size: 0.92rem; color: var(--navy-soft); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 44px;
  border-top: 1px solid rgba(23, 36, 71, 0.09);
  padding: 26px 0 34px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.footer-note {
  font-size: 0.82rem;
  color: var(--navy-muted);
  max-width: 46rem;
}

.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a {
  font-size: 0.84rem;
  color: var(--navy-soft);
  text-decoration: none;
}
.footer-links a:hover { color: var(--teal); text-decoration: underline; }

/* ---------- kundli dialog ---------- */
dialog.kundli {
  width: min(94vw, 520px);
  max-height: 90vh;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-lg);
  overflow: visible;
}

dialog.kundli::backdrop {
  background: rgba(23, 36, 71, 0.42);
  backdrop-filter: blur(2px);
}

.kundli-form { padding: 22px 20px 20px; }

.kundli-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.kundli-form h2 { font-size: 1.32rem; }

.dialog-close {
  background: none;
  border: 0;
  padding: 6px;
  margin: -4px -4px 0 0;
  cursor: pointer;
  color: var(--navy-muted);
  border-radius: 8px;
  line-height: 0;
}
.dialog-close:hover { background: var(--ivory-deep); color: var(--navy); }

.kundli-intro {
  font-size: 0.9rem;
  color: var(--navy-soft);
  margin-bottom: 18px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  border: 1px solid rgba(23, 36, 71, 0.2);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 0.97rem;
  background: var(--ivory);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 103, 0.14);
  background: var(--white);
}

.field input:disabled { opacity: 0.55; }

.why {
  font-size: 0.79rem;
  color: var(--navy-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 8px;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.time-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--teal);
  background: var(--teal-tint);
  border-radius: 8px;
  padding: 8px 10px;
}

.privacy {
  font-size: 0.78rem;
  color: var(--navy-muted);
  margin: 4px 0 18px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(23, 36, 71, 0.22);
  color: var(--navy);
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--ivory-deep); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .tara-stage {
  position: relative;
  z-index: 2;
  width: min(96%, 490px);
  aspect-ratio: 1;
}
.tara-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tara-glide { opacity: 0; }
@media screen and (max-width: 899px) {
  .hero-art { display: grid; position: relative; place-items: center; margin: 12px auto 0; width: min(56vw, 200px); }
}
@media (prefers-reduced-motion: no-preference) {
  .tara-glide { animation: taraArrive 2s ease-out both; }
  .tara-perched { animation: taraLand 2s ease-out both; }
}
@keyframes taraArrive {
  0% { opacity: 0; transform: translate(14%, -16%) rotate(-8deg) scale(.82); }
  18% { opacity: 1; }
  68% { opacity: 1; transform: translate(1%, -4%) rotate(-3deg) scale(.98); }
  84%, 100% { opacity: 0; transform: translateY(0); }
}
@keyframes taraLand {
  0%, 67% { opacity: 0; transform: translateY(-4%) scale(.98); }
  84% { opacity: 1; transform: translateY(1%) scale(1); }
  100% { opacity: 1; transform: translateY(0); }
}
.twinkle { animation: none; }
  .log { scroll-behavior: auto; }
}

/* ---------- print (report-ready) ---------- */
@media print {
  .site-header, .dock, .how, .site-footer, .hero-art { display: none; }
  body { background: #fff; }
}

.dock-head { flex-wrap: wrap; }
#invite-tara { order: 1; background: #176B67; color: white; padding: .7em 1.2em; border: 0; border-radius: 2em; cursor: pointer; font: inherit; }
#invite-tara[hidden] { display:none; }
@media (prefers-reduced-motion: no-preference) {
  #invite-tara { animation: invitePulse 1.8s ease-out 2; }
  .chat-panel:not([hidden]) { animation: openTara .25s ease-out; }
  @keyframes invitePulse { from { box-shadow: 0 0 0 0 #176b6755; } to { box-shadow: 0 0 0 12px transparent; } }
  @keyframes openTara { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
