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

:root {
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f7;
  --color-text: #1d1d1f;
  --color-text-secondary: #86868b;
  --color-text-tertiary: #515154;
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-border: #d2d2d7;
  --color-card-bg: #ffffff;
  --color-nav-bg: rgba(245, 245, 247, 0.85);
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --max-width: 980px;
  --max-width-narrow: 720px;
  --transition-theme: background 0.3s ease, color 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease;
  color-scheme: light;
}

.i18n-loading [data-i18n] {
  visibility: hidden;
}

/* Dark theme — explicit user choice */
:root[data-theme="dark"] {
  --color-bg: #000000;
  --color-bg-secondary: #1c1c1e;
  --color-text: #f5f5f7;
  --color-text-secondary: #98989d;
  --color-text-tertiary: #98989d;
  --color-accent: #0a84ff;
  --color-accent-hover: #409cff;
  --color-border: #38383a;
  --color-card-bg: #1c1c1e;
  --color-nav-bg: rgba(29, 29, 31, 0.85);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

/* Dark theme — follow system preference (only when no explicit theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #000000;
    --color-bg-secondary: #1c1c1e;
    --color-text: #f5f5f7;
    --color-text-secondary: #98989d;
    --color-text-tertiary: #98989d;
    --color-accent: #0a84ff;
    --color-accent-hover: #409cff;
    --color-border: #38383a;
    --color-card-bg: #1c1c1e;
    --color-nav-bg: rgba(29, 29, 31, 0.85);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.24);
    color-scheme: dark;
  }
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.47059;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: var(--transition-theme);
}

/* === Typography === */
h1 {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h4 {
  font-size: 1.17rem;
  font-weight: 600;
  line-height: 1.3;
}

p {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

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

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* === Layout Helpers === */
.features-lead {
  max-width: 600px;
  margin: 12px auto 0;
}

.screenshots-lead {
  max-width: 560px;
  margin: 12px auto 0;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--color-bg-secondary);
}

.section-sm {
  padding: 48px 0;
}

/* === Navigation === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo:hover {
  text-decoration: none;
  color: var(--color-text);
}

.nav-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.nav-logo-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0;
}

.nav-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.nav-btn-lang {
  width: auto;
  max-width: 9rem;
  padding: 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav-btn-menu {
  display: none;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 28px;
  font-size: 0.94rem;
  font-weight: 500;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
  letter-spacing: 0;
  min-height: 44px;
  text-align: center;
  overflow-wrap: anywhere;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}

.btn-outline:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-md);
}

.hero-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.hero h1 {
  margin-bottom: 12px;
}

.hero .subtitle {
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* === Features === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.feature-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.feature-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.94rem;
  color: var(--color-text-tertiary);
  line-height: 1.55;
}

/* === Screenshots === */
.screenshots-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 16px 2px 24px;
  scroll-padding-inline: 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.screenshots-wrap {
  margin-top: 32px;
}

.screenshots-scroll::-webkit-scrollbar {
  display: none;
}

.screenshot-frame {
  flex: 0 0 260px;
  scroll-snap-align: start;
  text-align: center;
}

.screenshot-frame img {
  width: 260px;
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  display: block;
}

.screenshot-caption {
  font-size: 0.78rem;
  color: var(--color-text-tertiary);
  margin-top: 10px;
  line-height: 1.4;
  max-width: 260px;
}

/* === Screenshot Nav Buttons === */
.screenshots-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  padding-right: 2px;
}

.screenshots-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: opacity 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.screenshots-arrow:hover {
  transform: scale(1.08);
}

.screenshots-arrow:active {
  transform: scale(0.95);
}

.screenshots-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.screenshots-arrow svg {
  width: 18px;
  height: 18px;
}

/* Keep placeholder for fallback */
.screenshot-placeholder {
  flex: 0 0 260px;
  height: 520px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
}

/* === Download Section === */
.download-section {
  text-align: center;
}

.download-section h2 {
  margin-bottom: 10px;
}

.download-section p {
  margin-bottom: 28px;
}

/* === Footer === */
.footer {
  background: var(--color-bg-secondary);
  padding: 40px 0;
  text-align: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.footer-links a:hover {
  color: var(--color-text);
}

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

/* === Mobile Menu === */
.mobile-menu {
  position: fixed;
  top: 52px;
  left: 0;
  width: 100%;
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
  background: var(--color-bg);
  z-index: 90;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow-y: auto;
  pointer-events: none;
}

.mobile-menu[hidden] {
  display: none;
}

.mobile-menu.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-menu-inner {
  padding: 24px 16px;
}

.mobile-nav-links {
  list-style: none;
}

.mobile-nav-links li {
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav-links li:last-child {
  border-bottom: none;
}

.mobile-nav-links a {
  display: block;
  padding: 16px 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.mobile-nav-links a:hover {
  color: var(--color-accent);
}

.mobile-menu-controls {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.mobile-menu-btn {
  flex: 1 1 0;
  min-width: 0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
}

/* === Legal Pages (Privacy, Terms, Support) === */
.legal-page {
  padding: 60px 0 80px;
}

.legal-page h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.legal-page .last-updated {
  font-size: 0.88rem;
  color: var(--color-text-tertiary);
  margin-bottom: 40px;
}

.legal-page h2,
.legal-page strong {
  display: block;
  font-size: 1.17rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 32px;
  margin-bottom: 8px;
}

.legal-page p {
  margin-bottom: 12px;
}

.legal-page ul {
  margin: 8px 0 16px 24px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.legal-page ul li {
  margin-bottom: 6px;
}

/* === Support Page === */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.faq-item:first-child {
  border-top: 1px solid var(--color-border);
}

.faq-item h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--color-text);
}

.faq-item p {
  font-size: 0.94rem;
}

.contact-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 40px;
  text-align: center;
}

.contact-card h3 {
  margin-bottom: 8px;
}

.contact-card p:last-child {
  margin-bottom: 0;
}

.contact-card .email {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--color-accent);
  margin: 10px 0 8px;
}

.test-item {
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.test-item:first-of-type {
  border-top: 1px solid var(--color-border);
}

.test-item h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.test-item p,
.test-item li {
  font-size: 0.94rem;
}

.test-item .email {
  font-size: 1.05rem;
  font-weight: 500;
  margin-top: 10px;
}

.test-download {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 40px;
  text-align: center;
}

.test-download p {
  font-size: 0.94rem;
  margin: 18px 0 0;
}

.not-found {
  padding-top: 120px;
  padding-bottom: 120px;
}

.not-found-code {
  font-size: 4rem;
  color: var(--color-text-tertiary);
  margin-bottom: 16px;
}

.not-found-text {
  font-size: 1.15rem;
  margin-bottom: 24px;
}

/* === Responsive === */
@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero {
    padding-top: 96px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .container,
  .container-narrow {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .section {
    padding: 56px 0;
  }

  .hero {
    padding: 60px 0 52px;
  }

  .hero-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
  }

  .hero h1 {
    margin-bottom: 8px;
  }

  .hero .subtitle {
    font-size: 1.15rem;
    margin-bottom: 24px;
    line-height: 1.5;
    max-width: 20.5rem;
    margin-left: auto;
    margin-right: auto;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;
  }

  .feature-card {
    padding: 24px 20px;
  }

  .nav-btn-lang,
  .nav-btn:not(.nav-btn-menu) {
    display: none;
  }

  .nav-btn-menu {
    display: inline-flex;
  }

  .nav-logo span {
    font-size: 0.92rem;
  }

  .nav-inner {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .mobile-menu-inner {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .screenshots-arrow {
    display: none;
  }

  .legal-page h1 {
    font-size: 2rem;
  }

  .screenshot-placeholder {
    flex: 0 0 220px;
    height: 440px;
  }

  .screenshots-scroll {
    padding-left: 0;
    padding-right: 0;
    scroll-padding-inline: 0;
  }

  .screenshot-frame {
    flex: 0 0 min(220px, 72vw);
  }

  .screenshot-frame img {
    width: min(220px, 72vw);
  }

  .screenshot-caption {
    max-width: min(220px, 72vw);
  }

  .download-section {
    padding-bottom: 64px;
  }

}

@media (max-width: 420px) {
  html {
    font-size: 16px;
  }

  .nav-logo {
    min-width: 0;
  }

  .nav-logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-actions .btn,
  .download-section .btn {
    width: auto;
    max-width: min(100%, 16.5rem);
    padding-left: 20px;
    padding-right: 20px;
  }

  .mobile-menu-controls {
    flex-direction: column;
    align-items: center;
  }

  .mobile-menu-btn {
    flex: 0 0 auto;
    width: min(100%, 16rem);
  }

  .contact-card,
  .test-download {
    padding: 24px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* === Utility === */
.text-center {
  text-align: center;
}

#features h2,
#features > .container > p,
#screenshots h2,
#screenshots > .container > p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.mt-2 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 16px;
}
