/* CSS Variables */
:root {
  --color-text: #333;
  --color-hero-text: #f9f9f9;
  --color-background: #f9f9f9;
  --color-heading: #222;
  --color-button-bg: #184ed8;
  --color-button-hover-bg: #184ed8;
  --color-footer-text: #777;
  --color-hero-background: #184ed8;
  --color-supplement: #ffb31a;

  --typo-h1-size: 5rem;
  --typo-h1-weight: 800;

  --typo-h2-size: 3rem;
}

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

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased; /* For WebKit browsers */
  -moz-osx-font-smoothing: grayscale; /* For Firefox on macOS */
}

a {
  color: var(--color-button-bg);
  text-decoration: none;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--color-hero-text);
  font-weight: 600;
}

.app-logo {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  box-shadow: 0px 3px 7px -2px rgba(0, 0, 0, 0.4);
}

.nav {
  position: fixed;
  width: 100%;
  padding: 2rem 1rem;
  background-color: var(--color-hero-background);
  z-index: 9999;
}

.nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-items {
  display: flex;
  gap: 2rem;
}

.nav-toggle {
  display: none;
  font-size: 2rem;
  color: var(--color-hero-text);
  background: none;
  border: none;
  cursor: pointer;
}

a.nav-item {
  color: var(--color-hero-text);
  opacity: 0.8;
  transition: opacity 0.3s ease-in-out;
}

a.nav-item:hover {
  opacity: 1;
}

/* Hero */
header.hero {
  padding: 8rem 0;
  margin-bottom: 19rem;
  width: 100%;
  background-color: var(--color-hero-background);
  height: 43rem;
}

.supplement {
  display: block;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-supplement);
}

.hero .container {
  margin-top: 3rem;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
}

.download-options {
  display: flex;
  gap: 1rem;
}

/* Screenshots */

.screenshots {
  position: relative;
  width: 22rem;
  height: 44rem;
}
.screenshot-container {
  position: absolute;
  height: auto;
}

.screenshot-frame {
  background-size: contain;
  overflow: hidden;
  background-repeat: no-repeat;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none; /* Prevent frame from interfering with interactions */
}

.screenshot {
  position: absolute;
  object-fit: cover;
  object-position: center;
  /* Safari-specific fixes */
  -webkit-transform: translateZ(0); /* Force hardware acceleration */
  transform: translateZ(0);
}

.screenshot-container.iphone-15-portrait {
  width: 22rem;
  height: 44rem; /* Explicit height for Safari */
}

.screenshot-container.iphone-15-portrait .screenshot-frame {
  background-image: url("/images/iphone-15-portrait.png");
}

.screenshot-container.iphone-15-portrait .screenshot {
  /* Position to match the screen area of the iPhone frame */
  top: 1.8rem;
  left: 1.8rem;
  right: 1.8rem;
  bottom: 2.4rem; /* Increased bottom margin to prevent screenshot from being too tall */
  width: calc(100% - 3.6rem);
  height: calc(100% - 4.33rem); /* Adjusted height to prevent overflow */
  border-radius: 2rem;
  /* Maintain aspect ratio while filling the area */
  aspect-ratio: 1419/2796;
}

.screenshot-container.google-pixel-8-rose-portrait {
  width: 20rem;
  height: 44rem; /* Explicit height for Safari */
}

.screenshot-container.google-pixel-8-rose-portrait .screenshot-frame {
  background-image: url("/images/google-pixel-8-rose-portrait.png");
}

.screenshot-container.google-pixel-8-rose-portrait .screenshot {
  /* Position to match the screen area of the Pixel frame - adjusted positioning */
  top: 1.04rem; /* Moved down slightly to align properly */
  left: 0.6rem;
  right: 0.6rem;
  bottom: 2.2rem;
  width: calc(100% - 1.49rem);
  height: calc(100% - 3.07rem); /* Adjusted for new top position */
  border-radius: 1rem;
  /* Maintain aspect ratio while filling the area */
  aspect-ratio: 978/2100;
}

/* Safari-specific fixes using @supports for older versions */
@supports not (aspect-ratio: 1) {
  .screenshot-container.iphone-15-portrait .screenshot {
    /* Use fixed dimensions based on container size for Safari */
    width: calc(22rem - 3.6rem);
    height: calc(44rem - 4.2rem);
  }

  .screenshot-container.google-pixel-8-rose-portrait .screenshot {
    /* Use fixed dimensions based on container size for Safari */
    width: calc(20rem - 1.2rem);
    height: calc(44rem - 3.3rem);
  }
}

.screenshot-page-icons {
  display: flex;
  justify-content: center;
  position: absolute;
  bottom: 0;
  width: 100%;
}
.screenshot-page-icon {
  height: 0.5rem;
  width: 0.5rem;
  background-color: var(--color-heading);
  border-radius: 0.5rem;
  opacity: 0.4;
  cursor: pointer;
  transition: width 100ms ease-in;
  &.active {
    width: 1rem;
    opacity: 1;
  }
  &:not(:first-child) {
    margin-left: 1em;
  }
}

/* Layout Helpers */
.container {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.hidden {
  display: none;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--color-heading);
}

h1 {
  color: var(--color-hero-text);
  font-size: var(--typo-h1-size);
  font-weight: var(--typo-h1-weight);
  line-height: 1;
  margin-bottom: 2rem;
}

h2 {
  font-size: var(--typo-h2-size);
  font-weight: var(--typo-h1-weight);
  text-align: center;
  color: var(--color-heading);
  margin: 0;
}

p {
  margin-bottom: 1rem;
}

/* Buttons */
.button {
  background-color: var(--color-button-bg);
  color: white;
  padding: 0.6rem 0.8rem;
  border-radius: 0.4rem;
  text-align: center;
  line-height: 1;
  font-weight: 600;
  transition: background-color 0.2s;
}

.hero .button {
  background-color: var(--color-hero-text);
  color: var(--color-hero-background);
  height: 40px;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 4rem 0;
  align-items: start;
}

.feature {
  display: flex;
  align-items: start;
  padding: 1rem;
  background-color: var(--color-background);
  border-radius: 0.5rem;
}

.feature-icon {
  font-size: 2rem;
  margin-right: 2rem;
  align-self: flex-start;
  &.has-image {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 6rem;
    height: 2rem;
  }
}

.feature h3 {
  font-size: 2rem;
  font-weight: 600;
  text-align: left;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* Support */
.support-modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 4rem 0;
  align-items: start;
}

.support-modules > *:only-child {
  grid-column: span 2;
}

.support-modules .module a {
  border-radius: 1rem;
  display: block;
  color: var(--color-background);
  background-color: var(--color-hero-background);
  padding: 2rem;
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  opacity: 0.8;
  transition: opacity 0.3s ease-in-out;
}

.support-modules .module a:hover {
  opacity: 1;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--color-footer-text);
  font-size: 0.875rem;
}

footer.container {
  margin: 8rem auto;
}

/* Legal */

.legal {
  padding: 4rem 0;
}

.legal .nav-top {
  margin-bottom: 4rem;
}

.legal h1 {
  color: var(--color-heading);
}

.legal h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 3rem 0 2rem;
  text-align: left;
}

.legal ul,
.legal ol {
  padding-left: 2rem;
  margin-bottom: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
  body {
    font-size: 0.9rem;
  }

  h1 {
    font-size: 4rem;
  }

  .button {
    padding: 0.5rem 1rem;
  }

  .container {
    padding: 0 0.5rem;
  }

  .nav {
    padding: 2rem 1rem;
  }

  header.hero {
    height: 65rem;
    margin-bottom: 13rem;
  }

  .hero .container {
    flex-wrap: wrap;
    margin-top: 1rem;
    flex-direction: column-reverse;
  }

  .screenshots {
    order: -1;
    margin: 0 auto;
  }

  .screenshot-page-icon {
    background-color: var(--color-hero-text);
  }

  .hero-statement {
    text-align: center;
    margin: 2rem auto 4rem;
  }

  .download-options {
    justify-content: center;
    margin: 0 auto;
  }

  header.hero {
    padding-bottom: 3rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .support-modules {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .legal .container {
    padding: 2rem;
  }

  .legal h2 {
    font-size: 1.6rem;
  }
}
