/* ============================================================
   King Resistance Trainer – Design System & Styles
   Clean, white, premium — with warm wood-tone accents
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Colors */
  --color-bg: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-secondary: #555555;
  --color-accent: #B8864E;          /* warm wood / gold */
  --color-accent-light: #D4A76A;
  --color-surface-warm: #FAF6F1;    /* light birch tint */
  --color-border: #E8DDD0;
  --color-border-light: #F0EAE2;

  /* Buttons */
  --btn-primary-bg: #1A1A1A;
  --btn-primary-text: #FFFFFF;
  --btn-secondary-bg: transparent;
  --btn-secondary-border: #1A1A1A;
  --btn-secondary-text: #1A1A1A;

  /* Typography */
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --section-padding: 3.5rem 1.25rem;
  --container-max: 720px;

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* Screen-reader only (for accessible h1 when logo is visual) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Container ---------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.15;
}

/* ============================================================
   HERO SECTION
   Mobile: stacked. Desktop: two-column.
   Must fit above the fold on ~390×750 mobile.
   ============================================================ */
.hero {
  padding: 2rem 1.25rem 2.5rem;
  text-align: center;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

/* Full PNG logo */
.hero-logo {
  max-width: 120px;
  height: auto;
  margin: 0 auto 0.5rem;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

/* Hero image — 4:3, height capped on mobile */
.hero-image-wrap {
  position: relative;
  width: 100%;
  max-height: 45vh;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  background: var(--color-surface-warm);
}

.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-price {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.hero-gate {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Info icon */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--color-text-secondary);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  font-family: var(--font-body);
  line-height: 1;
}
.info-btn:hover, .info-btn:focus {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

/* CTA Buttons */
.hero-buttons,
.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.875rem 1.5rem;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  border: 2px solid transparent;
  line-height: 1.3;
  text-decoration: none;
}

.btn-context {
  display: block;
  width: 100%;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.btn-action {
  display: block;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}
.btn-primary:hover {
  background: #333;
  border-color: #333;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}
.btn-secondary:hover {
  background: var(--color-text);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Lead-time note (lives below bottom CTA) */
.lead-time-note {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  font-style: italic;
  max-width: 420px;
  margin: 1rem auto 0;
  line-height: 1.5;
  text-align: center;
  padding: 0 1.5rem;
}

/* ---------- Thin wood-grain divider between sections ---------- */
.section-divider {
  display: block;
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  border: none;
  margin: 0 auto;
  border-radius: 2px;
  opacity: 0.7;
}

/* ============================================================
   THE STORY
   ============================================================ */
.story {
  padding: var(--section-padding);
  background: var(--color-surface-warm);
}

.story .container {
  max-width: 620px;
}

.story p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}
.story p:last-of-type { margin-bottom: 0; }

.story-signature {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-accent);
  text-align: center;
  margin-top: 1.25rem;
  margin-bottom: 0;
}

/* ============================================================
   IMAGE CAROUSEL — 3:4 aspect ratio
   ============================================================ */
.carousel-section {
  padding: 3rem 0;
  background: var(--color-bg);
}

.carousel-container {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 1rem;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 8px;
  touch-action: pan-y pinch-zoom;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s var(--ease);
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--color-surface-warm);
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Special crop for image 6 (action shot) — keep face visible */
.carousel-slide.slide-action img {
  object-position: center 15%;
}

/* Carousel nav row (arrows + dots, below image) */
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0 0.5rem;
}

.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.carousel-btn:hover {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

/* Carousel dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--color-border);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  padding: 0;
}
.carousel-dot.active {
  background: var(--color-accent);
  transform: scale(1.25);
}

/* ============================================================
   WHAT'S INCLUDED
   ============================================================ */
.included {
  padding: var(--section-padding);
  background: var(--color-bg);
}

.included h2 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  margin-bottom: 0.75rem;
  text-align: center;
}

.included-intro {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.included-list {
  max-width: 520px;
  margin: 0 auto 2.5rem;
}

.included-list li {
  padding: 0.65rem 0 0.65rem 2rem;
  position: relative;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border-light);
  line-height: 1.55;
}
.included-list li:last-child { border-bottom: none; }

/* Checkmark icon */
.included-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  transform: rotate(-45deg);
}

.cta-buttons {
  max-width: 440px;
  margin: 0 auto;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  padding: 2.5rem 1.25rem;
  text-align: center;
  border-top: 1px solid var(--color-border-light);
}

.footer-ig {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text);
  transition: color 0.2s var(--ease);
  margin-bottom: 0.75rem;
}
.footer-ig:hover { color: var(--color-accent); }

.footer-ig svg {
  width: 20px;
  height: 20px;
  color: var(--color-accent);
}

footer .copyright {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

/* ============================================================
   INFO POPUP / TOOLTIP
   ============================================================ */
.info-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}
.info-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.info-popup-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.75rem 1.5rem;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  transform: translateY(12px);
  transition: transform 0.3s var(--ease);
}
.info-popup-overlay.active .info-popup-card {
  transform: translateY(0);
}

.info-popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--color-surface-warm);
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}
.info-popup-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.info-popup-card p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--color-text);
}

.info-popup-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding-right: 2rem;
}

.info-popup-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-popup-list li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
  padding: 0.45rem 0 0.45rem 1.5rem;
  position: relative;
  border-bottom: 1px solid var(--color-border-light);
}
.info-popup-list li:last-child { border-bottom: none; }

.info-popup-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* ============================================================
   SHIPPING PAGE
   ============================================================ */
.shipping-page {
  padding: 2rem 1.25rem 4rem;
  min-height: 100vh;
}

.shipping-page .container {
  max-width: 560px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  padding: 1rem 1.25rem;
  transition: color 0.2s;
  font-weight: 500;
}
.back-link:hover { color: var(--color-text); }

.shipping-page h1 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  margin-bottom: 0.5rem;
}

.shipping-page h2 {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  margin-bottom: 1.25rem;
  color: var(--color-accent);
  text-transform: none;
  letter-spacing: 0;
}

.shipping-page p {
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

/* Form */
.shipping-form {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--color-surface-warm);
  border-radius: 10px;
  border: 1px solid var(--color-border-light);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  background: #fff;
  transition: border-color 0.2s var(--ease);
}
.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-accent);
  flex-shrink: 0;
  cursor: pointer;
}

.form-checkbox label {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  line-height: 1.5;
}

.shipping-form .btn {
  width: 100%;
  margin-top: 0.5rem;
}

/* Freight quote conditional fields */
.freight-fields {
  display: none;
  overflow: hidden;
  border-top: 1px solid var(--color-border-light);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.freight-fields.visible {
  display: block;
  animation: slideDown 0.3s var(--ease);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Select dropdowns */
.shipping-form select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--color-text);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

.shipping-form select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Field hint text */
.field-hint {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin-top: 0.4rem;
  line-height: 1.45;
  font-style: italic;
}

/* Form success state */
.form-success {
  text-align: center;
  padding: 2rem 1rem;
}

.form-success svg {
  width: 48px;
  height: 48px;
  color: var(--color-accent);
  margin-bottom: 1rem;
}

.form-success h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
}

.form-success p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

/* Form error */
.form-error {
  background: #FFF0F0;
  color: #C0392B;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}
.form-error.visible { display: block; }

/* ============================================================
   DESKTOP OVERRIDES (768px+)
   ============================================================ */
@media (min-width: 768px) {
  :root {
    --section-padding: 5rem 2rem;
  }

  /* Hero: two-column layout via grid areas */
  .hero {
    padding: 3rem 2rem;
  }

  .hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "logo   image"
      "sub    image"
      "price  image"
      "gate   image"
      "btns   image";
    gap: 0 2.5rem;
    align-items: center;
    max-width: 960px;
    text-align: left;
  }

  .hero-logo         { grid-area: logo; margin: 0 auto 0.5rem; max-width: 160px; align-self: end; }
  .hero-subtitle     { grid-area: sub; text-align: center; }
  .hero-image-wrap   { grid-area: image; max-height: none; border-radius: 8px; aspect-ratio: 4 / 3; align-self: center; }
  .hero-price        { grid-area: price; text-align: center; }
  .hero-gate         { grid-area: gate; justify-content: center; }
  .hero-buttons      { grid-area: btns; max-width: 380px; margin: 0 auto; }

  /* Carousel constrained on desktop */
  .carousel-container {
    max-width: 380px;
  }

  .carousel-section {
    padding: 4rem 0;
  }

  /* Included list */
  .included h2, .included-intro { text-align: center; }

  .cta-buttons {
    flex-direction: row;
    max-width: 600px;
  }
  .cta-buttons .btn { flex: 1; }
}

/* Large desktop */
@media (min-width: 1024px) {
  .hero-inner {
    max-width: 1060px;
    gap: 0 3.5rem;
  }
}

/* ============================================================
   ANIMATIONS — entrance fade-up on scroll
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.fade-up-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.fade-up-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}
.fade-up-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.fade-up-stagger.visible > *:nth-child(2) { transition-delay: 0.08s; }
.fade-up-stagger.visible > *:nth-child(3) { transition-delay: 0.16s; }
.fade-up-stagger.visible > *:nth-child(4) { transition-delay: 0.08s; }
.fade-up-stagger.visible > *:nth-child(5) { transition-delay: 0.16s; }
.fade-up-stagger.visible > *:nth-child(6) { transition-delay: 0.24s; }

/* Button press micro-interaction */
.btn:active {
  transform: translateY(0) scale(0.98);
}

/* ============================================================
   LOADING SPINNER (for form submit)
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
