/* ===================================================================
   SleepQuiet Pro — Single Shared Stylesheet
   Mobile-first. One file. No preprocessor. No external fonts.
   =================================================================== */

/* ------------------------------------------------------------------ */
/*  CSS Custom Properties                                               */
/* ------------------------------------------------------------------ */
:root {
  /* Palette */
  --color-white:       #ffffff;
  --color-cream:       #faf6f0;
  --color-blue:        #1a5fb4;
  --color-blue-dark:   #144b8e;
  --color-blue-light:  #e8f0fa;
  --color-charcoal:    #1a1a1a;
  --color-gray-600:    #555555;
  --color-gray-400:    #999999;
  --color-gray-200:    #e0e0e0;
  --color-gray-100:    #f5f5f5;
  --color-green:       #2e7d32;
  --color-red:         #c62828;

  /* Spacing scale (4px base) */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;
  --space-20:  80px;

  /* Typography – system font stack */
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;

  /* Font sizes (mobile-first – large on small screens) */
  --text-xs:    0.75rem;   /* 12px */
  --text-sm:    0.875rem;  /* 14px */
  --text-base:  1.0625rem; /* 17px */
  --text-lg:    1.25rem;   /* 20px */
  --text-xl:    1.5rem;    /* 24px */
  --text-2xl:   1.875rem;  /* 30px */
  --text-3xl:   2.25rem;   /* 36px */
  --text-4xl:   2.75rem;   /* 44px */

  /* Line heights */
  --leading-tight:  1.15;
  --leading-snug:   1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Border radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);

  /* Container */
  --container-max: 1024px;
  --container-pad: var(--space-5);
}

/* ------------------------------------------------------------------ */
/*  Reset & Base                                                        */
/* ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-charcoal);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/*  Container                                                           */
/* ------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

/* ------------------------------------------------------------------ */
/*  Section                                                             */
/* ------------------------------------------------------------------ */
.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}
.section + .section {
  border-top: 1px solid var(--color-gray-200);
}
.section-title {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  color: var(--color-charcoal);
}
.section-subtitle {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-gray-600);
  margin: 0 0 var(--space-8);
  max-width: 640px;
}

/* ------------------------------------------------------------------ */
/*  Page Header                                                         */
/* ------------------------------------------------------------------ */
.page-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  padding: var(--space-4) var(--container-pad);
}
.page-header .container {
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-header .wordmark {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-blue);
  letter-spacing: -0.02em;
  line-height: 1;
}
.page-header .wordmark span {
  font-weight: 400;
  color: var(--color-gray-400);
}

/* ------------------------------------------------------------------ */
/*  Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn-primary {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--color-white);
  background-color: var(--color-blue);
  border: 2px solid var(--color-blue);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-8);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px; /* large tap target */
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--color-blue-dark);
  border-color: var(--color-blue-dark);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--color-blue);
  background-color: transparent;
  border: 2px solid var(--color-blue);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  background-color: var(--color-blue-light);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: translateY(0);
}
.btn-secondary:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
}

.btn-link {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  color: var(--color-gray-600);
  background: none;
  border: none;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}
.btn-link:hover {
  color: var(--color-charcoal);
}

/* ------------------------------------------------------------------ */
/*  Card                                                                */
/* ------------------------------------------------------------------ */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.card--highlight {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 1px var(--color-blue), var(--shadow-sm);
}

/* ------------------------------------------------------------------ */
/*  Stat Display                                                        */
/* ------------------------------------------------------------------ */
.stat {
  text-align: center;
  padding: var(--space-4);
}
.stat-number {
  display: block;
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: var(--leading-tight);
  color: var(--color-blue);
}
.stat-label {
  display: block;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--color-gray-600);
  margin-top: var(--space-1);
}

.stat-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stat-bar .stat {
  padding: var(--space-5) var(--space-4);
  background: var(--color-cream);
  border-radius: var(--radius-md);
}

/* ------------------------------------------------------------------ */
/*  Order Summary                                                       */
/* ------------------------------------------------------------------ */
.order-summary {
  background: var(--color-cream);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.order-summary-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  color: var(--color-charcoal);
}
.order-summary-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.order-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--color-charcoal);
}
.order-summary-item + .order-summary-item {
  border-top: 1px solid var(--color-gray-200);
}
.order-summary-item-name {
  flex: 1;
}
.order-summary-item-price {
  font-weight: 600;
  white-space: nowrap;
}
.order-summary-divider {
  border: none;
  border-top: 2px solid var(--color-gray-200);
  margin: var(--space-3) 0;
}
.order-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-charcoal);
  padding-top: var(--space-1);
}
.order-summary-shipping {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-green);
  margin-top: var(--space-1);
}
.order-summary-empty {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  text-align: center;
  padding: var(--space-4) 0;
}

/* ------------------------------------------------------------------ */
/*  Citation Card                                                       */
/* ------------------------------------------------------------------ */
.citation-card {
  background: var(--color-cream);
  border-left: 4px solid var(--color-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
}
.citation-card:last-child {
  margin-bottom: 0;
}
.citation-journal {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-blue);
  margin: 0 0 var(--space-1);
}
.citation-year {
  font-size: var(--text-xs);
  color: var(--color-gray-400);
  font-weight: 400;
  margin-left: var(--space-2);
}
.citation-finding {
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--color-charcoal);
  margin: 0 0 var(--space-2);
}
.citation-link {
  font-size: var(--text-xs);
  color: var(--color-blue);
  word-break: break-all;
}

/* ------------------------------------------------------------------ */
/*  Price Row                                                           */
/* ------------------------------------------------------------------ */
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-base);
}
.price-row + .price-row {
  border-top: 1px solid var(--color-gray-200);
}
.price-row-label {
  color: var(--color-charcoal);
}
.price-row-value {
  font-weight: 600;
  white-space: nowrap;
}
.price-row-value--strikethrough {
  text-decoration: line-through;
  color: var(--color-gray-400);
  font-weight: 400;
}
.price-row-value--highlight {
  color: var(--color-green);
  font-weight: 700;
}
.price-row-value--our-price {
  color: var(--color-blue);
  font-weight: 700;
  font-size: var(--text-lg);
}

/* ------------------------------------------------------------------ */
/*  Hero Media (image containers)                                       */
/* ------------------------------------------------------------------ */
.hero-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-blue-light); /* fallback bg */
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-media--portrait {
  aspect-ratio: 3 / 4;
}
.hero-media--square {
  aspect-ratio: 1 / 1;
}
.hero-media--tall {
  aspect-ratio: 4 / 5;
}

/* ------------------------------------------------------------------ */
/*  Image Missing Fallback                                              */
/* ------------------------------------------------------------------ */
.img-missing {
  background: linear-gradient(135deg, var(--color-blue-light) 0%, var(--color-cream) 100%);
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  position: relative;
}
.img-missing::after {
  content: attr(alt);
  display: block;
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  text-align: center;
  padding: var(--space-4);
  max-width: 80%;
  line-height: var(--leading-snug);
}

/* ------------------------------------------------------------------ */
/*  Form Fields                                                         */
/* ------------------------------------------------------------------ */
.form-field {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-charcoal);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-field:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px var(--color-blue-light);
  outline: none;
}
.form-field::placeholder {
  color: var(--color-gray-400);
}
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: var(--space-1);
}
.form-group {
  margin-bottom: var(--space-5);
}
.form-group--checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}
.form-group--checkbox input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-blue);
  cursor: pointer;
}
.form-group--checkbox label {
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Guarantee Badge                                                     */
/* ------------------------------------------------------------------ */
.guarantee-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-green);
  line-height: var(--leading-snug);
  text-align: center;
}
.guarantee-badge::before {
  content: "\2713\00a0"; /* checkmark + space */
  font-size: inherit;
}

/* ------------------------------------------------------------------ */
/*  Video Placeholder                                                   */
/* ------------------------------------------------------------------ */
.video-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-blue-dark) 0%, #0d2f5a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.video-placeholder-icon {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.video-placeholder-icon::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent var(--color-blue);
  margin-left: 4px;
}
.video-placeholder:hover .video-placeholder-icon {
  transform: scale(1.08);
}

/* ------------------------------------------------------------------ */
/*  Two Column Layout                                                   */
/* ------------------------------------------------------------------ */
.two-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* ------------------------------------------------------------------ */
/*  Text Utilities                                                      */
/* ------------------------------------------------------------------ */
.text-center {
  text-align: center;
}
.text-sm {
  font-size: var(--text-sm);
}
.text-lg {
  font-size: var(--text-lg);
}
.text-muted {
  color: var(--color-gray-600);
}

/* ------------------------------------------------------------------ */
/*  Stack Spacing Utilities                                             */
/* ------------------------------------------------------------------ */
.stack-1  > * + * { margin-top: var(--space-1);  }
.stack-2  > * + * { margin-top: var(--space-2);  }
.stack-3  > * + * { margin-top: var(--space-3);  }
.stack-4  > * + * { margin-top: var(--space-4);  }
.stack-5  > * + * { margin-top: var(--space-5);  }
.stack-6  > * + * { margin-top: var(--space-6);  }
.stack-8  > * + * { margin-top: var(--space-8);  }
.stack-10 > * + * { margin-top: var(--space-10); }
.stack-12 > * + * { margin-top: var(--space-12); }

/* ------------------------------------------------------------------ */
/*  Inline Spacing Utility                                              */
/* ------------------------------------------------------------------ */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ------------------------------------------------------------------ */
/*  Mobile-first: tablet & up (≥ 640px)                                */
/* ------------------------------------------------------------------ */
@media (min-width: 640px) {
  :root {
    --container-pad: var(--space-8);
    --text-base: 1.125rem;  /* 18px */
    --text-lg:   1.375rem;  /* 22px */
    --text-xl:   1.625rem;  /* 26px */
    --text-2xl:  2.125rem;  /* 34px */
    --text-3xl:  2.5rem;    /* 40px */
    --text-4xl:  3rem;      /* 48px */
  }

  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }
  .section-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-5);
  }
  .section-subtitle {
    font-size: var(--text-lg);
    margin-bottom: var(--space-10);
  }

  /* Stat bar horizontal on tablet+ */
  .stat-bar {
    flex-direction: row;
    gap: var(--space-4);
  }
  .stat-bar .stat {
    flex: 1;
  }

  .stat-number {
    font-size: var(--text-4xl);
  }

  .citation-card {
    padding: var(--space-6) var(--space-8);
  }

  .order-summary {
    padding: var(--space-8);
  }
}

/* ------------------------------------------------------------------ */
/*  Desktop: ≥ 768px                                                    */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) {
  :root {
    --container-pad: var(--space-10);
    --text-base: 1.125rem;  /* 18px */
    --text-lg:   1.375rem;  /* 22px */
    --text-xl:   1.75rem;   /* 28px */
    --text-2xl:  2.25rem;   /* 36px */
    --text-3xl:  2.75rem;   /* 44px */
    --text-4xl:  3.25rem;   /* 52px */
  }

  .two-col {
    flex-direction: row;
    align-items: flex-start;
  }
  .two-col > * {
    flex: 1;
    min-width: 0;
  }
  .two-col--wide-right > *:last-child {
    flex: 1.4;
  }
  .two-col--wide-left > *:first-child {
    flex: 1.4;
  }

  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }

  .page-header .container {
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------------------ */
/*  Large desktop: ≥ 1024px                                             */
/* ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  :root {
    --text-2xl:  2.5rem;  /* 40px */
    --text-3xl:  3rem;    /* 48px */
    --text-4xl:  3.5rem;  /* 56px */
  }
}
