/* ============================================================
   Pillarboxd — shared styles
   Dark, late-night phone-glow. Letterboxd warmth, 9:16 energy.
   ============================================================ */

:root {
  --bg: #0E1116;
  --surface: #171B23;
  --elevated: #1F2430;
  --border: #2A3040;
  --text: #E8ECF4;
  --text-2: #97A0B5;
  --pink: #FF2D78;
  --violet: #9D4EDD;
  --cyan: #00E0B8;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 16px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--space-4); }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(255, 45, 120, 0.35); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.section { padding: var(--space-8) 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.section-head h2 { margin: 0; }

.section-sub { color: var(--text-2); margin: var(--space-2) 0 0; max-width: 56ch; }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: var(--space-3);
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 17, 22, 0.85);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4) var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.brand:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  flex-wrap: wrap;
  margin-left: auto;
}

.nav-link {
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--elevated);
  text-decoration: none;
}

.nav-link[aria-current="page"] { color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
              background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.35);
}

.btn-primary:hover {
  background: #ff4a8c;
  box-shadow: 0 6px 26px rgba(255, 45, 120, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover { border-color: var(--text-2); background: var(--elevated); }

.btn-sm { padding: 8px 16px; font-size: 0.88rem; }

.btn[disabled], .btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-8) 0 var(--space-7);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 130%;
  background:
    radial-gradient(38% 45% at 18% 30%, rgba(255, 45, 120, 0.16), transparent 70%),
    radial-gradient(34% 42% at 82% 22%, rgba(157, 78, 221, 0.16), transparent 70%),
    radial-gradient(30% 40% at 60% 80%, rgba(0, 224, 184, 0.10), transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: var(--space-7);
}

.hero-copy .sub {
  color: var(--text-2);
  font-size: 1.12rem;
  max-width: 46ch;
  margin-bottom: var(--space-5);
}

.hero-ctas {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

.hero-note { color: var(--text-2); font-size: 0.85rem; margin-top: var(--space-3); }

/* App Store badge placeholder */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  padding: 8px 18px 8px 14px;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.store-badge:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: var(--text-2);
}

.store-badge .badge-text { line-height: 1.2; text-align: left; }
.store-badge .badge-text small { display: block; font-size: 0.62rem; color: #c9c9ce; }
.store-badge .badge-text strong { font-size: 1.05rem; letter-spacing: -0.01em; }

/* ---------- iPhone mockup ---------- */

.phone-wrap {
  display: flex;
  justify-content: center;
  perspective: 1200px;
}

.phone {
  width: min(300px, 76vw);
  aspect-ratio: 9 / 19;
  background: #05070a;
  border: 3px solid #2f3542;
  border-radius: 44px;
  padding: 10px;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(255, 45, 120, 0.12),
    0 0 90px rgba(157, 78, 221, 0.10);
  animation: phone-float 7s ease-in-out infinite;
}

@keyframes phone-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(0.5deg); }
}

.phone-screen {
  position: relative;
  height: 100%;
  background: var(--bg);
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-notch {
  flex: none;
  width: 42%;
  height: 20px;
  margin: 8px auto 4px;
  background: #05070a;
  border-radius: 12px;
}

.phone-body {
  flex: 1;
  overflow: hidden;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
}

.phone-brandline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.phone-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.phone-posters {
  display: flex;
  gap: 8px;
}

.phone-posters .poster {
  flex: 1;
  border-radius: 8px;
  font-size: 7px;
}

.phone-posters .poster .poster-title { font-size: 7.5px; padding: 10px 5px 5px; }
.phone-posters .poster .poster-platform { font-size: 5.5px; padding: 2px 5px; top: 4px; left: 4px; }

.phone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.phone-card .avatar { width: 22px; height: 22px; font-size: 9px; flex: none; }
.phone-card .stars { font-size: 9px; }
.phone-card p { margin: 2px 0 0; color: var(--text-2); font-size: 9.5px; line-height: 1.35; }
.phone-card .phone-card-head { font-size: 10px; font-weight: 700; line-height: 1.3; }

.phone-tabbar {
  flex: none;
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  padding: 8px 4px 4px;
  color: var(--text-2);
  font-size: 8px;
  font-weight: 600;
}

.phone-tabbar .tab-active { color: var(--pink); }

/* ---------- Posters ---------- */

.poster {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  color: #fff;
  cursor: default;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.poster, button.poster { cursor: pointer; }

a.poster:hover { text-decoration: none; }

a.poster:hover, button.poster:hover,
a.poster:focus-visible, button.poster:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 45, 120, 0.7);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 24px rgba(255, 45, 120, 0.35);
}

/* vignette */
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(5, 7, 10, 0.82) 0%, rgba(5, 7, 10, 0.25) 38%, transparent 62%),
    radial-gradient(120% 90% at 50% 20%, transparent 55%, rgba(5, 7, 10, 0.35) 100%);
  pointer-events: none;
}

.poster-platform {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(5, 7, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 3px 9px;
  backdrop-filter: blur(4px);
}

.poster-title {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  padding: var(--space-5) var(--space-3) var(--space-3);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.poster-meta-row {
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--text-2);
}

/* Horizontal scroll row */
.poster-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(140px, 17vw, 190px);
  gap: var(--space-4);
  overflow-x: auto;
  padding: var(--space-2) var(--space-1) var(--space-4);
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.poster-row > * { scroll-snap-align: start; }

/* ---------- Stars ---------- */

.stars {
  position: relative;
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 2px;
  color: #39415455;
  vertical-align: -1px;
  white-space: nowrap;
}

.stars .stars-bg { color: #3d465c; }

.stars .stars-fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--cyan);
  pointer-events: none;
}

.rating-number { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Avatars ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #0E1116;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  flex: none;
}

/* ---------- Feature cards ---------- */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.feature-card:hover { transform: translateY(-3px); border-color: #3a4256; }

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: 1.3rem;
}

.feature-card h3 { margin-bottom: var(--space-2); }
.feature-card p { color: var(--text-2); font-size: 0.94rem; margin: 0; }

/* ---------- Review cards ---------- */

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.review-card:hover { transform: translateY(-3px); border-color: #3a4256; }

.review-head { display: flex; align-items: center; gap: var(--space-3); }

.review-who { min-width: 0; }
.review-who .name { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.review-who .handle { color: var(--text-2); font-size: 0.82rem; }

.review-show {
  font-size: 0.85rem;
  color: var(--text-2);
}

.review-show strong { color: var(--text); font-weight: 700; }

.review-text {
  margin: 0;
  font-size: 0.97rem;
  color: var(--text);
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-7) 0 var(--space-6);
  margin-top: var(--space-7);
  color: var(--text-2);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5) var(--space-7);
  justify-content: space-between;
  align-items: flex-start;
}

.footer-links { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.footer-links a { color: var(--text-2); font-weight: 600; }
.footer-links a:hover { color: var(--text); }

.footer-disclaimer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: #6b7488;
}

/* ---------- Browse page ---------- */

.page-head { padding: var(--space-7) 0 var(--space-4); }
.page-head p { color: var(--text-2); max-width: 60ch; }

.browse-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.controls-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1 1 260px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

input[type="search"], select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  transition: border-color 0.15s ease;
}

input[type="search"] { width: 100%; padding-left: 38px; }

input[type="search"]::placeholder { color: #6b7488; }

input[type="search"]:hover, select:hover { border-color: #3a4256; }
input[type="search"]:focus, select:focus { border-color: var(--pink); outline: none; }
input[type="search"]:focus-visible, select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

select { cursor: pointer; }

.pill-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 15px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.pill:hover { color: var(--text); border-color: #3a4256; }

.pill[aria-pressed="true"] {
  background: rgba(255, 45, 120, 0.14);
  border-color: var(--pink);
  color: #ff7aa8;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4) var(--space-4);
  padding-bottom: var(--space-7);
}

.browse-cell { display: flex; flex-direction: column; }

.result-count { color: var(--text-2); font-size: 0.88rem; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-2);
  padding: var(--space-8) var(--space-4);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-l);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal-overlay.is-open { display: flex; }

.modal {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  max-width: 720px;
  width: 100%;
  margin: auto 0;
  padding: var(--space-5);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-5);
  position: relative;
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover { color: var(--text); border-color: var(--text-2); }

.modal .poster { max-width: 200px; }

.modal-title { font-size: 1.45rem; margin-bottom: var(--space-2); padding-right: var(--space-6); }

.modal-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.meta-chip {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
}

.meta-chip.platform-chip { color: #ff7aa8; border-color: rgba(255, 45, 120, 0.4); }

.modal-rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: 0.95rem;
  color: var(--text-2);
}

.modal-rating .stars { font-size: 1.15rem; }

.modal-genres { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }

.genre-tag {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--violet);
  background: rgba(157, 78, 221, 0.12);
  border: 1px solid rgba(157, 78, 221, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
}

.modal-synopsis { color: var(--text); font-size: 0.97rem; }

.modal-reviews { margin-top: var(--space-4); }
.modal-reviews h4 {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--space-3);
}

.modal-review {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.modal-review .avatar { width: 32px; height: 32px; font-size: 0.75rem; }
.modal-review .who { font-weight: 700; font-size: 0.88rem; }
.modal-review .stars { font-size: 0.85rem; }
.modal-review p { margin: 4px 0 0; font-size: 0.92rem; color: var(--text-2); }

.modal-actions { margin-top: var(--space-4); }

body.modal-open { overflow: hidden; }

/* ---------- Prose (privacy) ---------- */

.prose { max-width: 760px; padding-bottom: var(--space-7); }
.prose h2 { margin-top: var(--space-6); font-size: 1.35rem; }
.prose h3 { margin-top: var(--space-5); }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ul { padding-left: 1.3em; margin: 0 0 var(--space-4); }
.prose li { margin-bottom: var(--space-2); }
.prose .effective {
  color: var(--text-2);
  font-size: 0.9rem;
  border-left: 3px solid var(--pink);
  padding-left: var(--space-3);
  margin: var(--space-4) 0 var(--space-5);
}

/* ---------- Motion & responsive ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .phone { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; }
  .phone-wrap { order: 2; }
  .hero { padding-top: var(--space-7); }
  .section { padding: var(--space-7) 0; }
}

@media (max-width: 560px) {
  .container { padding: 0 var(--space-4); }
  .modal { grid-template-columns: 1fr; }
  .modal .poster { max-width: 160px; }
  .browse-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
  .nav-links { margin-left: 0; }
  .footer-inner { flex-direction: column; }
}
