/* ══════════════════════════════════════════════════════════
   Birth Sky — Style System
   Dark cosmic theme with glassmorphism & micro-animations
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette */
  --bg-void:        #000000;
  --bg-deep:        #030311;
  --bg-card:        rgba(12, 12, 35, 0.55);
  --bg-card-border: rgba(120, 120, 200, 0.12);

  --accent-gold:    #C9A84C;
  --accent-gold-dim:#9a7d35;
  --accent-blue:    #4A7BF7;
  --accent-purple:  #7B5EA7;

  --text-primary:   #E8E6F0;
  --text-secondary: #9896A8;
  --text-hint:      #6A6880;
  --text-error:     #F06060;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-serif:   'Cormorant Garamond', 'Georgia', serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --duration: 0.35s;

  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.section--landing {
  justify-content: flex-start !important;
  min-height: 100vh;
  padding: 3.5rem var(--space-md) var(--space-2xl) !important;
  box-sizing: border-box;
}

/* ── Ambient Background Canvas ──────────────────────────── */
#ambientCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Sections ───────────────────────────────────────────── */
.section {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
}

/* .section--landing padding removed to avoid duplication */



.section[hidden] { display: none; }

/* ── Landing Content ────────────────────────────────────── */
.landing__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
  width: 100%;
  animation: fadeInUp 1s var(--ease-out) both;
}

.landing__eyebrow {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: var(--space-sm);
  opacity: 0.85;
}

.landing__title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.25;
  padding: 0.15em 0;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-gold) 50%, #ffffff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease-in-out infinite;
  margin-bottom: var(--space-md);
}

.landing__subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
  max-width: 440px;
}

/* ── Glass Card (Form) ──────────────────────────────────── */
.glass-card {
  width: 100%;
  padding: var(--space-xl) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 1.25rem;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 8px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── Form Elements ──────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  position: relative;
}

.autocomplete-container {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(15, 15, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.625rem;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background var(--duration) var(--ease-out);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: rgba(201, 168, 76, 0.15);
  color: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

input[type="text"],
input[type="date"],
input[type="time"] {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

input:focus {
  border-color: var(--accent-gold-dim);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

input::placeholder {
  color: var(--text-hint);
}

/* Fix date/time input calendar/clock icons in dark mode */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) !important;
  opacity: 0.8 !important;
  cursor: pointer;
}

/* Force mobile browser date/time segment fields to be readable */
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="time"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="time"]::-webkit-datetime-edit-ampm-field {
  color: var(--text-primary) !important;
}

input[type="date"],
input[type="time"] {
  color: var(--text-primary) !important;
  min-height: 2.85rem;
  box-sizing: border-box;
  background: rgba(255,255,255,0.04) !important;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-hint);
}

.form-error {
  font-size: 0.82rem;
  color: var(--text-error);
  text-align: center;
  min-height: 1.2em;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  font-family: var(--font-display);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: #000;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #E8D48B 100%);
  border-radius: 0.75rem;
  text-transform: uppercase;
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201,168,76,0.3);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--primary.loading .btn__text { opacity: 0; }
.btn--primary.loading .btn__loader { opacity: 1; }

.btn__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.btn__loader::after {
  content: '';
  width: 22px;
  height: 22px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn--download {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.75rem;
}

.btn--download:hover {
  background: rgba(201,168,76,0.12);
  border-color: var(--accent-gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.btn__size {
  font-size: 0.72rem;
  color: var(--text-hint);
  font-weight: 300;
}

/* ── Result Section ─────────────────────────────────────── */
/* ── Result Section ─────────────────────────────────────── */
.section--result {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  overflow: hidden;
  max-width: none;
  z-index: 100;
}

.section--result[hidden] {
  display: none !important;
}

/* ── Top Navigation Bar ─────────────────────────────────── */
.result__nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 10;
  background: rgba(8, 8, 16, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.nav__left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav__center {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Mode Toggle ────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: var(--space-xs);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.75rem;
  padding: 4px;
}

.mode-btn {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-hint);
  background: transparent;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-secondary);
}

.mode-btn--active {
  color: var(--text-primary);
  background: rgba(201, 168, 76, 0.15);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ── Customize Options ──────────────────────────────────── */
.customize-options {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.toggle-control input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s, border-color 0.2s;
}

.toggle-control input[type="checkbox"]:checked {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.toggle-control input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: #000;
  font-size: 11px;
  font-weight: bold;
  left: 3px;
  top: -1px;
}

.toggle-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

/* ── Canvas Wrapper ─────────────────────────────────────── */
.canvas-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: none !important;
  aspect-ratio: auto !important;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  z-index: 1;
  margin: 0 !important;
}

#skyCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-2xl) var(--space-md) var(--space-xl);
  font-size: 0.75rem;
  color: var(--text-hint);
  letter-spacing: 0.04em;
}

.footer__attribution {
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--accent-gold);
  opacity: 0.75;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Result section entrance ────────────────────────────── */
.section--result:not([hidden]) {
  animation: fadeIn 0.6s var(--ease-out) both;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .section--landing {
    padding: 1.5rem var(--space-md) 1rem !important;
  }

  .landing__eyebrow {
    display: none !important;
  }

  .landing__title {
    font-size: 2.1rem !important;
    margin-bottom: 0.75rem !important;
    line-height: 1.2 !important;
    padding: 0.05em 0 !important;
  }

  .landing__subtitle {
    display: none !important;
  }

  .glass-card {
    padding: 1.1rem 0.95rem !important;
    border-radius: 0.75rem !important;
  }

  .form-group {
    margin-bottom: 0.55rem !important;
  }

  .form-group label {
    margin-bottom: 0.25rem !important;
    font-size: 0.64rem !important;
  }

  .form-group input {
    padding: 0.55rem 0.75rem !important;
    font-size: 0.86rem !important;
    min-height: 2.2rem !important;
  }

  .btn--primary {
    padding: 0.6rem 1.25rem !important;
    font-size: 0.82rem !important;
    min-height: 2.4rem !important;
    margin-top: 0.25rem !important;
  }

  .footer {
    padding: 0.5rem var(--space-md) !important;
  }

  .footer p:first-child {
    display: none !important;
  }

  .footer__attribution {
    margin-top: 0 !important;
    font-size: 0.64rem !important;
  }

  .form-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
  }

  /* Sticky Top Navigation Responsive wrap */
  .result__nav {
    flex-direction: column;
    height: auto;
    padding: 0.6rem var(--space-md);
    gap: var(--space-sm);
  }

  .nav__left, .nav__center, .nav__right {
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .nav__title {
    font-size: 0.95rem;
  }

  .mode-toggle {
    width: 100%;
    justify-content: center;
  }

  .mode-btn {
    font-size: 0.74rem;
    padding: 0.45rem 0.8rem;
    flex: 1;
    text-align: center;
  }

  .customize-options {
    width: 100%;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .toggle-label {
    font-size: 0.74rem;
  }

  .btn--download {
    font-size: 0.78rem;
    padding: 0.5rem 1rem;
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .landing__subtitle {
    font-size: 0.85rem;
  }
}
