/* ===== Hope Day 2026 — Live Schedule =====
   Mobile-first, vertically scrolling day-of timeline.
   Shares the palette & type of index.html / styles.css. */

:root {
  --cream: #fef6e9;
  --card: #fffcf4;
  --ink: #220f0e;
  --green: #3c542f;
  --red: #c33927;
  --blue: #255186;
  --amber: #a5651c;
  --line: rgba(60, 84, 47, 0.28);
  --topbar-h: 3.4rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "americane", "Rubik", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) 1rem 0.5rem;
  min-height: var(--topbar-h);
  background: rgba(254, 246, 233, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(35, 17, 15, 0.1);
}

.topbar .back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
}

.topbar .back-arrow {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--red);
  transform: translateY(-1px);
}

.topbar .back strong {
  font-weight: 800;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.clock {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.picks-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1.5px solid rgba(60, 84, 47, 0.35);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.picks-btn svg path {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.picks-btn[aria-pressed="true"] {
  background: #f6e3b8;
  border-color: #c98f1b;
}

.picks-btn[aria-pressed="true"] svg path {
  fill: #e0a52c;
  stroke: #c98f1b;
}

.now-btn {
  border: none;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(195, 57, 39, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.now-btn:active {
  transform: scale(0.94);
  box-shadow: 0 1px 4px rgba(195, 57, 39, 0.35);
}

/* ===== Page layout ===== */
.timeline-wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(4rem + env(safe-area-inset-bottom));
}

.picks-empty {
  display: none;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed rgba(60, 84, 47, 0.4);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

body.picks-only.no-picks .picks-empty {
  display: block;
}

/* ===== Timeline & rail ===== */
.timeline {
  position: relative;
}

/* Rail line: runs from the bottom of the first time label to the top of
   the last one. --rail-top / --rail-height are measured and set by JS. */
.timeline::before {
  content: "";
  position: absolute;
  left: 27px;
  top: var(--rail-top, 0px);
  height: var(--rail-height, 0px);
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.time-group {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.rail {
  position: relative;
}

.time-label {
  position: sticky;
  top: calc(var(--topbar-h) + 0.85rem + env(safe-area-inset-top));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
  padding: 0.4rem 0.15rem 0.35rem;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 12px;
  color: var(--green);
  line-height: 1.05;
}

.time-label .t {
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.time-label .ap {
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.cards {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ===== Event cards ===== */
.card {
  --accent: var(--green);
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 0.95rem 1.05rem 1rem 1.45rem;
  box-shadow: 0 5px 16px rgba(35, 17, 15, 0.06);
  scroll-margin-top: calc(var(--topbar-h) + 2.5rem);
}

/* Pill-shaped accent bar — replaces the old color-coded left border */
.card-bar {
  position: absolute;
  left: 0.45rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.tag-race    { --accent: var(--red); }
.tag-sports  { --accent: var(--blue); }
.tag-market  { --accent: var(--green); }
.tag-kids    { --accent: var(--blue); }
.tag-parade  { --accent: var(--red); }
.tag-community { --accent: var(--green); }
.tag-food    { --accent: var(--amber); }
.tag-music   { --accent: var(--red); }

.card h2 {
  font-family: "americane", "Rubik", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1.2;
  margin: 0.15rem 2rem 0.45rem 0;
  text-align: left;
}

.card h2 a:link,
.card h2 a:visited {
  color: var(--red);
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-right: 2rem;
}

.tag-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
}

.live-pill {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
}

.card.live .live-pill {
  display: inline-flex;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

.card.past {
  opacity: 0.55;
}

.card-time,
.card-loc {
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 0.2rem;
}

.card-time {
  font-weight: 700;
  color: var(--ink);
}

.card-loc {
  font-weight: 500;
  color: var(--blue);
}

.ic {
  width: 0.95em;
  height: 0.95em;
  fill: currentColor;
  vertical-align: -0.1em;
  margin-right: 0.4em;
}

.card-body {
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 0.45rem;
}

.card-body .red,
.card .red {
  color: var(--red);
  font-weight: 700;
}

.card-list {
  margin: 0.45rem 0 0 1.15rem;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.55;
}

.card-list li {
  margin-bottom: 0.15rem;
}

/* Star / pick button */
.star {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.star svg path {
  fill: none;
  stroke: #bda88c;
  stroke-width: 1.7;
  stroke-linejoin: round;
  transition: fill 0.2s ease, stroke 0.2s ease, transform 0.2s ease;
}

.star:active svg {
  transform: scale(0.85);
}

.card.starred .star svg path {
  fill: #e0a52c;
  stroke: #c98f1b;
}

@keyframes starPop {
  0%   { transform: scale(0.6); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.card.starred .star svg {
  animation: starPop 0.35s ease;
}

/* Picks-only filter */
body.picks-only .card:not(.starred) {
  display: none;
}

body.picks-only .time-group:not(:has(.card.starred)) {
  display: none;
}

/* Flash highlight when jumping to a card from a "happening now" chip */
@keyframes cardFlash {
  0%, 55% { box-shadow: 0 0 0 3px rgba(195, 57, 39, 0.55), 0 5px 16px rgba(35, 17, 15, 0.06); }
  100%    { box-shadow: 0 5px 16px rgba(35, 17, 15, 0.06); }
}

.card.flash {
  animation: cardFlash 1.4s ease;
}

/* ===== "Now" line ===== */
.now-line {
  position: relative;
  margin: 1.6rem 0;
  scroll-margin-top: calc(var(--topbar-h) + 2.5rem);
}

.now-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.now-head::before {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--red) 0 8px, transparent 8px 14px);
  opacity: 0.55;
}

.now-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(195, 57, 39, 0.4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.now-pill .live-dot {
  background: #fff;
}

.now-head::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--red) 0 8px, transparent 8px 14px);
  opacity: 0.55;
}

.now-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  padding-left: 0.15rem;
}

.now-sub-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  opacity: 0.85;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  border: 1.5px solid rgba(195, 57, 39, 0.45);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  padding: 0.5rem 0.85rem 0.55rem;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.chip-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.chip-meta {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  opacity: 0.85;
}

.chip-meta .left {
  color: var(--red);
  font-weight: 700;
  opacity: 1;
}

.chip:active {
  transform: scale(0.95);
  background: #fbe9dc;
}

/* ===== End cap ===== */
.end-cap {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}

.end-cap .end-emoji {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.end-cap p {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
}

.end-cap .end-small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  opacity: 0.75;
  margin-top: 0.3rem;
}

/* ===== Scroll-in / scroll-out animations ===== */
.card,
.now-line,
.end-cap {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22, 0.9, 0.3, 1);
  transition-delay: 0ms;
  will-change: opacity, transform;
}

/* When scrolling up, elements enter from above instead */
body[data-dir="up"] .card:not(.in-view),
body[data-dir="up"] .now-line:not(.in-view),
body[data-dir="up"] .end-cap:not(.in-view) {
  transform: translateY(-28px) scale(0.985);
}

.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: var(--d, 0ms);
}

.card.past.in-view {
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .now-line,
  .end-cap {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none !important;
  }

  .card.past {
    opacity: 0.55;
  }

  .live-dot {
    animation: none;
  }
}

/* ===== Slightly larger screens ===== */
@media (min-width: 640px) {
  .timeline-wrap {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .card {
    padding: 1.1rem 1.3rem 1.2rem 1.65rem;
  }

  .card h2 {
    font-size: 1.4rem;
  }
}
