/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Account for sticky header when navigating to anchors */
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.55;
  color: #0f172a;
  background: #f7f8fb;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: rgba(10, 102, 255, 0.15);
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

a {
  color: #0a66ff;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

button {
  font: inherit;
  cursor: pointer;
}

:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --bg-soft: #eef1f7;
  --fg: #0f172a;
  --fg-muted: #5b6478;
  --primary: #0a66ff;
  --primary-dark: #0852cc;
  --border: #e3e7ee;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --container: 1120px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: -9999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  background: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  /* Respect iOS safe areas in landscape */
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.muted {
  color: var(--fg-muted);
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  /* Account for iOS notch when used as PWA */
  padding-top: env(safe-area-inset-top);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
}
.brand:hover {
  text-decoration: none;
}

.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand__name {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.nav__link {
  color: var(--fg);
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 8px;
}

.nav__link:hover,
.nav__link:focus {
  background: var(--bg-soft);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(40px, 6vw, 80px) 0 clamp(32px, 5vw, 64px);
  background: radial-gradient(1200px 500px at 80% -10%, #dbe7ff 0%, transparent 60%),
    radial-gradient(900px 400px at -10% 0%, #e7f0ff 0%, transparent 50%),
    var(--bg);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
}

.hero__content {
  max-width: 640px;
}

.badge {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--primary-dark);
  background: #e1ecff;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero__title {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 4.6vw, 2.6rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero__subtitle {
  margin: 0 0 24px;
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  color: var(--fg-muted);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  min-height: 44px;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--primary-dark);
}

.btn--secondary {
  background: #fff;
  color: var(--fg);
  border-color: var(--border);
}
.btn--secondary:hover {
  border-color: #cbd2dd;
  background: #fafbfd;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 0;
}

.meta__item {
  margin: 0;
}

.meta dt {
  font-size: 0.8rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.meta dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Phone stack ---------- */
.hero__media {
  position: relative;
  display: flex;
  justify-content: center;
}

.phone-stack {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 360 / 640;
  margin: 0 auto;
}

.phone {
  position: absolute;
  inset: 0;
  width: 80%;
  height: auto;
  border-radius: 28px;
  background: #e7ecf3;
  box-shadow: var(--shadow-md);
  border: 1px solid #d4d9e2;
  object-fit: cover;
  max-width: 100%;
}

.phone--front {
  left: 8%;
  top: 6%;
  z-index: 2;
  transform: rotate(-3deg);
}

.phone--back {
  right: 4%;
  top: 0;
  z-index: 1;
  transform: rotate(6deg) translateX(8%);
  opacity: 0.95;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(40px, 6vw, 80px) 0;
}

.section--alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section__head {
  margin-bottom: 24px;
}

.section__title {
  margin: 0 0 24px;
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  letter-spacing: -0.02em;
  font-weight: 800;
}

.section__lead {
  margin: -12px 0 0;
  color: var(--fg-muted);
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card__text {
  margin: 0;
  color: var(--fg-muted);
}

/* ---------- Steps ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  background: var(--bg);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.step__num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.step__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.step__text {
  margin: 0;
  color: var(--fg-muted);
}

/* ---------- Two-col ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.panel__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.panel__text {
  margin: 0;
  color: var(--fg-muted);
}

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.shot {
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.shot:hover,
.shot:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd2dd;
  outline: none;
}

.shot img {
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 640;
  object-fit: cover;
  background: #e7ecf3;
}

/* ---------- Download ---------- */
.download {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.download__card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.download__card--soft {
  background: var(--bg-soft);
  box-shadow: none;
}

.download__title {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.specs,
.bullets {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.specs__item,
.bullets li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--fg);
}
.specs__item:last-child,
.bullets li:last-child {
  border-bottom: 0;
}

.bullets li {
  position: relative;
  padding-left: 22px;
  border-bottom: 0;
  color: var(--fg-muted);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.specs__k {
  color: var(--fg-muted);
  margin-right: 6px;
}

/* ---------- QR code ---------- */
.qr {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.qr__img {
  width: clamp(160px, 55vw, 240px);
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.qr__caption {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
  max-width: 280px;
}

/* ---------- Footer ---------- */
.footer {
  background: #0f172a;
  color: #cdd5e3;
  padding: 28px 0 18px;
  margin-top: 40px;
  /* Account for iOS home indicator */
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.footer .brand__name {
  color: #fff;
}

.footer .muted {
  color: #8a96ad;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: space-between;
}

.footer__right {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer__link {
  color: #cdd5e3;
}
.footer__link:hover,
.footer__link:focus {
  color: #fff;
}

.footer__bottom {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #1e2a44;
  font-size: 0.9rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  /* dvh handles mobile address-bar collapse */
  max-height: 100dvh;
  width: 100%;
  height: 100%;
}

.lightbox::backdrop {
  background: rgba(8, 12, 24, 0.85);
  backdrop-filter: blur(4px);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox__inner {
  position: relative;
  width: min(96vw, 720px);
  max-height: 92vh;
  max-height: 92dvh;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.lightbox__img {
  max-width: 100%;
  max-height: 92vh;
  max-height: 88dvh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  background: #1e2a44;
}

.lightbox__close {
  position: absolute;
  top: max(-10px, calc(env(safe-area-inset-top) + 8px));
  right: max(-10px, calc(env(safe-area-inset-right) + 8px));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  border: 0;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: #f0f3f9;
  outline: none;
}

/* ---------- Focus ring ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 860px) {
  .hero__grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
  .cards {
    grid-template-columns: repeat(4, 1fr);
  }
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  .download {
    grid-template-columns: 1.1fr 0.9fr;
  }
  .footer__inner {
    flex-direction: row;
    align-items: center;
  }
}

@media (min-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ---------- Mobile-specific tweaks ---------- */
@media (max-width: 599px) {
  html {
    scroll-padding-top: 64px;
  }
  .header__inner {
    min-height: 56px;
    gap: 10px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .nav {
    gap: 2px 8px;
    font-size: 0.9rem;
  }
  .nav__link {
    padding: 6px 6px;
  }
  .brand__logo {
    width: 32px;
    height: 32px;
  }
  .brand__name {
    font-size: 0.95rem;
  }
  .hero {
    padding-top: 24px;
  }
  .hero__content {
    text-align: left;
  }
  .cta {
    gap: 10px;
  }
  .cta .btn {
    flex: 1 1 auto;
    min-width: 140px;
  }
  .meta {
    gap: 12px 20px;
  }
  .phone-stack {
    width: min(86%, 320px);
    margin: 0 auto;
  }
  .section {
    padding: 32px 0;
  }
  .section__title {
    margin-bottom: 16px;
  }
  .step {
    grid-template-columns: 38px 1fr;
    padding: 14px;
    gap: 12px;
  }
  .step__num {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .card,
  .panel,
  .download__card {
    padding: 16px;
  }
  .download__card {
    padding: 18px;
  }
  .footer__inner {
    align-items: flex-start;
  }
  .lightbox__close {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
  }
}

/* Very small phones (e.g. iPhone SE 1st gen, older Androids) */
@media (max-width: 380px) {
  .container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .hero__title {
    font-size: 1.5rem;
  }
  .gallery {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .nav {
    gap: 0 6px;
  }
  .nav__link {
    padding: 6px 4px;
    font-size: 0.85rem;
  }
  .cta {
    flex-direction: column;
    align-items: stretch;
  }
  .cta .btn {
    width: 100%;
  }
}

/* Hide secondary nav links on the smallest screens to keep the header tidy */
@media (max-width: 419px) {
  .nav__link[href="#how"],
  .nav__link[href="#screenshots"] {
    display: none;
  }
}

/* Landscape phones: keep the hero compact and avoid awkward stacking */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero {
    padding: 24px 0;
  }
  .hero__grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: center;
  }
  .phone-stack {
    width: min(60%, 260px);
  }
  .header__inner {
    min-height: 48px;
  }
}

/* Touch-first devices: remove hover lift that lingers as :hover on tap */
@media (hover: none) and (pointer: coarse) {
  .shot:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
  }
  .btn:hover {
    background: var(--primary);
  }
  .btn--secondary:hover {
    background: var(--bg-alt, #fff);
    border-color: var(--border);
  }
  .nav__link:hover {
    background: transparent;
  }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1322;
    --bg-alt: #111a2d;
    --bg-soft: #15203a;
    --fg: #e7ecf5;
    --fg-muted: #9aa6bd;
    --border: #1f2a44;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
  body {
    background: var(--bg);
    color: var(--fg);
  }
  .header {
    background: rgba(12, 19, 34, 0.78);
  }
  .nav__link {
    color: var(--fg);
  }
  .btn--secondary {
    background: var(--bg-alt);
    color: var(--fg);
    border-color: var(--border);
  }
  .btn--secondary:hover {
    background: var(--bg-soft);
    border-color: #2a3a5e;
  }
  .card,
  .panel,
  .download__card {
    background: var(--bg-alt);
  }
  .download__card--soft {
    background: var(--bg-soft);
  }
  .badge {
    background: #15244a;
    color: #cfdcff;
  }
  .hero {
    background: radial-gradient(1200px 500px at 80% -10%, #14224a 0%, transparent 60%),
      radial-gradient(900px 400px at -10% 0%, #0f1d3d 0%, transparent 50%),
      var(--bg);
  }
}
