/* With 애니 — standalone digital photobooth
   Theme-able by design: frame themes live in app.js as data,
   page chrome uses the custom props below.
   Chrome follows the ALIVE v2 "vinyl" system: ivory canvas, hairlines,
   brass accents, Cormorant Garamond / Nanum Myeongjo / Montserrat.
   Token values mirror alive/assets/css/v2.css — kept inline so the app
   stays self-contained. */

:root {
  --canvas: #f7f1e7;
  --canvas-low: #f2eadf;
  --surface: #fbf7ef;
  --ink: #241d15;
  --ink-soft: #5e574e;
  --muted: #958875;
  --hairline: rgba(132, 104, 66, 0.24);
  --brass: #c8964d;
  --brass-light: #e2b86d;
  --brass-text: #a87a38;
  --brass-deep: #8a6227;
  --serif: "Cormorant Garamond", Georgia, serif;
  --serif-kr: "Nanum Myeongjo", serif;
  --sans: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.5), transparent 38%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-low) 100%);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; flex: 1; }
.screen.active { display: block; }

/* ---------------- site rail ---------------- */

.site-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* The wordmark and nav links carry a 44px min-height for tap targets, which
     centers the logo mark within a taller box than the borderless rails
     (index/tour) use. Trim the top padding so the logo lines up at the same
     height as the other pages. */
  padding: 16px max(28px, 5vw) 0;
}

.site-wordmark {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 44px;
  color: var(--ink);
  font-size: 0; /* hide the text label; it stays in the DOM as the link's accessible name */
  text-decoration: none;
}
.site-wordmark::before {
  content: "";
  height: 16px;
  aspect-ratio: 800 / 155;
  background-color: currentColor;
  -webkit-mask: url("/_vinyl/brand/alive-logo.png") center / contain no-repeat;
  mask: url("/_vinyl/brand/alive-logo.png") center / contain no-repeat;
}
.site-wordmark span { display: none; }

.site-rail nav {
  display: flex;
  gap: 38px;
}
.site-rail nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 600 11px/1 var(--sans);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 200ms ease;
}
.site-rail nav a.active { color: var(--brass-deep); }
.site-rail nav a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--brass);
  transform: translateX(-50%);
}
.site-wordmark:focus-visible,
.site-rail nav a:focus-visible {
  outline: 2px solid var(--brass-deep);
  outline-offset: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .site-rail nav a:hover { color: var(--brass-deep); }
}

/* ---------------- start screen ---------------- */

.masthead {
  text-align: center;
  padding: clamp(28px, 6vh, 72px) 20px 8px;
}

.kicker {
  font: 700 11px/1.8 var(--sans);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.wordmark {
  font: 500 clamp(38px, 4.6vw, 54px)/1.1 var(--serif);
  letter-spacing: -0.01em;
  margin: 0;
}
.wordmark .kr {
  font-family: var(--serif-kr);
  font-size: .86em;
}

.tagline {
  max-width: 60ch;
  margin: 18px auto 0;
  font: 400 15px/1.65 var(--serif);
  color: var(--ink-soft);
}

.setup {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

/* § section heads — italic serif brass numeral + caps title over a hairline */
.setup-label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font: 600 12px/1 var(--sans);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
  margin: 36px 0 18px;
}
.setup-label .num {
  font: italic 500 17px/1 var(--serif);
  letter-spacing: 0;
  color: var(--brass-text);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* surface cards — hairline border, brass selected state + dot */
.option-card {
  position: relative;
  font-family: var(--sans);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 26px rgba(78, 52, 21, .07);
  transition: border-color .15s ease, box-shadow .15s ease;
  color: var(--ink);
}
.option-card:hover { border-color: rgba(132, 104, 66, .45); }
.option-card.selected { border-color: var(--brass); }
.option-card.selected::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--brass);
}
.option-card .option-name {
  font: 600 10.5px/1.5 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
}

/* compact rows — pill chips, brass-filled when selected */
.option-row.compact { gap: 10px; }
.option-row.compact .option-card {
  padding: 12px 20px;
  border-radius: 99px;
  box-shadow: none;
  color: var(--ink-soft);
}
.option-row.compact .option-card .option-name {
  font: 600 11px/1 var(--sans);
  letter-spacing: .14em;
  text-transform: none;
}
.option-row.compact .option-card.selected {
  background: var(--brass);
  border-color: var(--brass);
  color: #fff;
}
.option-row.compact .option-card.selected::after { display: none; }

/* grouped backdrop shelves (special / classic) */
.backdrop-groups { display: flex; flex-direction: column; gap: 10px; }
.backdrop-section-label {
  font: 600 10px/1.6 var(--sans);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 2px;
}
.backdrop-groups > .backdrop-section-label:first-child { margin-top: 4px; }
/* -2px trims the note's trailing line-leading so the gap below it matches the
   card-row → next-section-label gap (≈16px) rather than reading ~2px larger */
.backdrop-section-note { margin-top: 2px; margin-bottom: -2px; }

/* layout pictograms */
.layout-icon { display: grid; gap: 2px; }
.strip-icon { grid-template-rows: repeat(4, 6px); width: 14px; }
.grid-icon  { grid-template-columns: repeat(2, 10px); grid-template-rows: repeat(2, 8px); }
.layout-icon i { background: var(--hairline); border-radius: 1px; display: block; }
.option-card.selected .layout-icon i { background: rgba(200, 150, 77, .5); }

/* theme swatch chip */
.swatch {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  display: inline-block;
  flex: none;
}

.big-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: 600 12px/1 var(--sans);
  letter-spacing: .28em;
  text-transform: uppercase;
  background: var(--brass);
  color: #fff;
  border: 0;
  border-radius: 99px;
  box-shadow: 0 14px 30px rgba(138, 98, 39, .28), inset 0 1px 0 var(--brass-light);
  padding: 18px 32px;
  margin-top: 34px;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease, background .15s ease;
}
.big-button:hover { background: var(--brass-text); }
.big-button:active { transform: translateY(1px); box-shadow: 0 8px 18px rgba(138, 98, 39, .24), inset 0 1px 0 var(--brass-light); }
.big-button .arrow { transition: transform .15s ease; }
.big-button:hover .arrow { transform: translateX(4px); }
.big-button.secondary {
  background: var(--surface);
  color: var(--brass-deep);
  border: 1px solid var(--hairline);
  box-shadow: 0 10px 26px rgba(78, 52, 21, .07);
}
.big-button.secondary:hover { border-color: var(--brass); background: var(--surface); }
.big-button[disabled] { opacity: .5; cursor: not-allowed; }

.ghost-button {
  font: 500 11px/1 var(--sans);
  letter-spacing: .1em;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px;
}
.ghost-button:hover { color: var(--brass-deep); }

.fine-print {
  font: 400 11px/1.7 var(--sans);
  color: var(--muted);
  margin-top: 16px;
  max-width: 52ch;
}
.fine-print a {
  color: var(--brass-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fine-print a:hover { color: var(--brass-text); }
.upload-hint {
  margin-top: 12px;
  font: 400 14.5px/1.65 var(--serif);
  color: var(--ink-soft);
}

/* ---------------- booth screen ---------------- */

#screen-booth.active { display: flex; align-items: center; justify-content: center; }

.booth-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
  width: 100%;
}

.booth-status {
  font: 600 12px/1 var(--sans);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin: 0 0 12px;
}

.cut-dots { display: flex; gap: 8px; margin-bottom: 16px; }
.cut-dots .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.cut-dots .dot.active { transform: scale(1.35); border-color: var(--brass-deep); }
.cut-dots .dot.done { background: var(--brass); border-color: var(--brass); }

.viewfinder {
  position: relative;
  width: min(92vw, 560px);
  aspect-ratio: 4 / 3;
  background: #111;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 22px 44px rgba(78, 52, 21, .14);
}

#camera, #fx {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror like a real booth screen */
}
#fx { z-index: 1; }

/* backdrop swatches get their gradient inline from JS */
.swatch.backdrop-swatch { border-radius: 50%; }
/* "Plain" swatch is a native colour input styled to match the round chips */
.swatch.backdrop-swatch.plain-color { padding: 0; cursor: pointer; background: none; appearance: none; -webkit-appearance: none; }
.swatch.backdrop-swatch.plain-color::-webkit-color-swatch-wrapper { padding: 0; }
.swatch.backdrop-swatch.plain-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.swatch.backdrop-swatch.plain-color::-moz-color-swatch { border: none; border-radius: 50%; }
/* multi-shot sets render their four scenes as a 2×2 inside the chip — squared
   off (not round) with dividing lines, so "four different scenes" reads even
   when the shots look alike. Bigger than the single-photo chips on purpose. */
.swatch.backdrop-swatch.quad {
  width: 24px; height: 24px;
  border-radius: 5px;
  display: grid;
  grid-template: 1fr 1fr / 1fr 1fr;
  gap: 1.5px;
  overflow: hidden;
  padding: 0;
  background: currentColor; /* shows through the gap as divider lines */
}
.swatch.backdrop-swatch.quad i {
  background-size: cover;
  background-position: center;
  background-color: #d8d4c8; /* fallback tile tint before the webp decodes */
}

/* backdrop preview — so picking isn't blind */
.backdrop-preview {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  margin: 0 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(78, 52, 21, .1);
  overflow: hidden;
  background: var(--canvas-low);
}
#backdrop-preview-canvas {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  transform: scaleX(-1); /* match the booth's mirrored #fx canvas */
}
.backdrop-preview-label {
  position: absolute;
  left: 8px; bottom: 8px;
  font: 500 10px/1 var(--sans);
  letter-spacing: .08em;
  color: #fff;
  background: rgba(36, 29, 21, .72);
  padding: 5px 10px;
  border-radius: 999px;
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 clamp(90px, 24vw, 180px)/1 var(--serif);
  color: #fff;
  text-shadow: 0 4px 28px rgba(0, 0, 0, .55);
  pointer-events: none;
}
.countdown.tick { animation: pop .45s ease both; }
@keyframes pop {
  0% { transform: scale(1.6); opacity: 0; }
  35% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.92); opacity: .9; }
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.flash.fire { animation: flashfire .5s ease-out both; }
@keyframes flashfire {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.last-shot-peek {
  position: absolute;
  z-index: 4;
  right: 10px; bottom: 10px;
  width: 88px;
  aspect-ratio: 4 / 3;
  border: 2px solid #fff;
  border-radius: 6px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) rotate(2deg);
  transition: opacity .3s ease, transform .3s ease;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.last-shot-peek.show { opacity: 1; transform: translateY(0) rotate(2deg); }

.booth-hint { font: 400 12px/1.6 var(--sans); color: var(--ink-soft); margin-top: 16px; }

.camera-fallback {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px;
  font: 400 14px/1.7 var(--sans);
  color: var(--ink-soft);
}
.fallback-title {
  font: 500 26px/1.2 var(--serif);
  color: var(--ink);
  margin: 0 0 8px;
}
.file-button { display: inline-flex; }

/* ---------------- result screen ---------------- */

#screen-result.active { display: block; }

.result-layout {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 5vw, 64px);
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.print-slot-wrap { position: relative; flex: none; }

.print-slot {
  position: relative;
  width: 100%;
  height: 18px;
  z-index: 3;
}
.slot-lip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% + 36px);
  height: 16px;
  background: var(--ink);
  border-radius: 8px;
  display: block;
  box-shadow: 0 3px 0 rgba(36, 29, 21, .25);
}

.strip-holder {
  position: relative;
  overflow: hidden;
  padding: 0 18px 26px;
  margin-top: -2px;
}

#strip-canvas {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 14px 34px rgba(78, 52, 21, .28);
  border-radius: 4px;
  transform: translateY(-104%);
}
.printing #strip-canvas {
  animation: printout 2.6s cubic-bezier(.22,.9,.3,1) forwards;
}
@keyframes printout {
  0%   { transform: translateY(-104%); }
  12%  { transform: translateY(-96%); }
  18%  { transform: translateY(-97%); } /* the little printer hesitation */
  100% { transform: translateY(0); }
}

.strip-holder.strip-size { width: min(72vw, 280px); }
.strip-holder.grid-size  { width: min(88vw, 430px); }

.result-controls { max-width: 440px; }
.result-title {
  font: 500 clamp(30px, 4vw, 42px)/1.1 var(--serif);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.result-sub { font: 400 13px/1.7 var(--sans); color: var(--ink-soft); margin: 0 0 8px; }

.retake-row { display: flex; gap: 10px; flex-wrap: wrap; }
.retake-thumb {
  width: 76px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 6px 16px rgba(78, 52, 21, .12);
  transition: border-color .15s ease;
  padding: 0;
}
.retake-thumb:hover { border-color: var(--brass); }
.retake-thumb::after {
  content: "✎";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  background: rgba(36, 29, 21, .45);
  opacity: 0;
  transition: opacity .12s ease;
  border-radius: 7px;
}
.retake-thumb:hover::after { opacity: 1; }

.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.action-row .big-button { margin-top: 18px; }

/* ---------------- touch-up editor ---------------- */

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(36, 29, 21, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.editor-overlay[hidden] { display: none; }

.editor-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 22px 44px rgba(36, 29, 21, .3);
  padding: 20px 22px 22px;
  max-width: 640px;
  width: 100%;
  max-height: 94svh;
  overflow: auto;
}

.editor-title {
  font: 600 12px/1 var(--sans);
  letter-spacing: .22em;
  color: var(--brass-deep);
  margin: 0 0 8px;
}
.editor-sub { font: 400 12px/1.6 var(--sans); color: var(--ink-soft); margin: 0 0 14px; }

#edit-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  background: #111;
}

.editor-tools { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.editor-tools.disabled { opacity: .45; pointer-events: none; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 12px/1 var(--sans);
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--brass);
}

.editor-actions { margin-top: 6px; }
.editor-actions .big-button { margin-top: 14px; padding: 14px 22px; }

/* ---------------- colophon ---------------- */

.colophon {
  text-align: center;
  font: 400 12px/1.6 var(--serif);
  color: var(--muted);
  padding: 18px 16px 26px;
}
.colophon p { margin: 0; }

@media (max-width: 680px) {
  .site-rail nav { display: none; }
  .result-layout { flex-direction: column; align-items: center; }
  .result-controls { text-align: center; }
  .result-controls .setup-label { justify-content: center; }
  .option-row { justify-content: center; }
  /* but keep the setup pickers (layout / backdrop / timer) left-aligned, like desktop */
  .setup .option-row { justify-content: flex-start; }
  .retake-row, .action-row { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .printing #strip-canvas { animation-duration: .6s; }
  .countdown.tick { animation: none; }
}
