/* 05 / Your morning in one message (automation 11, Shopify ops). The 8:00 AM summary arrives on
   a phone in a Slack or an email skin, and each of its lines is wired to the source card it comes
   from. Every rule is scoped under #morning. The skin palettes (--sl-*, --ml-*, --sa-brand) are
   declared on the phone screen only, never on the page. */

/* ---------- Channel switch: Slack / Email, right-aligned above the stage ---------- */

#morning .so-mo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 14px;
}

#morning .so-mo-tag {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ash);
}

@media (max-width: 768px) {
  #morning .so-mo-b {
    min-height: 44px;
  }
}

#morning .so-mo-view {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

#morning .so-mo-b {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ash);
  transition: color 0.2s, background-color 0.2s;
}

#morning .so-mo-b svg {
  width: 14px;
  height: 14px;
  flex: none;
}

#morning .so-mo-b:hover {
  color: var(--bone);
}

#morning .so-mo-b[aria-pressed="true"] {
  background: var(--bone);
  color: var(--ink);
}

#morning .so-mo-b:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Stage grid: phone | connector gutter | sources, Replay on its own row ---------- */

#morning .so-mo-in {
  display: grid;
  grid-template-columns: 300px 120px minmax(0, 1fr);
  align-items: center;
  padding: 32px;
}

/* Finished state (static or reduced motion): nothing animates and there is no Replay row */
#morning .so-mo-in.is-final,
#morning .so-mo-in.is-final * {
  transition: none !important;
}

#morning .so-mo-phone {
  --phone-fs: 12.5px;
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}

#morning .so-mo-gut {
  grid-column: 2;
  grid-row: 1;
}

#morning .so-mo-src {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
}

#morning .so-mo-replay {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  margin-top: 20px;
}

/* Wires: the grey base is always there; the gold line draws over it when its line appears */
#morning .so-mo-wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#morning .so-mo-base {
  fill: none;
  stroke: var(--line);
  stroke-width: 1px;
}

#morning .so-mo-wire {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.25px;
  transition: stroke-dashoffset 420ms var(--ease-soft);
}

#morning .so-mo-dot {
  fill: var(--accent);
  opacity: 0;
  transition: opacity 300ms var(--ease-std);
}

#morning .so-mo-w.is-lit .so-mo-dot {
  opacity: 1;
}

/* One gold ring around the phone when the notification lands */
#morning .so-mo-ring {
  position: absolute;
  inset: -6px;
  border-radius: 3.9em;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.6), 0 0 40px 4px rgb(255 255 255 / 0.28);
}

#morning .so-mo-ring.is-glow {
  animation: so-mo-ring 900ms var(--ease-out) 1 both;
}

@keyframes so-mo-ring {
  from { opacity: 1; transform: scale(0.97); }
  to { opacity: 0; transform: scale(1.05); }
}

/* ---------- The phone screen: palettes, lock screen, notification ---------- */

#morning .so-mo-screen {
  --sl-bg: #1a1d21;
  --sl-raise: #222529;
  --sl-line: rgba(255, 255, 255, 0.1);
  --sl-ink: #d1d2d3;
  --sl-bright: #f8f8f8;
  --sl-muted: #ababad;
  --sa-brand: #2f6f73;
  --ml-bg: #111214;
  --ml-ink: #f2f2f7;
  --ml-muted: #8e8e93;
  --ml-line: #2c2c2e;
  --ml-accent: #0a84ff;
  background: var(--wa-bg);
}

#morning .so-mo-lock {
  position: absolute;
  inset: 0;
  color: #fff;
  background: radial-gradient(120% 80% at 30% 10%, #1f4b4f 0%, #0f1f22 55%, #090c0d 100%);
  transition: opacity 380ms var(--ease-soft);
}

#morning .so-mo-lock.is-away {
  opacity: 0;
}

#morning .so-mo-sb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  height: 3.3em;
  padding: 0.9em 0.9em 0 1.9em;
  font-size: 1em;
  font-weight: 600;
  color: inherit;
}

#morning .so-mo-sb-t {
  font-size: 0.95em;
  min-width: 3.2em;
}

#morning .so-mo-lk-t {
  position: absolute;
  top: 5.5em;
  left: 0;
  right: 0;
  text-align: center;
}

#morning .so-mo-lk-day {
  display: block;
  font-size: 1em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

#morning .so-mo-lk-clock {
  display: block;
  font-family: var(--font-display);
  font-size: 5.2em;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: #fff;
}

#morning .so-mo-note {
  position: absolute;
  top: 17em;
  left: 0.9em;
  right: 0.9em;
  padding: 0.9em 1em;
  border-radius: 1.4em;
  background: rgba(38, 38, 40, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  opacity: 0;
  transform: translateY(-1.5em);
  transition: opacity 420ms var(--ease-soft), transform 420ms var(--ease-soft);
}

#morning .so-mo-note.is-on {
  opacity: 1;
  transform: none;
}

#morning .so-mo-note-h {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

#morning .so-mo-note-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 22%;
  background: var(--sa-brand);
  color: #fff;
}

#morning .so-mo-note-ic svg {
  width: 1.2em;
  height: 1.2em;
}

#morning .so-mo-note-n {
  font-size: 0.85em;
  font-weight: 600;
}

#morning .so-mo-note-now {
  margin-left: auto;
  font-size: 0.75em;
  color: rgba(255, 255, 255, 0.55);
}

#morning .so-mo-note-b {
  margin: 0.3em 0 0;
  font-size: 0.85em;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#morning .so-mo-ic-mail {
  display: none;
}

#morning .so-mo-screen[data-skin="email"] .so-mo-note-ic .so-mo-ic-bolt {
  display: none;
}

#morning .so-mo-screen[data-skin="email"] .so-mo-ic-mail {
  display: block;
}

#morning .so-mo-screen[data-skin="email"] .so-mo-note-ic {
  background: var(--ml-accent);
}

/* ---------- App screen: Slack DM or email, crossfades in from the lock screen ---------- */

#morning .so-mo-app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 380ms var(--ease-soft), transform 380ms var(--ease-soft);
}

#morning .so-mo-app.is-on {
  opacity: 1;
  transform: none;
}

#morning .so-mo-app[data-skin="slack"] {
  background: var(--sl-bg);
  color: var(--sl-ink);
}

#morning .so-mo-app[data-skin="email"] {
  background: var(--ml-bg);
  color: var(--ml-ink);
}

#morning .so-mo-hd {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex: none;
  height: 3.6em;
  padding: 0 0.9em;
  border-bottom: 1px solid var(--sl-line);
}

#morning .so-mo-app[data-skin="email"] .so-mo-hd {
  border-bottom-color: var(--ml-line);
}

#morning .so-mo-hd-back {
  display: inline-flex;
  flex: none;
  width: 1.35em;
  height: 1.35em;
  color: var(--sl-bright);
}

#morning .so-mo-hd-back svg {
  width: 100%;
  height: 100%;
}

#morning .so-mo-app[data-skin="email"] .so-mo-hd-back {
  color: var(--ml-accent);
}

#morning .so-mo-hd-link {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--ml-accent);
}

#morning .so-mo-hd-t {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

#morning .so-mo-hd-n {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.95em;
  font-weight: 700;
  color: var(--sl-bright);
}

#morning .so-mo-hd-s {
  font-size: 0.72em;
  color: var(--sl-muted);
}

#morning .so-mo-badge {
  font-size: 0.6em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.03em;
  padding: 0.2em 0.45em;
  border-radius: 0.3em;
  background: rgba(255, 255, 255, 0.12);
  color: var(--sl-ink);
}

#morning .so-mo-bd {
  flex: 1;
  min-height: 0;
  padding: 1em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#morning .so-mo-day {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin: 0.2em 0 1em;
  font-size: 0.7em;
  color: var(--sl-muted);
}

#morning .so-mo-day::before,
#morning .so-mo-day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sl-line);
}

#morning .so-mo-mh {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.6em;
}

#morning .so-mo-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: 22%;
  background: var(--sa-brand);
  color: #fff;
}

#morning .so-mo-av svg {
  width: 1.3em;
  height: 1.3em;
}

#morning .so-mo-mh-n {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--sl-bright);
}

#morning .so-mo-mh-t {
  margin-left: auto;
  font-size: 0.72em;
  color: var(--sl-muted);
  white-space: nowrap;
}

/* Message lines (both skins): line 0 is the title, then one line per summary row */
#morning .so-mo-l {
  margin: 0 0 0.5em;
  font-size: 0.84em;
  line-height: 1.45;
  color: var(--sl-ink);
  opacity: 0;
  transform: translateY(0.3em);
  transition: opacity 260ms var(--ease-soft), transform 260ms var(--ease-soft), background-color 300ms var(--ease-std), border-color 300ms var(--ease-std);
}

#morning .so-mo-l.is-on {
  opacity: 1;
  transform: none;
}

#morning .so-mo-l b,
#morning .so-mo-l--title {
  font-weight: 700;
  color: var(--sl-bright);
}

/* The Note line: flagged by the automation with a gold marker and a chip (negative margins keep the text aligned) */
#morning .so-mo-l.is-note {
  margin: 0 -0.5em 0.5em calc(-0.5em - 2px);
  padding: 0.35em 0.5em 0.35em calc(0.5em + 2px);
  border-left: 2px solid transparent;
  border-radius: 0 0.4em 0.4em 0;
}

#morning .so-mo-l.is-note.is-flag {
  background: rgb(255 255 255 / 0.12);
  border-left-color: var(--accent);
}

#morning .so-mo-flag {
  display: flex;
  align-items: center;
  gap: 0.35em;
  width: max-content;
  margin-top: 0.45em;
  padding: 0.15em 0.45em;
  border: 1px solid rgb(255 255 255 / 0.5);
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

#morning .so-mo-flag[hidden] {
  display: none;
}

#morning .so-mo-flag svg {
  width: 1em;
  height: 1em;
  flex: none;
}

#morning .so-mo-ib {
  flex: none;
  margin: 0 0.9em 0.9em;
  padding: 0.6em 0.8em;
  border: 1px solid var(--sl-line);
  border-radius: 0.6em;
  font-size: 0.8em;
  color: var(--sl-muted);
}

/* Email skin */

#morning .so-mo-app[data-skin="email"] .so-mo-l {
  font-size: 0.86em;
  line-height: 1.5;
  color: var(--ml-ink);
}

#morning .so-mo-app[data-skin="email"] .so-mo-l b,
#morning .so-mo-app[data-skin="email"] .so-mo-l--title {
  font-weight: 600;
  color: var(--ml-ink);
}

#morning .so-mo-app[data-skin="email"] .so-mo-l--title {
  font-weight: 700;
}

#morning .so-mo-subj {
  margin: 0 0 0.7em;
  font-size: 1.15em;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ml-ink);
}

#morning .so-mo-from {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.8em;
}

#morning .so-mo-from .so-mo-av {
  width: 2.2em;
  height: 2.2em;
}

#morning .so-mo-from-t {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

#morning .so-mo-from-n {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--ml-ink);
}

#morning .so-mo-from-to,
#morning .so-mo-from-time {
  font-size: 0.75em;
  color: var(--ml-muted);
}

#morning .so-mo-from-time {
  white-space: nowrap;
}

#morning .so-mo-hair {
  height: 1px;
  margin: 0 0 1em;
  background: var(--ml-line);
}

/* ---------- Sources: one card per line of the message ---------- */

#morning .so-mo-src {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#morning .so-mo-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color 0.4s var(--ease-std), background-color 0.4s var(--ease-std);
}

#morning .so-mo-card.is-lit {
  border-color: rgb(255 255 255 / 0.45);
}

#morning .so-mo-card.is-flag.is-lit {
  border-color: var(--accent);
  background-color: rgb(255 255 255 / 0.05);
}

#morning .so-mo-ic {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--elev);
  color: var(--ash);
  transition: color 0.4s var(--ease-std);
}

#morning .so-mo-ic svg {
  width: 16px;
  height: 16px;
}

#morning .so-mo-card.is-lit .so-mo-ic {
  color: var(--accent);
}

#morning .so-mo-cm {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#morning .so-mo-ck {
  font-size: 11.5px;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

#morning .so-mo-cd {
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--bone-70);
  transition: color 0.4s var(--ease-std);
}

#morning .so-mo-card.is-lit .so-mo-cd {
  color: var(--bone);
}

#morning .so-mo-cs {
  padding: 3px 7px;
  border: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  color: var(--ash);
  white-space: nowrap;
  transition: color 0.4s var(--ease-std), border-color 0.4s var(--ease-std);
}

#morning .so-mo-card.is-lit .so-mo-cs {
  color: var(--bone);
}

#morning .so-mo-card.is-flag.is-lit .so-mo-cs {
  color: var(--accent);
  border-color: var(--accent-40);
}

/* ---------- Replay: bottom right, its row is kept (hidden) until the sequence ends ---------- */

#morning .so-mo-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-soft), visibility 0.4s, border-color 0.2s, color 0.2s;
}

#morning .so-mo-replay.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#morning .so-mo-replay:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#morning .so-mo-replay:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#morning .so-mo-replay svg {
  width: 14px;
  height: 14px;
}

/* Static and reduced motion: no Replay at all */
#morning .so-mo-in.is-final .so-mo-replay {
  display: none;
}

/* ---------- Caption under the stage, left-aligned like 03's train line ---------- */

#morning .so-mo-line {
  max-width: 44rem;
  margin: 24px 0 0;
  text-align: left;
}

#morning .sec-title .gold-i {
  display: inline-block;
}

/* ---------- Desktop: connectors shown (1024 and up), the sources sit to the right ---------- */

@media (min-width: 1024px) {
  #morning .so-mo-wires {
    display: block;
  }
}

/* ---------- Below 1024: one column (phone, sources, Replay); no connectors ---------- */

@media (max-width: 1023px) {
  #morning .so-mo-in {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
    padding: 18px;
  }

  #morning .so-mo-phone {
    grid-column: 1;
    grid-row: 1;
  }

  #morning .so-mo-gut,
  #morning .so-mo-wires {
    display: none;
  }

  #morning .so-mo-src {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  #morning .so-mo-replay {
    grid-column: 1;
    grid-row: 3;
    justify-self: end;
    margin-top: 0;
  }
}

/* Below 1024: the chip drops under the text so the card stays readable */
@media (max-width: 1023px) {
  #morning .so-mo-card {
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
  }

  #morning .so-mo-cs {
    grid-column: 2;
    justify-self: start;
  }
}

/* Phones: a smaller phone and one source column */
@media (max-width: 599px) {
  #morning .so-mo-phone {
    --phone-fs: 12px;
  }

  #morning .so-mo-src {
    grid-template-columns: minmax(0, 1fr);
  }
}
