/* Flapsy Lab: one stylesheet for every page. The only font is self-hosted; no third-party requests. */

@font-face {
  font-family: "Bricolage";
  src: url("/assets/fonts/bricolage-grotesque-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f3f5fa;
  --paper-2: #e8ecf6;
  --surface: #ffffff;
  --ink: #141a30;
  --muted: #5a627a;
  --line: #d6dbe8;
  --link: #2b57c9;
  --focus: #2b57c9;
  --shadow: 0 1px 2px rgba(20, 26, 48, 0.06), 0 12px 32px -12px rgba(20, 26, 48, 0.18);
  --glow-blue: rgba(47, 91, 211, 0.16);
  --glow-sun: rgba(241, 216, 62, 0.22);
  --grain-opacity: 0.05;

  --display: "Bricolage", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1122;
    --paper-2: #121834;
    --surface: #161c35;
    --ink: #edf0f8;
    --muted: #9ea7c2;
    --line: #262e50;
    --link: #9db8ff;
    --focus: #f1d83e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px -16px rgba(0, 0, 0, 0.7);
    --glow-blue: rgba(47, 91, 211, 0.28);
    --glow-sun: rgba(241, 216, 62, 0.10);
    --grain-opacity: 0.07;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(60rem 28rem at 85% -6rem, var(--glow-blue), transparent 70%),
    radial-gradient(40rem 22rem at -10% 4rem, var(--glow-sun), transparent 70%),
    var(--paper);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

/* Fine grain over everything, so the flat colours feel less digital. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; text-wrap: balance; }

p { text-wrap: pretty; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 101;
  padding: 8px 14px; border-radius: 10px; background: var(--ink); color: var(--paper); text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---- Frame shared by every page ---- */

.wrap { width: min(100% - 32px, 64rem); margin-inline: auto; }

.site-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 0; }

.wordmark {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink); text-decoration: none;
  font: 700 1.125rem/1 var(--display); letter-spacing: -0.02em;
}
.wordmark .mark { width: 34px; height: 34px; flex: none; }
.wordmark .lab { font-weight: 300; color: var(--muted); margin-left: -0.15em; }

/* The logo: an "f" on a tile whose corner is folded over, a flap. Now and then the flap opens and closes. */
.hero-mark { display: block; width: clamp(72px, 20vw, 112px); height: auto; aspect-ratio: 1; margin-bottom: 26px; }
.flap { transform-box: view-box; transform-origin: 53px 11px; transform: rotate(45deg) scaleY(1) rotate(-45deg); }
@media (prefers-reduced-motion: no-preference) {
  .hero-mark .flap { animation: flap 5.5s 1.4s infinite cubic-bezier(0.5, 0, 0.3, 1); }
  .wordmark:hover .flap { animation: flap-once 0.7s 1 cubic-bezier(0.5, 0, 0.3, 1); }
  @keyframes flap {
    0%, 80%, 100% { transform: rotate(45deg) scaleY(1) rotate(-45deg); }
    88%, 91% { transform: rotate(45deg) scaleY(-1) rotate(-45deg); }
  }
  @keyframes flap-once {
    0%, 100% { transform: rotate(45deg) scaleY(1) rotate(-45deg); }
    45%, 55% { transform: rotate(45deg) scaleY(-1) rotate(-45deg); }
  }
}

.site-head nav { display: flex; gap: 4px; font-size: 0.9375rem; }
.site-head nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 999px; transition: background 200ms var(--ease), color 200ms var(--ease); }
.site-head nav a:hover { color: var(--ink); background: var(--paper-2); }
.site-head nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
/* Five links do not fit beside the wordmark on a phone: Support and Privacy are in the footer too. */
.site-head nav { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
@media (max-width: 640px) {
  .site-head nav a[href$="/support"], .site-head nav a[href$="/privacy"] { display: none; }
  .site-head nav a { padding: 8px 8px; }
}
@media (max-width: 360px) {
  .site-head nav { font-size: 0.875rem; gap: 0; }
  .site-head nav a { padding: 6px 6px; }
}

.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  margin-top: 72px; padding: 22px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9375rem;
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--ink); }

.label {
  font: 500 0.75rem/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The official App Store and Google Play badges, shown as supplied and at the same height (both stores' rules). */
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; padding: 0; }
.store-badge {
  position: relative; z-index: 1;
  display: inline-block; border-radius: 9px; line-height: 0;
  transition: transform 200ms var(--ease), filter 200ms var(--ease);
}
.store-badge img { height: 50px; width: auto; }
.store-badge:hover { transform: translateY(-2px); filter: brightness(1.12); }
.store-badge:active { transform: translateY(0) scale(0.98); }
.store-badge[hidden] { display: none; }
.badges.is-small .store-badge img { height: 44px; }

.tm { flex-basis: 100%; font-size: 0.75rem; line-height: 1.5; opacity: 0.8; }

/* Arrival: things rise into place once, in order. Off when the reader asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 700ms var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
}

/* ---- Home ---- */

.home-hero { padding: 64px 0 56px; }
.home-hero h1 {
  font-size: clamp(3.5rem, 17vw, 8.5rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.88;
}
.home-hero h1 span { display: block; color: var(--muted); font-weight: 300; }
.home-hero p { max-width: 30rem; margin: 22px 0 0; font-size: clamp(1.125rem, 4.5vw, 1.375rem); line-height: 1.45; color: var(--muted); }

.apps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 20px; }

.app-card {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 300ms var(--ease), box-shadow 300ms var(--ease);
}
.app-card:hover { transform: translateY(-3px); }

.app-card-media { position: relative; aspect-ratio: 4 / 3; background: #2b3a1f; overflow: hidden; }
.app-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.app-card-media .is-lens { clip-path: inset(0 0 0 50%); }
.app-card-media::after { content: ""; position: absolute; inset: 0 auto 0 50%; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.92); }

.app-card-body { padding: 22px 22px 24px; display: grid; gap: 14px; align-content: start; }
.app-card-title { display: flex; align-items: center; gap: 14px; }
.app-card-title img { width: 56px; height: 56px; border-radius: 14px; background: #000; flex: none; }
.app-card h3 { font-size: clamp(1.75rem, 6vw, 2.25rem); font-weight: 700; letter-spacing: -0.035em; }
.app-card h3 a { color: inherit; text-decoration: none; }
/* The name's link covers the whole card; the store pills sit above it. */
.app-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 28px; }
.app-card h3 a:focus-visible { outline: none; }
.app-card:has(h3 a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.app-card-body > p { margin: 0; color: var(--muted); font-size: 1.0625rem; line-height: 1.5; max-width: 30rem; }
.app-card-more { font-weight: 600; color: var(--ink); font-size: 0.9375rem; }
.app-card-more::after { content: "→"; display: inline-block; margin-left: 0.35em; transition: transform 300ms var(--ease); }
.app-card:hover .app-card-more::after { transform: translateX(4px); }

@media (min-width: 760px) {
  .app-card { grid-template-columns: 1.05fr 1fr; }
  .app-card-media { aspect-ratio: auto; min-height: 26rem; }
  .app-card-body { padding: 40px 40px 40px 36px; align-content: center; }
}

/* ---- Tag on photos: "You", "Dog" ---- */

.photo-tag {
  position: absolute; bottom: 12px; z-index: 2;
  transform: translateX(-50%);
  padding: 4px 11px; border-radius: 999px;
  background: rgba(10, 12, 20, 0.62); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: 600 0.8125rem/1.3 var(--body);
  pointer-events: none;
}

/* ---- App page ---- */

.app-hero { display: grid; gap: 36px; padding: 40px 0 0; }

.app-id { display: flex; align-items: center; gap: 16px; }
.app-id img { width: 80px; height: 80px; border-radius: 20px; background: #000; flex: none; box-shadow: var(--shadow); }
.app-id h1 { font-size: clamp(2.5rem, 11vw, 4.25rem); font-weight: 800; letter-spacing: -0.045em; }
.app-id p { margin: 6px 0 0; color: var(--muted); font-size: 0.9375rem; line-height: 1.4; }

.app .lede { font-size: clamp(1.1875rem, 4.6vw, 1.375rem); line-height: 1.5; margin: 22px 0 0; max-width: 34rem; }

.get { margin: 28px 0 0; }
@media (min-width: 600px) { .get .store-badge img { height: 58px; } }

/* On a phone we know, the store for that phone comes first. */
.on-ios .store-ios, .on-android .store-android { order: -1; }

.fine { color: var(--muted); font-size: 0.9375rem; margin: 14px 0 0; max-width: 34rem; }

/* Compare: drag the line between your view and the lens, like Compare in the app. */
.compare { margin: 0; width: 100%; max-width: 27rem; justify-self: center; }
.compare-stage {
  --pos: 50%;
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 28px;
  background: #2b3a1f;
  box-shadow: var(--shadow);
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.compare-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.compare-lens { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.compare-handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 3;
  width: 44px; margin-left: -22px;
  display: grid; place-items: center;
  outline: none;
}
.compare-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 12px rgba(0, 0, 0, 0.35); }
.compare-handle span {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  display: grid; place-items: center; color: #141a30; font-size: 0.875rem; font-weight: 700; letter-spacing: -0.1em;
}
.compare-handle:focus-visible span { outline: 3px solid var(--focus); outline-offset: 3px; }
/* Each tag sits in the middle of its side of the line, and fades out when that side gets too narrow. */
.photo-tag { transition: opacity 200ms var(--ease); }
.photo-tag.on-left { left: calc(var(--pos, 50%) / 2); }
.photo-tag.on-right { left: calc((var(--pos, 50%) + 100%) / 2); }
.hide-left .photo-tag.on-left, .hide-right .photo-tag.on-right { opacity: 0; }

.lens-chips { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.lens-chips button {
  min-height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 0.9375rem/1 var(--body); cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}
.lens-chips button:active { transform: scale(0.97); }
.lens-chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.compare figcaption { margin: 12px auto 0; color: var(--muted); font-size: 0.875rem; line-height: 1.45; text-align: center; max-width: 24rem; }

@media (min-width: 860px) {
  .app-hero { grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 56px; padding-top: 56px; }
}

.facts {
  list-style: none; margin: 64px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  border-top: 1px solid var(--line);
}
.facts li { padding: 20px 20px 20px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.9375rem; line-height: 1.45; }
.facts b { display: block; margin-bottom: 4px; color: var(--ink); font: 700 1.25rem/1.2 var(--display); letter-spacing: -0.02em; }

.section-head { margin: 72px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-head h2 { font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 700; letter-spacing: -0.035em; }

/* App Store screenshots: a row you swipe on a phone; arrows appear where there is a mouse. */
.gallery-nav { display: none; gap: 8px; }
.gallery-nav button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.125rem; line-height: 1; cursor: pointer;
  transition: border-color 200ms var(--ease), opacity 200ms var(--ease), transform 200ms var(--ease);
}
.gallery-nav button:hover:not(:disabled) { border-color: var(--ink); }
.gallery-nav button:active:not(:disabled) { transform: scale(0.95); }
.gallery-nav button:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) and (pointer: fine) { .gallery-nav { display: flex; } }

.shots {
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(58%, 15rem);
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  /* Run the row to the screen edges on a phone, so the next screenshot peeks in from the side. */
  margin: 0 -16px;
  padding: 4px 16px 18px;
  scroll-padding-inline: 16px;
}
.shots::-webkit-scrollbar { display: none; }
.shots li { scroll-snap-align: start; }
.shots img { width: 100%; aspect-ratio: 460 / 1000; border-radius: 22px; background: var(--paper-2); box-shadow: var(--shadow); }

@media (min-width: 700px) {
  .shots {
    grid-auto-columns: calc((100% - 4 * 18px) / 4.4);
    gap: 18px; margin: 0; padding: 4px 0 18px; scroll-padding-inline: 0;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
    mask-image: linear-gradient(90deg, #000 90%, transparent);
  }
  .shots.at-end { -webkit-mask-image: none; mask-image: none; }
}

/* ---- Text pages: support and privacy ---- */

.doc { width: min(100% - 32px, 44rem); margin-inline: auto; padding: 44px 0 0; }
.doc h1 { font-size: clamp(2.25rem, 9vw, 3.25rem); font-weight: 800; letter-spacing: -0.04em; }
.doc h2 { font-size: 1.375rem; margin: 2.5rem 0 0.5rem; letter-spacing: -0.02em; }
.doc h3 { font-size: 1.125rem; margin: 1.75rem 0 0.25rem; letter-spacing: -0.01em; font-family: var(--body); font-weight: 650; line-height: 1.3; }
.doc p, .doc li { overflow-wrap: break-word; }
.doc ul { padding-left: 1.25rem; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.doc th, .doc td { border-top: 1px solid var(--line); padding: 0.5rem 0.75rem 0.5rem 0; text-align: left; vertical-align: top; }
.doc > header { border-bottom: 1px solid var(--line); padding-bottom: 1.25rem; }
.doc .publisher, .doc .effective, .doc .applies { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9375rem; }
.doc footer { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.25rem; }
.doc .badges { margin-top: 18px; }

.contact {
  margin: 24px 0 0; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.contact a.mail { font: 700 1.25rem/1.3 var(--display); letter-spacing: -0.01em; word-break: break-all; }
.contact p { margin: 6px 0 0; color: var(--muted); font-size: 0.9375rem; }
