/* Pre-calculate common font sizes to prevent layout shift */
:root {
  --font-size-h1: 3rem;
  --font-size-h2: 2.5rem;
  --font-size-h3: 1.5rem;
  --font-size-body: 1rem;
  --font-size-large: 1.2rem;
}

html {
  height: 100%;
  overflow: hidden;
}

/* General Body Styles */
body {
  font-family: 'Comfortaa', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #333;
  font-size: var(--font-size-body);
  font-weight: 400;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Font loading states will override the font-family */
.fonts-loaded body {
  font-family: 'Comfortaa', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.container {
  width: 90%;
  max-width: 1100px;
  margin: auto;
  padding: 20px 0;
  position: relative;
  z-index: 2;
}

/* Header and Hero Section */
.hero-section {
  background: #fff;
  color: #000;
  text-align: center;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero-logo {
  position: absolute;
  top: 54%;
  transform: translate(-50%, -50%);
  max-width: 470px;
  height: auto;
  opacity: 1;
  z-index: 1;
  mix-blend-mode: multiply;
  filter: contrast(1.1) brightness(1.2);
}

.hero-logo-left {
  left: 23%;
  max-width: 240px;
}

.hero-logo-right {
  left: 77%;
  max-width: 230px;
  top: 56%;
}

.hero-section .container {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 450px;
}

.hero-section h1 {
  font-size: var(--font-size-h1);
  margin-bottom: 10px;
  font-weight: 700;
}

.hero-section .subheadline {
  font-size: large;
  margin-bottom: 30px;
  font-weight: bold;
}

.cta-button {
  display: inline-block;
  background: #007bff;
  color: #fff;
  padding: 15px 30px;
  text-decoration: none;
  border-radius: 5px;
  font-size: 1.1rem;
  transition: background 0.3s ease;
}

.cta-button:hover {
  background: #0056b3;
}

/* Section Styling */
section {
  padding: 20px 0 60px 0;
  text-align: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

section h2 {
  font-size: var(--font-size-h2);
  margin-bottom: 20px;
  font-weight: 700;
}

/* Problem and Solution Sections */
.problem-section,
.solution-section {
  position: relative;
  overflow: hidden;
}

.background-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 0;
}

.grid-image {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.grid-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.problem-section .container,
.solution-section .container {
  position: relative;
  z-index: 2;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 15px;
  padding: 30px;
  margin: 20px auto;
}

.problem-section .scenario {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 5px solid rgba(0, 123, 255, 0.8);
  border-radius: 8px;
  padding: 25px;
  margin: 10px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, backdrop-filter 0.2s ease;
}

.problem-section .scenario:hover {
  transform: translateY(-2px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.solution-section {
  background: #f4f4f4;
}

/* Features Section */
.features-section {
  background: #fff;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  text-align: left;
}

.feature {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 5px;
}

.feature h3 {
  font-size: var(--font-size-h3);
  margin-bottom: 10px;
  font-weight: 700;
}

/* Future Section */
.future-section {
  background: #fff;
}

.future-section ul {
  list-style: none;
  padding: 0;
}

.future-section li {
  margin: 10px 0;
  font-size: 1.1rem;
}

.future-section li strong {
  font-weight: 700;
}

/* Call to Action (Signup) Section */
.cta-section {
  background: #007bff;
  color: #fff;
}

.cta-section form {
  margin-top: 20px;
}

.cta-section input[type="email"] {
  padding: 15px;
  width: 300px;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
}

.cta-section button {
  padding: 15px 30px;
  border: none;
  background: #333;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.cta-section button:hover {
  background: #555;
}

/* Footer */
footer {
  background: #333;
  color: #fff;
  text-align: center;
  padding: 20px 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.problem-scenarios {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin: 40px 0;
}

.scenario {
  background-color: #f9f9f9;
  border-left: 5px solid #007bff;
  padding: 20px;
  text-align: left;
}

.scenario p {
  margin: 0;
  font-size: 1.1rem;
}

/* --- Readability Improvements --- */
.problem-section .container>p,
.solution-section .container>p {
  max-width: 75ch;
  margin-left: auto;
  margin-right: auto;
}

.future-section .container>p {
  font-size: x-large;
}

#footer-logo {
  display: none;
}

.solution-section h2 span {
  display: inline-block;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .hero-logo-right {
    display: none;
  }

  .hero-logo-left {
    left: 50%;
    max-width: 100vw;
    top: 50%;
  }

  .hero-section .container {
    animation: fadeIn 0.8s ease-out;
    animation-delay: 1.5s;
    animation-fill-mode: backwards;
    background: rgba(255, 255, 255, 0.7);
    height: 100vh;
    margin: 0;
    padding: 0;
  }

  .hero-section {
    padding: 0;
    min-height: 100vh;
  }

  .hero-section h1,
  .hero-section .subheadline {
    color: #000;
    text-shadow: none;
  }

  .problem-scenarios {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Problem section - first and last images */
  .problem-section .background-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 50% 50%;
  }

  .problem-section .grid-image:nth-child(2),
  .problem-section .grid-image:nth-child(3) {
    display: none;
  }

  /* Solution section - only last image */
  .solution-section .background-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .solution-section .grid-image:not(:last-child) {
    display: none;
  }

  .problem-section .container,
  .solution-section .container {
    padding: 20px;
  }

  .feature {
    padding: 0 20px;
  }

  .features-grid {
    gap: 0;
  }

  /* Hide the original logo in the header on mobile */
  .hero-logo-right {
    display: none;
  }

  /* Style the footer for mobile view */
  footer {
    background-color: white;
    color: #333;
    /* Change text color for readability on white background */
    text-align: center;
    padding: 0;
  }

  /* Ensure footer headings and paragraphs also change color */
  footer h2,
  footer .tagline,
  footer p {
    color: #333;
  }

  /* Show the footer logo only on mobile */
  .container>#footer-logo {
    display: block;
    margin: 0 auto 10px;
    width: 70vw;
  }
}

.tagline {
  font-style: italic;
  opacity: 0.9;
  font-size: 1.1rem;
  margin-top: -10px;
  /* Pulls it a bit closer to the main heading */
  margin-bottom: 25px;
}

/* Interactive elements keep system fonts for better readability */
.cta-button,
button,
input {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Snap Points */
.hero-section,
section,
footer {
  width: 100%;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
}