/*
  AI Cinema: what its two pages need on top of site.css. The form is
  movie-generator.blade.php, and a movie's own page is movie.blade.php.
*/

/* ═══ The form ═════════════════════════════════════════════ */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 580px);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 64px) clamp(16px, 4vw, 32px) 0;
}
.studio-intro { position: sticky; top: calc(var(--header-h) + clamp(24px, 5vw, 64px)); }
.studio-intro .display { margin-top: 12px; }
.studio-intro .lede { max-width: 44ch; margin-top: 16px; }

/* What comes out, in three numbered lines. */
.how { counter-reset: how; display: grid; gap: 14px; margin: clamp(22px, 4vw, 34px) 0 0; padding: clamp(18px, 3vw, 24px) 0 0; border-top: 1px solid var(--line); list-style: none; }
.how li { counter-increment: how; display: flex; align-items: flex-start; gap: 12px; color: var(--ink-2); font-size: .95rem; line-height: 1.55; }
.how li::before {
  content: counter(how);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 .72rem/1 var(--mono);
}

.movie-form .field { margin-bottom: 22px; }
.movie-form .req { color: var(--accent); }
.field.error .input, .field.error .textarea, .field.error .select { border-color: var(--danger); }
.field.error .field-error { display: block; }

/* Genres: one of them, picked like a button. */
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.genre-option { position: relative; }
.genre-option input { position: absolute; width: 0; height: 0; opacity: 0; }
.genre-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.genre-option label:hover { border-color: var(--ink-3); color: var(--ink); }
.genre-option input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.genre-option input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The story, with a button in its corner that writes one for you. */
.prompt-wrapper { position: relative; }
.prompt-wrapper .textarea { padding-bottom: 54px; resize: none; }
.autofill-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 .8rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, opacity .15s;
}
.autofill-btn:hover { border-color: var(--accent); }
.autofill-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.autofill-btn .autofill-spin { display: none; animation: spin .8s linear infinite; }
.autofill-btn.loading { opacity: .6; pointer-events: none; }
.autofill-btn.loading .btn-icon { display: none; }
.autofill-btn.loading .autofill-spin { display: block; }

.form-rule { margin: 26px 0 22px; border: 0; border-top: 1px solid var(--line); }
.movie-form .captcha { margin-bottom: 16px; }
#submitBtn svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .studio-intro { position: static; }
}

/* ═══ A movie's page ═══════════════════════════════════════ */
.film-hero { border-bottom: 1px solid var(--line); background: var(--surface); }
.film-hero-inner {
  display: grid;
  grid-template-columns: minmax(180px, 270px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: start;
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 3vw, 28px);
}

.poster-wrap { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow-lg); }
.poster-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; color: var(--ink-3); font-size: .85rem; text-align: center; }
.poster-placeholder svg { width: 40px; height: 40px; opacity: .4; }
.poster-spinner { display: none; flex-direction: column; align-items: center; gap: 12px; }
#posterIdle { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.film-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.film-badges .tag { text-transform: capitalize; }
.film-badges .tag.is-accent { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); color: var(--accent); }
.movie-title { font: 600 clamp(2rem, 5.4vw, 3.8rem)/1.02 var(--serif); letter-spacing: -.035em; overflow-wrap: anywhere; text-wrap: balance; }
.movie-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 14px; color: var(--ink-3); font: 500 .72rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.movie-meta-line .dot { color: var(--line-strong); }

/* A score out of ten, the way film sites show one. */
.score-block { display: inline-flex; align-items: center; gap: 10px; margin-top: 20px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.score-star { color: var(--accent); }
.score-num { font: 600 1.6rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.score-denom { align-self: flex-end; margin-left: -6px; color: var(--ink-3); font-size: .85rem; }
.score-label { padding-left: 10px; border-left: 1px solid var(--line); }

.plot-text { max-width: 62ch; margin-top: 20px; color: var(--ink-2); font-size: 1.05rem; line-height: 1.7; text-wrap: pretty; }
.stars-line { margin-top: 18px; color: var(--ink-2); font-size: .9rem; }
.stars-line strong { color: var(--ink); font-weight: 600; }
.star-link { color: var(--accent); text-decoration: none; }
.star-link:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .film-hero-inner { grid-template-columns: minmax(0, 1fr); }
  .poster-wrap { width: min(100%, 240px); margin-inline: auto; }
}

.film { width: 100%; max-width: 1120px; margin-inline: auto; padding: clamp(24px, 4vw, 44px) clamp(16px, 3vw, 28px) 0; }
.film section { scroll-margin-top: calc(var(--header-h) + 16px); }
.film section + section { margin-top: clamp(28px, 4vw, 44px); }

/* The cast, with photos that arrive after the page does. */
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.cast-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.cast-photo-wrap { position: relative; aspect-ratio: 2 / 3; overflow: hidden; background: var(--surface-2); }
.cast-photo-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cast-initials { color: var(--ink-3); font: 600 1.8rem/1 var(--serif); }
.cast-info { padding: 10px 12px 12px; }
.cast-actor { overflow: hidden; font-size: .88rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cast-role { margin-top: 2px; overflow: hidden; color: var(--ink-3); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }

.storyline-text { max-width: 72ch; color: var(--ink-2); font-size: 1.02rem; line-height: 1.8; white-space: pre-line; }
.storyline-text::first-letter { float: left; margin: 6px 10px 0 0; color: var(--accent); font: 600 3.4em/.8 var(--serif); }
.loading-pulse { display: inline-block; color: var(--ink-3); font-style: italic; animation: pulse-opacity 1.4s ease-in-out infinite; }
@keyframes pulse-opacity { 50% { opacity: .35; } }

/* Other movies, in a row that scrolls sideways. */
.more-create-link { font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.more-create-link:hover { text-decoration: underline; }
.suggestion-rail {
  display: flex;
  gap: 14px;
  margin-inline: -4px;
  padding: 4px 4px 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.suggestion-card {
  display: flex;
  flex: 0 0 160px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
  transition: border-color .2s, transform .2s var(--ease);
}
.suggestion-card:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.suggestion-poster { position: relative; flex-shrink: 0; aspect-ratio: 2 / 3; overflow: hidden; background: var(--surface-2); }
.suggestion-poster img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.suggestion-card:hover .suggestion-poster img { transform: scale(1.04); }
.suggestion-noposter { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ink-3); }
.suggestion-genre-badge { position: absolute; bottom: 8px; left: 8px; padding: 3px 7px; border-radius: 6px; background: rgba(9, 16, 27, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); color: #fff; font: 500 .6rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.suggestion-info { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.suggestion-title { display: -webkit-box; overflow: hidden; font: 600 .95rem/1.25 var(--serif); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.suggestion-desc { display: -webkit-box; overflow: hidden; color: var(--ink-3); font-size: .75rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
