/*
 * /search results page styles.
 *
 * Ports the in-place homepage search result styling (previously inline in
 * static/js/pages/home.js result strings + shared classes in home.css) into a
 * dedicated SSR stylesheet. Class names mirror the old markup so the visual
 * result matches the in-place search field-for-field. (Per the Phase 5 brief,
 * the corresponding rules are left in home.css for the Phase 6 dead-CSS sweep —
 * this file is the live source for /search.)
 */

/* ── Dark theme tokens ────────────────────────────────────────────────
   /search is a dark-surfaced page like /my-list and /movements. The default
   tokens (base/tokens.css) are tuned for a cream body; the search-result markup
   (ported from the homepage's dark entry screen) expects cream-on-dark. Mirror
   the homepage's token overrides + dark body so the results render exactly as
   they did in the in-place search. (Same pattern as my_list.css / movements.css.)
*/
:root {
  --border: rgba(227, 218, 201, 0.1);
  --border-strong: rgba(227, 218, 201, 0.22);
  --cream: var(--color-base);
  --cream-mid: rgba(227, 218, 201, 0.6);
  --cream-dim: rgba(227, 218, 201, 0.55);
  --gray-mid: rgba(227, 218, 201, 0.55);
  --cream-border: rgba(227, 218, 201, 0.12);
}
body {
  background: var(--color-primary);
  color: var(--color-base);
}

/* ── Page shell ───────────────────────────────────────────────────────── */
.search-page {
  min-height: 60vh;
}
.search-entry-results {
  padding: 32px;
  max-width: 720px;
}
.search-result-pad {
  padding: 32px;
  max-width: 720px;
}
.search-result-title {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--color-base);
}
.search-result-note {
  font-size: 15px;
  color: var(--gray-mid);
  line-height: 1.8;
}

/* Eyebrow — the uppercase red "Threads" / section labels. */
.search-eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 18px;
}

/* ── Empty / prompt state ─────────────────────────────────────────────── */
.search-empty {
  padding: 64px 32px;
  max-width: 640px;
}
.search-empty-eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 14px;
}
.search-empty-title {
  font-family: "Playfair Display", serif;
  font-size: 36px;
  color: var(--color-base);
  font-weight: 700;
  margin: 0 0 16px;
}
.search-empty-sub {
  font-family: "Lora", serif;
  font-size: 16px;
  line-height: 1.8;
  color: rgba(227, 218, 201, 0.7);
}
.search-empty-link {
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid var(--red);
}

/* ── DNA threads view ─────────────────────────────────────────────────── */
.dna-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dna-hero {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dna-hero-poster-link {
  flex-shrink: 0;
  display: block;
  line-height: 0;
  border-radius: 2px;
  overflow: hidden;
}
.dna-hero-poster {
  width: 160px;
  height: 240px;
  object-fit: cover;
  display: block;
  background: #181818;
}
.dna-hero-poster-empty {
  width: 160px;
  height: 240px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.dna-hero-poster-text {
  font-family: "Playfair Display", serif;
  font-size: 13px;
  color: rgba(242, 237, 228, 0.8);
  text-align: center;
  line-height: 1.4;
}
.dna-hero-body {
  flex: 1;
  min-width: 200px;
}
.dna-hero-title-link {
  text-decoration: none;
  color: inherit;
}
.dna-hero-title {
  font-family: "Playfair Display", serif;
  font-size: 28px;
  margin-bottom: 16px;
  line-height: 1.2;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.dna-hero-title-link:hover .dna-hero-title {
  border-bottom-color: var(--red);
}
.dna-hero-bridge-wrap {
  max-width: 580px;
}
.dna-hero-bridge {
  font-family: "Lora", serif;
  font-style: normal;
  font-size: 1.25rem;
  color: var(--color-base);
  line-height: 1.7;
}

.dna-affiliates {
  margin-bottom: 20px;
}
.dna-section-label {
  margin-top: 28px;
  margin-bottom: 14px;
}
.dna-section-shaped {
  margin-bottom: 38px;
}
.dna-section-inspired {
  margin-top: 48px;
  margin-bottom: 38px;
}

.dna-film-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.dna-film-item:hover {
  background: #1a1a1a;
}
.dna-film-poster {
  width: 120px;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #181818;
}
.dna-film-poster-empty {
  width: 120px;
  height: 180px;
}
.dna-film-body {
  flex: 1;
  min-width: 0;
}
.dna-film-title {
  font-family: "Playfair Display", serif;
  font-style: normal;
  font-weight: 600;
  font-size: 19px;
  color: var(--color-base);
  margin-bottom: 3px;
}
.dna-film-trace {
  color: var(--red);
  font-size: 12px;
  margin-left: 8px;
  font-style: normal;
  letter-spacing: 1px;
  white-space: nowrap;
}
.dna-film-meta {
  font-size: 12px;
  color: var(--gray-mid);
}
.dna-film-director-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--red);
}

.hub-film-item {
  display: block;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.hub-film-item:hover {
  background: #1a1a1a;
}
.hub-film-title {
  font-family: "Playfair Display", serif;
  font-style: italic;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--color-base);
}
.hub-film-meta {
  font-size: 13px;
  color: var(--gray-mid);
}
.hub-influenced-film {
  cursor: pointer;
  color: var(--red);
  text-decoration: none;
}

/* Lazy "similar energy" row */
.sim-source-note {
  font-size: 14px;
  color: var(--gray-mid);
  margin-bottom: 14px;
  font-style: italic;
}
.sim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.sim-tile {
  text-decoration: none;
  transition: opacity 0.15s;
}
.sim-tile:hover {
  opacity: 0.7;
}
.sim-tile-poster {
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 10px;
  background: #181818;
}
.sim-tile-poster-empty {
  width: 100%;
  height: 210px;
  background: #181818;
  border-radius: 4px;
  margin-bottom: 10px;
}
.sim-tile-title {
  font-family: "Playfair Display", serif;
  font-style: normal;
  font-weight: 600;
  font-size: 19px;
  color: var(--color-base);
  margin-bottom: 3px;
}
.sim-tile-meta {
  font-size: 12px;
  color: var(--gray-mid);
}

/* ── Director films view ──────────────────────────────────────────────── */
.search-director {
  padding: 0;
}
.search-director-name {
  font-family: "Playfair Display", serif;
  font-size: 26px;
  margin-bottom: 6px;
  color: var(--color-base);
}
.search-director-sub {
  font-size: 14px;
  color: var(--gray-mid);
  margin-bottom: 24px;
}
.search-director-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.onboarding-film-card {
  background: var(--color-primary);
  border: 1px solid var(--border-strong);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  text-decoration: none;
  display: block;
}
.onboarding-film-card:hover {
  background: var(--black);
  border-color: var(--red);
}
.onboarding-film-card:hover .onboarding-film-title {
  color: var(--off-white);
}
.onboarding-film-card:hover .onboarding-film-director {
  color: rgba(227, 218, 201, 0.55);
}
.onboarding-film-title {
  font-family: "Playfair Display", serif;
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--color-base);
  margin-bottom: 8px;
  line-height: 1.3;
  transition: color 0.15s;
}
.onboarding-film-director {
  font-size: 0.875rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cream-dim);
  transition: color 0.15s;
}

/* ── Mood / theme exploration ─────────────────────────────────────────── */
.theme-results-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: start;
}
.theme-results-right .film-card-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 0;
}
.theme-results-right .film-card {
  width: 100%;
}
@media (max-width: 1024px) {
  .theme-results-layout {
    grid-template-columns: 1fr;
  }
}
.explore-single {
  max-width: 720px;
}
.explore-header {
  padding: 0 0 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.explore-eyebrow {
  letter-spacing: 3px;
  margin-bottom: 12px;
}
.explore-title {
  font-family: "Playfair Display", serif;
  font-size: 36px;
  color: var(--color-base);
  font-weight: 700;
  margin-bottom: 16px;
}
.explore-context {
  font-family: "Lora", serif;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(227, 218, 201, 0.7);
}
.search-ai-loading {
  font-style: italic;
  color: rgba(227, 218, 201, 0.45);
  opacity: 0.7;
  animation: search-ai-pulse 1.6s ease-in-out infinite;
}
@keyframes search-ai-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.8; }
}
.explore-directors {
  margin-bottom: 40px;
}
.theme-section-label {
  letter-spacing: 3px;
  margin-bottom: 16px;
}

/* Film cards (ported verbatim from home.css) */
.film-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  background: #0f0f0f;
  margin-bottom: 24px;
}
.film-card-link {
  text-decoration: none;
  color: inherit;
}
.film-card {
  width: 100%;
  aspect-ratio: 2/3;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    border-color 0.15s,
    transform 0.2s ease;
  overflow: hidden;
  border-radius: var(--radius);
  position: relative;
  background: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.film-card:hover {
  border-color: var(--red);
}
/* The poster img fills the 2/3 card; info/meta sit in normal flow and are
   clipped by the card's overflow:hidden — matching the in-place search +
   list_view.css behavior (both leave .film-card-info unstyled). */
.film-card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.film-card-placeholder {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: absolute;
  top: 0;
  left: 0;
}
.film-card-placeholder-text {
  font-family: "Playfair Display", serif;
  font-size: 0.8125rem;
  font-style: italic;
  color: rgba(227, 218, 201, 0.55);
  text-align: center;
  line-height: 1.4;
}
.film-card-title {
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  font-weight: 700;
  font-style: normal;
  color: var(--off-white);
  line-height: 1.25;
  margin-bottom: 4px;
  overflow: hidden;
  border-radius: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  word-break: normal;
  overflow-wrap: break-word;
}
.film-card-meta {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  color: #8c8678;
  letter-spacing: 0.5px;
}
.film-card-bookmark {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s;
  background: rgba(15, 15, 15, 0.65);
  border: none;
  cursor: pointer;
  padding: 7px;
  border-radius: 2px;
  color: var(--color-base);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.film-card:hover .film-card-bookmark {
  opacity: 1;
}
@media (max-width: 700px) {
  .film-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Director rows (ported from home.css) */
.director-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.director-row:first-child {
  border-top: 1px solid var(--border);
}
.director-row[data-action="go-director"] {
  cursor: pointer;
}
.director-row[data-action="go-director"]:hover {
  background: #181818;
  padding-left: 12px;
  padding-right: 12px;
  margin: 0 -12px;
}
.director-row[data-action="go-director"]:hover .erc-name {
  color: var(--color-base);
}
.director-row[data-action="go-director"]:hover .dir-sep {
  color: #999;
}
.director-row[data-action="go-director"]:hover .erc-arrow {
  color: var(--red);
}
.director-row-body {
  flex: 1;
  min-width: 0;
}
.director-row-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.dir-sep {
  color: #bbb;
  font-size: 0.875rem;
}
.director-row .erc-origin {
  margin-bottom: 0;
}
.erc-name {
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  color: var(--color-base);
  margin-bottom: 3px;
}
.erc-origin {
  font-size: 0.875rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(227, 218, 201, 0.55);
  margin-bottom: 8px;
}
.erc-why {
  font-family: "Playfair Display", serif;
  font-size: 0.875rem;
  color: rgba(227, 218, 201, 0.6);
  line-height: 1.6;
}
.erc-arrow {
  font-size: 1.25rem;
  color: var(--cream-mid);
  flex-shrink: 0;
  margin-top: 4px;
  transition: color 0.15s;
}

/* Standard director-result cards (no context / no films) */
.std-dir-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--cream-dim);
  text-transform: none;
}
.entry-result-card {
  border: 1px solid var(--border-strong);
  background: #181818;
  padding: 20px 24px;
  margin-bottom: 10px;
  transition: all 0.15s;
}
.entry-result-card[data-action="go-director"] {
  cursor: pointer;
}
.entry-result-card[data-action="go-director"]:hover {
  background: var(--black);
  border-color: var(--color-base);
}
.erc-primary-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--red);
  margin-bottom: 6px;
}
.erc-name-lg {
  font-size: 20px;
}
.erc-why-featured {
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.7;
}
.erc-thematic {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 12px;
  color: var(--cream-dim);
  line-height: 1.7;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}
.erc-enter {
  margin-top: 12px;
  font-size: 11px;
  color: var(--red);
  letter-spacing: 1px;
}
.erc-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.erc-why-sm {
  font-size: 11px;
  margin-top: 4px;
}

/* ── Film banner (searched-film) — ported from home.css ───────────────── */
.film-banner {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  background: var(--color-primary);
  color: var(--color-base);
  padding: 36px 32px;
  border-bottom: 2px solid var(--red);
  margin-bottom: 36px;
}
.film-banner-poster-link {
  display: block;
  line-height: 0;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.15s;
}
.film-banner-poster-link:hover {
  opacity: 0.8;
}
.film-banner-poster {
  width: 150px;
  height: 225px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.film-banner-info {
  flex: 1;
  min-width: 0;
}
.film-banner-title {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 8px;
}
.film-banner-title-link {
  color: inherit;
  text-decoration: none;
}
.film-banner-title-link:hover {
  text-decoration: underline;
}
.film-banner-meta {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cream-mid);
  margin-bottom: 16px;
}
.film-banner-synopsis {
  font-family: "Lora", serif;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-base);
  max-width: 640px;
}
@media (max-width: 700px) {
  .film-banner {
    flex-direction: column;
  }
  .film-banner-poster {
    width: 120px;
    height: 180px;
  }
}

/* ── Affiliate badges — ported from home.css ──────────────────────────── */
.affiliate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: Inter, sans-serif;
  font-size: 0.75rem;
  border: 1px solid var(--cream-border);
  color: var(--color-base);
  text-decoration: none;
  border-radius: 2px;
  cursor: pointer;
  margin-right: 8px;
  margin-top: 12px;
  background: transparent;
  transition: all 0.15s;
}
.affiliate-badge:hover {
  background: var(--color-primary);
  color: var(--color-base);
  border-color: var(--color-base);
}
.affiliate-badge.mubi {
  background: var(--color-accent);
  color: var(--color-base);
  border-color: var(--color-accent);
}
.affiliate-badge.mubi:hover {
  background: #a82f22;
  border-color: #a82f22;
  color: var(--color-base);
}
.affiliate-badge.criterion {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.affiliate-badge.criterion:hover {
  background: var(--color-accent);
  color: var(--color-base);
  border-color: var(--color-accent);
}

/* ── Fallback — film_suggestions / film_not_found ─────────────────────── */
.fallback-suggestions {
  max-width: 900px;
}
.fallback-suggestions-title {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--color-base);
}
.fallback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.fallback-card {
  text-decoration: none;
  color: inherit;
  display: block;
}
.fallback-card-poster {
  aspect-ratio: 2/3;
  overflow: hidden;
  border: 1px solid rgba(227, 218, 201, 0.22);
  background: #181818;
  margin-bottom: 8px;
  transition: border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fallback-card:hover .fallback-card-poster {
  border-color: var(--red);
}
.fallback-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fallback-card-poster-text {
  text-align: center;
  padding: 10px;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(227, 218, 201, 0.35);
}
.fallback-card-title {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 13px;
  color: var(--color-base);
}
.fallback-card-year {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: rgba(227, 218, 201, 0.35);
}

.fallback-not-found {
  max-width: 680px;
}
.fallback-not-found .search-eyebrow {
  font-size: 10px;
  margin-bottom: 14px;
}
.fallback-not-found-msg {
  font-family: "Lora", serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-base);
}
.fallback-escape {
  margin-top: 20px;
  font-size: 14px;
  color: rgba(227, 218, 201, 0.55);
}
.fallback-escape-link {
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid var(--red);
}
.fallback-escape-name {
  color: var(--red);
}
