/*
  ColorPhoto landing page: the app's empty gallery (EmptyGallery.swift and
  Theme.swift in the iOS repo). Colors and sizes follow the app. Layout uses
  logical properties (inline/block) so a right-to-left translation mirrors.
*/

:root {
  /* AppBackground asset: warm paper. */
  --paper: #f3efe6;
  /* Color.ink: deep green for big headlines. */
  --ink: #213529;
  /* AccentColor asset (Display P3), the app icon's light green. */
  --brand: #a3d082;
  --brand: color(display-p3 0.636 0.813 0.509);
  /* PrintMat: a warm white border, like a photo print. */
  --mat: #fffdf6;
  --surface: #ffffff;
  --text: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --separator: rgba(60, 60, 67, 0.18);

  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Phone frame on larger screens: an iPhone's logical screen size. */
  --phone-w: 393;
  --phone-h: 852;

  /* The app is always light. */
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- The screen ---------------------------------------------------------
   On a phone: the whole viewport, like the app. */

.phone, .screen {
  position: relative;
  height: 100svh;
  height: 100dvh;
  /* Clip the sliding sheet without making the frame a scroll container. */
  overflow: clip;
  background: var(--paper);
}

.status-bar { display: none; }

.gallery {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-block-start: env(safe-area-inset-top);
  padding-block-end: max(env(safe-area-inset-bottom), 12px);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  cursor: default;
}

/* ---- Top bar: Menu and the credits pill -------------------------------- */

.top-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 0;
}

/* The iOS 26 toolbar's glass capsule. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(250, 248, 243, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow:
    0 6px 18px rgba(60, 50, 30, 0.10),
    0 1px 2px rgba(60, 50, 30, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s ease-out;
}

.pill:active { transform: scale(0.96); }

.pill-icon { flex: none; }

.sparkles { flex: none; fill: var(--brand); }

.credits-note {
  position: absolute;
  inset-block-start: calc(100% + 10px);
  inset-inline-end: 16px;
  z-index: 2;
  max-width: 260px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(60, 50, 30, 0.16), 0 1px 3px rgba(60, 50, 30, 0.08);
  font-size: 16px;
  line-height: 1.4;
  color: var(--secondary);
  animation: pop-in 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
  transform-origin: top right;
}

.credits-note strong { display: block; color: var(--text); font-weight: 600; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(-6px); }
}

/* ---- The demo video, framed like a print ------------------------------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.video-area {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 28px 40px;
  /* The print fits inside, keeping 9:16 (SwiftUI's .fit). */
  container-type: size;
}

.print {
  width: min(100cqw, 100cqh * 9 / 16);
  aspect-ratio: 9 / 16;
  padding: 7px;
  border-radius: 4px;
  background: var(--mat);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.print video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  background: #2a2522;
}

/* ---- Headline ---------------------------------------------------------- */

.headline {
  display: grid;
  margin: 0;
  padding: 0 24px 20px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
}

/* Hebrew has no good system serif (same rule as the app). */
:lang(he) .headline { font-family: var(--sans); }

/* The two lines share one spot and cross-fade. */
.headline > span {
  grid-area: 1 / 1;
  transition: opacity 0.35s ease-in-out;
}

.headline-hint { opacity: 0; }
.is-hinting .headline-default { opacity: 0; }
.is-hinting .headline-hint { opacity: 1; }

/* ---- Store badges, in place of the app's Gallery and Camera buttons ---- */

.stores {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 4px 16px 4px;
}

.store {
  position: relative;
  display: block;
  border-radius: 10px;
  transition: transform 0.12s ease-out;
}

.store:active { transform: scale(0.97); }

/* Both badges the same height, as Apple and Google ask. */
.store img {
  display: block;
  height: clamp(40px, 13.5vw, 54px);
  width: auto;
}

.store .store-qr, .menu-downloads .store-qr, .desktop-copy { display: none; }

.store:focus-visible, .pill:focus-visible, .close:focus-visible, .list a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* TapHintPulse: a tap on the page shows where to tap. */
.store::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
}

.is-hinting .store::after { animation: ripple 1.1s linear infinite; }

@keyframes ripple {
  from { inset: -4px; opacity: 0.6; border-radius: 14px; }
  to { inset: -14px; opacity: 0; border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .is-hinting .store { animation: none; }
  .is-hinting .store::after { animation: none; opacity: 0.6; }
  .credits-note, .menu { animation: none !important; }
}

/* ---- Menu sheet -------------------------------------------------------- */

.menu-backdrop {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.25);
}

.menu {
  position: absolute;
  inset: max(env(safe-area-inset-top), 12px) 0 0;
  z-index: 11;
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.12);
}

.menu-header {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 10px 16px 0;
  touch-action: pan-x pinch-zoom;
}

.menu-header::before {
  /* The sheet's drag indicator. */
  content: "";
  position: absolute;
  inset-block-start: 6px;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(60, 60, 67, 0.3);
}

.menu-header h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* Close button, top left, as in the app. */
.close {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-start: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(250, 248, 243, 0.9);
  box-shadow: 0 4px 12px rgba(60, 50, 30, 0.10), 0 1px 2px rgba(60, 50, 30, 0.08);
  cursor: pointer;
}

.menu-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px max(env(safe-area-inset-bottom), 24px);
  overscroll-behavior: contain;
}

.menu-body h3 {
  margin: 22px 16px 8px;
  font-size: 15px;
  font-weight: 400;
  color: var(--secondary);
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 22px;
  background: var(--surface);
  overflow: hidden;
}

.list li + li a { box-shadow: inset 0 1px 0 var(--separator); }
.list li + li a { background-clip: padding-box; }

.list a {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 16px;
  color: var(--text);
  font-size: 20px;
  text-decoration: none;
}

.list a:active { background: rgba(0, 0, 0, 0.05); }

.menu-downloads a {
  justify-content: space-between;
  min-height: 68px;
  padding-block: 14px;
}

.menu-downloads img {
  display: block;
  flex: none;
  height: 40px;
  width: auto;
}

.menu-downloads .store-platform {
  color: var(--secondary);
  font-size: 15px;
}

/* Settings-style colored icon tile. */
.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--tile), white 12%), var(--tile));
}

.tile svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Larger screens: the screen floats as a bezel-less phone ----------- */

@media (min-width: 640px) and (min-height: 640px) {
  body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 32px;
  }

  .phone {
    --h: min(calc(var(--phone-h) * 1px), calc(100dvh - 64px));
    height: var(--h);
    width: max(320px, calc(var(--h) * var(--phone-w) / var(--phone-h)));
    border-radius: calc(var(--h) * 55 / var(--phone-h));
    overflow: clip;
    box-shadow:
      0 40px 80px -20px rgba(60, 45, 20, 0.28),
      0 18px 36px -18px rgba(60, 45, 20, 0.22),
      0 0 0 1px rgba(60, 45, 20, 0.05);
  }

  .screen { height: 100%; }

  .status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 4px 34px 0 46px;
    font-size: 17px;
    font-weight: 600;
  }

  .status-icons { display: flex; gap: 6px; align-items: center; }
  .status-icons svg { fill: currentColor; }

  .island {
    position: absolute;
    inset-block-start: 11px;
    left: 50%;
    width: 124px;
    height: 36px;
    border-radius: 18px;
    background: #000;
    transform: translateX(-50%);
  }

  .gallery {
    height: calc(100% - 54px);
    padding: 0 0 24px;
  }

  .menu { inset-block-start: 54px; }

  .store img { height: clamp(40px, calc(var(--h) * 50 / var(--phone-h)), 50px); }
}

/* On desktop, each store is one card: badge as its heading, then the code.
   Keep the code still and preserve its four-module white quiet zone. */
@media (hover: hover) and (pointer: fine) {
  .phone {
    --download-outer-gap: 20px;
    --download-inner-gap: 14px;
  }

  .touch-copy { display: none; }
  .desktop-copy { display: inline; }

  .gallery { padding-block-end: max(env(safe-area-inset-bottom), var(--download-outer-gap)); }

  .video-area {
    padding-block: var(--download-outer-gap);
    align-items: end;
  }

  .headline {
    padding-block-end: var(--download-outer-gap);
    font-size: 26px;
    line-height: 1.2;
  }

  .headline > span {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
  }

  .stores {
    gap: 12px;
    padding-block: 0;
  }

  .store, .menu-downloads a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* The SVG's 14px white margins supply equal space above and below the code. */
    gap: 0;
    padding: var(--download-inner-gap) 10px 0;
    border: 0;
    border-radius: 20px;
    background: var(--surface);
  }

  .store {
    flex: 1;
    max-width: 168px;
  }

  .store img { height: 40px; }

  .store img:not(.store-qr), .menu-downloads .store-badge { order: -1; }

  .store .store-qr, .menu-downloads .store-qr {
    display: block;
    width: 128px;
    height: 128px;
    background: #fff;
  }

  .store-qr svg { display: block; width: 100%; height: 100%; }

  .store:active { transform: none; }

  .menu-downloads {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    background: transparent;
    overflow: visible;
  }

  .menu-downloads .store-platform { display: none; }
  .menu-downloads li + li a { box-shadow: none; }

  .menu-downloads a:active { background: var(--surface); }

  .is-hinting .store::after {
    animation: none;
    inset: -4px;
    border-radius: 24px;
    opacity: 0.5;
  }
}

/* Give the two download cards room without compressing their store badges. */
@media (hover: hover) and (pointer: fine) and (min-width: 640px) and (min-height: 640px) {
  .phone { width: max(360px, calc(var(--h) * var(--phone-w) / var(--phone-h))); }
}

/* Short phone frames (small laptop windows) need a smaller headline. */
@media (min-width: 640px) and (max-height: 820px) and (hover: none) {
  .headline { font-size: 30px; }
}

/* Android invitation page. */
.signup-page {
  display: grid;
  place-items: center;
  min-height: 100svh;
  height: auto;
  padding: max(env(safe-area-inset-top), 24px) 24px max(env(safe-area-inset-bottom), 32px);
}

.signup { width: min(100%, 420px); padding-block: 16px; }
.signup-back { display: inline-block; margin-block-end: 40px; color: var(--ink); text-decoration: none; font-weight: 600; }
.signup-icon { display: block; border-radius: 15px; margin-block-end: 24px; }
.signup-eyebrow { margin: 0 0 8px; color: var(--secondary); font-size: 15px; font-weight: 600; }
.signup h1 { margin: 0 0 16px; color: var(--ink); font: 600 clamp(32px, 7vw, 42px)/1.1 var(--serif); letter-spacing: -0.02em; }
.signup-intro { margin: 0 0 28px; color: var(--ink); font-size: 17px; line-height: 1.5; }
.signup label { display: block; margin-block-end: 8px; font-size: 16px; font-weight: 600; }
.signup input { width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--separator); border-radius: 14px; background: #fff; color: var(--text); font: 17px var(--sans); }
.signup-submit { width: 100%; min-height: 52px; margin-block-start: 16px; padding: 12px; border: 0; border-radius: 14px; background: var(--ink); color: white; font-weight: 600; cursor: pointer; }
.signup-submit:disabled { opacity: 0.6; cursor: default; }
.signup-honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.signup-privacy { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: var(--secondary); }
.signup a { color: var(--ink); }
.signup-error { color: #a32c20; font-size: 15px; line-height: 1.5; }
.signup-success { border-radius: 20px; padding: 24px; background: #fff; color: var(--ink); }
.signup-success h2 { margin: 0 0 12px; font-size: 24px; }
.signup-success p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.signup input:focus-visible, .signup button:focus-visible, .signup a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Help and legal documents share the landing page's paper and type. */
.content-page {
  display: block;
  min-height: 100svh;
  height: auto;
  padding: max(env(safe-area-inset-top), 24px) max(env(safe-area-inset-right), 24px) max(env(safe-area-inset-bottom), 32px) max(env(safe-area-inset-left), 24px);
}

.content { width: min(100%, 720px); margin-inline: auto; padding-block: 16px; font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.content .back { margin-block-end: 40px; }
.content .back a { text-decoration: none; font-weight: 600; }
.content a { color: var(--ink); text-underline-offset: 3px; }
.content a:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 3px; }
.content h1 { margin: 0 0 20px; color: var(--ink); font: 600 clamp(32px, 6vw, 46px)/1.12 var(--serif); letter-spacing: -0.02em; }
.content h2, .content h3 { color: var(--ink); line-height: 1.3; }
.content p { margin-block: 0 20px; }
.content-intro { color: var(--secondary); font-size: 17px; }
.content footer { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-block-start: 40px; padding-block-start: 20px; border-block-start: 1px solid var(--separator); font-size: 14px; }
.faq { margin-block: 16px; padding: 24px; border-radius: 22px; background: var(--surface); }
.faq h2 { margin: 0 0 12px; font-size: 20px; }
.faq p { margin: 0; }
.support-contact { margin-block-start: 32px; }
.support-contact h2 { margin-block-end: 8px; font-size: 20px; }
.legal-content hr { margin-block: 28px; border: 0; border-block-start: 1px solid var(--separator); }
.legal-content h3 { margin-block: 28px 12px; font-size: 20px; }
.legal-content ul { padding-inline-start: 24px; }
.legal-content li + li { margin-block-start: 10px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.legal-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.legal-content th, .legal-content td { padding: 12px; border: 1px solid var(--separator); vertical-align: top; }
.legal-content th { background: var(--surface); }
