:root {
  --white: #ffffff;
  --gray-100: #f4f4f4;
  --gray-200: #eeeeee;
  --text: #444444;
  --text-heading: #3e3e3e;
  --text-muted: #888888;
  --accent: #43b3e0;
  --accent-hover: #43bff0;
  --nav: #f6bb43;
  --nav-dark: #e5a82e;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --max-width: 1140px;
  --nav-height: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 400;
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

h1, h2, h3 {
  color: var(--text-heading);
  line-height: 1.2;
  margin: 0 0 0.75em;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 1.25em;
  color: var(--text);
}

p:last-child {
  margin-bottom: 0;
}

.container {
  width: min(var(--max-width), calc(100% - 48px));
  margin-inline: auto;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--nav);
  box-shadow: var(--shadow-sm);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav__links::-webkit-scrollbar {
  display: none;
}

.nav__links a {
  display: block;
  padding: 8px 14px;
  color: var(--text-heading);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav__links a:hover {
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-heading);
}

/* Language picker (scrollable, searchable dropdown that scales to many
   languages without widening the nav). */
.lang-select {
  position: relative;
  flex-shrink: 0;
}

.lang-select__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-heading);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.2s ease;
}

.lang-select__toggle:hover {
  background: rgba(255, 255, 255, 0.6);
}

.lang-select__flag {
  width: 22px;
  height: auto;
  border-radius: 2px;
  flex-shrink: 0;
}

.lang-select__name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.lang-select__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s ease;
}

.lang-select__toggle[aria-expanded="true"] .lang-select__caret {
  transform: rotate(180deg);
}

.lang-select__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  max-width: calc(100vw - 32px);
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  z-index: 200;
}

.lang-select__search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  margin-bottom: 8px;
}

.lang-select__search:focus {
  border-color: var(--accent);
}

.lang-select__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lang-select__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  transition: background 0.15s ease;
}

/* `display: flex` above overrides the hidden attribute's default display:none,
   so restore it explicitly for filtered-out options. */
.lang-select__option[hidden] {
  display: none;
}

.lang-select__option:hover {
  background: var(--gray-100);
}

.lang-select__option.is-active {
  background: rgba(67, 179, 224, 0.14);
  color: var(--accent);
}

.lang-select__option img {
  width: 22px;
  height: auto;
  border-radius: 2px;
  flex-shrink: 0;
}

.lang-select__empty {
  margin: 4px 0 0;
  padding: 8px 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* The picker stays left-aligned to the toggle even in RTL layouts. */
[dir="rtl"] .lang-select__panel {
  right: auto;
  left: 0;
}

/* Sections */
.section {
  padding: 80px 0;
}

.section--alt {
  background: var(--gray-200);
}

.section--hero {
  padding-top: calc(var(--nav-height) + 64px);
  padding-bottom: 80px;
  background: linear-gradient(180deg, var(--white) 0%, var(--gray-100) 100%);
}

.section__grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 48px;
  align-items: center;
  direction: ltr;
}

/* Media on the right: swap column widths and reorder, independent of text
   direction so the alternation is identical in every language. */
.section__grid--reverse {
  grid-template-columns: 1.4fr 1fr;
}

.section__grid--reverse .phone-frame {
  order: 2;
}

.section__grid--reverse .section__content {
  order: 1;
}

.section__content {
  max-width: 560px;
}

.section__content--right {
  margin-left: auto;
  text-align: right;
}

.section__label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section__text {
  font-size: 1.05rem;
  line-height: 1.75;
}

/* Device mockup: iPhone frame overlaid on top of a screenshot / video */
.phone-frame {
  display: flex;
  justify-content: center;
}

.device {
  position: relative;
  width: min(270px, 82%);
  aspect-ratio: 376 / 776; /* matches img/iphone_frame.png */
  margin: 0 auto;
  filter: drop-shadow(0 22px 45px rgba(0, 0, 0, 0.18));
  transition: transform 0.4s ease;
}

.device:hover {
  transform: translateY(-6px);
}

/* The frame PNG sits on top; its transparent screen reveals the media. */
.device__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

/* Media is inset to the frame's transparent screen area and tucked a hair
   under the bezel so no gap shows at the edges. */
/*.device__media {
  position: absolute;
  top: 0.6%;
  bottom: 0.6%;
  left: 2.4%;
  right: 2.4%;
  width: auto;
  height: auto;
  object-fit: cover;
  object-position: top center;
  border-radius: 7% / 3.4%;
  background: #fff;
  z-index: 1;
  display: block;
}*/

.device__media {
  position: absolute;

  /* Make video/image slightly larger than the visible screen */
  top: 1.1%;
  left: 2.2%;
  width: 95.6%;
  height: 97.8%;

  object-fit: cover;
  object-position: top center;

  border-radius: 9% / 4.5%;
  background: #fff;
  z-index: 1;
  display: block;
}

/* Auto-rotating carousel (one phone per block) */
.carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.carousel__stage {
  position: relative;
  width: min(260px, 78%);
  aspect-ratio: 1179 / 2556;
  border-radius: 30px;
  background: var(--gray-100);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.carousel__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}

.carousel__slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.carousel__dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.carousel__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel__dot:hover {
  background: rgba(0, 0, 0, 0.32);
}

.carousel__dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

/* Video */
.video-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Store badges & links */
.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 28px;
}

.store-badges img {
  height: 52px;
  width: auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-badges a:hover img {
  transform: scale(1.04);
  opacity: 0.92;
}

.doc-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.doc-links a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Footer */
.footer {
  padding: 48px 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

.footer__contact {
  font-size: 0.95rem;
  line-height: 1.8;
}

.footer__contact a {
  font-weight: 600;
}

.footer__social {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.footer__social img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.footer__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.footer__badges img {
  height: 46px;
  width: auto;
}

.g-plusone {
  margin-top: 16px;
}

/* Responsive */
@media (max-width: 900px) {
  .section {
    padding: 56px 0;
  }

  .section--hero {
    padding-top: calc(var(--nav-height) + 40px);
  }

  .section__grid,
  .section__grid--reverse {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  /* Single column on mobile: media always on top, text below. */
  .section__grid .phone-frame,
  .section__grid--reverse .phone-frame {
    order: -1;
  }

  .section__grid .section__content,
  .section__grid--reverse .section__content {
    order: 0;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer__badges {
    justify-content: center;
  }

  .footer__social {
    justify-content: center;
  }
}

/* RTL (Farsi) */
[dir="rtl"] body {
  text-align: right;
}

/* The grid layout is locked to LTR for consistent alternation, so restore
   right-to-left reading direction inside text content for Farsi. */
[dir="rtl"] .section__content {
  direction: rtl;
}

[dir="rtl"] .store-badges {
  justify-content: flex-start;
}

[dir="rtl"] .footer__badges {
  justify-content: flex-start;
}

[dir="rtl"] .nav__links {
  padding-right: 0;
}

@media (max-width: 600px) {
  .container {
    width: calc(100% - 32px);
  }

  .nav__links a {
    padding: 8px 10px;
    font-size: 0.8125rem;
  }

  .store-badges {
    flex-direction: column;
    align-items: flex-start;
  }

  .section__content--right .store-badges {
    align-items: flex-end;
  }

  .carousel__stage {
    width: min(280px, 82%);
  }
}
