/* ============================================================
   Horror Fest — style.css
   Mobile-first, dark horror aesthetic, row-card layout
   ============================================================ */

/* ── Custom Properties ───────────────────────────────────── */
:root {
  --blood:      #cf6766;
  --blood-dark: #9e3f3f;
  --ash:        #1a1a1a;
  --shadow:     #111;
  --mist:       #2a2a2a;
  --bone:       #ccc;
  --pale:       #e8e8e8;
  --dim:        #888;
  --dull:       #555;
  --border:     #333;
  --up:         #4caf7d;
  --down:       #cf6766;
  --font:       'Arial', 'Helvetica', sans-serif;
  --radius:     4px;
  --gap:        12px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: .875rem;
  line-height: 1.5;
  color: var(--bone);
  background-color: var(--shadow);
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
a   { color: var(--blood); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
ul, ol { list-style: none; }

/* ── Shell ───────────────────────────────────────────────── */
#shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ── Header / Nav ────────────────────────────────────────── */
#header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: var(--gap);
}

#logo a {
  display: block;
  width: 180px;
  height: 37px;
  background: url('../img/logo.gif') no-repeat 0 0 / contain;
  font-size: 0;
}

/* ── Bottom Tab Bar ──────────────────────────────────────── */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1100px;
  background: rgba(10,10,10,.96);
  border-top: 1px solid #1e1e1e;
  display: flex;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  color: #3a3a3a;
  text-decoration: none;
  font-size: 9px;
  font-family: var(--font);
  letter-spacing: .3px;
  transition: color .15s;
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
}
.tab-item.active { color: var(--blood); }
.tab-item:hover:not(.active) { color: #666; text-decoration: none; }
.tab-item svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blood);
}

/* ── Jump Strip ──────────────────────────────────────────── */
#jump-strip {
  position: fixed;
  right: max(0px, calc(50% - 548px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  z-index: 150;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  width: 28px;
}
.jump-item {
  display: block;
  font-size: 10px;
  font-weight: bold;
  color: #3a3a3a;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 3px;
  text-decoration: none;
  width: 100%;
  text-align: center;
  pointer-events: none;
}
.jump-item.active {
  color: var(--blood);
  background: rgba(207,103,102,.12);
  border-radius: 3px;
}
.strip-label {
  font-size: 7px;
  color: var(--blood);
  font-weight: bold;
  margin-bottom: 4px;
  pointer-events: none;
}

/* Callout bubble shown while drag-scrubbing */
#scrub-callout {
  position: absolute;
  right: 32px;
  top: 0;
  background: var(--blood);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  width: 44px;
  height: 44px;
  border-radius: 50% 50% 0 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
  transform: translateY(-50%);
}

/* ── List section dividers (for jump strip anchors) ─────── */
.list-section-head {
  font-size: 9px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #333;
  padding: 6px 0 3px;
  border-bottom: 1px solid #1e1e1e;
  margin-bottom: 2px;
  scroll-margin-top: 60px;
}

/* Header search */
.header-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 180px;
  gap: 4px;
}
.header-search input[type="search"] {
  flex: 1;
  width: auto;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 5px 8px;
  font-size: .8rem;
  height: 32px;
}
.header-search button[type="submit"] {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1rem;
  padding: 4px 6px;
  margin: 0;
  line-height: 1;
  cursor: pointer;
  transition: color .15s;
}
.header-search button[type="submit"]:hover { color: var(--blood); }

/* Vote budget pill in header */
#vote-budget {
  display: flex;
  gap: 10px;
  font-size: .8rem;
  font-weight: bold;
  color: var(--dim);
  flex-shrink: 0;
}
#vote-budget .bud-up   { color: var(--up); }
#vote-budget .bud-down { color: var(--down); }

/* ── Main Layout ─────────────────────────────────────────── */
#main {
  padding: 16px 0 76px; /* bottom clears fixed tab bar */
}
/* When the jump strip is present, pull content away from the right edge */
body:has(#jump-strip) #main {
  padding-right: 32px;
}
/* Date mode — slim bar scrubber instead of letter list */
#jump-strip[data-mode="date"] {
  width: 24px;
  /* Override the centered positioning — pin it top-to-bottom instead */
  top: 80px;
  bottom: 80px;
  transform: none;
  height: auto;
}
#jump-strip[data-mode="date"] .jump-item {
  display: none; /* hidden; kept in DOM for JS position mapping */
}
body:has(#jump-strip[data-mode="date"]) #main {
  padding-right: 28px;
}
.strip-cap {
  font-size: 7px;
  color: var(--dim);
  letter-spacing: .3px;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
  margin: 2px 0;
}
.date-track {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  min-height: 80px;
}
.date-track::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--blood-dark), #1a1a1a);
  border-radius: 2px;
}
.date-thumb {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--blood);
  border-radius: 50%;
  border: 2px solid var(--pale);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(207,103,102,.4);
  transition: top .08s;
}

/* Sidebar layout kicks in at wider screens */
.layout-two-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Section Headings ────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0 8px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}
.section-head h2 {
  font-size: 1rem;
  font-weight: bold;
  color: var(--blood);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.section-head .count {
  font-size: .75rem;
  color: var(--dim);
}

/* ── Vote budget inline bar ──────────────────────────────── */
.budget-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  padding: 6px 0 10px;
  color: var(--dim);
}
.bud-up   { color: var(--up);   font-weight: bold; }
.bud-down { color: var(--down); font-weight: bold; }
.bud-sep  { color: var(--border); }

/* ── Movie Row Cards ─────────────────────────────────────── */
.movie-list { display: flex; flex-direction: column; gap: 10px; }

.movie-card {
  display: flex;
  gap: 0;
  background: #161616;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .15s;
}
.movie-card:hover { border-color: var(--dull); }

/* Poster column */
.card-poster {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 114px;
  overflow: hidden;
  display: block;
  background: linear-gradient(160deg, #1a1a1a 0%, #2d1a1a 100%);
}
.card-poster img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-poster.no-img::after {
  content: '🎬';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* Trend badges overlaid on poster */
.trend-badge {
  position: absolute;
  top: 6px;
  left: 0;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 0 4px 4px 0;
  z-index: 10;
  pointer-events: none;
}
.trend-badge.undead {
  background: rgba(140,0,180,.92);
  color: #f0d0ff;
  text-shadow: 0 0 6px rgba(200,100,255,.6);
}
.trend-badge.buried {
  background: rgba(15,20,30,.95);
  border-right: 1px solid #6699bb;
  color: #aabdd0;
  text-shadow: 0 0 6px rgba(80,130,180,.5);
}

/* Info column */
.movie-card .info {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
}

/* Vote row always sits at the bottom of the info column */
.vote-row { margin-top: auto; }

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
a.title, .title {
  font-size: .8125rem;
  font-weight: bold;
  color: var(--pale);
  line-height: 1.3;
  text-decoration: none;
}
a.title:hover { color: var(--blood); }

.rt-badge {
  font-size: .625rem;
  color: #888;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 2px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rt-badge span { color: var(--blood); }

.year-genre {
  font-size: .625rem;
  color: var(--dull);
  margin-bottom: 5px;
}

.plot {
  font-size: .6875rem;
  color: #777;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
}

/* Vote row at bottom of card */
.vote-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: .9375rem;
  background: #1e1e1e;
  transition: all .15s;
  padding: 0;
}
.vote-btn.up   { border-color: #2d3d2d; color: var(--up); }
.vote-btn.up:hover:not(:disabled)   { background: #1e2e1e; }
.vote-btn.up.active   { background: #2d4a2d; border-color: var(--up); }
.vote-btn.down { border-color: #3d2d2d; color: var(--down); }
.vote-btn.down:hover:not(:disabled) { background: #2e1e1e; }
.vote-btn.down.active { background: #4a2020; border-color: var(--down); }
.vote-btn:disabled    { opacity: .4; cursor: default; }

.score {
  font-size: .875rem;
  font-weight: bold;
  color: var(--dull);
  min-width: 28px;
  text-align: center;
}
.score.positive { color: var(--up);   }
.score.negative { color: var(--down); }
.vote-total { font-size: .875rem; font-weight: bold; min-width: 28px; text-align: center; color: var(--dull); }
.vote-total.pos { color: var(--up);   }
.vote-total.neg { color: var(--down); }

.collection-tag {
  margin-left: auto;
  font-size: .5625rem;
  color: var(--dull);
  background: #1a1a1a;
  border: 1px solid #252525;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* ── Activity Feed ───────────────────────────────────────── */
#activity-feed .feed-list { display: flex; flex-direction: column; gap: 4px; }

.feed-item {
  font-size: .8rem;
  color: var(--dim);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.feed-item:last-child { border-bottom: none; }
.feed-item .feed-who  { color: var(--bone); font-weight: bold; }
.feed-item .feed-what { color: var(--blood); }
.feed-item .feed-time { float: right; font-size: .7rem; }

/* ── Bonus / Gamification Panel ──────────────────────────── */
#bonus-panel .bonus-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
#bonus-panel .bonus-table th {
  text-align: left;
  color: var(--dim);
  font-weight: bold;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
#bonus-panel .bonus-table td {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
#bonus-panel .bonus-table td:last-child { text-align: right; color: var(--blood); font-weight: bold; }
.bonus-icon { font-size: 1rem; margin-right: 4px; }

/* ── Superlatives ────────────────────────────────────────── */
.superlatives-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.superlative-card {
  background: var(--ash);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.superlative-card .sup-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.superlative-card .sup-icon { font-size: 1.1rem; }
.superlative-card .sup-name { font-weight: bold; color: var(--blood); font-size: .85rem; margin-top: 2px; }
.superlative-card .sup-val  { font-size: .8rem; color: var(--bone); }

/* ── Single Movie Page ───────────────────────────────────── */
#single {
  padding-top: 16px;
}
.movie-detail {
  display: flex;
  gap: 20px;
  flex-direction: column;
}
.movie-detail .detail-poster {
  flex: 0 0 152px;
  width: 152px;
}
.movie-detail .detail-poster img {
  width: 152px;
  height: 214px;
  object-fit: cover;
  border-radius: var(--radius);
}
.movie-detail .detail-info h1 {
  font-size: 1.5rem;
  color: var(--blood);
  margin-bottom: 6px;
}
.movie-detail .detail-meta {
  font-size: .8rem;
  color: var(--dim);
  margin-bottom: 10px;
}
.movie-detail .detail-desc {
  font-size: .9rem;
  color: var(--bone);
  line-height: 1.6;
}

/* ── Comments ────────────────────────────────────────────── */
#comments { margin-top: 24px; }

.comment-item {
  background: var(--ash);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.comment-item .c-header {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--dim);
  margin-bottom: 6px;
}
.comment-item .c-user { font-weight: bold; color: var(--pale); }
.comment-item .c-body { font-size: .875rem; color: var(--bone); line-height: 1.5; }
.comment-item.redacted .c-body { color: var(--dull); font-style: italic; }

#comment-form textarea {
  width: 100%;
  height: 80px;
  background: var(--ash);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: var(--font);
  font-size: .875rem;
  padding: 8px;
  resize: vertical;
  margin-bottom: 8px;
}
#comment-form textarea:focus { outline: none; border-color: var(--blood); }

/* ── Forms ───────────────────────────────────────────────── */
.fieldname {
  display: block;
  font-size: .8rem;
  color: var(--dim);
  margin-bottom: 3px;
  margin-top: 10px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  display: block;
  width: 100%;
  max-width: 320px;
  background: var(--mist);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: var(--font);
  font-size: .875rem;
  padding: 7px 9px;
  height: auto;
  margin-bottom: 4px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blood);
}
input[type="submit"],
button.btn,
.btn {
  display: inline-block;
  background: var(--blood-dark);
  color: var(--pale);
  border: none;
  border-radius: var(--radius);
  padding: 9px 20px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  margin-top: 8px;
}
input[type="submit"]:hover, button.btn:hover, .btn:hover {
  background: var(--blood);
}
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--dim);
}
.btn-ghost:hover { border-color: var(--blood); color: var(--blood); background: none; }

.field-ok  { font-size: .75rem; color: var(--up);   margin-top: 2px; }
.field-err { font-size: .75rem; color: var(--down);  margin-top: 2px; }

.form-wrap {
  max-width: 360px;
  margin: 0 auto;
  padding: 24px 0 40px;
}
.form-title {
  color: var(--blood);
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.form-group {
  margin-bottom: 12px;
}
.form-input {
  display: block;
  width: 100%;
  max-width: none;
  background: var(--mist);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: var(--font);
  font-size: .875rem;
  padding: 7px 9px;
  margin-bottom: 0;
}
.form-input:focus { outline: none; border-color: var(--blood); }
.btn-primary {
  display: inline-block;
  background: var(--blood-dark);
  color: var(--pale);
  border: none;
  border-radius: var(--radius);
  padding: 9px 20px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--blood); }
.form-link {
  font-size: .8rem;
  color: var(--dim);
  text-align: center;
  margin-top: 10px;
}
.form-link a { color: var(--dim); }
.form-link a:hover { color: var(--blood); }

.error   { color: #ff5555; font-size: .875rem; margin-bottom: 8px; }
.success { color: var(--up); font-size: .875rem; margin-bottom: 8px; }

/* ── Footer ──────────────────────────────────────────────── */
#footer {
  border-top: 1px dashed var(--border);
  padding: 14px 0;
  font-size: .75rem;
  color: var(--dull);
  text-align: center;
}
#footer a { color: var(--dull); }
#footer a:hover { color: var(--blood); }

/* ── Toast ───────────────────────────────────────────────── */
#hf-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ash);
  border: 1px solid var(--blood);
  color: var(--bone);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: .875rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  white-space: nowrap;
}
#hf-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Utility ─────────────────────────────────────────────── */
.text-muted  { color: var(--dim); }
.text-blood  { color: var(--blood); }
.text-center { text-align: center; }
.mt-1 { margin-top: 6px;  }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; }

/* Voting-closed notice */
.voting-closed {
  text-align: center;
  padding: 20px;
  color: var(--dim);
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.search-bar input {
  flex: 1;
  max-width: none;
  margin: 0;
}
.search-bar button { margin: 0; }

/* Genre sub-row */
.genre-bar {
  margin-top: -6px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}
.genre-bar .filter-pill {
  font-size: .7rem;
  padding: 2px 8px;
}

/* Filter pills */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-pill {
  background: var(--mist);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .75rem;
  color: var(--dim);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-pill:hover,
.filter-pill.active { background: var(--blood-dark); border-color: var(--blood); color: var(--pale); text-decoration: none; }

/* ── Tablet (600px+) ─────────────────────────────────────── */
@media (min-width: 600px) {
  #logo a { width: 220px; height: 45px; }

  .header-search { max-width: 240px; }

  .movie-detail {
    flex-direction: row;
  }
  .superlatives-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Desktop (900px+) ────────────────────────────────────── */
@media (min-width: 900px) {
  .layout-two-col {
    flex-direction: row;
    align-items: flex-start;
  }
  .layout-main  { flex: 1 1 auto;  min-width: 0; }
  .layout-side  { flex: 0 0 280px; width: 280px; }

  .superlatives-grid { grid-template-columns: repeat(4, 1fr); }
}
