/* ============================================================
   OPTIMISED STYLESHEET — Cross-Device & Cross-Platform
   ============================================================
   Changes summary:
   - Added @import for Google Fonts with display=swap for perf
   - Used logical properties where appropriate
   - Fixed iOS/Safari tap highlight & font rendering quirks
   - Added safe-area insets for iPhone notch / home bar
   - Fixed -webkit-backdrop-filter for Safari
   - Replaced animation shorthand that can break in older Safari
   - Added prefers-reduced-motion media query
   - Fixed .mobile-floating-btn conflicting media queries
   - Added touch-action & -webkit-tap-highlight-color on buttons
   - Added min-height: 0 / min-width: 0 on grid/flex children
   - Improved scrollbar normalisation
   - Added vendor prefixes where still needed
   - Normalised form / button resets for Firefox & Safari
   - Added text-size-adjust to prevent Safari auto-zooming
   - Improved focus-visible styles for keyboard navigation
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* ── Custom Properties ────────────────────────────────────── */
:root {
  /* Colors */
  --primary:             #28a745;
  --primary-hover:       #218838;
  --text-dark:           #111827;
  --text-light:          #4b5563;
  --text-lighter:        #6b7280;
  --bg-white:            #ffffff;
  --bg-light:            #f8fafc;
  --accent-blue:         #007bff;
  --red-alert:           #dc2626;
  --yellow-alert:        #fef08a;
  --yellow-alert-border: #fde047;

  /* Typography */
  --font-display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --spacing-1:  0.25rem;
  --spacing-2:  0.5rem;
  --spacing-3:  0.75rem;
  --spacing-4:  1rem;
  --spacing-6:  1.5rem;
  --spacing-8:  2rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;

  /* Border Radius */
  --radius:      0.375rem;
  --radius-lg:   0.5rem;
  --radius-full: 9999px;

  /* Container Width */
  --container-max: 1152px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  color: var(--text-dark);
  background-color: var(--bg-white);
  line-height: 1.5;
  scroll-behavior: smooth;

  /* Prevent Safari auto-font-size inflation on rotation */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
       text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent overscroll bounce issues on iOS */
  overscroll-behavior-y: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  /* Prevent broken-image icon on Safari */
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  /* Remove the blue highlight on tap (iOS / Android) */
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  /* Normalize appearance across Firefox, Safari, Chrome */
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  /* Remove mobile tap flash */
  -webkit-tap-highlight-color: transparent;
  /* Allow touch gestures on buttons */
  touch-action: manipulation;
}

/* Accessible focus ring (keyboard only) */
:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

strong {
  font-weight: 700;
}

/* ── Typography Utilities ─────────────────────────────────── */
.font-display   { font-family: var(--font-display); }
.text-primary   { color: var(--primary); }
.text-red       { color: var(--red-alert); }
.text-accent-blue { color: var(--accent-blue); }
.text-muted     { color: var(--text-lighter); }
.italic         { font-style: italic; }
.uppercase      { text-transform: uppercase; }
.text-center    { text-align: center; }

h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem); /* fluid between mobile & desktop */
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: var(--spacing-4);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 700;
  margin-bottom: var(--spacing-6);
  font-family: var(--font-display);
}

h3 {
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 700;
  margin-bottom: var(--spacing-4);
  font-family: var(--font-display);
}

h4 {
  font-size: 1rem;
  font-weight: 700;
}

p {
  margin-bottom: var(--spacing-4);
}

/* ── Layout Containers ────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin-inline: auto; /* logical property — safe in all modern browsers */
  padding-inline: var(--spacing-4);
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-8);
  padding-top: var(--spacing-8);
  padding-bottom: var(--spacing-8);
}

/* ── Header / Banner ──────────────────────────────────────── */
.top-banner {
  background-color: var(--primary);
  color: white;
  padding: var(--spacing-2) var(--spacing-4);
  position: sticky;
  top: 0;
  /* Account for iOS status bar / notch */
  padding-top: max(var(--spacing-2), env(safe-area-inset-top));
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.top-banner-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.banner-left,
.banner-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  /* Prevent flex children collapsing below content size */
  min-width: 0;
}

.banner-right {
  display: none; /* revealed at ≥768 px */
}

.pulse-emoji {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  /* Ensure emoji renders correctly on Windows */
  font-style: normal;
}

.btn-banner {
  background-color: white;
  color: var(--primary);
  padding: 0.25rem 1rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  transition: background-color 0.2s ease;
  /* Needed for Safari to treat <a> inside banner as a button */
  display: inline-block;
}

.btn-banner:hover {
  background-color: var(--bg-light);
}

/* ── Alert Box ────────────────────────────────────────────── */
.alert-box {
  background-color: #FFF9E1;
  border: 1px solid #FFF9E1;
  padding: var(--spacing-4);
  text-align: center;
  font-size: 0.875rem;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-8);
}

/* ── Author Meta ──────────────────────────────────────────── */
.author-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  border-top: 1px solid var(--bg-light);
  border-bottom: 1px solid var(--bg-light);
  padding: var(--spacing-4) 0;
  margin-bottom: var(--spacing-8);
  /* Prevent overflow of long names on narrow screens */
  flex-wrap: wrap;
}

.author-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  object-fit: cover;
  /* Fix aspect ratio on older Safari */
  flex-shrink: 0;
}

.author-name {
  font-weight: 700;
  margin-bottom: 0;
}

.author-date {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-lighter);
  margin-bottom: 0;
}

/* ── Hero Image ───────────────────────────────────────────── */
.hero-image-container {
  position: relative;
  margin-bottom: var(--spacing-12);
}

.hero-img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.time-badge {
  position: absolute;
  top: var(--spacing-4);
  left: var(--spacing-4);
  background-color: rgba(40, 167, 69, 0.8);
  /* Safari requires both prefixed and unprefixed */
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  color: white;
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 1.125rem;
}

.expand-icon {
  position: absolute;
  bottom: var(--spacing-4);
  right: var(--spacing-4);
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  color: white;
  padding: var(--spacing-2);
  border-radius: var(--radius-full);
  transition: transform 0.2s ease;
}

.expand-icon:hover {
  transform: scale(1.1);
}

/* ── Article Content ──────────────────────────────────────── */
.article-content {
  font-size: 1.125rem;
  margin-bottom: var(--spacing-12);
  color: var(--text-light);
}

/* ── Comparison Grid ──────────────────────────────────────── */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-12);
}

.card {
  background-color: var(--bg-light);
  padding: var(--spacing-4);
  border-radius: var(--radius-lg);
  border: 1px solid #e5e7eb;
  /* Prevent grid blowout */
  min-width: 0;
}

.card-primary {
  border-color: rgba(40, 167, 69, 0.3);
}

.card-img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-4);
}

.card-title {
  margin-bottom: var(--spacing-2);
  text-transform: uppercase;
  font-size: 0.875rem;
}

/* ── Features Section ─────────────────────────────────────── */
.features-section {
  margin-bottom: var(--spacing-12);
}

.diagram-container {
  position: relative;
  margin-bottom: var(--spacing-8);
}

.diagram-img {
  width: 100%;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 4px solid white;
}

.annotation {
  display: none;
  position: absolute;
  background-color: var(--accent-blue);
  color: white;
  font-size: 0.625rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  font-weight: 700;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  /* Prevent annotation text from wrapping oddly */
  white-space: nowrap;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: var(--spacing-6);
}

.feature-item {
  display: flex;
  gap: var(--spacing-4);
  /* Prevent long words breaking layout */
  word-break: break-word;
  overflow-wrap: break-word;
}

.feature-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.feature-title {
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 1);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  margin-bottom: var(--spacing-1);
}

.feature-desc {
  font-size: 0.875rem;
  color: var(--text-lighter);
  margin-bottom: 0;
}

/* ── Buttons ──────────────────────────────────────────────── */

/* Shared interactive properties for all CTA buttons */
.btn-cta,
.btn-primary-large,
.btn-secondary,
.btn-floating {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-cta-wrapper {
  background-color: var(--primary);
  padding: 0.25rem;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-12);
}

.btn-cta {
  width: 100%;
  padding: var(--spacing-4);
  background-color: var(--primary);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
  letter-spacing: -0.025em;
  transition: background-color 0.2s ease;
}

.btn-cta:hover {
  background-color: var(--primary-hover);
}

.btn-primary-large {
  width: 100%;
  padding: var(--spacing-6) var(--spacing-4);
  background-color: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  margin-bottom: var(--spacing-16);
  transition: transform 0.2s ease;
  /* Inline-block ensures correct sizing when used as <a> */
  display: inline-block;
  text-align: center;
}

.btn-primary-large:hover {
  transform: scale(1.02);
}

.btn-secondary {
  width: 100%;
  padding: var(--spacing-4);
  background-color: var(--primary);
  color: white;
  font-weight: 700;
  border-radius: var(--radius-lg);
  text-transform: uppercase;
  font-size: 0.875rem;
  transition: background-color 0.2s ease;
  margin-bottom: var(--spacing-8);
}

.btn-secondary:hover {
  background-color: var(--primary-hover);
}

.btn-floating {
  width: 100%;
  padding: var(--spacing-4);
  background-color: var(--primary);
  color: white;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  font-size: 0.875rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-2);
}

/* ── Testimonials ─────────────────────────────────────────── */
.testimonials {
  margin-bottom: var(--spacing-12);
}

.testimonial-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-8);
}

.testimonial-img {
  width: 100%;
  height: 16rem;
  object-fit: cover;
  border-radius: var(--radius);
}

.testimonial-content h4 {
  margin-bottom: var(--spacing-1);
}

.testimonial-quote {
  font-style: italic;
  color: var(--text-light);
  margin-bottom: var(--spacing-4);
}

.testimonial-author {
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* ── Guarantee Box ────────────────────────────────────────── */
.guarantee-box {
  background-color: var(--bg-light);
  border: 1px solid #e5e7eb;
  padding: var(--spacing-8);
  border-radius: 0.75rem;
  margin-bottom: var(--spacing-12);
}

.guarantee-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-8);
  padding: var(--spacing-6) 0;
}

.seal-container {
  position: relative;
  width: 10rem;
  height: 10rem;
  flex-shrink: 0;
}

.seal-pulse {
  position: absolute;
  inset: 0;
  background-color: #fbbf24;
  border-radius: var(--radius-full);
  opacity: 0.2;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.seal-inner {
  background-color: var(--text-dark);
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  border: 8px solid #fbbf24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-4);
  position: relative;
  z-index: 10;
}

.seal-number  { color: #fbbf24; font-weight: 700; font-size: 2.25rem; line-height: 1; }
.seal-text-lg { color: white; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.seal-text-sm { color: white; font-size: 0.625rem; line-height: 1.2; }

/* ── Comments ─────────────────────────────────────────────── */
.comments-section {
  border-top: 1px solid #e5e7eb;
  padding-top: var(--spacing-12);
}

.comment-list {
  display: grid;
  gap: var(--spacing-8);
}

.comment-item {
  display: flex;
  gap: var(--spacing-4);
  min-width: 0; /* prevent grid blowout */
}

.comment-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  background-color: #e5e7eb;
  flex-shrink: 0;
  object-fit: cover;
}

.comment-meta {
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: var(--spacing-1);
  /* Prevent long names overflowing on narrow screens */
  word-break: break-word;
}

.comment-actions {
  display: flex;
  gap: var(--spacing-4);
  color: var(--text-lighter);
  font-weight: 600;
  font-size: 0.75rem;
}

.comment-actions button:hover {
  text-decoration: underline;
}

/* ── Image Grid ───────────────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: var(--spacing-8);
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.image-grid:hover {
  opacity: 1;
}

.grid-img {
  width: 100%;
  height: 8rem;
  object-fit: cover;
  /* Ensure no gap under images caused by inline baseline */
  display: block;
}

/* ── Sidebar / Product Box ────────────────────────────────── */
.sidebar {
  display: none;
}

.product-box {
  background-color: var(--bg-white);
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  margin-bottom: var(--spacing-6);
}

.product-header {
  padding: var(--spacing-6);
  text-align: center;
  border-bottom: 1px solid var(--bg-light);
}

.product-body {
  padding: var(--spacing-6);
  position: relative;
}

.discount-badge {
  position: absolute;
  top: var(--spacing-4);
  left: var(--spacing-4);
  background-color: var(--red-alert);
  color: white;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: rotate(-12deg);
  z-index: 10;
  /* Prevent it clipping on small sidebars */
  white-space: nowrap;
}

.product-img {
  width: 100%;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-6);
}

.payment-icons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-3);
  flex-wrap: wrap; /* wrap on very narrow sidebar */
}

.payment-icon {
  height: 2rem;
}

.feature-box {
  background-color: rgba(40, 167, 69, 0.05);
  border: 1px solid rgba(40, 167, 69, 0.2);
  border-radius: 0.75rem;
  padding: var(--spacing-6);
}

.feature-box-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-4);
}

.small-feature-list {
  list-style: none;
  font-size: 0.875rem;
}

.small-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-3);
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background-color: var(--bg-light);
  border-top: 1px solid #e5e7eb;
  margin-top: 5rem;
  padding: 4rem 1rem 2rem;
  /* Respect home-bar space on iOS */
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.footer-content {
  max-width: 56rem;
  margin-inline: auto;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-lighter);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-6);
  border-top: 1px solid #e5e7eb;
  padding-top: var(--spacing-8);
  margin-bottom: var(--spacing-12);
  flex-wrap: wrap; /* don't overflow on small screens */
}

.footer-links a:hover {
  text-decoration: underline;
}

.built-with {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  font-size: 0.625rem;
  opacity: 0.6;
}

/* ── Floating Bottom Bar ──────────────────────────────────── */
/*
   FIX: original code had conflicting rules — once in a bare block
   and again inside @media (max-width: 480px). This consolidates them.
   Default: shown on mobile (< 1024 px), hidden on desktop.
*/
.mobile-floating-btn {
  display: block;
  position: fixed;
  bottom: var(--spacing-4);
  /* Respect iOS notch / home bar */
  bottom: max(var(--spacing-4), env(safe-area-inset-bottom));
  left: var(--spacing-4);
  right: var(--spacing-4);
  z-index: 40;
}

/* Banner button variant (mobile only) */
.btn-banner-mobile {
  background-color: white;
  color: var(--primary);
  padding: 0.25rem 1rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-banner-mobile:hover {
  background-color: var(--bg-light);
}

/* ── Misc ─────────────────────────────────────────────────── */
#redirectBtn {
  cursor: pointer;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes pulse {
  0%,   100% { opacity: 1; }
  50%         { opacity: 0.5; }
}

/* Respect user motion preferences (accessibility) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Responsive: ≥ 768 px ─────────────────────────────────── */
@media (min-width: 768px) {
  /* Hide mobile-only link variants */
  .btn-link-mobile,
  .btn-banner-mobile {
    display: none;
  }

  h1 { font-size: 2.94rem; }
  h2 { font-size: 2.25rem; }

  .banner-right {
    display: flex;
  }

  .comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .annotation {
    display: block;
  }

  .annotation-1 { top: 20%; left: 20%; }
  .annotation-2 { top: 50%; left: 45%; }
  .annotation-3 { bottom: 20%; right: 30%; }

  .testimonial-item {
    flex-direction: row;
    align-items: flex-start;
  }

  .testimonial-item.reverse {
    flex-direction: row-reverse;
  }

  .testimonial-img {
    width: 100%;
    height: 16rem;
  }

  .guarantee-inner {
    flex-direction: row;
  }

  .image-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .testimonial-photo-row img {
    flex: none !important;
    width: 50% !important;
    height: 220px !important;
  }
}

/* ── Responsive: ≥ 1024 px ────────────────────────────────── */
@media (min-width: 1024px) {
  .main-layout {
    grid-template-columns: 8fr 4fr;
  }

  .sidebar {
    display: block;
  }

  .sidebar-inner {
    position: sticky;
    top: 6rem;
  }

  /* Hide mobile floating button on desktop */
  .mobile-floating-btn {
    display: none;
  }

  .testimonial-photo-row {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
  }

  .testimonial-photo-row img {
    border-radius: 4px;
    object-fit: cover;
    min-width: 0;
  }

  .photo-tall-wide {
    flex: 1.8;
    height: 315px;
  }

  .photo-tall-narrow {
    flex: 1;
    height: 315px;
  }
}