/* ============================================================
   CELL 4 · The Milo Daypart Rhythm (TIMELINE) · data-bg=paper · medium
   A connected morning→lunch story. 4 daypart cards with pastel top
   headers + colored mood footers, joined by DASHED SUN-GLYPH CONNECTORS
   (the day progressing left→right) — the connectors are what make this a
   timeline, structurally distinct from c2's matrix + c3's peak (C5).
   Reuses shared primitives: .frame · .eyebrow(--lined) · .star-rule ·
   .display · .em · .btn · .amb-pulse/.amb-perf/.amb-steam · .lift · .sec-head.
   Only cell-4-scoped styling lives here.
   ============================================================ */

#cell-4 { overflow: hidden; }

.c4 { display: flex; flex-direction: column; align-items: center; }

/* ---- head ------------------------------------------------------------ */
.c4__head { max-width: 62ch; margin-bottom: var(--space-l); }

.c4__eyebrow-sun {
  color: var(--accent);
  flex: none;
}
/* keep the sun glyph inside the lined-eyebrow flow, before the hairline lead */
.c4__eyebrow.eyebrow--lined { color: var(--support); }
.c4__eyebrow.eyebrow--lined::before { width: 30px; opacity: 0.55; }

.c4__title {
  display: grid;
  gap: 0.08em;
  font-size: var(--step-section);
  line-height: var(--leading-display);
}
.c4__title-1 { color: var(--ink); }
.c4__title-2 .em { font-size: 1em; }

.c4__star {
  width: min(320px, 60%);
  margin: var(--space-2xs) auto 0;
}
.c4__star > span { color: var(--accent); }

.c4__sub {
  margin-top: var(--space-2xs);
  color: var(--ink-soft);
}

/* ---- the timeline row ------------------------------------------------ */
/* 4 cards (1fr) interleaved with 3 connector columns (auto). */
.c4__timeline {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
}

/* ---- daypart card ---------------------------------------------------- */
.c4-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--paper-line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 44%),
    var(--paper-raised);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition:
    transform 320ms var(--ease-out),
    box-shadow 320ms var(--ease-out),
    border-color 320ms var(--ease-out);
}

/* card top header — pastel tint, icon + label (teal / marigold alternating) */
.c4-card__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: var(--space-s) var(--space-xs) calc(var(--space-s) - 0.15rem);
  text-align: center;
  border-bottom: 1px dashed var(--paper-line-strong);   /* order-slip perforation seam */
}
.c4-card__head--teal {
  background: linear-gradient(180deg, rgba(76, 181, 200, 0.16), rgba(76, 181, 200, 0.05));
  color: var(--teal-deep);
}
.c4-card__head--clay {
  background: linear-gradient(180deg, rgba(201, 114, 59, 0.15), rgba(201, 114, 59, 0.045));
  color: var(--support-deep);
}
.c4-card__glyph { display: inline-flex; line-height: 0; }
.c4-card__label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* card food image — portrait frame; crop out any dark counter surrounds so the
   bright plate dominates (C4 / kill-gate lesson: no dark quadrant fights). */
.c4-card__media {
  aspect-ratio: 4 / 5;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--paper-soft);
}
.c4-card__media > img { filter: saturate(1.05) contrast(1.03) brightness(1.03); }
/* per-image framing to keep the food centered + push dark edges out of frame */
.c4-card[data-daypart="morning"] .c4-card__media > img { object-position: 50% 42%; }
.c4-card[data-daypart="brunch"]  .c4-card__media > img { object-position: 50% 46%; }
.c4-card[data-daypart="midday"]  .c4-card__media > img { object-position: 50% 50%; }
.c4-card[data-daypart="lunch"]   .c4-card__media > img { object-position: 50% 52%; }

/* card mood footer — the STATE COLOR (solid deep tone, cream text = AA-safe).
   Fixed min-height + centered so all four footers are IDENTICAL height (T2.2)
   even though the strings differ in length; size/tracking tuned so the longest
   ("Hearty. Comforting. Done right.") holds one line at the narrowest card. */
.c4-card__mood {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.55rem 0.7rem;
  text-align: center;
  text-wrap: balance;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.71rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--paper-raised);
}
.c4-card__mood--teal { background: var(--teal-deep); }     /* cream on #1f6d79 — strong AA */
.c4-card__mood--clay { background: var(--support-deep); }  /* cream on #a95c2c — 4.7:1 AA (shared .btn tone) */

/* ---- connector between cards — the dashed sun-glyph day-progression ---- */
.c4-conn {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;               /* vertically centered on the card media band */
  gap: 0;
  padding-inline: clamp(0.35rem, 0.9vw, 0.9rem);
  color: rgba(31, 109, 121, 0.5);   /* muted teal-deep line */
}
.c4-conn__dash {
  width: clamp(10px, 1.4vw, 22px);
  height: 0;
  border-top: 2px dashed currentColor;
  opacity: 0.7;
}
.c4-conn__glyph {
  display: inline-flex;
  line-height: 0;
  color: var(--accent);
  margin-inline: 0.28rem;
}

/* ---- foot band (VARIED per C6 — earns its own treatment) ------------- */
.c4__foot {
  width: 100%;
  margin-top: var(--space-l);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: var(--space-m);
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius);
  border: 1px dashed var(--paper-line-strong);   /* order-slip band, dashed not solid (variation) */
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 46%),
    var(--paper-raised);
  box-shadow: var(--shadow-soft);
}
.c4__foot-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.c4__foot-icon { color: var(--teal-deep); line-height: 0; display: inline-flex; }
.c4__foot-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal-deep);
  white-space: nowrap;
}
.c4__foot-div {
  width: 1px;
  align-self: stretch;
  min-height: 2.2rem;
  background: var(--paper-line-strong);
}
.c4__foot-copy {
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.4;
}
.c4__foot-btn { justify-self: end; white-space: nowrap; }
.c4__foot-btn-icon { flex: none; }

/* ============================================================
   RESPONSIVE — mobile is desktop RECOMPOSED, not squished (T2.31).
   DESIGN.md cell-4 plan: collapse the daypart row into a vertical
   morning → brunch → lunch STORYBOARD; connectors turn vertical so the
   day still visibly progresses top→bottom.
   ============================================================ */

/* tablet / mid: 2×2 card grid; connectors are decorative only, hide them */
@media (max-width: 980px) {
  .c4__timeline {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-s);
  }
  .c4-conn { display: none; }
  .c4-card__media { aspect-ratio: 3 / 2; }
}

@media (max-width: 620px) {
  .c4__head { margin-bottom: var(--space-m); }

  /* vertical storyboard: single column with a running connector between rows */
  .c4__timeline {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 420px;
    margin-inline: auto;
  }
  .c4-card { margin-inline: auto; width: 100%; }
  .c4-card__media { aspect-ratio: 16 / 10; }

  /* re-show a VERTICAL connector between the stacked cards (day flows down) */
  .c4-conn {
    display: flex;
    flex-direction: column;
    padding-block: 0.5rem;
    padding-inline: 0;
  }
  .c4-conn__dash {
    width: 0;
    height: clamp(10px, 3vw, 18px);
    border-top: 0;
    border-left: 2px dashed currentColor;
  }
  .c4-conn__glyph { margin-block: 0.24rem; margin-inline: 0; }

  /* foot band restacks: mark + copy over a full-width button */
  .c4__foot {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: var(--space-s);
    padding: var(--space-m);
  }
  .c4__foot-div { display: none; }
  .c4__foot-copy { max-width: 34ch; }
  .c4__foot-br { display: none; }
  .c4__foot-btn { justify-self: center; width: 100%; max-width: 320px; }
}

/* very small: keep the vertical storyboard tight */
@media (max-width: 380px) {
  .c4-card__label { letter-spacing: 0.12em; }
}

/* ---- ambient: the connector glyphs sweep a gentle left→right daypart pulse
     at rest (the day progressing). Only under .motion-ready; reduced-motion /
     static / solo never run it (content is fully alive without it). ---- */
.motion-ready .c4-conn__glyph {
  animation: c4-conn-pulse 5.4s ease-in-out infinite;
  transform-origin: center;
}
/* stagger the three connectors so the pulse reads as a wave down the timeline
   (connectors are the 1st/2nd/3rd <span> of type among the timeline children) */
.motion-ready .c4-conn:nth-of-type(1) .c4-conn__glyph { animation-delay: 0s; }
.motion-ready .c4-conn:nth-of-type(2) .c4-conn__glyph { animation-delay: 0.5s; }
.motion-ready .c4-conn:nth-of-type(3) .c4-conn__glyph { animation-delay: 1s; }
@keyframes c4-conn-pulse {
  0%, 100% { transform: scale(0.9)  rotate(0deg);   opacity: 0.55; }
  50%      { transform: scale(1.12) rotate(18deg);  opacity: 1; }
}
.motion-ready .c4-conn__dash { animation: c4-dash-breathe 5.4s ease-in-out infinite; }
@keyframes c4-dash-breathe {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .c4-conn__glyph, .c4-conn__dash { animation: none; }
}
