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

/* ---- 3-phone hero (under landing page hero) ---- */
.phone-stage-section {
  background: #ffffff;
  position: relative;
}
.phone-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5vmin;
  max-width: 90rem;
  margin: 0 auto;
}
.phone {
  position: relative;
  width: 30vmin;
  height: 62vmin;
  max-width: 360px;
  max-height: 740px;
  border-radius: 3.5vmin;
  background: linear-gradient(160deg,#2a2a2e 0%,#131316 35%,#0a0a0c 70%,#1a1a1d 100%);
  padding: 0.8vmin;
  box-sizing: border-box;
  box-shadow:
    0 0 80px 8px rgba(0,0,0,0.16),
    0 0 160px 16px rgba(0,0,0,0.10),
    0 60px 120px -20px rgba(0,0,0,0.28),
    0 30px 60px -16px rgba(0,0,0,0.18),
    0 12px 24px -8px rgba(0,0,0,0.12),
    inset 0 0 0 1.2px rgba(255,255,255,0.10),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(255,255,255,0.06);
}
.phone::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 3.5vmin;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.10) 0%,
    rgba(255,255,255,0) 8%,
    rgba(255,255,255,0) 92%,
    rgba(255,255,255,0.05) 100%);
  pointer-events: none;
}
.phone .screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 2.8vmin;
  overflow: hidden;
  background: #f1f1f1;
  box-shadow: inset 0 0 0 1.2px #000, inset 0 0 30px rgba(0,0,0,0.4);
}
.phone .screen img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.phone .island {
  position: absolute;
  top: 1.2vmin;
  left: 50%;
  transform: translateX(-50%);
  width: 6.6vmin;
  height: 1.8vmin;
  max-width: 70px;
  max-height: 20px;
  background: #000;
  border-radius: 1.2vmin;
  z-index: 5;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}
.phone .sheen {
  position: absolute; inset: 0;
  border-radius: 2.8vmin;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.05) 18%,
    rgba(255,255,255,0) 38%,
    rgba(255,255,255,0) 70%,
    rgba(255,255,255,0.06) 100%);
  pointer-events: none;
  mix-blend-mode: screen;
}
.phone.tilt-left  { transform: rotate(-8deg) translateY(2vmin); }
.phone.tilt-right { transform: rotate( 8deg) translateY(2vmin); }
.phone.center     { transform: scale(1.18); z-index: 2; }

.phone-wrap { position: relative; }
.phone-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5vmin;
  width: 34vmin;
  height: 4vmin;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 50%,
    rgba(0,0,0,0.22) 0%, rgba(0,0,0,0.10) 40%, rgba(0,0,0,0) 80%);
  filter: blur(18px);
  pointer-events: none;
}
.phone-wrap.is-center::after {
  width: 40vmin;
  height: 5vmin;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.12) 40%, rgba(0,0,0,0) 80%);
}

/* Mobile: keep 3 side-by-side, slightly larger than before */
@media (max-width: 640px) {
  .phone-stage { gap: 2vw; }
  .phone {
    width: 30vw;
    height: 62vw;
    max-width: none;
    max-height: none;
    border-radius: 4.5vw;
    padding: 1.1vw;
  }
  .phone .screen { border-radius: 3.6vw; }
  .phone .island {
    top: 1.4vw;
    width: 8vw;
    height: 2vw;
    max-width: none;
    max-height: none;
    border-radius: 1.2vw;
  }
  .phone-wrap::after { width: 30vw; height: 2.6vw; }
  .phone-wrap.is-center::after { width: 34vw; height: 3.2vw; }
}

/* ---- Scroll-reveal: slide-up + fade-in ---- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 700ms ease-out, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--delay, 0ms);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-item {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 600ms ease-out, transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--delay, 0ms);
}
.reveal.is-visible .reveal-item {
  opacity: 1;
  transform: translateY(0);
}
/* Phones inside the stage stagger in too */
.phone-stage.reveal .phone-wrap {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 700ms ease-out, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--delay, 0ms);
}
.phone-stage.reveal.is-visible .phone-wrap {
  opacity: 1;
  transform: translateY(0);
}

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