/* 05 / Monday report: the weekly summary email arrives in a mail app, opens and writes itself.
   Every rule is scoped under #report. Fernhollow paper tokens sit on the email itself. */

/* ---------- Fernhollow paper tokens (the email only) ---------- */

#report .pm-rep-paper {
  --fh-paper: #f7f5ef;
  --fh-card: #ffffff;
  --fh-ink: #1d2420;
  --fh-sub: #3a423d;
  --fh-muted: #6a716b;
  --fh-line: #e3e0d6;
  --fh-rule: #cfcabd;
  --fh-fern: #2f4a3a;
  --fh-moss: #4e6b57;
  --fh-sage: #93a89a;
  --fh-sand: #e2c46d;
  --fh-red: #d63a3a;
  --fh-red-ink: #c42f2f;
  --fh-red-bg: #fff6f5;
  --fh-gold: #d4ac35;
  --fh-gold-ink: #7a5d0e;
  --fh-ok: #2f6b4f;
  --fh-ok-bg: #e3eee6;
  --fh-amber: #b7701c;
  --fh-amber-bg: #f6ead8;
  --fh-chip: #eef0ec;
}

@keyframes pm-rep-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pm-rep-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ---------- Mail app (dark, site palette) ---------- */

/* The whole stage fits the viewport under the section head; the reading pane scrolls inside it */
#report .pm-mail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: min(100svh - 140px, 860px);
}

#report .pm-mail-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

#report .pm-mail-dots {
  display: flex;
  gap: 6px;
  flex: none;
}

#report .pm-mail-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ash);
  opacity: 0.55;
}

#report .pm-mail-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#report .pm-mail-r {
  flex: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#report .pm-mail-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

/* ---------- Inbox list ---------- */

#report .pm-mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  border-right: 1px solid var(--line);
  overflow: hidden;
  align-self: start;
}

/* Each slot is a grid whose single row animates from 0fr to 1fr, so the new message slides in */
#report .pm-mail-slot {
  display: grid;
  grid-template-rows: 1fr;
}

#report .pm-mail-slot--new {
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease-out);
}

#report .pm-mail-slot--new.pm-in {
  grid-template-rows: 1fr;
}

#report .pm-mail-row {
  min-height: 0;
  overflow: hidden;
}

#report .pm-mail-in {
  position: relative;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.4s var(--ease-soft), background-color 0.3s var(--ease-std);
}

#report .pm-mail-slot--new .pm-mail-in {
  opacity: 0;
}

#report .pm-mail-slot--new.pm-in .pm-mail-in {
  opacity: 1;
}

#report .pm-mail-in.pm-sel {
  background: var(--elev);
}

#report .pm-mail-in.pm-sel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

#report .pm-mail-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#report .pm-mail-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

#report .pm-mail-dot--off {
  visibility: hidden;
}

#report .pm-mail-from {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  line-height: 1.2;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#report .pm-mail-from--new {
  font-weight: 600;
}

#report .pm-mail-time {
  flex: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ash);
}

#report .pm-mail-subject,
#report .pm-mail-preview {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#report .pm-mail-subject {
  margin-top: 5px;
  font-size: 14.5px;
  line-height: 1.35;
  color: hsl(42 30% 94% / 0.72);
}

#report .pm-mail-preview {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ash);
}

/* ---------- Reading pane ---------- */

#report .pm-mail-read {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ink);
}

#report .pm-mail-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#report .pm-mail-msg {
  display: none;
  padding: 0 20px;
}

#report .pm-mail.pm-open .pm-mail-empty {
  display: none;
}

#report .pm-mail.pm-open .pm-mail-msg {
  display: block;
}

#report .pm-mail-head {
  margin: 0 -20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  animation: pm-rep-in 0.25s var(--ease-out) both;
}

#report .pm-mail-subj {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--bone);
}

#report .pm-mail-fromrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
}

#report .pm-mail-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

#report .pm-mail-who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#report .pm-mail-whol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  min-width: 0;
}

#report .pm-mail-name {
  font-size: 15px;
  color: var(--bone);
}

#report .pm-mail-addr {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ash);
  white-space: nowrap;
}

#report .pm-mail-to {
  font-size: 14px;
  color: var(--ash);
}

#report .pm-mail-time--r {
  margin-top: 2px;
  white-space: nowrap;
}

/* ---------- The email (light, Fernhollow palette) ---------- */

#report .pm-rep-paper {
  position: relative;
  max-width: 760px;
  margin: 24px auto 28px;
  padding: 24px 32px;
  border-radius: 6px;
  background: var(--fh-card);
  color: var(--fh-ink);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.8);
  animation: pm-rep-in 0.25s var(--ease-out) both;
}

#report .pm-rep-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--fh-line);
}

#report .pm-rep-brand {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fh-fern);
}

#report .pm-rep-week {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fh-muted);
  text-align: right;
}

#report .pm-rep-title {
  margin: 14px 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--fh-ink);
}

#report .pm-rep-basis {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 16px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fh-muted);
}

#report .pm-rep-basis svg {
  flex: none;
  width: 12px;
  height: 12px;
  color: var(--fh-gold);
}

#report .pm-rep-block {
  display: none;
  margin-top: 16px;
}

#report .pm-rep-block.pm-on {
  display: block;
}

#report .pm-rep-block + .pm-rep-block {
  padding-top: 14px;
  border-top: 1px solid var(--fh-line);
}

#report .pm-rep-p {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fh-sub);
}

#report .pm-rep-lab {
  font-weight: 700;
  color: var(--fh-ink);
}

#report .pm-rep-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--fh-gold);
  animation: pm-rep-blink 1s step-end infinite;
}

/* Stacked share bar: flex-grow carries each share (set inline), 2px paper gaps between parts */
#report .pm-rep-stack {
  display: flex;
  gap: 2px;
  height: 12px;
  margin-top: 12px;
  border-radius: 3px;
  overflow: hidden;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.6s var(--ease-std);
}

#report .pm-rep-stack.pm-grown {
  transform: none;
}

#report .pm-rep-stack i {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

#report [data-k="cheapest"] {
  background: var(--fh-fern);
}

#report [data-k="mid"] {
  background: var(--fh-sage);
}

#report [data-k="expensive"] {
  background: var(--fh-amber);
}

#report .pm-rep-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--fh-sub);
  opacity: 0;
  transition: opacity 0.25s var(--ease-std);
}

#report .pm-rep-legend.pm-on {
  opacity: 1;
}

#report .pm-rep-legend b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fh-ink);
}

#report .pm-rep-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: -1px;
}

#report .pm-rep-rows {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

/* Four fixed columns in every row: label | bar | count (right) | note (left), so counts and notes line up */
#report .pm-rep-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 22px 96px;
  align-items: center;
  column-gap: 12px;
  min-height: 22px;
}

#report .pm-rep-row-name {
  white-space: nowrap;
  font-size: 14.5px;
  line-height: 1.25;
  color: var(--fh-sub);
}

#report .pm-rep-bar {
  height: 8px;
  border-radius: 2px;
  background: #ece8de;
  overflow: hidden;
}

#report .pm-rep-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--fh-moss);
  transition: width 0.5s var(--ease-std);
}

#report .pm-rep-bar.pm-grown i {
  width: var(--w);
}

#report .pm-rep-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--fh-ink);
}

#report .pm-rep-note {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--fh-muted);
  white-space: nowrap;
}

#report .pm-rep-note:empty {
  display: none;
}

/* Suggestions: numbered circles, tag chips, typed text, attachment after item 1 */
#report .pm-rep-sug {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

#report .pm-rep-sug li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}

#report .pm-rep-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--fh-fern);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.25s var(--ease-std), transform 0.3s var(--ease-out);
}

#report .pm-rep-num.pm-on {
  opacity: 1;
  transform: none;
}

#report .pm-rep-item-p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fh-sub);
}

#report .pm-rep-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
  opacity: 0;
  transition: opacity 0.3s var(--ease-std);
}

#report .pm-rep-tag.pm-on {
  opacity: 1;
}

#report .pm-rep-tag--raise {
  color: var(--fh-ok);
  background: var(--fh-ok-bg);
}

#report .pm-rep-tag--hold {
  color: var(--fh-sub);
  background: #eceae3;
}

#report .pm-rep-tag--watch {
  color: var(--fh-amber);
  background: var(--fh-amber-bg);
}

#report .pm-rep-att {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin-top: 10px;
  padding: 5px 9px;
  border: 1px solid var(--fh-line);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fh-ink);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.35s var(--ease-soft), transform 0.35s var(--ease-soft);
}

#report .pm-rep-att.pm-on {
  opacity: 1;
  transform: none;
}

#report .pm-rep-att svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--fh-muted);
}

#report .pm-rep-att-meta {
  font-size: 12px;
  color: var(--fh-muted);
}

/* Footer: the two links, not functional in the demo */
#report .pm-rep-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--fh-line);
  font-size: 15px;
  line-height: 1.5;
  color: var(--fh-sub);
  opacity: 0;
  transition: opacity 0.4s var(--ease-soft);
}

#report .pm-rep-foot.pm-on {
  opacity: 1;
}

/* Not links in the demo: the plain text style, no pointer, no underline */
#report .pm-rep-link {
  color: var(--fh-fern);
  text-decoration: none;
  cursor: default;
}

/* ---------- Replay, toast, line under the stage ---------- */

#report .pm-mail-tail {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

#report .pm-rep-replay {
  visibility: hidden;
  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;
  background: transparent;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

#report .pm-mail.pm-end .pm-rep-replay {
  visibility: visible;
}

#report .pm-rep-replay:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#report .pm-rep-replay svg {
  width: 14px;
  height: 14px;
}

#report .pm-mail.pm-final .pm-rep-replay {
  display: none;
}

#report .pm-rep-toast {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 3;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elev);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--bone);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.4s var(--ease-soft), transform 0.4s var(--ease-soft);
}

#report .pm-rep-toast.pm-on {
  opacity: 1;
  transform: none;
}

#report .pm-rep-line {
  max-width: 44rem;
  margin: 24px 0 0;
  text-align: left;
}

/* Static and reduced motion: the finished state at once, nothing animates */
#report .pm-mail.pm-static,
#report .pm-mail.pm-static * {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #report .pm-rep-caret {
    animation: none;
  }
}

/* ---------- Desktop: the list sits beside the email ---------- */

/* ---------- One pane below 1024px: the list is hidden, the email takes the full width ---------- */

@media (max-width: 1023px) {
  #report .pm-mail-body {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  #report .pm-mail-list {
    display: none;
  }
}

/* ---------- Phones ---------- */

@media (max-width: 600px) {
  #report .pm-mail-msg {
    padding: 0 14px;
  }

  #report .pm-mail-head {
    margin: 0 -14px;
    padding: 14px 16px;
  }

  #report .pm-mail-subj {
    font-size: 18px;
  }

  #report .pm-rep-paper {
    margin: 14px auto 20px;
    padding: 20px 18px;
  }

  #report .pm-rep-title {
    font-size: 19px;
  }

  #report .pm-rep-legend {
    gap: 6px 14px;
  }

  /* Name on its own line (whole, never cut), bar and count beneath it, the note under the bar */
  #report .pm-rep-row {
    grid-template-columns: minmax(0, 1fr) 22px;
    row-gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--fh-line);
  }

  #report .pm-rep-row:last-child {
    border-bottom: 0;
  }

  #report .pm-rep-row-name {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #report .pm-rep-bar {
    grid-column: 1;
    grid-row: 2;
  }

  #report .pm-rep-count {
    grid-column: 2;
    grid-row: 2;
  }

  #report .pm-rep-note {
    grid-column: 1 / -1;
    grid-row: 3;
    white-space: normal;
  }
}
