/* style.css — Sleep Foundation Pillow Recommender */

/* ===== CSS VARIABLES ===== */
:root {
  --color-primary: #2B4C7E;
  --color-secondary: #1A8754;
  --color-accent: #F4A623;
  --color-pale-blue: #EEF2F8;
  --color-pale-green: #E8F5EE;
  --color-dark: #1A1A2E;
  --color-gray: #6B7280;
  --color-bg: #F8F9FA;
  --color-white: #FFFFFF;
  --color-border: #E5E7EB;
  --color-body-text: #374151;
  --color-secondary-hover: #157347;
  --color-primary-light: #EEF2F8;
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --header-height-mobile: 60px;
  --header-height-desktop: 68px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-body-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: underline; }
a:hover { color: var(--color-secondary); }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 32px; font-weight: 700; color: var(--color-dark); line-height: 1.2; }
h2 { font-size: 24px; font-weight: 700; color: var(--color-dark); line-height: 1.3; }
h3 { font-size: 18px; font-weight: 700; color: var(--color-dark); line-height: 1.4; }
.label, .subtitle {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-secondary); font-weight: 600;
}
.caption { font-size: 13px; color: var(--color-gray); }

/* ===== SCREEN SYSTEM ===== */
.screen { display: none; }
.screen.active { display: block; }

/* ===== HEADER ===== */
.app-header {
  background: var(--color-primary);
  height: var(--header-height-mobile);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 100;
}
.app-header .logo img, .app-header .logo svg {
  height: 32px; filter: brightness(0) invert(1);
}
.app-header .nav-link {
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 14px;
}
.app-header .nav-link:hover { color: #fff; }

/* ===== FOOTER ===== */
.app-footer {
  background: var(--color-dark);
  color: #fff;
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
}
.app-footer .logo img, .app-footer .logo svg {
  height: 28px; filter: brightness(0) invert(1); margin: 0 auto 12px;
}
.app-footer a { color: rgba(255,255,255,0.7); }
.app-footer a:hover { color: #fff; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-stack);
  font-size: 16px; font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer; border: none; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-secondary); color: #fff;
  padding: 14px 28px;
}
.btn-primary:hover { background: var(--color-secondary-hover); color: #fff; }
.btn-secondary {
  background: transparent; color: var(--color-primary);
  border: 2px solid var(--color-primary);
  padding: 12px 24px;
}
.btn-secondary:hover { background: var(--color-primary-light); }
.btn-ghost {
  background: none; color: var(--color-primary);
  border: none; text-decoration: underline; padding: 8px 4px;
}
.btn-ghost:hover { color: var(--color-secondary); }
.btn-full { width: 100%; }

/* ===== PASSWORD GATE ===== */
#password-gate {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--color-dark);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px; color: #fff; padding: 24px;
}
#password-gate.hidden { display: none; }
#password-gate input {
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.1);
  color: #fff; font-size: 16px; width: 260px; text-align: center;
  font-family: var(--font-stack);
}
#password-gate input::placeholder { color: rgba(255,255,255,0.5); }
#password-gate .error-msg { color: #ef4444; font-size: 13px; min-height: 20px; }

/* ===== CONTAINERS ===== */
.container    { max-width: 640px;  margin: 0 auto; padding: 0 16px; }
.container-md { max-width: 900px;  margin: 0 auto; padding: 0 16px; }
.container-lg { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container-xl { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.section { padding: 40px 0; }

/* ===== LANDING SCREEN ===== */

/* Hero Section — dark navy full-width block */
.hero-section {
  background: linear-gradient(160deg, #1A1A2E 0%, #2B4C7E 50%, #1e3a5f 100%);
  position: relative; overflow: hidden;
}
.hero-section::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(26,135,84,0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(244,166,35,0.05) 0%, transparent 40%);
  pointer-events: none;
}
.hero { text-align: center; padding: 28px 0 24px; position: relative; z-index: 1; }
.hero h1 { margin-bottom: 10px; color: #fff; }
.hero .subhead {
  font-size: 16px; color: rgba(255,255,255,0.75);
  max-width: 520px; margin: 0 auto 20px; line-height: 1.5;
}

/* Sister sites badge */
.hero-family {
  font-size: 12px; color: rgba(255,255,255,0.5);
  margin-bottom: 16px; letter-spacing: 0.02em;
}
.hero-family strong { color: rgba(255,255,255,0.85); }
.hero-family-sites { display: block; margin-top: 4px; }
.hero-family-sites a {
  color: rgba(255,255,255,0.5); text-decoration: none;
  font-size: 12px; transition: color 0.2s;
}
.hero-family-sites a:hover { color: rgba(255,255,255,0.8); }
.hero-dot { margin: 0 6px; color: rgba(255,255,255,0.3); }

/* Stats Row (inside dark hero) */
.stats-row {
  display: flex; justify-content: center; gap: 32px;
  padding: 16px 0; margin-bottom: 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.stat { text-align: center; }
.stat .stat-value {
  font-size: 24px; font-weight: 700; color: #fff;
}
.stat .stat-label { font-size: 12px; color: rgba(255,255,255,0.55); }

/* Hero CTA */
.hero-cta { margin-bottom: 8px; }
.btn-hero {
  font-size: 17px; padding: 14px 36px;
  box-shadow: 0 4px 16px rgba(26,135,84,0.3);
}
.btn-hero:hover { box-shadow: 0 6px 20px rgba(26,135,84,0.4); }
.hero-how { margin-bottom: 0; }
.hero-how a {
  color: rgba(255,255,255,0.6); font-size: 13px; text-decoration: underline;
  text-underline-offset: 3px;
}
.hero-how a:hover { color: rgba(255,255,255,0.85); }

/* How It Works */
.how-it-works { padding: 24px 0 16px; }
.how-it-works h2 { text-align: center; margin-bottom: 16px; }
.steps { display: flex; flex-direction: column; gap: 12px; }
.step {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 20px;
  box-shadow: var(--shadow-card);
}
.step-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--color-pale-green);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.step-content h3 { margin-bottom: 4px; font-size: 16px; }
.step-content p { font-size: 14px; color: var(--color-gray); }

/* Pillow Types Grid */
.pillow-types { padding: 16px 0 24px; }
.pillow-types h2 { text-align: center; margin-bottom: 24px; }
.types-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.type-card {
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 20px; text-align: center;
  box-shadow: var(--shadow-card);
}
.type-card .type-icon { font-size: 32px; margin-bottom: 8px; }
.type-card h3 { font-size: 15px; margin-bottom: 4px; }
.type-card p { font-size: 13px; color: var(--color-gray); }

/* Trust Bar */
.trust-bar {
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px 0;
}
.trust-item {
  display: flex; gap: 12px; align-items: flex-start;
}
.trust-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--color-pale-blue);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.trust-item strong { font-size: 14px; color: var(--color-dark); display: block; }
.trust-item span { font-size: 13px; color: var(--color-gray); }

/* ===== SCAN SCREEN ===== */
#screen-scan {
  background: var(--color-dark); min-height: 100vh; color: #fff;
}
.scan-container {
  max-width: 480px; margin: 0 auto; padding: 16px;
  display: flex; flex-direction: column; align-items: center;
}
.scan-progress-bar {
  display: flex; gap: 4px; width: 100%; margin-bottom: 16px;
}
.scan-progress-bar .seg {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.2); transition: background 0.3s;
}
.scan-progress-bar .seg.done { background: var(--color-secondary); }
.scan-progress-bar .seg.active { background: var(--color-accent); }
.scan-video-wrap {
  position: relative; width: 100%; max-width: 400px;
  aspect-ratio: 3/4; border-radius: var(--radius-md);
  overflow: hidden; background: #000;
}
.scan-video-wrap video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.scan-video-wrap canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.scan-status {
  text-align: center; padding: 16px 0;
  font-size: 18px; font-weight: 600; min-height: 56px;
}
/* Persistent rotation instruction */
.scan-rotation-instruction {
  text-align: center; padding: 12px 16px;
  font-size: 17px; font-weight: 500; color: #fff;
  line-height: 1.5; max-width: 360px; margin: 0 auto;
}
.scan-rotation-instruction strong { color: var(--color-secondary); }

.scan-skip {
  color: rgba(255,255,255,0.6); font-size: 14px;
  text-decoration: underline; cursor: pointer;
  background: none; border: none; padding: 8px;
  font-family: var(--font-stack);
}
.scan-skip:hover { color: #fff; }
.scan-tip {
  text-align: center; font-size: 13px; color: rgba(255,255,255,0.4);
  max-width: 320px; margin-top: 12px;
}
/* Scan Disclaimer */
.scan-disclaimer {
  width: 100%; max-width: 440px; margin: 40px auto 24px;
}
.disclaimer-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 28px 24px; text-align: left;
}
.disclaimer-card h3 { color: #fff; margin-bottom: 12px; text-align: center; font-size: 20px; }
.disclaimer-card p {
  font-size: 14px; color: rgba(255,255,255,0.75);
  margin-bottom: 12px; line-height: 1.6;
}
.disclaimer-card p strong { color: rgba(255,255,255,0.95); }
.disclaimer-check {
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; margin: 20px 0 16px;
  font-size: 14px; color: rgba(255,255,255,0.9); line-height: 1.4;
}
.disclaimer-check input[type="checkbox"] {
  width: 20px; height: 20px; flex-shrink: 0;
  margin-top: 2px; accent-color: var(--color-secondary); cursor: pointer;
}
#scan-consent-proceed:disabled {
  opacity: 0.4; cursor: not-allowed;
}

/* Scan Error Card */
.scan-error-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md); padding: 24px;
  text-align: center; margin-top: 16px;
}
.scan-error-card p { margin-bottom: 16px; font-size: 15px; }

/* Scan Success */
.scan-success {
  text-align: center; padding: 80px 20px;
}
.scan-success-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(26,135,84,0.15);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: successPulse 1s ease-in-out;
}
@keyframes successPulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
.scan-error-actions {
  display: flex; gap: 12px; justify-content: center;
}
.scan-error-actions .btn-secondary {
  border-color: rgba(255,255,255,0.4); color: #fff;
}
.scan-error-actions .btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== QUIZ SCREEN ===== */
#screen-quiz { padding-top: 12px; padding-bottom: 60px; }
.quiz-progress {
  height: 4px; background: var(--color-border);
  border-radius: 2px; margin-bottom: 16px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; background: var(--color-secondary);
  border-radius: 2px; transition: width 0.3s ease;
}
.quiz-question { text-align: center; margin-bottom: 14px; }
.quiz-question h2 { font-size: 20px; margin-bottom: 6px; }
.quiz-question .helper { font-size: 14px; color: var(--color-gray); }
.quiz-options { display: flex; flex-direction: column; gap: 6px; }
.quiz-option {
  display: flex; align-items: center; gap: 12px;
  background: var(--color-white); border: 2px solid var(--color-border);
  border-radius: var(--radius-md); padding: 12px 16px;
  cursor: pointer; transition: all 0.15s;
  font-size: 16px; color: var(--color-dark);
}
.quiz-option:hover { border-color: var(--color-primary); background: var(--color-pale-blue); }
.quiz-option.selected { border-color: var(--color-secondary); background: var(--color-pale-green); }
.quiz-option .check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--color-border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.quiz-option.selected .check {
  background: var(--color-secondary); border-color: var(--color-secondary); color: #fff;
}
.quiz-option.multi .check { border-radius: 4px; }
/* Quiz Why Tooltip — inline ? circle */
.quiz-why-trigger {
  position: relative; display: inline-flex;
  vertical-align: baseline; margin-left: 4px; cursor: help;
  top: -2px;
}
.quiz-why-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--color-gray);
  font-size: 12px; font-weight: 600; color: var(--color-gray);
  font-style: normal; line-height: 1;
  transition: all 0.15s;
}
.quiz-why-trigger:hover .quiz-why-icon,
.quiz-why-trigger:focus .quiz-why-icon {
  border-color: var(--color-primary); color: var(--color-primary);
}
.quiz-why-tooltip {
  display: none; position: absolute;
  top: 32px; left: 50%; transform: translateX(-50%);
  width: 280px; padding: 12px 14px;
  background: var(--color-dark); color: #fff;
  font-size: 13px; font-weight: 400; line-height: 1.5;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10; text-align: left;
}
.quiz-why-tooltip::before {
  content: ''; position: absolute;
  top: -6px; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--color-dark);
}
.quiz-why-trigger:hover .quiz-why-tooltip,
.quiz-why-trigger:focus .quiz-why-tooltip,
.quiz-why-trigger.active .quiz-why-tooltip { display: block; }

.quiz-nav {
  display: flex; gap: 12px; margin-top: 16px; justify-content: center;
}

/* ===== RESULTS SCREEN ===== */
#screen-results { padding-top: 24px; padding-bottom: 48px; }

/* Results page visual header */
#screen-results { padding-top: 0; }
.results-header {
  background: linear-gradient(160deg, #2B4C7E 0%, #1A1A2E 100%);
  padding: 28px 16px 28px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.results-header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1A8754, #2B4C7E, #F4A623);
}
.results-header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; gap: 32px; align-items: center;
}
.results-header-main { flex: 1; }
.results-header h2 { color: #fff; margin-bottom: 6px; font-size: 22px; }
.results-header-sub {
  color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.5; margin: 0;
}
.results-header-sub strong { color: rgba(255,255,255,0.95); }
.results-header-about {
  flex: 0 0 280px; padding-left: 24px;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.results-header-about p {
  color: rgba(255,255,255,0.55); font-size: 12px; line-height: 1.5; margin: 0;
}
.results-header-about strong { color: rgba(255,255,255,0.8); }

/* Mobile: stack header */
@media (max-width: 700px) {
  .results-header-inner { flex-direction: column; gap: 16px; text-align: center; }
  .results-header-about {
    flex: none; padding-left: 0; border-left: none;
    padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.12);
  }
}

/* Section dividers */
.results-divider {
  height: 1px; max-width: 200px; margin: 32px auto;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

/* Sponsored product card label */
.product-card-featured { position: relative; }
.product-partner-label {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-gray); background: rgba(255,255,255,0.9);
  padding: 3px 8px; border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* Scan Snapshot */
.scan-snapshot {
  width: 160px; height: 160px; border-radius: 14px;
  overflow: hidden; flex-shrink: 0;
  border: 3px solid var(--color-primary);
  box-shadow: 0 4px 16px rgba(43,76,126,0.15);
}
.scan-snapshot img {
  width: 100%; height: 100%; object-fit: cover;
}

/* Scan Summary Card */
.scan-summary {
  background: var(--color-pale-blue); border: 1px solid var(--color-primary);
  border-radius: var(--radius-md); padding: 24px 28px; margin-bottom: 24px;
}
.scan-summary-layout {
  display: flex; gap: 28px; align-items: center;
}
.scan-summary-data { flex: 1; min-width: 0; }
.scan-summary-data h3 { margin-bottom: 14px; color: var(--color-primary); font-size: 17px; }
.measurements-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 32px;
}
.measurement { text-align: left; padding: 4px 0; }
.measurement .meas-label { font-size: 11px; color: var(--color-gray); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.measurement .meas-values { font-size: 18px; font-weight: 700; color: var(--color-dark); }
.measurement .meas-unit { font-size: 13px; font-weight: 400; color: var(--color-gray); margin-left: 1px; }
.measurement .meas-sep { margin: 0 4px; color: var(--color-border); font-weight: 400; }
.measurement .meas-desc { font-size: 12px; color: var(--color-gray); margin-top: 1px; }
.scan-summary .scan-quality { margin-top: 12px; font-size: 12px; color: var(--color-gray); }

/* Mobile: stack snapshot above measurements */
@media (max-width: 500px) {
  .scan-summary { padding: 20px; }
  .scan-summary-layout { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .scan-snapshot { width: 120px; height: 120px; }
  .measurements-grid { gap: 8px 24px; }
  .measurement { text-align: center; }
}

/* Why Card */
.why-card {
  background: var(--color-pale-blue); border-radius: var(--radius-md);
  padding: 24px; margin-bottom: 24px;
}
.why-card h3 { margin-bottom: 12px; }
.why-card p { margin-bottom: 12px; font-size: 15px; line-height: 1.6; }
.why-card p:last-child { margin-bottom: 0; }

/* Context Notes */
.context-notes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.context-note {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.5;
}
.context-note.orange { background: #FFF7ED; border-left: 3px solid var(--color-accent); color: #92400E; }
.context-note.purple { background: #EEF2F8; border-left: 3px solid var(--color-primary); color: var(--color-primary); }
.context-note.info { background: var(--color-pale-blue); border-left: 3px solid var(--color-border); color: var(--color-gray); }

/* Sponsor Banner */
.partner-card {
  background: linear-gradient(135deg, #F0F4FF 0%, #E8F5EE 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 28px 24px;
  text-align: center; margin-bottom: 24px;
  max-width: 560px; margin-left: auto; margin-right: auto;
}
.partner-card .partner-intro {
  font-size: 13px; color: var(--color-gray); margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.partner-card .partner-logo {
  margin-bottom: 10px;
}
.partner-card .partner-logo img {
  max-height: 48px; margin: 0 auto; display: block;
}
.partner-card .partner-name {
  font-size: 20px; font-weight: 700; color: var(--color-dark);
  margin-bottom: 4px;
}
.partner-card .partner-tagline {
  font-size: 14px; color: var(--color-gray); margin-bottom: 14px; line-height: 1.4;
}
.partner-card .partner-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--color-secondary); font-size: 15px; font-weight: 600;
  text-decoration: none; padding: 10px 24px;
  border: 2px solid var(--color-secondary); border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.partner-card .partner-link:hover {
  background: var(--color-secondary); color: #fff;
}
.partner-card .partner-disclosure {
  display: block; margin-top: 12px;
  font-size: 11px; text-transform: uppercase; color: var(--color-gray);
  letter-spacing: 0.06em;
}

/* Sponsor Strip — slim horizontal version for landing page */
.partner-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
  background: var(--color-pale-blue); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 12px 20px;
  margin: 8px 0 24px; text-align: center;
}
.partner-bar .partner-intro {
  font-size: 12px; color: var(--color-gray); letter-spacing: 0.02em;
}
.partner-bar .partner-logo img {
  max-height: 24px; display: block;
}
.partner-bar .partner-name {
  font-size: 14px; font-weight: 700; color: var(--color-dark);
}
.partner-bar .partner-link {
  color: var(--color-secondary); font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.partner-bar .partner-link:hover { text-decoration: underline; }
.partner-bar .partner-disclosure {
  font-size: 10px; text-transform: uppercase; color: var(--color-gray);
  letter-spacing: 0.05em;
}

/* Top sponsor bar — sits at hero/content junction, no extra space */
.partner-bar-top {
  background: var(--color-pale-blue); border-bottom: 1px solid var(--color-border);
  text-align: center; padding: 8px 16px;
}
.partner-bar-top:empty { display: none; }
.partner-bar-top .partner-bar {
  margin: 0; padding: 0; background: none; border: none; border-radius: 0;
  font-size: 12px; gap: 8px;
}
.partner-bar-top .partner-bar .partner-logo img { max-height: 18px; }
.partner-bar-top .partner-bar .partner-name { font-size: 12px; }
.partner-bar-top .partner-bar .partner-link { font-size: 12px; }

/* Product Cards */
.results-section { margin-bottom: 32px; }
.results-section h2 { margin-bottom: 4px; }
.results-section .section-sub {
  font-size: 13px; color: var(--color-gray); font-style: italic; margin-bottom: 16px;
}
.product-cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.product-card {
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-card);
}
.product-card .product-image {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  background: var(--color-pale-blue);
}
.product-card .product-image img {
  width: 100%; height: 100%; object-fit: cover;
}
.product-card .product-body { padding: 20px; }
.product-card .product-brand { font-size: 13px; color: var(--color-gray); margin-bottom: 2px; }
.product-card .product-name { font-size: 18px; font-weight: 700; color: var(--color-dark); margin-bottom: 10px; }
.product-pills {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.product-pill {
  font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: var(--color-pale-blue); color: var(--color-primary);
  font-weight: 500;
}
.product-pill.fill { background: var(--color-primary); color: #fff; }
.product-pill.price { background: var(--color-pale-green); color: var(--color-secondary); font-weight: 700; }
.product-card .product-trial { font-size: 13px; color: var(--color-secondary); font-weight: 500; margin-bottom: 8px; }
.product-card .product-desc { font-size: 14px; color: var(--color-gray); margin-bottom: 12px; line-height: 1.5; }
.product-badges {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.product-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  background: var(--color-pale-green); color: var(--color-secondary);
  font-weight: 600;
}
/* Product Why Toggle */
.product-why { margin-bottom: 14px; }
.product-why-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0;
  color: var(--color-primary); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font-stack);
  transition: color 0.15s;
}
.product-why-toggle:hover { color: var(--color-secondary); }
.product-why-toggle svg { transition: transform 0.2s; }
.product-why-content {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease;
}
.product-why-content.open {
  max-height: 400px; padding-top: 10px;
}
.product-why-content.open + .product-why-toggle svg,
.product-why-content.open ~ .product-why-toggle svg { transform: rotate(180deg); }
.product-why-content ul {
  list-style: none; padding: 0; margin: 0;
}
.product-why-content li {
  font-size: 13px; color: var(--color-body-text); line-height: 1.5;
  padding: 5px 0 5px 18px; position: relative;
}
.product-why-content li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-secondary); opacity: 0.6;
}

.product-card .btn-primary { width: 100%; text-align: center; }

/* Also Consider — slightly lighter */
.also-consider .product-card { opacity: 0.92; }

/* Learn More */
.learn-more {
  background: var(--color-pale-blue); border-radius: var(--radius-md);
  padding: 24px; margin-bottom: 24px;
}
.learn-more h3 { margin-bottom: 16px; }
.learn-more ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.learn-more li {
  padding: 8px 16px; background: var(--color-white);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
.learn-more a { font-size: 14px; font-weight: 500; text-decoration: none; }
.learn-more a:hover { text-decoration: underline; }

/* Email Capture */
.save-capture {
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 24px; text-align: center;
  margin-bottom: 24px; box-shadow: var(--shadow-card);
}
.save-capture h3 { margin-bottom: 8px; }
.save-capture .save-sub { font-size: 14px; color: var(--color-gray); margin-bottom: 16px; }
}

/* Actions */
.results-actions {
  display: flex; gap: 12px; justify-content: center;
  padding: 16px 0;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5); display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 32px; max-width: 480px; width: 100%;
  max-height: 80vh; overflow-y: auto; position: relative;
}
.modal-content h3 { margin-bottom: 16px; }
.modal-content p { font-size: 15px; color: var(--color-gray); margin-bottom: 12px; }
.modal-close-x {
  position: sticky; top: 0; float: right;
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--color-gray);
  padding: 0 0 8px 8px; font-family: var(--font-stack);
  z-index: 1;
}
.modal-close-x:hover { color: var(--color-dark); }
.modal-close {
  margin-top: 16px; background: none; border: none;
  color: var(--color-primary); font-size: 15px; cursor: pointer;
  text-decoration: underline; font-family: var(--font-stack);
}

/* ===== SETTINGS PAGE ===== */
.settings-section {
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.settings-section h2 { font-size: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--color-border); padding-bottom: 8px; }
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
}
.settings-grid dt { font-size: 13px; color: var(--color-gray); }
.settings-grid dd { font-size: 14px; font-weight: 600; color: var(--color-dark); margin-bottom: 8px; }
.settings-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.settings-table th {
  text-align: left; padding: 8px; background: var(--color-pale-blue);
  border-bottom: 1px solid var(--color-border); font-weight: 600; color: var(--color-dark);
}
.settings-table td {
  padding: 8px; border-bottom: 1px solid var(--color-border); color: var(--color-body-text);
}
.settings-table tr:last-child td { border-bottom: none; }
.settings-status {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600;
}
.settings-status.active { background: var(--color-pale-green); color: var(--color-secondary); }
.settings-status.inactive { background: #FEE2E2; color: #991B1B; }

/* Settings Tooltips */
.settings-tip {
  position: relative; display: inline-flex;
  vertical-align: baseline; margin-left: 5px; cursor: help; top: -1px;
}
.settings-tip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--color-gray);
  font-size: 10px; font-weight: 700; color: var(--color-gray);
  line-height: 1; transition: all 0.15s;
}
.settings-tip:hover .settings-tip-icon,
.settings-tip:focus .settings-tip-icon {
  border-color: var(--color-primary); color: var(--color-primary);
}
.settings-tip-text {
  display: none; position: absolute;
  top: 24px; left: 0;
  width: 300px; padding: 10px 12px;
  background: var(--color-dark); color: #fff;
  font-size: 12px; font-weight: 400; line-height: 1.5;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 20;
}
.settings-tip-text::before {
  content: ''; position: absolute;
  top: -5px; left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid var(--color-dark);
}
.settings-tip:hover .settings-tip-text,
.settings-tip:focus .settings-tip-text,
.settings-tip.active .settings-tip-text { display: block; }

/* ===== SETTINGS FORM (Sponsor Editor) ===== */
.partner-form { margin-top: 8px; }
.form-row {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 13px; font-weight: 600; color: var(--color-dark);
}
.form-input {
  padding: 10px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); font-size: 14px;
  font-family: var(--font-stack); color: var(--color-dark);
  background: var(--color-white); width: 100%;
}
.form-input:focus { outline: none; border-color: var(--color-secondary); box-shadow: 0 0 0 2px rgba(26,135,84,0.15); }
.form-input-sm { max-width: 100px; }
.form-hint { font-size: 12px; color: var(--color-gray); margin-top: 2px; }
.form-toggle {
  display: flex; align-items: center; gap: 10px;
}
.toggle-switch {
  position: relative; display: inline-block; width: 48px; height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--color-border); border-radius: 26px; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-secondary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.toggle-label { font-size: 14px; font-weight: 600; color: var(--color-dark); }
.form-checks {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.form-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--color-dark); cursor: pointer;
}
.form-check input { accent-color: var(--color-secondary); cursor: pointer; }
.form-actions {
  display: flex; gap: 12px; align-items: center;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.form-status { margin-top: 8px; min-height: 20px; }

@media (min-width: 768px) {
  .form-row { flex-direction: row; align-items: center; gap: 12px; }
  .form-label { min-width: 140px; flex-shrink: 0; }
  .form-input { max-width: 400px; }
}

/* ===== TEXT WIDTH CONSTRAINTS (for wide results container) ===== */
.why-card, .scan-summary, .context-notes {
  max-width: 960px; margin-left: auto; margin-right: auto;
}
.learn-more, .save-capture {
  max-width: 960px; margin-left: auto; margin-right: auto;
}
.results-actions {
  max-width: 960px; margin-left: auto; margin-right: auto;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .app-header {
    height: var(--header-height-desktop);
    padding: 0 32px;
  }
  .container { padding: 0 32px; }
  .container-md { padding: 0 32px; }
  .container-lg { padding: 0 32px; }
  .container-xl { padding: 0 32px; }
  h1 { font-size: 40px; }
  .hero { padding: 36px 0 28px; }
  .hero .subhead { font-size: 17px; max-width: 540px; }
  .hero-family-sites { display: inline; margin-top: 0; margin-left: 8px; }
  .steps { flex-direction: row; }
  .step { flex: 1; flex-direction: column; text-align: center; }
  .trust-bar { flex-direction: row; gap: 24px; }
  .trust-item { flex: 1; }
  /* Product cards 2-column on tablet+ */
  .product-cards { grid-template-columns: 1fr 1fr; }
  /* Scan area wider */
  .scan-container { max-width: 560px; }
  .scan-video-wrap { max-width: 480px; }
  .scan-disclaimer { max-width: 480px; }
  /* Snapshot scales up on tablet */
  .scan-snapshot { width: 180px; height: 180px; }
  .scan-summary { padding: 28px 32px; }
  .scan-summary-layout { gap: 32px; }
  .measurements-grid { gap: 12px 40px; }
  .measurement .meas-values { font-size: 20px; }
}

@media (min-width: 1024px) {
  h1 { font-size: 48px; }
  h2 { font-size: 28px; }
  body { font-size: 17px; }
  .hero { padding: 48px 0 32px; }
  .hero .subhead { font-size: 18px; max-width: 600px; }
  .hero-family { font-size: 13px; margin-bottom: 20px; }
  .stat .stat-value { font-size: 28px; }
  .stat .stat-value { font-size: 34px; }
  .stats-row { gap: 48px; }
  .step { padding: 24px; }
  .step-content h3 { font-size: 17px; }
  .types-grid { grid-template-columns: repeat(4, 1fr); }
  .scan-container { max-width: 640px; }
  .scan-video-wrap { max-width: 540px; }
  .scan-disclaimer { max-width: 540px; }
  .app-header { padding: 0 48px; }
  .container-lg { padding: 0 40px; }
  .container-xl { padding: 0 40px; }
  /* Larger snapshot on desktop */
  .scan-snapshot { width: 200px; height: 200px; border-radius: 16px; }
  .scan-summary { padding: 32px 36px; }
  .scan-summary-layout { gap: 36px; }
  .scan-summary-data h3 { font-size: 19px; }
  .measurements-grid { gap: 14px 48px; }
  .measurement .meas-values { font-size: 22px; }
  .measurement .meas-label { font-size: 12px; }
  .measurement .meas-desc { font-size: 13px; }
}

@media (min-width: 1200px) {
  h1 { font-size: 52px; }
  .hero .subhead { font-size: 20px; max-width: 640px; }
  .container    { padding: 0 40px; }
  .container-md { padding: 0 40px; }
  .container-lg { padding: 0 48px; }
  .container-xl { padding: 0 48px; }
  .app-footer { padding: 40px 48px; }
}

/* ===== PRINT STYLES ===== */
@media print {
  body { background: #fff; font-size: 12pt; }
  .app-header, .app-footer, .save-capture, .results-actions,
  .partner-bar, .partner-bar-top, .partner-card,
  .product-partner-label, #btn-print { display: none !important; }
  .screen { display: none !important; }
  #screen-results { display: block !important; }
  .container-xl { max-width: 100%; padding: 0; }
  .product-cards { grid-template-columns: 1fr 1fr; gap: 16px; }
  .product-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .results-header { box-shadow: none; border: 1px solid #ddd; }
  a { color: var(--color-primary); text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #888; }
  a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }
