/* Pet Movie create page. Mobile first. The page sets --a and --b to the brand accents. */

:root {
  color-scheme: dark;
  --bg: #090b13;
  --panel: rgba(18, 22, 34, .82);
  --panel-solid: #121622;
  --field: #0e1220;
  --line: #2b3041;
  --line-soft: #242938;
  --text: #ffffff;
  --text-soft: #d8ddea;
  --muted: #aeb6ca;
  --faint: #858da0;
  --danger: #ff9b9b;
  --ok: #7fe0a8;
  --radius: 20px;
  --radius-small: 14px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--a) 26%, transparent), transparent 30rem),
    radial-gradient(circle at 95% 12%, color-mix(in srgb, var(--b) 20%, transparent), transparent 26rem);
}

a { color: inherit; }

.wrap {
  position: relative;
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Navigation and hero */

.topnav { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 900; font-size: 20px; letter-spacing: -.03em; text-decoration: none; }
.brand span { display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: 0 0 20px var(--b); }
.navlinks { display: flex; gap: 18px; color: #b8bfd0; font-size: 14px; font-weight: 600; }
.navlinks a { text-decoration: none; }

.hero { padding: 22px 0 8px; }
.eyebrow { color: #d9ddec; font-weight: 800; font-size: 12px; letter-spacing: .16em; }
.hero h1 { margin: 12px 0 12px; font-size: clamp(38px, 10vw, 66px); line-height: .95; letter-spacing: -.055em; }
.gradient { background: linear-gradient(100deg, #fff 8%, var(--a) 55%, var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 0; color: #bec5d6; font-size: clamp(16px, 4.2vw, 20px); line-height: 1.5; max-width: 620px; }

/* Panels, steps and buttons */

.panel, .step {
  margin: 20px 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; }
.panel p { color: var(--muted); line-height: 1.55; margin: 0 0 14px; }

.step { min-width: 0; }
.step legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.step legend + * { clear: both; }
.step-no {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--a) 18%, #151925);
  color: var(--a);
  font-size: 13px;
  font-weight: 900;
}
.step-help { color: var(--muted); margin: 0 0 14px; line-height: 1.5; font-size: 15px; }

.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-small);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--a), var(--b));
  box-shadow: 0 14px 40px color-mix(in srgb, var(--a) 22%, transparent);
}
.button.secondary { background: #151925; border: 1px solid #303649; box-shadow: none; color: var(--text-soft); }
.button.small { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 12px; box-shadow: none; }
.button.wide { width: 100%; min-height: 56px; font-size: 17px; }
.button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.button:focus-visible, .button:focus-within, .link-button:focus-visible { outline: 2px solid var(--a); outline-offset: 3px; }

.link-button {
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: rgba(9, 11, 19, .72); border: 1px solid rgba(255, 255, 255, .18); font-size: 12px; font-weight: 800; color: #fff; }

/* Choice cards (templates and cast modes) */

.choice-grid { display: grid; gap: 10px; }
.choice-grid.templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-grid.templates .template-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.choice-grid.cast { grid-template-columns: 1fr; }

.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(24, 29, 43, .96), rgba(12, 15, 25, .96));
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.choice-title { font-weight: 800; font-size: 15px; }
.choice-text { color: #9fa8bd; font-size: 13px; line-height: 1.45; }
.price { margin-top: auto; padding-top: 4px; color: var(--a); font-size: 13px; font-weight: 800; }
.choice input:checked + .choice-body {
  border-color: var(--a);
  box-shadow: 0 0 0 1px var(--a), 0 12px 32px color-mix(in srgb, var(--a) 20%, transparent);
}
.choice input:focus-visible + .choice-body { outline: 2px solid var(--b); outline-offset: 2px; }

/* The poster shows the sample thumbnail when the site has a sample for the
   template. Without it, the poster shows an icon on the gradient of the template theme
   (TEMPLATE_PAGE_COPY in pet_site_service.py). */
.poster {
  position: relative;
  height: 96px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--a) 70%, #1b1f2e), color-mix(in srgb, var(--b) 55%, #10131d));
}
.poster[data-theme="night"] { background: linear-gradient(150deg, #3a4a5c, #10151f); }
.poster[data-theme="field"] { background: linear-gradient(150deg, #1f8f6a, #0f2a3a); }
.poster[data-theme="stage"] { background: linear-gradient(150deg, #6b3fd4, #1a1330); }
.poster[data-theme="party"] { background: linear-gradient(150deg, #ff5bb7, #ffb347); }
.poster-icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: rgba(255, 255, 255, .92);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
}
.poster-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .chip { position: absolute; right: 7px; bottom: 7px; }

/* A template card with a sample has a play button over its poster
   (pet_samples.css). The button sits next to the label and not in it, so
   the offsets are the border (1px) and the padding (12px) of .choice-body,
   and the height is the poster height. The poster chip stays visible. */
.template-card { position: relative; }
.template-card > .choice { height: 100%; }
.template-card > .sample-play { top: 13px; left: 13px; right: 13px; height: 96px; }
.sound-tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.template-sound { margin-top: 12px; color: var(--text-soft); font-weight: 700; }

/* Song style (only for a song template) */

.song-style { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.choice-grid.song-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Photo slots */

.photo-grid { display: grid; gap: 12px; }
/* The optional body notes under the photos. */
.body-notes { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.body-notes .field:last-child { margin-bottom: 0; }
.body-note-text { margin-top: 12px; }
.photo-slot {
  display: flex;
  gap: 14px;
  padding: 12px;
  border: 1px dashed #3a4157;
  border-radius: 16px;
  background: rgba(9, 11, 19, .5);
}
.photo-slot[data-state="ready"] { border-style: solid; border-color: color-mix(in srgb, var(--a) 60%, var(--line)); }
.photo-slot[data-state="error"] { border-style: solid; border-color: #6b2a35; }

.photo-preview {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #151925;
  display: grid;
  place-items: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-preview img:not([hidden]) ~ .photo-empty { display: none; }
.photo-empty {
  width: 38px;
  height: 30px;
  border: 2px solid #4a5270;
  border-radius: 8px;
  position: relative;
}
.photo-empty::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #4a5270;
  border-radius: 50%;
}
.photo-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, .55); overflow: hidden; }
.photo-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a), var(--b)); transition: width .2s ease; }

.photo-info { min-width: 0; flex: 1; }
.photo-info h3 { margin: 2px 0 4px; font-size: 16px; }
.photo-status { margin: 4px 0 8px; font-size: 13px; font-weight: 700; min-height: 1em; color: var(--muted); }
.photo-status[data-kind="ready"] { color: var(--ok); }
.photo-status[data-kind="error"] { color: var(--danger); }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-actions .button { position: relative; }

/* The camera button helps on phones only. A desktop shows one "Choose photo" button. */
.pointer-only { display: none; }
@media (hover: hover) and (pointer: fine) {
  .camera-only { display: none; }
  .touch-only { display: none; }
  .pointer-only { display: inline; }
}

/* Text fields */

.field { margin: 0 0 16px; }
.field label, .field-label { display: block; margin: 0 0 7px; font-weight: 700; font-size: 15px; }
.optional { color: var(--faint); font-weight: 600; }
.field input[type="text"], .field input[type="number"], .field textarea, .field select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--a); outline-offset: 1px; border-color: transparent; }
.field input[type="range"] { width: 100%; accent-color: var(--a); }
.range-value { display: inline-block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.counter { display: block; margin-top: 5px; text-align: right; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); }
.segmented label { position: relative; margin: 0; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 42px; border-radius: 10px; font-weight: 700; font-size: 15px; color: var(--muted); }
.segmented input:checked + span { background: linear-gradient(135deg, var(--a), var(--b)); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--a); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; line-height: 1.45; font-size: 15px; cursor: pointer; }
.check input { flex: 0 0 22px; width: 22px; height: 22px; margin: 0; accent-color: var(--a); cursor: pointer; }
.check + .check { border-top: 1px solid var(--line-soft); }

.advanced { margin-top: 6px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.advanced summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 800; color: var(--text-soft); }
.advanced-fields { padding-top: 10px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 0; }
.caption-hint { color: var(--text-soft); font-weight: 700; }

/* Start */

.submit-area { margin: 20px 0 0; }
.price-line { margin: 10px 0 0; min-height: 1.4em; color: var(--text-soft); font-size: 14px; font-weight: 700; line-height: 1.45; }
.missing { min-height: 1.5em; }
.error { margin: 10px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(141, 38, 54, .35); border: 1px solid #6b2a35; color: #ffd3d3; line-height: 1.5; }

.banner { margin: 18px 0 0; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-solid); line-height: 1.5; }
.banner[data-kind="error"] { border-color: #6b2a35; background: rgba(141, 38, 54, .35); color: #ffd3d3; }
.banner[data-kind="success"] { border-color: #2d6b4c; background: rgba(35, 110, 72, .3); color: #d4f7e3; }
.banner a { font-weight: 800; }

.success { border-color: color-mix(in srgb, var(--a) 55%, var(--line)); }
.success:focus { outline: none; }

/* Movies */

.movies { margin: 36px 0 0; scroll-margin-top: 12px; }
.movies h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.movie-grid { display: grid; gap: 14px; margin-top: 12px; }
.movie-card { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.movie-card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  border-radius: 14px;
  background: #000;
  object-fit: contain;
}
.movie-placeholder {
  min-height: 150px;
  border-radius: 14px;
  display: grid;
  place-content: center;
  gap: 10px;
  justify-items: center;
  background: linear-gradient(160deg, #151925, #0b0e17);
  color: var(--muted);
  font-weight: 800;
  font-size: 22px;
}
.movie-progress { width: 140px; height: 6px; border-radius: 99px; background: #262c3d; overflow: hidden; }
.movie-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--a), var(--b)); }
.movie-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 10px; }
.movie-head h3 { margin: 0; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.status-chip { flex: 0 0 auto; padding: 4px 10px; border-radius: 999px; background: #1b2030; border: 1px solid var(--line); font-size: 12px; font-weight: 800; color: var(--text-soft); }
.movie-card[data-status="completed"] .status-chip { color: var(--ok); border-color: #2d6b4c; }
.movie-card[data-status="failed"] .status-chip { color: var(--danger); border-color: #6b2a35; }
.movie-card[data-status="running"] .status-chip { color: var(--a); border-color: color-mix(in srgb, var(--a) 50%, var(--line)); }
.movie-card[data-status="paused"] .status-chip { color: #ffd479; border-color: #6b5a2a; }
.movie-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.report-button { color: var(--faint); }
.reported { color: var(--muted); font-size: 13px; font-weight: 700; }

/* Report sheet */

.report-movie { margin: 0 0 8px; color: var(--text-soft); font-weight: 700; overflow-wrap: anywhere; }
.report-reasons { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.report-reasons legend { padding: 0; margin: 0 0 4px; font-weight: 800; font-size: 15px; }
.report-reasons .check { padding: 10px 0; }

/* Credits sheet */

.sheet {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
}
.sheet::backdrop { background: rgba(4, 6, 12, .72); }
.sheet h2 { margin: 0 0 8px; font-size: 21px; }
.sheet p { color: var(--muted); line-height: 1.5; }
.sheet .actions { margin-top: 16px; }
.packs { display: grid; gap: 10px; margin: 12px 0; }
.pack {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151925;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pack:hover { border-color: var(--a); }
.pack:disabled { opacity: .5; cursor: progress; }
.pack-text { display: grid; gap: 2px; }
.pack-text span { color: var(--muted); font-size: 13px; }
.pack-price { font-weight: 900; font-size: 17px; color: var(--a); }

/* Guest view */

.signin .button { width: 100%; }
.showcase { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.showcase li { position: relative; display: flex; gap: 12px; align-items: stretch; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(9, 11, 19, .5); }
.showcase li.selected { border-color: var(--a); }
.showcase .poster { flex: 0 0 84px; height: auto; min-height: 84px; margin: 0; }
.showcase .poster-icon { width: 30px; height: 30px; }
/* The play button covers the poster: the border (1px) and the padding (10px) of the row. */
.showcase .sample-play { top: 11px; left: 11px; bottom: 11px; width: 84px; }
.showcase-text { min-width: 0; }
.showcase p { margin: 4px 0 0; font-size: 14px; }
.showcase .meta { color: var(--faint); font-size: 13px; }

/* Footer */

.ai-note { margin: 36px 0 0; color: var(--faint); font-size: 13px; line-height: 1.55; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 20px; padding: 22px 0 36px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 13px; }
footer div { display: flex; flex-wrap: wrap; gap: 16px; }

/* Wider screens */

@media (min-width: 640px) {
  .panel, .step { padding: 24px; }
  .choice-grid.templates { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-grid.templates .template-card:last-child:nth-child(odd) { grid-column: auto; }
  .choice-grid.cast { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button.wide { width: auto; min-width: 280px; }
  .signin .button { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .choice-body, .photo-progress span { transition: none; }
}
