/* ReCollection web app (V1 prototype), in the style of live.re-collection.xyz:
   DM Sans only, near-black ground with the installation loop under a scrim, two-tone headlines,
   glass cards with a thin white border, square corners, white and outline buttons with small
   uppercase labels, the light-blue pill. Breakpoints 900 px (left/right layout) and 640 px. */
:root {
  --ground: #0B0C10;
  --white: #fff;
  --text: rgba(255, 255, 255, .82);
  --muted: rgba(255, 255, 255, .62);
  --faint: rgba(255, 255, 255, .45);
  --line: rgba(255, 255, 255, .16);
  --line-strong: rgba(255, 255, 255, .3);
  --glass: rgba(255, 255, 255, .06);
  --pill: #8FC6EA;
  --warn: #e8a598;
  --sans: "DM Sans", Arial, sans-serif;
  --wrap: 1320px;
  --pad: clamp(20px, 4vw, 48px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100svh; background: var(--ground); color: var(--white);
  font-family: var(--sans); font-size: 18px; line-height: 1.55; letter-spacing: -.015em; -webkit-font-smoothing: antialiased; }
p { margin: 0; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--pill); outline-offset: 3px; }

/* background loop and scrim, as on the Try page */
.bg { position: fixed; inset: 0; z-index: 0; background: var(--ground); }
.bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-scrim { position: absolute; inset: 0; transition: background-color .4s ease;
  background: linear-gradient(90deg, rgba(11, 12, 16, .84) 0%, rgba(11, 12, 16, .6) 42%, rgba(11, 12, 16, .26) 100%),
              linear-gradient(rgba(11, 12, 16, .3), rgba(11, 12, 16, .3)); }
/* where a memory video is the picture, the loop steps back */
body[data-screen="home"] .bg-scrim, body[data-screen="result"] .bg-scrim { background-color: rgba(11, 12, 16, .7); }
@media (prefers-reduced-motion: reduce) {
  .bg-video { display: none; }
  .bg { background: var(--ground) url("media/bg-poster.jpg") center / cover no-repeat; }
  * { transition: none !important; animation: none !important; }
}

/* header, as on the Try page */
.site-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) var(--pad) 18px;
  background: rgba(11, 12, 16, .8); border-bottom: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.site-home { font: 700 20px/1 var(--sans); letter-spacing: -.045em; color: #fff; text-decoration: none; white-space: nowrap; }
.site-home:hover { color: #d0d0d0; }
.pill { display: inline-block; font: 500 13px/1.2 var(--sans); letter-spacing: 0; color: var(--pill);
  border: 1px solid rgba(143, 198, 234, .45); background: rgba(143, 198, 234, .1); padding: 7px 14px; }

/* screens: phone first */
main { position: relative; z-index: 1; }
.screen { display: flex; flex-direction: column; gap: 28px; max-width: var(--wrap); margin: 0 auto;
  padding: clamp(36px, 7vw, 64px) var(--pad) max(48px, env(safe-area-inset-bottom)); }
.screen[hidden] { display: none !important; }   /* stronger than the per-screen layouts */
.col-text { display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 560px; }
.col-media { min-width: 0; }
.screen[data-screen="home"] .col-media, .screen[data-screen="result"] .col-media { order: -1; }   /* phones: the video first */

/* type, as on the Try page */
.eyebrow { font: 500 13px/1.3 var(--sans); color: #fff; margin-bottom: -4px; }
.h2 { font: 400 clamp(32px, 3vw, 48px)/1.08 var(--sans); letter-spacing: -.05em; margin: 0; max-width: 17ch; }
.h2 .muted { color: var(--muted); }
.lede { font-size: 17px; line-height: 1.55; color: var(--text); max-width: 44ch; }
.note { font-size: 14px; line-height: 1.5; color: var(--muted); }
.back { font: 500 13px/1 var(--sans); color: rgba(255, 255, 255, .7); text-decoration: none; width: fit-content; margin-bottom: 4px; }
.back:hover { color: #fff; }

/* buttons: the site's small uppercase labels, square */
.cta-row { padding-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 14px 28px;
  font: 500 13px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .25s ease, color .25s ease, border-color .25s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent; }
.btn-primary { background: #fff; color: #0B0C10; }
.btn-primary:hover { background: #d9d9d9; }
.btn-outline { background: rgba(11, 12, 16, .35); color: #fff; border-color: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.btn-outline:hover { background: #fff; color: #0B0C10; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary:disabled:hover { background: #fff; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn-block { width: 100%; }

/* small labels and item text */
.label { font: 500 13px/1.3 var(--sans); color: var(--muted); margin-bottom: 10px; }
.row-title { font-size: 16px; color: #fff; }
.row-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* the memory field */
.field { position: relative; }
textarea { display: block; width: 100%; min-height: 168px; resize: none; padding: 18px 20px 40px; outline: none;
  background: var(--glass); border: 1px solid var(--line); color: #fff; font: 400 17px/1.5 var(--sans); letter-spacing: -.01em;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: border-color .2s ease; }
textarea:focus { border-color: rgba(255, 255, 255, .7); }
textarea::placeholder { color: var(--faint); }
.count { position: absolute; right: 16px; bottom: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.full { color: var(--warn); }
.msg { color: var(--warn); font-size: 14px; margin-top: -8px; }
.msg:empty { display: none; }

/* two-line headlines: the second sentence on its own line */
.h2.two-line { max-width: none; }
.h2.two-line .muted { display: block; }
/* a column as wide as its headline's longest line (the write screen's field follows it) */
.col-text.fit { width: max-content; max-width: 100%; }

/* confirm & pay */
.confirm { display: flex; flex-direction: column; gap: 20px; width: 100%; }
.h3 { font: 400 clamp(22px, 1.9vw, 30px)/1.2 var(--sans); letter-spacing: -.035em; color: #fff; }
.confirm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 8px; }
.memory-box { background: var(--glass); border: 1px solid var(--line); padding: 22px 24px; min-height: 120px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.memory-text { font-size: 18px; line-height: 1.5; color: #fff; overflow-wrap: anywhere; }
.memory-box .memory-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.cg-pay { display: flex; flex-direction: column; gap: 16px; }
.btn.pay-btn { width: 100%; min-height: 62px; background: #fff; color: #0B0C10; font: 500 18px/1 var(--sans); letter-spacing: -.01em; text-transform: none; }
.btn.pay-btn:hover { background: #e2e2e2; }
.lock-note, .info-note { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.45; color: var(--text); }
.lock-note svg, .info-note svg { flex: none; width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rule { border: 0; border-top: 1px solid var(--line-strong); margin: 22px 0 10px; }
.cg-get { display: flex; flex-direction: column; gap: 20px; }
.get-row { display: flex; flex-direction: column; gap: 18px; }
.get-item { display: flex; gap: 18px; align-items: flex-start; }
.get-item svg { flex: none; width: 44px; height: 44px; fill: none; stroke: #fff; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.get-item .row-title { font-size: 17px; font-weight: 500; }
.get-item .row-sub { font-size: 15px; color: var(--text); margin-top: 4px; }
.get-divider { display: block; height: 1px; background: var(--line); }

/* generating: the memory, then the progress line under it */
.gen-col { width: min(100%, 900px); max-width: none; }
.gen-memory .label { margin-bottom: 8px; }
.gen-memory .memory-text { font-size: 20px; }
.progress { position: relative; height: 1px; background: var(--line-strong); overflow: hidden; margin-top: -4px; }
.progress span { position: absolute; top: 0; left: 0; width: 0; height: 1px; background: #fff; transition: width 1.4s linear; }
.progress.waiting span { left: -30%; width: 30%; transition: none; animation: run 1.8s ease-in-out infinite; }
@keyframes run { to { left: 100%; } }
.queue { font-size: 15px; color: var(--text); }
.queue:empty { display: none; }
.info-note { color: var(--muted); }
.info-note svg { stroke: var(--muted); }

/* video player */
.player { position: relative; overflow: hidden; background: #000; border: 1px solid var(--line); aspect-ratio: 4 / 3; }
.player video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Example and generated videos share the full portrait frame. */
.screen[data-screen="home"] .player, .screen[data-screen="result"] .player {
  width: min(100%, 420px, calc(56.25svh - 90px));
  margin-inline: auto;
  aspect-ratio: 9 / 16;
}
.screen[data-screen="home"] .player video, .screen[data-screen="result"] .player video { object-fit: contain; }
.play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .85); background: rgba(11, 12, 16, .35); cursor: pointer; border-radius: 50%;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .25s ease, background-color .25s ease; }
.play:hover { background: rgba(255, 255, 255, .15); }
.play svg { width: 24px; height: 24px; fill: #fff; margin-left: 3px; }
.dur { position: absolute; right: 12px; bottom: 12px; font-size: 12px; line-height: 1; padding: 5px 7px; background: rgba(0, 0, 0, .6);
  color: #fff; font-variant-numeric: tabular-nums; }
.dur:empty { display: none; }
.player.playing .play, .player.playing .dur { opacity: 0; pointer-events: none; }

/* result */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.screen[data-screen="result"] .cta-row { padding-top: 0; }
.screen[data-screen="result"] .cta-row .btn { width: 100%; }
.quote-lede { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }

/* toast */
.toast { position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translate(-50%, 10px); z-index: 20;
  padding: 12px 18px; background: #fff; color: #0B0C10; font: 500 14px/1.2 var(--sans); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .site-home { font-size: 18px; }
  .pill { font-size: 12px; padding: 6px 10px; }
  .cta-row .btn { width: 100%; }
}

/* desktop: left/right in one screen, content on the left like the Try page */
@media (min-width: 900px) {
  .screen { display: grid; grid-template-columns: minmax(380px, 5fr) 6fr; gap: clamp(48px, 6vw, 96px); align-items: center;
    min-height: calc(100vh - 61px); min-height: calc(100svh - 61px); padding-top: 40px; padding-bottom: 48px; }
  .screen[data-screen="result"] { grid-template-columns: 6fr minmax(380px, 5fr); }
  .screen[data-screen="home"] .col-media, .screen[data-screen="result"] .col-media { order: 0; }
  /* one-column screens, centred vertically */
  .screen[data-screen="create"], .screen[data-screen="generating"], .screen[data-screen="confirm"], .screen[data-screen="missing"], .screen[data-screen="failed"] { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
  /* confirm: "Your memory" and "Total" on one line, the box and the Pay button top-aligned, what you get in a row */
  .confirm-grid { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); column-gap: 40px; row-gap: 16px; align-items: start;
    grid-template-areas: "mlabel total" "mbox pay" "rule rule" "get ."; }
  .cg-mlabel { grid-area: mlabel; } .cg-mbox { grid-area: mbox; } .cg-total { grid-area: total; margin-top: 0; }
  .cg-pay { grid-area: pay; } .cg-rule { grid-area: rule; margin: 18px 0 6px; } .cg-get { grid-area: get; }
  .get-row { flex-direction: row; align-items: stretch; gap: 0; }
  .get-item { flex: 1; padding-right: 28px; }
  .get-item + .get-divider + .get-item { padding: 0 0 0 28px; }
  .get-divider { width: 1px; height: auto; }
}
