/* Photomosaic Maker — one light look on purpose: white, near-black, one orange.
   Phone first; on wide screens the stage (image or viewer) fills the window and the controls float in a panel. */
:root {
  --bg: #f6f6f6;
  --card: #ffffff;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #777777;
  --line: #eeeeee;
  --soft: #f2f2f2;
  --accent: #ff4d1a;      /* marks and rings only */
  --accent-ink: #d63a10;  /* fills under white text (4.5:1) */
  --ok: #1f9d55;
  --warm: #fff3ee;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Segoe UI', sans-serif;
  --radius: 22px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--ink-2); margin: 0; font-size: 14px; }
.h2 { margin: 0; font-size: 28px; line-height: 1.05; font-weight: 800; letter-spacing: -.04em; }
.h3 { margin: 0 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.fineprint { margin: 0; text-align: center; font-size: 13px; color: var(--ink-2); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.94); border-radius: 99px; padding: 8px 13px; }
.chip-float { position: absolute; left: 12px; bottom: 12px; font-size: 12px; font-weight: 700; padding: 6px 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.dot-ok { background: var(--ok); }

.cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 0; border-radius: 16px; padding: 17px 20px; background: var(--ink); color: #ffffff; font-size: 17px; font-weight: 700; text-decoration: none; text-align: center; }
.cta svg { stroke: #ffffff; }
.cta:disabled { opacity: .35; cursor: default; }
.cta-warm { background: var(--accent-ink); }
.soft { border: 0; border-radius: 12px; background: var(--soft); padding: 12px 6px; font-size: 14px; font-weight: 600; }
.pill { border: 0; border-radius: 99px; background: var(--ink); color: #ffffff; padding: 9px 14px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.linkish { border: 0; background: none; padding: 6px; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.94); display: inline-flex; align-items: center; justify-content: center; }
.round-soft { background: var(--soft); border-radius: 12px; }

/* ---------- 1 · Top ---------- */
/* Three things only: what it is (the search phrase as the headline), the sample, one button. */
.screen-top { padding: max(18px, env(safe-area-inset-top)) 16px 8px; }
.headline { margin: 0; padding: 0 2px; font-size: clamp(34px, 10.4vw, 64px); line-height: 1.02; font-weight: 800; letter-spacing: -.045em; text-wrap: balance; }
.headline.long { font-size: clamp(28px, 8.4vw, 64px); }
.headline .phrase { display: inline-block; }
/* Chinese and Japanese characters are a full em wide: smaller, so the headline stays on two lines */
.headline:is(:lang(ja), :lang(zh)) { font-size: clamp(28px, 8.2vw, 52px); letter-spacing: -.02em; }
.promise { margin: 2px 2px 4px; font-size: 16px; font-weight: 700; color: var(--ink-2); }
.top-grid { max-width: 1180px; margin: 0 auto; }
.top-copy { display: flex; flex-direction: column; gap: 12px; max-width: 520px; margin: 0 auto; }
.sample-card { position: relative; background: var(--card); border-radius: var(--radius); padding: 8px; }
.sample-img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.sample-card::after { content: ""; position: absolute; inset: 8px; border-radius: 16px; pointer-events: none; background: url(/assets/sample-main.jpg) center / cover no-repeat; opacity: var(--blend, 0); transition: opacity .15s linear; }
.sample-card .chip-float { z-index: 1; }
/* hero.js shows the sample here in the zoom viewer: first one photo (the box's own background until the viewer draws), then the whole picture */
.hero { position: absolute; inset: 8px; border-radius: 16px; overflow: hidden; background: #e8e8e8; }
.intro .sample-card:not(.live) .hero { background: #e8e8e8 url(/assets/intro-1.jpg) center / cover no-repeat; }
.intro .sample-img { visibility: hidden; }
.sample-card.live::after { display: none; }
.hero .chip { position: absolute; z-index: 3; font-size: 12px; font-weight: 700; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); transition: opacity .4s; }
.hero-label { left: 10px; top: 10px; }
.hero-hint { left: 10px; bottom: 10px; max-width: calc(100% - 72px); }
.hero-ctrls { position: absolute; z-index: 3; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; transition: opacity .4s; }
.hero-ctrls button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.94); box-shadow: 0 2px 8px rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; padding: 0; }
.hero-ctrls svg { width: 18px; height: 18px; }
.sample-card:not(.done) .hero .chip, .sample-card:not(.done) .hero-ctrls { opacity: 0; pointer-events: none; }
.hero.used .hero-hint, .hero.zoomed .hero-label { opacity: 0; pointer-events: none; }
/* the demonstration taps, and the square under the mouse */
.hero-tap { position: absolute; z-index: 2; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 0 0 2px rgba(0,0,0,.18), inset 0 0 0 2px rgba(0,0,0,.18); pointer-events: none; animation: hero-tap 1.2s ease-out forwards; }
@keyframes hero-tap { 0% { transform: scale(.35); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.hero-cell { outline: 2px solid #ffffff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .hero .openseadragon-canvas { cursor: pointer; } }

.row-blend { padding: 10px 0 12px; }
.blend-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 700; color: var(--ink); }
.blend-head output { font-size: 13px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.blend { width: 100%; margin: 8px 0 2px; accent-color: var(--ink); }
.blend-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }

/* ---------- Stage + sheet (2 · Add, 4 · Ready) ---------- */
.screen-add, .screen-ready { position: fixed; inset: 0; overflow: hidden; background: #0f0f0f; }
.stage { position: absolute; inset: 0; background: #0f0f0f center 22% / cover no-repeat; }
.stage-top { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; }
.sheet { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; max-height: 82%; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 20px max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -10px 40px rgba(0,0,0,.18); }
.grabber { align-self: center; width: 40px; height: 5px; border-radius: 99px; background: #d4d4d4; flex: none; }
.count { display: flex; align-items: center; gap: 16px; }
.ring { width: 78px; height: 78px; flex: none; transform: rotate(-90deg); }
.ring-bg, .ring-fg { fill: none; stroke-width: 12; }
.ring-bg { stroke: #f0f0f0; }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 214; transition: stroke-dasharray .4s ease; }
.count-num { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.count-num small { font-size: 16px; font-weight: 500; color: #888888; }
.strip { display: flex; gap: 6px; overflow-x: auto; min-height: 48px; scrollbar-width: none; }
.strip img, .strip .more { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.strip .more { background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.strip:empty::before { content: "Your photos will show up here"; font-size: 13px; color: var(--ink-3); align-self: center; }
.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source { text-align: left; border: 0; border-radius: 16px; background: #f5f5f5; padding: 14px; display: flex; flex-direction: column; gap: 3px; }
.source strong { font-size: 15px; }
.source span { font-size: 12px; color: #666666; line-height: 1.4; }
.status { margin: 0; min-height: 1.4em; font-size: 13px; color: var(--ink-2); }

/* ---------- 3 · Making ---------- */
.screen-making { min-height: 100%; background: var(--card); }
.making-wrap { max-width: 520px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.forming { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #eee; }
.forming img { width: 100%; height: 100%; object-fit: cover; }
.bar { height: 8px; border-radius: 99px; background: #f0f0f0; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.bar-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: -8px; font-variant-numeric: tabular-nums; }
.note { background: var(--bg); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.note strong { color: var(--ink); font-size: 15px; }

/* ---------- 4 · Ready ---------- */
.viewer { background: #0f0f0f; bottom: var(--sheet-h, 0px); }
/* A mosaic that was just made: its main photo, where the viewer is about to draw it (the viewer's margins on wide screens). */
.viewer.revealing::before { content: ""; position: absolute; inset: 0; background: var(--main) center / contain no-repeat; }
@media (min-width: 900px) { .viewer.revealing::before { inset: 80px 32px 32px; } }
.blend-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: url(/assets/sample-main.jpg) center / cover no-repeat; opacity: 0; mix-blend-mode: normal; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#ready .sheet { gap: 12px; }
#ready .h2 { font-size: clamp(21px, 6.2vw, 28px); }
#ready .blend-scale { display: none; }
.navigator-hidden { opacity: 0 !important; pointer-events: none; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.buy { text-align: left; text-decoration: none; border: 1px solid #dddddd; background: var(--card); border-radius: 14px; padding: 11px 12px; display: flex; flex-direction: column; gap: 1px; }
.buy strong { font-size: 14px; }
.buy span { font-size: 12px; color: var(--ink-2); }
.buy-warm { background: var(--warm); border-color: transparent; }
.buy-wide { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px; }
.buy-all { width: 100%; margin-top: 10px; align-items: center; text-align: center; padding: 13px 12px; }

/* ---------- 5 · Print ---------- */
.screen-print { min-height: 100%; background: var(--card); }
.print-wrap { max-width: 520px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.print-head { display: flex; align-items: center; gap: 12px; }
.room { position: relative; height: 260px; border-radius: 20px; background: linear-gradient(#ece7df 78%, #d9d1c4 78%); overflow: hidden; display: flex; align-items: flex-start; justify-content: center; padding-top: 34px; }
.frame { background: #1d1b19; padding: 8px; box-shadow: 0 16px 30px rgba(0,0,0,.28); transition: all .25s ease; }
.mat { background: #ffffff; padding: 12px; transition: all .25s ease; }
.mat img { width: 120px; height: 150px; object-fit: cover; }
.room[data-format="Poster"] .frame { background: transparent; padding: 0; box-shadow: 0 10px 18px rgba(0,0,0,.18); }
.room[data-format="Poster"] .mat { padding: 0; }
.room[data-format="Canvas"] .frame { background: transparent; padding: 0; box-shadow: 6px 10px 0 rgba(0,0,0,.12), 0 16px 30px rgba(0,0,0,.22); }
.room[data-format="Canvas"] .mat { padding: 0; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--soft); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sizes button { text-align: left; background: var(--card); border: 1px solid #dddddd; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.sizes button[aria-checked="true"] { border: 2px solid var(--ink); padding: 9px 11px; }
.sizes strong { font-size: 14px; }
.sizes span { font-size: 12px; color: #666666; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #333333; }
.checks li::before { content: "✓"; color: #1f7a45; font-weight: 800; margin-right: 8px; }

/* ---------- 6 · Video ---------- */
/* The sample is exactly as large as its video. The video's own background is #f9f8f3 (promo-video's BG). */
.clip { position: relative; align-self: center; height: 400px; aspect-ratio: 9 / 16; border-radius: 20px; background: #f9f8f3; overflow: hidden; }
.clip[data-shape="horizontal"] { align-self: stretch; height: auto; aspect-ratio: 16 / 9; }
.clip video { display: block; width: 100%; height: 100%; }
.seg-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Modal + toast ---------- */
.modal { border: 0; border-radius: 24px; padding: 22px 20px 18px; width: min(92vw, 420px); color: var(--ink); background: var(--card); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(0,0,0,.45); }
.modal p { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 8px; }
.modal-actions .cta { padding: 14px; font-size: 15px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #ffffff; border-radius: 99px; padding: 11px 18px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }

/* ---------- Wide screens ---------- */
@media (min-width: 900px) {
  .screen-top { padding: 40px 40px; display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
  .top-grid { width: 100%; margin: auto; }
  /* Words and the button on the left, centred against a large square sample on the right */
  .top-copy { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: ". card" "brand card" "prom card" "cta card" "fine card" ". card"; grid-template-rows: 1fr auto auto auto auto 1fr; column-gap: 56px; row-gap: 16px; }
  .headline { grid-area: brand; font-size: min(5.6vw, 84px); }
  .headline:is(:lang(ja), :lang(zh)) { font-size: min(3.6vw, 52px); }
  .promise { grid-area: prom; margin: 0 0 8px; font-size: 19px; }
  /* Keep the whole sample above the fold, down to 1280×720 laptops. */
  .sample-card { grid-area: card; justify-self: end; width: min(100%, max(380px, calc(100svh - 80px))); }
  .top-copy > .cta { grid-area: cta; max-width: 420px; }
  .fineprint { grid-area: fine; text-align: start; max-width: 420px; }
  .sheet { left: auto; right: 24px; bottom: auto; top: 88px; width: 420px; max-height: calc(100% - 112px); border-radius: 28px; padding: 22px 22px 20px; }
  #ready .sheet { gap: 14px; }
  #ready .h2 { font-size: 28px; }
  .viewer { bottom: 0; right: 468px; }
  .grabber { display: none; }
  .making-wrap, .print-wrap { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- About (below the tool on the first screen) ---------- */
body:not([data-screen="top"]) .about { display: none; }
.about { max-width: 720px; margin: 0 auto; padding: 40px 20px max(56px, env(safe-area-inset-bottom)); display: grid; gap: 14px; color: var(--ink); }
.about p, .about li { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.about strong { color: var(--ink); }
.about .h3 { margin: 22px 0 0; }
.about .lead { font-size: 17px; }
.about a { text-underline-offset: 3px; }
.facts { margin: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 8px; }
.facts div { background: var(--card); border-radius: 14px; padding: 10px 14px; display: grid; gap: 2px; }
.facts dt { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-size: 15px; color: var(--ink); }
.steps, .ticks { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 10px; }
.ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.ideas section { background: var(--card); border-radius: 18px; padding: 16px 18px; scroll-margin-top: 16px; }
.ideas h4 { margin: 0 0 6px; font-size: 16px; }
.faq { display: grid; gap: 8px; }
.faq details { background: var(--card); border-radius: 16px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.faq details p { margin-top: 8px; }
.about-cta { margin-top: 18px; }
.about-cta .cta { max-width: 360px; margin: 0 auto; }

/* ---------- Shared link page ---------- */
.shared { background: #0f0f0f; }
.screen-shared { position: fixed; inset: 0; overflow: hidden; }
.screen-shared .viewer { right: 0; bottom: 0; }
.shared-top { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.shared-top > * { pointer-events: auto; }
.wordmark { color: #ffffff; text-decoration: none; font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.shared-card { position: absolute; z-index: 4; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); background: var(--card); border-radius: 24px; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.kicker { margin: 0; font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.shared-card .h2 { font-size: clamp(24px, 7vw, 30px); }
@media (min-width: 900px) {
  .shared-top { left: 28px; right: 28px; top: 22px; }
  .shared-card { left: 28px; right: auto; bottom: 28px; width: 380px; padding: 24px 24px 18px; gap: 14px; }
  .shared-card .h2 { font-size: 34px; }
}

/* Turnstile shows something only if Cloudflare asks the person to click */
#turnstile { position: fixed; z-index: 30; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); }

/* ---------- Text pages (terms, privacy) ---------- */
.doc { background: var(--card); }
.doc-wrap { max-width: 680px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px 48px; font-size: 16px; line-height: 1.6; }
.doc-wrap h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.05; font-weight: 800; letter-spacing: -.04em; margin: 8px 0 4px; }
.doc-wrap h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 28px 0 6px; }
.doc-wrap ul { padding-left: 1.2em; }
.doc-wrap li { margin: 6px 0; }
.doc-draft { display: inline-block; margin: 0; background: var(--warm); color: var(--accent-ink); font-size: 13px; font-weight: 700; border-radius: 99px; padding: 6px 12px; }
.doc-back { margin-top: 32px; font-weight: 600; }
.order-video { display: block; max-width: 100%; max-height: 70vh; margin: 20px auto; border-radius: 16px; background: var(--bg); }
.doc-wrap .files, .files { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.doc-wrap .files li, .files li { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #dddddd; border-radius: 14px; background: var(--card); font-size: 14px; }
.files .cta { width: auto; margin: 0; padding: 8px 16px; font-size: 14px; flex: none; }
.legal { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; }
.legal a { white-space: nowrap; }
.langs a[aria-current] { color: var(--ink); font-weight: 600; }
.legal a { color: var(--ink-3); text-decoration: none; }
/* Footer under the about section (top screen only) */
body:not([data-screen="top"]) .site-foot { display: none; }
.site-foot { max-width: 720px; margin: 0 auto; padding: 0 20px max(36px, env(safe-area-inset-bottom)); display: grid; gap: 14px; border-top: 1px solid #e4e4e4; padding-top: 24px; }
.foot-name { margin: 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.foot-name a { color: inherit; }
