/* =========================================================
   Mobile Numerology Analysis — form styles
   Mobile-first. One accent (muted gold). Ivory + charcoal.
   ========================================================= */

:root {
  --bg: #FAF7F1;
  --surface: #FFFFFF;
  --ink: #1F1C18;
  --ink-2: #5E5850;
  --ink-3: #8F887D;
  --line: #E8E1D5;
  --line-strong: #D5CBBA;

  --accent: #8C6B3C;          /* muted gold / earthy */
  --accent-soft: #F4EDE0;
  --accent-ring: rgba(140, 107, 60, 0.16);

  --error: #B0432D;
  --radius: 14px;

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

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }

/* ---------- Decorative background ring ---------- */
.bg-ring {
  position: fixed;
  top: -250px;
  right: -250px;
  width: 360px;
  height: 360px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.ring-line { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.ring-dash { stroke-dasharray: 2 6; }
.ring-num text {
  font-family: var(--serif);
  font-size: 22px;
  fill: #C9BBA3;
  text-anchor: middle;
  dominant-baseline: central;
}
@media (min-width: 1200px) {
  .bg-ring { top: -110px; right: -160px; width: 520px; height: 520px; }
}

/* ---------- Layout ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: 18px 20px 48px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.topbar { padding-top: 4px; }

.brandline {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  white-space: nowrap;
}
.brandline span { margin: 0 5px; color: var(--accent); }
@media (min-width: 400px) { .brandline { font-size: 11px; letter-spacing: 0.16em; } }

/* ---------- Progress ---------- */
.progress { margin-top: 20px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.bar {
  margin-top: 8px;
  height: 3px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.45s ease;
}

.save-status {
  margin-top: 9px;
  min-height: 18px;
  font-size: 12.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.save-status svg { width: 13px; height: 13px; flex: none; }
.save-status.is-saving { color: var(--ink-2); }
.save-status.is-error { color: var(--error); }
.save-status .dot-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
.link-btn {
  background: none;
  border: none;
  padding: 2px 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Screens ---------- */
.screen { flex: 1; padding-top: 28px; }

.step { animation: fadeUp 0.35s ease both; }

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 6.6vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  outline: none;
}

.question {
  margin: 18px 0 0;
  font-size: 18px;
  font-weight: 500;
}

.help {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--ink-2);
}

.step-body {
  margin-top: 26px;
  display: grid;
  gap: 20px;
}

/* ---------- Welcome back notice ---------- */
.notice {
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 14.5px;
  color: var(--ink-2);
}
.notice strong { display: block; color: var(--ink); font-size: 15.5px; margin-bottom: 2px; }

/* ---------- Fields ---------- */
.field { display: block; }

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 15.5px;
  font-weight: 500;
}

.input {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 15px 16px;
  font: inherit;
  font-size: 17px;           /* >=16px prevents iOS zoom */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #ADA597; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.input[aria-invalid="true"] { border-color: var(--error); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(176, 67, 45, 0.14); }

textarea.input {
  min-height: 160px;
  resize: vertical;
  line-height: 1.55;
}

.prefix-wrap { position: relative; }
.prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--ink-2);
  pointer-events: none;
}
.prefix-wrap .input { padding-left: 54px; }

.hint { margin: 7px 0 0; font-size: 13.5px; color: var(--ink-3); }

.error {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--error);
}
.error:empty { display: none; }

.counter {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
}

/* Honeypot */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

/* Date of birth: DD / MM / YYYY */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 10px;
}
.split .input { text-align: center; padding-left: 8px; padding-right: 8px; }
.mini-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

/* Time: HH : MM  [AM|PM] */
.time-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
}
.time-row .input { text-align: center; }
.time-colon { padding-top: 14px; font-size: 20px; color: var(--ink-3); }

.segmented {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.seg {
  min-height: 50px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Choice cards ---------- */
.options { display: grid; gap: 10px; }

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 15px 16px;
  text-align: left;
  font-size: 16px;
  line-height: 1.35;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: var(--line-strong); }
.option:active { transform: scale(0.99); }
.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.option[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-dot {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  transition: border-color 0.15s;
}
.option[aria-checked="true"] .option-dot { border-color: var(--accent); }
.option[aria-checked="true"] .option-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.option-label { flex: 1; }
.option.is-strong .option-label { font-weight: 500; }

.reveal { animation: fadeUp 0.25s ease both; }

.chip {
  justify-self: start;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- Buttons / nav ---------- */
.nav {
  margin-top: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  position: relative;
  flex: 1;
  min-height: 58px;
  padding: 16px 26px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: #33302B; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-primary[disabled] { opacity: 0.7; cursor: progress; }

.btn-back {
  flex: none;
  min-height: 48px;
  padding: 10px 6px;
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 15.5px;
  font-weight: 500;
  cursor: pointer;
}
.btn-back:hover { color: var(--ink); }

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.submit-error { margin-top: 14px; }

/* ---------- Intro ---------- */
.intro { padding-top: 6vh; }
.numeral-row {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.6em;
  color: #BFAF95;
}
.intro .title { font-size: clamp(32px, 9vw, 44px); }
.intro .lead {
  margin: 16px 0 0;
  font-size: 17px;
  color: var(--ink-2);
  max-width: 34em;
}
.intro .meta {
  margin: 22px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-3);
}
.intro .meta svg { width: 15px; height: 15px; }
.intro .btn-primary { width: 100%; margin-top: 34px; }
.intro .fine {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}

/* ---------- Thank you ---------- */
.thanks { padding-top: 7vh; text-align: center; }
.emblem {
  width: 76px; height: 76px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 30px;
  color: var(--accent);
  background: var(--surface);
}
.thanks .lead { margin: 16px auto 0; font-size: 16.5px; color: var(--ink-2); max-width: 30em; }
.thanks .btn-primary { width: 100%; margin-top: 34px; }
.thanks .ref { margin-top: 18px; font-size: 13px; color: var(--ink-3); }

/* ---------- Misc ---------- */
.demo-badge {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 5;
  padding: 6px 12px;
  border-radius: 999px;
  background: #2B2824;
  color: #F3EEE6;
  font-size: 12px;
  white-space: nowrap;
}
.noscript { padding: 40px 0; text-align: center; color: var(--ink-2); }

@media (min-width: 640px) {
  .shell { padding-top: 34px; }
  .screen { padding-top: 40px; }
  .nav .btn-primary { flex: 0 1 260px; margin-left: auto; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
