/* 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 ---------- */
.screen-top { min-height: 100%; padding: max(14px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: flex-end; padding: 2px 4px 8px; }
.toplink { font-size: 14px; font-weight: 600; text-decoration: none; }
.top-grid { max-width: 1180px; margin: 0 auto; }
.top-copy { display: flex; flex-direction: column; gap: 12px; max-width: 520px; margin: 0 auto; }
.brand { margin: 0; font-size: clamp(44px, 14.6vw, 112px); line-height: .9; font-weight: 800; letter-spacing: -.055em; padding: 0 2px; }
.sample-card { position: relative; background: var(--card); border-radius: var(--radius); padding: 8px; }
.sample-img { width: 100%; height: auto; aspect-ratio: 7 / 4; 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 .loupe, .sample-card .chip-float { z-index: 1; }
.loupe { position: absolute; right: 18px; top: 18px; width: 84px; height: 84px; border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 8px 20px rgba(0,0,0,.28); background: url(/assets/sample-closeup.jpg) 46% 30% / 230% no-repeat; }
.rows { background: var(--card); border-radius: var(--radius); padding: 2px 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 13px; color: #666666; }
.row-text strong { font-size: 15px; color: var(--ink); }
.thumb { width: 44px; height: 44px; border-radius: 11px; flex: none; background: #eee center / cover no-repeat; }
.thumb-main { background-image: url(/assets/sample-main.jpg); }
.thumb-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; background: none; }
.thumb-tiles i { background: url(/assets/sample-closeup.jpg) no-repeat; background-size: 1200% 1200%; }
.thumb-tiles i:nth-child(1) { border-radius: 4px 0 0 0; background-position: 27.3% 9.1%; }
.thumb-tiles i:nth-child(2) { border-radius: 0 4px 0 0; background-position: 63.6% 45.5%; }
.thumb-tiles i:nth-child(3) { border-radius: 0 0 0 4px; background-position: 9.1% 72.7%; }
.thumb-tiles i:nth-child(4) { border-radius: 0 0 4px 0; background-position: 90.9% 18.2%; }
.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); }
.occasions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.occasions a { font-size: 13px; font-weight: 600; text-decoration: none; background: var(--card); border-radius: 99px; padding: 7px 11px; }

/* ---------- 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; }

/* ---------- 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; }

/* ---------- 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: 22px 40px 40px; display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
  .top-grid { width: 100%; margin: auto; }
  .top-copy { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: "brand card" "rows card" "cta card" "fine card" "occ card"; column-gap: 48px; row-gap: 14px; align-items: start; }
  .top-copy { grid-template-areas: "brand brand" "rows card" "cta card" "fine card" "occ card"; grid-template-rows: auto auto auto auto 1fr; align-content: start; }
  .brand { grid-area: brand; font-size: min(9.6vw, 128px); white-space: nowrap; margin-bottom: 18px; }
  .brand br { display: none; }
  /* 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 - 250px))); }
  .sample-img { aspect-ratio: 1; }
  .loupe { width: 140px; height: 140px; }
  .rows { grid-area: rows; }
  .top-copy > .cta { grid-area: cta; }
  .fineprint { grid-area: fine; }
  .occasions { grid-area: occ; justify-content: flex-start; }
  .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; } }

/* ---------- 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; }
.legal { display: flex; gap: 14px; justify-content: center; font-size: 12px; }
.legal a { color: var(--ink-3); text-decoration: none; }
@media (min-width: 900px) { .legal { grid-column: 1; justify-content: flex-start; } }
