/* photo-restore.app landing page styles.
   Theme tokens mirror app/lib/core/theme.dart in emerald mode
   (_useEmerald = true): off-white surfaces, emerald accent. */

:root {
  /* Chrome */
  --bg: #F2EFE6;
  --bg-gradient-top: #F2EFE6;
  --bg-gradient-bottom: #DDD7C8;
  --surface: #FBF9F3;
  --text-primary: #0C2A12;
  --text-secondary: #2C4A33;
  --text-muted: #7C8A7E;
  --accent: #046307;
  --accent-strong: #034F05;

  /* Photo overlay (theme-invariant; matches theme.dart) */
  --overlay-scrim: rgba(0, 0, 0, 0.35);
  --overlay-content: #FFFFFF;
  --shadow: rgba(0, 0, 0, 0.18);
  --border: rgba(12, 42, 18, 0.10);

  /* Layout */
  --content-max: 1100px;
  --content-narrow: 760px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --font-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--bg-gradient-top), var(--bg-gradient-bottom));
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.15;
  font-weight: 700;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-2);
  color: var(--text-secondary);
}

.lede {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 56ch;
}

/* ---------- Layout ---------- */

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.container-narrow {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

section {
  padding: var(--space-5) 0;
}

@media (min-width: 720px) {
  section {
    padding: var(--space-6) 0;
  }
}

/* ---------- Site header ---------- */

.site-header {
  padding: var(--space-2) 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand:hover {
  text-decoration: none;
  color: var(--text-primary);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-header nav {
  display: flex;
  gap: var(--space-3);
  font-size: 0.95rem;
}

.site-header nav a {
  color: var(--text-secondary);
}

/* ---------- Hero ---------- */

.hero {
  padding-top: var(--space-3);
  padding-bottom: var(--space-5);
}

.hero .container {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 980px) {
  .hero .container {
    grid-template-columns: 1.05fr 1fr;
    gap: var(--space-5);
  }
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}

.hero-meta {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: var(--space-2);
}

/* ---------- App Store badge ---------- */

.app-store-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--text-primary);
  color: var(--surface);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid var(--text-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-store-cta:hover {
  color: var(--surface);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.app-store-cta svg {
  width: 22px;
  height: 22px;
  fill: var(--surface);
}

.app-store-cta .label-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-align: left;
}

.app-store-cta .label-stack .small {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.85;
}

.app-store-cta .label-stack .big {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---------- Before/After slider ----------

   Structure (per slider):

     .ba-slider
       .ba-side.ba-side-after          (normal flow - sets height)
         <img>                         (the "after" image)
         .ba-label                     (top-right)
       .ba-side.ba-side-before         (absolute overlay, clip-path)
         <img>                         (the "before" image)
         .ba-label                     (top-left)
       .ba-handle                      (vertical bar + circle, centre)
       <input type="range">            (transparent, captures drag)

   Why labels live inside their side: the side's clip-path applies to
   the label too, so dragging the slider past a label naturally hides
   it. No JS, no z-index gymnastics, no "after label visible while
   showing before" problem.

   The container does NOT force an aspect ratio. The "after" side is
   in normal flow and sets the container height; the "before" side
   overlays on top and gets clipped from the right based on --ba-pos.
   That way each pair renders at its natural ratio. */

.ba-slider {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.35);
  background: var(--surface);
  user-select: none;
  touch-action: none;
}

.ba-slider .ba-side-after {
  position: relative;
}

.ba-slider .ba-side-after img {
  display: block;
  width: 100%;
  height: auto;
}

.ba-slider .ba-side-before {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--ba-pos, 50%)) 0 0);
}

.ba-slider .ba-side-before img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-slider .ba-label {
  position: absolute;
  top: var(--space-2);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--overlay-scrim);
  color: var(--overlay-content);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

.ba-slider .ba-side-after .ba-label { right: var(--space-2); }
.ba-slider .ba-side-before .ba-label { left: var(--space-2); }

.ba-slider .ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--overlay-content);
  left: var(--ba-pos, 50%);
  transform: translateX(-1px);
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 0 1px var(--overlay-scrim);
}

.ba-slider .ba-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  background: var(--overlay-content);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Handle icon: two chevrons pointing left and right ( < > ). Inline
   SVG data URI so it ships as part of the stylesheet, no extra
   request. Stroke colour is text-primary (#0C2A12) URL-encoded. */
.ba-slider .ba-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C2A12' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='10,6 4,12 10,18'/><polyline points='14,6 20,12 14,18'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.ba-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}

/* ---------- Features ---------- */

.features {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.features-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  margin-top: var(--space-3);
}

@media (min-width: 720px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.feature h3 {
  margin-top: 0;
  color: var(--text-primary);
}

.feature p {
  margin-bottom: 0;
}

.feature .icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--overlay-content);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

/* ---------- How it works ---------- */

.how-steps {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  counter-reset: step;
}

@media (min-width: 720px) {
  .how-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.how-step {
  position: relative;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.how-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -18px;
  left: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--overlay-content);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px var(--shadow);
}

.how-step h3 {
  margin-top: var(--space-2);
}

.how-step p {
  margin-bottom: 0;
}

/* ---------- "Any size" B/A gallery (multiple sliders in a grid) ---------- */

.ba-gallery {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  /* 1 col on mobile, 2x2 on tablet and up. Sticking to 2 cols at all
     widths above 720px because the gallery has 4 items - a 3-col grid
     would leave the 4th item stranded on its own row. */
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 720px) {
  .ba-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ba-gallery .ba-slider {
  /* Inside the gallery the sliders shouldn't be capped at 520px -
     let them fill their grid column so landscape pairs read at a
     sensible size. */
  max-width: none;
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.28);
}

/* ---------- Screenshots gallery ---------- */

.screenshots-gallery {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  grid-template-columns: repeat(2, 1fr);
}

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

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

.screenshots-gallery img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- FAQ ---------- */

.faq-list {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  padding: var(--space-1) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 400;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  margin: var(--space-1) 0 var(--space-2);
}

/* ---------- Final CTA ---------- */

.final-cta {
  text-align: center;
}

.final-cta .container {
  max-width: var(--content-narrow);
}

.final-cta h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: var(--space-4) 0 var(--space-5);
  color: var(--text-muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--border);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: center;
}

.site-footer nav {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.site-footer nav a {
  color: var(--text-secondary);
}

/* ---------- Legal page (privacy / terms / support) ---------- */

.legal-page {
  padding: var(--space-4) 0 var(--space-6);
}

.legal-page h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: var(--space-3);
}

.legal-page h2 {
  font-size: 1.3rem;
  margin-top: var(--space-4);
}

.legal-page p, .legal-page li {
  color: var(--text-secondary);
}

.legal-page ul {
  padding-left: 1.25rem;
}

.legal-page .updated {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-3);
}

/* ---------- Utility ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
