/* ============================================================
   Creative Architect — Quiz
   Theme lock: fixed navy background, cream titles/body, single
   orange accent. Intentional single theme (not OS light/dark
   adaptive) per brand direction. Green/sage excluded for now.
   Shape system: cards / buttons / inputs = 18px radius.
                 progress bar / dots = full (pill) radius.
   Handwriting rule: any "Nic Handwriting" text is always sized
   2x the font-size of the SF Pro Display text it accompanies.
   ============================================================ */

@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SFPRODISPLAYREGULAR.OTF") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SFPRODISPLAYMEDIUM.OTF") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SFPRODISPLAYBOLD.OTF") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SFPRODISPLAYSEMIBOLDITALIC.OTF") format("opentype");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SFPRODISPLAYBLACKITALIC.OTF") format("opentype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Nic Handwriting";
  src: url("fonts/Nic_handwriting-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #ffeddf;
  --navy: #2d3047;
  --orange: #f15106;

  --bg: var(--navy);
  --text: var(--cream);
  --text-secondary: rgba(255, 237, 223, 0.76);
  --surface: #363a56;
  --surface-hover: #3f4462;
  --border: rgba(255, 237, 223, 0.16);
  --border-strong: rgba(255, 237, 223, 0.32);
  --error: #ff6a55;
  --shadow-orange: 0 10px 26px rgba(241, 81, 6, 0.32);

  --radius: 18px;
  --radius-sm: 12px;
  --max-width: 480px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse 120% 60% at 18% -10%, #3a3f5c 0%, var(--navy) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Real paper-grain photo (not synthetic SVG noise), never on scrolling
   containers (perf + the "slight vintage feel" from the brand brief). */
.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: overlay;
  background-image: url("images/textures/paper-texture.jpg");
  background-size: 900px auto;
  background-repeat: repeat;
  /* Promote to its own GPU layer so replacing #stage's content (every
     question) doesn't force the browser to recomposite this full-viewport
     blend-mode overlay along with it — that recomposite is what shows up
     as a flash/stutter on slower mobile WebViews (e.g. Instagram's
     in-app browser). */
  will-change: opacity;
  transform: translateZ(0);
}

button {
  font-family: inherit;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar / progress ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem 0.75rem;
  background: rgba(45, 48, 71, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar[hidden] {
  display: none;
}

.back-btn {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}

.back-btn svg {
  display: block;
}

.back-btn:active {
  transform: scale(0.92);
}

.progress-track {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 237, 223, 0.18);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--orange);
  transition: width 0.4s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill {
    transition: none;
  }
}

.progress-label {
  flex: 0 0 auto;
  font-family: "SF Pro Display", sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- Stage ---------- */

.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
}

.screen {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  animation: rise 0.45s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none;
  }
}

/* ---------- Landing hero (materic direction) ---------- */
/* Breaks out of .stage's own padding to go edge-to-edge, then the
   scrim/duotone bring it back to solid navy for the content below. */

.hero-image-wrap {
  position: relative;
  width: calc(100% + 2.5rem);
  margin: -1.5rem -1.25rem 1.25rem;
  height: 30vh;
  min-height: 190px;
  max-height: 280px;
  overflow: hidden;
  background: var(--navy);
}

.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Duotone: desaturate the source image, then let the gradient overlay
     (mix-blend-mode: color) restamp it with brand hues, so any reference
     photo lands in navy/cream instead of its original colors. */
  filter: grayscale(1) contrast(1.15) brightness(0.85);
}

.hero-duotone {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, var(--navy) 0%, var(--cream) 100%);
  mix-blend-mode: color;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(45, 48, 71, 0.1) 0%, var(--navy) 97%),
    linear-gradient(to right, var(--navy) 0%, transparent 14%, transparent 86%, var(--navy) 100%);
}

.bracket-label {
  font-family: "SF Pro Display", sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 0.85rem;
}

.bracket-label b {
  color: var(--orange);
  font-weight: 700;
}

h1.landing-title {
  font-size: 2.05rem;
  line-height: 1.12;
}

.highlight {
  display: inline-block;
  font-style: italic;
  font-weight: 900;
  color: var(--orange);
  background: rgba(241, 81, 6, 0.16);
  border: 1px solid rgba(241, 81, 6, 0.45);
  border-radius: 6px;
  padding: 0.05em 0.3em;
  margin: 0 0.05em;
  transform: rotate(-1.2deg);
  line-height: 1.2;
}

@media (min-width: 640px) {
  /* Past mobile width, the radial gradient's soft corner starts reading
     as "washed out gray" instead of navy on the much wider canvas, and
     the hero image reads as a bounded rectangle with visible edges
     inside the centered column. Flat navy body + a true full-viewport
     hero (breaks out of the centered column, not just its own padding)
     fixes both. */
  body {
    background: var(--navy);
  }

  .hero-image-wrap {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: -3rem;
    margin-bottom: 1.25rem;
    height: 34vh;
  }

  h1.landing-title {
    font-size: 2.6rem;
  }
}

/* ---------- Logo ---------- */

.logo-mark {
  display: block;
  width: 200px;
  height: auto;
  margin: 0 0 1.75rem;
}

.eyebrow {
  font-family: "SF Pro Display", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 0.5rem;
}

/* ---------- Type ---------- */

h1 {
  font-family: "SF Pro Display", sans-serif;
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--cream);
  margin: 0 0 0.75rem;
}

h1 em, h2 em {
  font-style: italic;
  font-weight: 900;
  color: var(--orange);
  line-height: 1.15;
  padding-bottom: 0.05em;
  display: inline-block;
}

h2.question {
  font-family: "SF Pro Display", sans-serif;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--cream);
  margin: 0 0 1.5rem;
}

p.lede {
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 1.75rem;
  max-width: 40ch;
}

/* One complete thought per line, for the result/exit screens: several
   short paragraphs read better than one dense block that wraps wherever
   the browser feels like. */
p.thought {
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0 0 0.3rem;
}

/* Air only at the 3 key beats: into "how it shows up", into "what's
   possible", and into the closing "Thanks" line. Everything else stays
   tight so the page doesn't read as one long wall of text. */
p.thought.thought-group-start {
  margin-top: 0.55rem;
}

/* ---------- Form (landing) ---------- */

.field {
  margin-bottom: 1.1rem;
  text-align: left;
}

.field label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.field label svg {
  flex: 0 0 auto;
  color: var(--orange);
}

.field input {
  width: 100%;
  padding: 0.95rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field input::placeholder {
  color: var(--text-secondary);
  opacity: 0.65;
}

.field input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(241, 81, 6, 0.28);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
}

.field .hint {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.field .error {
  display: none;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--error);
}

.field .error svg {
  flex: 0 0 auto;
}

.field.has-error .error {
  display: flex;
}

/* ---------- Buttons ---------- */

.btn-primary {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  background: var(--orange);
  color: var(--navy);
  font-family: "SF Pro Display", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 1.05rem 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-orange);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  margin-top: 0.5rem;
  text-decoration: none;
  text-align: center;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Smaller, shrink-to-fit variant for secondary CTAs (e.g. the result
   screen's "get my analysis" link) that shouldn't compete with the
   full-width primary "Start the quiz" button. display:table lets a
   block-level element shrink to its content while still centering via
   margin:auto, without needing a flex wrapper. */
.btn-primary.btn-cta {
  display: table;
  width: auto;
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  margin: 1rem auto 0;
}

.btn-caption {
  display: block;
  text-align: center;
  font-family: "SF Pro Display", sans-serif;
  font-weight: 600;
  font-style: italic;
  color: var(--orange);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-top: 0.75rem;
}

/* ---------- Quiz options ---------- */

.options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 1.1rem 1.2rem;
  min-height: 64px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: "SF Pro Display", sans-serif;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.12s var(--ease), color 0.15s var(--ease);
}

.option:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.option:active {
  transform: scale(0.98);
}

.option .dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.option .dot svg {
  width: 13px;
  height: 13px;
  color: var(--navy);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

.option.selected {
  background: rgba(241, 81, 6, 0.16);
  border-color: var(--orange);
  color: var(--text);
  font-weight: 700;
}

.option.selected .dot {
  border-color: var(--orange);
  background: var(--orange);
}

.option.selected .dot svg {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Exit / final screens ---------- */

.icon-circle {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--orange);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-orange);
}

.icon-circle svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Handwriting signoff paired with p.lede (1.02rem) -> 2x = 2.04rem */
.signoff {
  font-family: "Nic Handwriting", cursive;
  color: var(--orange);
  font-size: 2.04rem;
  line-height: 1.15;
  margin-top: 1.75rem;
}

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
  .stage {
    padding: 3rem 1.5rem;
  }

  .logo-mark {
    width: 230px;
  }

  h1 {
    font-size: 2rem;
  }

  h2.question {
    font-size: 1.65rem;
  }
}
