/* Insta Quote AI — shared styles
   Layout normalization across pages + animations + selection states */

:root {
  --primary: #000000;
  --primary-container: #3b3b3b;
  --on-primary: #e2e2e2;
  --surface: #f9f9f9;
  --surface-container-low: #f3f3f3;
  --surface-container-high: #e8e8e8;
  --on-surface: #1a1c1c;
  --secondary: #5e5e5e;
  --outline-variant: #c6c6c6;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
}

/* ---- Buttons (universal hover/active/focus) ---- */
button,
a.btn,
.btn {
  cursor: pointer;
  transition: transform 200ms ease-out, opacity 200ms ease-out,
    box-shadow 200ms ease-out, background-color 200ms ease-out,
    color 200ms ease-out;
  will-change: transform;
}

button:hover,
a.btn:hover,
.btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

button:active,
a.btn:active,
.btn:active {
  transform: scale(0.97) translateY(0);
  opacity: 1;
}

button:focus-visible,
a.btn:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

/* Primary black buttons get a subtle gradient on hover (DESIGN.md "Signature Gradients") */
.btn-primary,
button.bg-primary,
button.bg-black {
  background-image: radial-gradient(circle at 30% 0%, #2a2a2a 0%, #000000 70%);
}

/* ---- Quiz option chips ---- */
.option-card {
  transition: border-color 200ms ease-out, border-width 150ms ease-out,
    box-shadow 250ms ease-out, transform 150ms ease-out, background-color 200ms ease-out;
}
label:hover .option-card {
  border-color: #d4d4d8 !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
}
label:active .option-card {
  transform: scale(0.995);
}

.option-radio:checked + .option-card {
  border-color: #000000 !important;
  border-width: 2px !important;
}
.option-radio:checked + .option-card .selection-circle {
  background-color: #000000;
  border-color: #000000;
}
.option-radio:checked + .option-card .selection-circle::after {
  content: '';
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
  display: block;
  animation: dot-pop 180ms ease-out;
}
.selection-circle {
  transition: background-color 180ms ease-out, border-color 180ms ease-out;
}
@keyframes dot-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ---- Form inputs ---- */
input, textarea, select {
  transition: background-color 180ms ease-out, box-shadow 180ms ease-out,
    border-color 180ms ease-out;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
input.invalid, textarea.invalid {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.45) !important;
}

/* ---- Send Message loading state ---- */
.btn-loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn-loading .btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
.btn-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-success {
  background-color: #16a34a !important;
  background-image: none !important;
}

.form-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  display: none;
}
.form-status.show { display: block; animation: fade-in 200ms ease-out; }
.form-status.success { background: #ecfdf5; color: #065f46; }
.form-status.error   { background: #fef2f2; color: #991b1b; }

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

/* ---- Page-level chrome normalization ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.site-header-inner {
  max-width: 96rem;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  margin-top: auto;
}
.site-footer-inner {
  max-width: 96rem;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  background: #000000;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #000000;
  white-space: nowrap;
}

/* ---- Material Symbols flash-of-unstyled-text suppressor ----
   Hide icon spans until the icon font has loaded. styles.css is paired
   with a tiny inline init in each page that adds .fonts-ready to <html>
   once document.fonts.ready resolves. */
.material-symbols-outlined {
  visibility: hidden;
}
html.fonts-ready .material-symbols-outlined {
  visibility: visible;
}

/* ---- Mobile pass (≤ 768px) ---- */
@media (max-width: 768px) {
  /* Header tighter on mobile */
  .site-header-inner {
    padding: 0.875rem 1.25rem;
  }
  .brand-mark {
    width: 2rem;
    height: 2rem;
  }
  .brand-name {
    font-size: 1rem;
  }

  /* Footer stacks vertically with centered content */
  .site-footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 2.5rem 1.5rem;
    gap: 1.5rem;
  }

  /* Make nav CTA pills more compact so two fit comfortably at 375px */
  .site-header-inner .btn {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
  }
  /* Right-side button group: tighten gap on mobile */
  .site-header-inner > .flex.items-center.gap-3 {
    gap: 0.5rem;
  }

  /* Quiz step buttons row: don't let it overflow */
  main .quiz-next,
  main .quiz-skip {
    font-size: 0.7rem;
  }
  main .quiz-next {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .option-radio:checked + .option-card .selection-circle::after {
    animation: none;
  }
}
