/* Global styles for Stereotype web application */
:root {
  --transition-duration: 0.25s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  background-image: url("../images/backgrounds/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  position: relative;
}

@media (max-width: 768px) {
  body {
    background-image: url("../images/backgrounds/background1.jpg");
  }
}

/* Layout containers */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header with wordmark link */
.app-header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  z-index: 100;
}

.app-header .wordmark {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

/* Main content area centres its children horizontally and vertically */
.app-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  position: relative;
}

/* Override app-main layout on results page: results pages should not
   vertically center their content.  Use block layout to allow the hero
   and editorial sections to flow naturally from top to bottom. */
body[data-page="results"] .app-main {
  display: block;
  padding: 0;
}

/* Brand footer is pinned to the bottom via flex layout */
.brand-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 0 20px;
}

/* Brand mark sizing and caption */
.brand-mark {
  width: 72px;
  height: 72px;
  opacity: 0.35;
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .brand-mark {
    width: 56px;
    height: 56px;
  }
}

.brand-caption {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* Home page hero container */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 560px;
}

.eyebrow {
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.85);
}

/* Base card styling: transparent with a thin white border and soft shadow */
.card,
.quiz-card,
.analysis-card {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  padding: 24px;
}

/* Pill buttons used on the home page.  These are not scoped to a quiz
   page and therefore retain a global selector.  Quiz‑specific pills are
   namespaced further down in this file. */
.pill {
  display: block;
  width: 100%;
  padding: 12px 0;
  margin-bottom: 12px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-duration), box-shadow var(--transition-duration);
}

.pill:hover,
.pill:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
  outline: none;
}

/* Hero cards can be wider up to 560px */
.hero-card {
  max-width: 560px;
  text-align: center;
  margin-bottom: 24px;
}

.cta-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 360px;
}

.pill {
  display: block;
  width: 100%;
  padding: 12px 0;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  text-decoration: none;
  text-align: center;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background var(--transition-duration), box-shadow var(--transition-duration);
}

.pill:hover,
.pill:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
  outline: none;
}

/* Legacy footer styles removed in favour of new .brand-footer definitions. */

/* Load local font faces.  These declarations map our DejaVu fallback font to
 * the expected family names.  If real Forma DJR files are present they
 * should replace these definitions. */
@font-face {
  font-family: 'Forma DJR Text';
  src: url('../fonts/DejaVuSans.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: 'Forma DJR Text';
  src: url('../fonts/DejaVuSans.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

body, .wordmark, .pill, .option-pill, .cta-pill, .back-pill, .quiz-question, .analysis-card, .disclaimer, .bar-label, .bar-value {
  font-family: 'Forma DJR Text', sans-serif;
}

/* Quiz styles are scoped by data-page to prevent leakage between simple
   and deep flows.  Each selector is prefixed with the appropriate
   [data-page] attribute.  Simple and deep flows share many visual
   tokens but are isolated to their own pages via CSS scoping. */

/* Common quiz containers */
body[data-page="simple-quiz"] .quiz-wrap,
body[data-page="deep-quiz"] .quiz-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body[data-page="simple-quiz"] .progress-label,
body[data-page="deep-quiz"] .progress-label {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  text-align: center;
}

/* Card styling */
body[data-page="simple-quiz"] .quiz-card,
body[data-page="deep-quiz"] .quiz-card {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  padding: 24px;
  flex: 1;
}

body[data-page="simple-quiz"] .quiz-question,
body[data-page="deep-quiz"] .quiz-question {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Option pills (simple) */
body[data-page="simple-quiz"] .option-pill {
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition-duration), outline var(--transition-duration);
}

body[data-page="simple-quiz"] .option-pill:hover,
body[data-page="simple-quiz"] .option-pill:focus {
  background: rgba(255, 255, 255, 0.12);
  outline: 2px solid rgba(255, 255, 255, 0.18);
  outline-offset: 2px;
}

/* Hint link and text (both modes) */
body[data-page="simple-quiz"] .hint-link,
body[data-page="deep-quiz"] .hint-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 8px;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

body[data-page="simple-quiz"] .hint-text,
body[data-page="deep-quiz"] .hint-text {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

body[data-page="simple-quiz"] .inline-error,
body[data-page="deep-quiz"] .inline-error {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 80, 80, 0.9);
}

/* Back and CTA pills */
body[data-page="simple-quiz"] .back-pill,
body[data-page="deep-quiz"] .back-pill,
body[data-page="deep-quiz"] .cta-pill {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition-duration), box-shadow var(--transition-duration);
}

body[data-page="deep-quiz"] .cta-pill {
  flex: 1;
  margin-left: 8px;
}

body[data-page="simple-quiz"] .back-pill:hover,
body[data-page="deep-quiz"] .back-pill:hover,
body[data-page="deep-quiz"] .cta-pill:hover,
body[data-page="simple-quiz"] .back-pill:focus,
body[data-page="deep-quiz"] .back-pill:focus,
body[data-page="deep-quiz"] .cta-pill:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
  outline: none;
}

/* Textarea for deep quiz */
body[data-page="deep-quiz"] .textarea-pill {
  width: 100%;
  height: 130px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  resize: vertical;
  font-size: 14px;
  margin-bottom: 8px;
}

body[data-page="deep-quiz"] .textarea-pill::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

/* Results page scoped styles */

body[data-page="results"] .bars {
  margin-top: 24px;
  margin-bottom: 24px;
}

body[data-page="results"] .result-bar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

body[data-page="results"] .bar-label {
  width: 80px;
  font-weight: 500;
  text-align: left;
}

body[data-page="results"] .bar-track {
  flex: 1;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  border-radius: 999px;
  overflow: hidden;
}

body[data-page="results"] .bar-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: inherit;
  width: 0%;
  transition: width 900ms cubic-bezier(.2, .7, .2, 1);
}

body[data-page="results"] .bar-value {
  width: 48px;
  text-align: right;
  font-weight: 500;
}

body[data-page="results"] .disclaimer {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 24px;
}



/* Analysis card inherits base card styles and tweaks spacing.  Scoped to
   the results page so that it does not style cards on other pages. */
body[data-page="results"] .analysis-card {
  margin-top: 24px;
  padding: 20px;
  text-align: left;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ===================================================================== */
/* Results page layout and overrides                                       */

/* Prevent results layouts leaking to other pages */
body:not([data-page="results"]) .results-root,
body:not([data-page="results"]) .results-hero,
body:not([data-page="results"]) .fragrance-screen {
  display: none !important;
}

/* On results pages, do not override the wordmark styling. The global
   .app-header .wordmark rule applies universally, so avoid
   redefining it here to maintain consistency with other pages. */

/* ---------- HERO (on gradient) ---------- */
body[data-page="results"] .results-hero{
  /* Occupy the visible viewport minus the header; footer is not part of the hero */
  min-height: calc(100svh - var(--header-h,72px));
  display:flex; align-items:center; justify-content:center;
  /* Use clamp to scale padding responsively */
  padding: clamp(20px, 5vw, 48px);
  width: 100%;
  grid-column: 1 / -1;
  float: none;
}

body[data-page="results"] .results-hero .hero-inner{
  width:min(1100px, 100%);
  margin:0 auto;
}

/* Pill used to display the personal insight inside the hero */
body[data-page="results"] .results-hero .insight-pill{
  margin-top:16px;
  padding:12px 16px;
  border-radius:12px;
  background:rgba(255,255,255,0.08);
  color:#fff;
  font-size:0.95rem;
}

/* Force hero to escape any float influence */
body[data-page="results"] .results-hero,
body[data-page="results"] .results-hero * {
  float: none;
}

/* Scroll snapping container for fragrance screens */
body[data-page="results"] .results-root {
  scroll-snap-type: y proximity;
  /* Allow content to overflow naturally so sections are not clipped */
  overflow: visible;
}

@supports (scroll-snap-type: y proximity) {
  body[data-page="results"] {
    scroll-behavior: smooth;
  }
}

/* Fragrance screens (white full‑screen sections) */
/* ---------- FULL-SCREEN WHITE SECTIONS ---------- */
body[data-page="results"] .fragrance-screen{
  background:#fff;
  color:#101010;
  min-height:100svh;            /* full screen */
  display:flex; align-items:center;
  padding-block: clamp(24px, 4vh, 48px);        /* responsive vertical padding */
  scroll-snap-align:start;
}

body[data-page="results"] .fragrance-screen .screen-inner{
  width:100%;
  height: calc(100svh - 2 * clamp(24px, 4vh, 48px));      /* full height minus vertical padding */
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 3vw, 32px);
  align-items:stretch;           /* allow image to fill height */
  padding-inline: clamp(16px, 3vw, 40px);
}

/* Alternate the order of image/text for even‑indexed sections */
body[data-page="results"] .fragrance-screen.reverse .media {
  order: 2;
}
body[data-page="results"] .fragrance-screen.reverse .copy {
  order: 1;
}

/* Ensure the image fills its parent column entirely */
body[data-page="results"] .fragrance-screen .media {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  /* Ensure the parent forms a new stacking context for the image */
  transform: translateZ(0);
}
body[data-page="results"] .fragrance-screen .media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: translateZ(0);
}

@media (max-width: 900px) {
  /* Stack image and text on mobile; let content dictate height */
  body[data-page="results"] .fragrance-screen .screen-inner {
    grid-template-columns: 1fr;
    height: auto;
  }
  body[data-page="results"] .fragrance-screen .media {
    height: 52vh;
  }
  body[data-page="results"] .fragrance-screen .media > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}

/* Typography inside fragrance screens */
body[data-page="results"] .fragrance-screen .copy{
  /* Responsive padding around the text column */
  padding: clamp(12px, 2.2vw, 28px);
  overflow:auto;
}
body[data-page="results"] .fragrance-screen .copy h2{
  margin: 0 0 12px;
  line-height:1.25;
  font-weight:700;
}
body[data-page="results"] .fragrance-screen .copy p{
  margin:8px 0;
}

/* ---------- FINAL CTA (full screen on gradient, not truncated) ---------- */
body[data-page="results"] .brand-cta{
  min-height: calc(100svh - var(--footer-h,120px));
  display:flex; align-items:center; justify-content:center;
  padding: clamp(24px, 5vw, 64px);
  text-align:center; color:#fff;
}
body[data-page="results"] .brand-cta a{
  color:#fff;
  text-decoration: underline;
  font-size: clamp(18px, 2.2vw, 24px);
}

/* Loader overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

#loading-overlay .loader-text {
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}