/* ==========================================================================
   MindPulse — Digital Wellbeing Score Predictor
   Design tokens: deep teal-navy ground, mint / coral / gold accent trio,
   Fraunces display + Manrope body + JetBrains Mono for data.
   ========================================================================== */

:root {
  /* Color */
  --bg-deep:      #0d1a1c;
  --bg-panel:     #122326;
  --bg-panel-2:   #16292d;
  --line:         rgba(237, 239, 236, 0.10);
  --line-strong:  rgba(237, 239, 236, 0.18);

  --text-hi:      #edefec;
  --text-mid:     rgba(237, 239, 236, 0.72);
  --text-low:     rgba(237, 239, 236, 0.48);

  --mint:         #7fd8be;
  --mint-strong:  #59c9a9;
  --coral:        #f2836b;
  --coral-strong: #ef6547;
  --gold:         #e8b86d;
  --sage:         #a8c9b8;

  /* Score tiers */
  --tier-poor:    #ef6547;
  --tier-fair:    #e8b86d;
  --tier-good:    #7fd8be;
  --tier-excellent: #59c9a9;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  /* Layout */
  --wrap: 1120px;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-soft: 0 20px 60px -20px rgba(0, 0, 0, 0.55);
  --shadow-lift: 0 30px 80px -24px rgba(0, 0, 0, 0.65);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

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

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  animation: drift 22s ease-in-out infinite;
}

.blob--mint {
  width: 480px; height: 480px;
  background: var(--mint);
  top: -120px; left: -100px;
}

.blob--coral {
  width: 380px; height: 380px;
  background: var(--coral);
  top: 40%; right: -140px;
  animation-delay: -7s;
}

.blob--gold {
  width: 340px; height: 340px;
  background: var(--gold);
  bottom: -140px; left: 30%;
  animation-delay: -14s;
  opacity: 0.18;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

/* ---------- Glassmorphism base ---------- */
.glass-card {
  position: relative;
  background: linear-gradient(160deg, rgba(237,239,236,0.06), rgba(237,239,236,0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

/* ---------- Type helpers ---------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 14px;
}
.eyebrow--center { display: block; text-align: center; }

.section-title {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  line-height: 1.2;
  color: var(--text-hi);
}
.section-title--center { text-align: center; margin: 0 auto 48px; max-width: 620px; }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(13, 26, 28, 0.65);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-hi);
}

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 0.92rem;
  color: var(--text-mid);
}
.site-nav a { transition: color 0.2s var(--ease); }
.site-nav a:hover { color: var(--mint); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn--primary {
  background: linear-gradient(135deg, var(--mint), var(--mint-strong));
  color: #0d1a1c;
  box-shadow: 0 14px 34px -12px rgba(127, 216, 190, 0.55);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px -12px rgba(127, 216, 190, 0.7);
}
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--text-hi);
  border-color: var(--line-strong);
}
.btn--ghost:hover {
  border-color: var(--mint);
  color: var(--mint);
}

.btn--wide { width: 100%; }
.btn--small { padding: 10px 20px; font-size: 0.85rem; }

/* Ripple / glow effect */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.35), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.btn:hover::after { opacity: 1; }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Loading spinner inside submit button */
.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(13,26,28,0.35);
  border-top-color: #0d1a1c;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn__label { opacity: 0.55; }
.btn.is-loading .btn__spinner { display: inline-block; }

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

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  z-index: 1;
  padding: 88px 0 96px;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 48px;
}

.hero__title {
  font-size: clamp(2.4rem, 1.6rem + 3.2vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--text-hi);
}

.hero__title-accent {
  background: linear-gradient(100deg, var(--mint), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lede {
  margin-top: 22px;
  max-width: 46ch;
  font-size: 1.05rem;
  color: var(--text-mid);
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

/* Breathing ring illustration */
.hero__visual {
  display: flex;
  justify-content: center;
}

.breath {
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 1 / 1;
}

.breath__ring {
  fill: none;
  stroke-width: 1.4;
  transform-origin: 150px 150px;
  animation: breathe 6s ease-in-out infinite;
}
.breath__ring--1 { stroke: rgba(127, 216, 190, 0.35); animation-delay: 0s; }
.breath__ring--2 { stroke: rgba(232, 184, 109, 0.4); animation-delay: -1.4s; }
.breath__ring--3 { stroke: rgba(242, 131, 107, 0.4); animation-delay: -2.8s; }

.breath__core {
  fill: url(#none);
  fill: var(--mint);
  opacity: 0.9;
  animation: pulseCore 6s ease-in-out infinite;
  transform-origin: 150px 150px;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.55; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes pulseCore {
  0%, 100% { transform: scale(0.92); }
  50% { transform: scale(1.08); }
}

.breath__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}
.breath__label-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-hi);
}
.breath__label-text {
  font-size: 0.78rem;
  color: var(--text-low);
  line-height: 1.35;
}

/* ==========================================================================
   About / How it works
   ========================================================================== */
.about {
  position: relative;
  z-index: 1;
  padding: 60px 0 100px;
}

.about__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.about-card {
  padding: 30px 26px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(237,239,236,0.05), rgba(237,239,236,0.01));
  border: 1px solid var(--line);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.about-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.about-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(127, 216, 190, 0.12);
  color: var(--mint);
  margin-bottom: 18px;
}

.about-card h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
  color: var(--text-hi);
}
.about-card p {
  font-size: 0.92rem;
  color: var(--text-mid);
}

/* ==========================================================================
   Predict form
   ========================================================================== */
.predict {
  position: relative;
  z-index: 1;
  padding: 40px 0 110px;
}

.predict__intro {
  max-width: 620px;
  margin: 0 auto 40px;
  text-align: center;
}
.predict__intro-text {
  margin-top: 14px;
  color: var(--text-mid);
  font-size: 0.98rem;
}

.form-card {
  padding: 40px clamp(20px, 4vw, 48px) 44px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}

.field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-hi);
}

.field input,
.field select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(13, 26, 28, 0.55);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%237FD8BE' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

.field select option { background: var(--bg-panel); color: var(--text-hi); }

.field input::placeholder { color: var(--text-low); }

.field input:hover, .field select:hover { border-color: rgba(237,239,236,0.3); }

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--mint);
  background: rgba(127, 216, 190, 0.06);
  box-shadow: 0 0 0 4px rgba(127, 216, 190, 0.14);
}

.field__hint {
  font-size: 0.74rem;
  color: var(--text-low);
}

.field__error {
  font-size: 0.76rem;
  color: var(--coral);
  min-height: 1em;
  display: block;
}

.field.has-error input,
.field.has-error select {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(242, 131, 107, 0.14);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 34px;
}
.form-actions .btn--wide { flex: 1; }

.form-status {
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--coral);
  min-height: 1.2em;
}
.form-status.is-success { color: var(--mint); }

/* ==========================================================================
   Result
   ========================================================================== */
.result {
  position: relative;
  z-index: 1;
  padding: 0 0 110px;
}

.result-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 44px;
  padding: 44px clamp(24px, 5vw, 56px);
}

.result-card__gauge {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
  justify-self: center;
}

.gauge__track {
  fill: none;
  stroke: rgba(237,239,236,0.08);
  stroke-width: 14;
}

.gauge__fill {
  fill: none;
  stroke: var(--mint);
  stroke-width: 14;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
  stroke-dasharray: 578;
  stroke-dashoffset: 578;
  transition: stroke-dashoffset 1.1s var(--ease), stroke 0.6s var(--ease);
}

.gauge__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge__score {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--text-hi);
}
.gauge__max {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-low);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(127, 216, 190, 0.14);
  color: var(--mint);
  margin-bottom: 14px;
}
.badge[data-tier="poor"] { background: rgba(239, 101, 71, 0.16); color: var(--coral); }
.badge[data-tier="fair"] { background: rgba(232, 184, 109, 0.16); color: var(--gold); }
.badge[data-tier="good"] { background: rgba(127, 216, 190, 0.16); color: var(--mint); }
.badge[data-tier="excellent"] { background: rgba(89, 201, 169, 0.2); color: var(--mint-strong); }

.result-card__title { font-size: 1.5rem; margin-bottom: 10px; }
.result-card__text { color: var(--text-mid); font-size: 0.98rem; max-width: 52ch; }

.progress-bar {
  margin-top: 22px;
  height: 8px;
  border-radius: 999px;
  background: rgba(237,239,236,0.08);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--gold), var(--mint));
  transition: width 1.1s var(--ease);
}

.result-card .btn--ghost { margin-top: 24px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 44px 0 40px;
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  color: var(--text-hi);
}

.site-footer__note {
  max-width: 56ch;
  font-size: 0.86rem;
  color: var(--text-low);
}

.site-footer__meta {
  font-size: 0.8rem;
  color: var(--text-low);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__visual { order: -1; }
  .about__grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .result-card { grid-template-columns: 1fr; text-align: center; }
  .result-card__text { max-width: none; }
  .progress-bar { max-width: 420px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 640px) {
  .site-nav { display: none; }
  .hero { padding: 56px 0 64px; }
  .about { padding: 40px 0 70px; }
  .about__grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 30px 18px 34px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .result-card { padding: 34px 22px; }
  .breath { width: 78vw; }
}