/* styles/sections/trace-shots.css
 * Product shots on the Customer Feedback trace, transcribed from the frames (oF2GB, LlDUC, W6doM)
 * inside .artifact-window shells: the Slack channel, the Brief document, research signal and feature
 * records (fern Brief bar), the Jira build ticket. The terminal is terminal-shot.css.
 * Each shot is a container ("shot"): from 440px wide it takes the D and W frame layout, narrower it
 * takes the M layout, so the shots between 900 and about 1100 reflow the way the 390 frame does.
 * Highlighted rows (orange 10% fill, 2px orange rule) are the rows the thread points at. Dimmed rows
 * (.is-dim) draw text in the closest colour to the frames' 45% that passes AA (tokens.css, BRI-7754);
 * their icons, avatars, rules and edges keep 45%.
 * Unset line heights are Pencil's "normal", 1.2 on whole pixels, set on every element. */
@layer sections {
  .trace-stop__art > .artifact-window { box-shadow: var(--elevation-floating); }

  .shot {
    --shot-pad: var(--space-20);
    container: shot / inline-size;
    font-family: var(--font-body);
  }

  /* Rounded per element (an em line height computed on the shell would be inherited in px) */
  .shot * { line-height: round(nearest, 1.2em, 1px); }

  /* The shell (artifacts layer) sets its own text colour; the shot's comes in one level down */
  .shot > * { color: var(--shot-text); }

  .shot--wide { width: min(100%, 876px); }
  .shot--narrow { width: min(100%, 584px); }

  :where(.shot) :is(p, ul, ol, dl, dd, blockquote) { margin: 0; }

  :where(.shot) :is(ul, ol) {
    padding: 0;
    list-style: none;
  }

  .shot img { display: block; flex: none; }

  .shot strong { font-weight: inherit; }

  /* Highlighted row: the rows the thread points at */
  .shot-hl,
  .shot-quote,
  .shot-row--hl,
  .shot-source {
    background: var(--orange-10);
    box-shadow: inset 2px 0 0 var(--orange);
  }

  .is-dim :is(img, .shot-msg__avatar) { opacity: 0.45; }

  /* ---------- Slack channel ---------- */
  .shot-slack-bar {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    padding: var(--space-16);
    box-shadow: inset 0 -1px 0 var(--slack-line);
    font-size: 13px;
    color: var(--slack-ink-2);
  }

  .shot-slack-bar strong {
    font-size: 16px;
    font-weight: 700;
    line-height: 19px;
    color: var(--slack-ink);
  }

  .shot-slack {
    display: flex;
    flex-direction: column;
    gap: var(--space-20);
    padding: var(--space-20) var(--space-16) var(--space-28);
    color: var(--slack-ink);
  }

  .shot-msg {
    display: flex;
    gap: var(--space-12);
  }

  .shot-msg__avatar {
    width: 36px;
    height: 36px;
  }

  .shot-msg__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
  }

  .shot-msg__head {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    font-size: 15px;
  }

  .shot-msg__head strong { font-weight: 700; }

  .shot-msg__head span {
    font-size: 12px;
    color: var(--slack-ink-2);
  }

  .shot-msg__text,
  .shot-slack .shot-hl {
    font-size: 15px;
    line-height: round(nearest, 1.45em, 1px);
  }

  .shot-slack .shot-hl {
    padding: var(--space-8) var(--space-14);
    font-style: italic;
  }

  .shot-day {
    display: flex;
    align-items: center;
    gap: var(--space-12);
  }

  .shot-day::before,
  .shot-day::after {
    content: "";
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--slack-line) 45%, transparent);
  }

  .shot-day span {
    padding: 2px 11px;
    border: 1px solid color-mix(in srgb, var(--slack-field) 45%, transparent);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
  }

  .shot-slack .is-dim,
  .shot-slack .is-dim .shot-msg__head span { color: var(--shot-dim); }

  /* ---------- Brief records: fern bar, crumbs, document, signal, feature ---------- */
  .shot-brief-bar {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    height: 40px;
    padding-inline: var(--space-16);
    background: var(--fern);
    font-size: 14px;
    line-height: 17px;
    color: var(--white-70);
  }

  .shot-brief-bar strong {
    font-weight: 600;
    color: var(--white);
  }

  .shot-crumbs {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-8);
    padding: var(--space-16) var(--shot-pad);
    box-shadow: inset 0 -1px 0 var(--shot-rule);
    font-size: 13px;
    color: var(--shot-text-2);
  }

  .shot-crumbs__current { color: var(--shot-black); }

  .shot-doc {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: var(--space-24) var(--shot-pad) var(--space-28);
  }

  .shot-doc__heading {
    font-size: 17px;
    font-weight: 600;
  }

  .shot-doc .is-dim { color: var(--shot-dim); }

  .shot-quote {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-8) var(--space-14);
    font-size: 14px;
    font-style: italic;
    line-height: round(nearest, 1.5em, 1px);
    color: var(--shot-text);
  }

  .shot-quote > p + p { line-height: round(nearest, 1.5em, 1px); }

  .shot-quote__stamp {
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
    line-height: 16px;
    color: var(--shot-black);
  }

  .shot-record {
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
    padding: var(--space-28) var(--shot-pad) var(--space-32);
  }

  .shot-record__title,
  .shot-feature__title {
    font-size: 19px;
    font-weight: 700;
    color: var(--shot-black);
  }

  .shot-record__title { line-height: round(nearest, 1.25em, 1px); }

  .shot-excerpts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-10);
  }

  .shot-key {
    font-size: 13px;
    font-weight: 600;
  }

  .shot-hl--excerpt {
    align-self: stretch;
    padding: var(--space-8) var(--space-14);
    font-size: 14px;
    font-style: italic;
    line-height: round(nearest, 1.5em, 1px);
  }

  /* 24px as drawn (5 + 14 + 5); below 390 the line can wrap and the chip grows with it */
  .shot-chip {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    min-height: 24px;
    padding: 5px var(--space-8);
    border-radius: var(--radius-sm);
    background: var(--chip-superseded-bg);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-2);
  }

  .shot-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
    padding-top: var(--space-20);
    box-shadow: inset 0 1px 0 var(--line-2);
  }

  .shot-meta > div {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-4);
  }

  .shot-meta dt {
    font-size: 12px;
    color: var(--ink-55);
  }

  .shot-meta dd {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
  }

  .shot-feature {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-12);
    padding: var(--space-32) var(--shot-pad) var(--space-24);
  }

  .shot-tag {
    display: inline-flex;
    flex: none;
    align-items: center;
    height: 24px;
    padding-inline: 7px;
    border: 1px solid var(--shot-tag);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
    color: var(--shot-tag);
  }

  .shot-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-14);
    padding: 18px var(--shot-pad);
    box-shadow: inset 0 1px 0 var(--shot-rule);
  }

  .shot-group__head {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    font-size: 14px;
    color: var(--shot-black);
  }

  .shot-group__head strong { font-weight: 600; }

  .shot-count {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding-inline: 6px;
    border: 1px solid var(--shot-count-edge);
    border-radius: 5px;
    font-size: 12px;
    color: var(--shot-count);
  }

  .shot-group__rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-14);
  }

  .shot-row {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: var(--space-10);
    padding-left: var(--space-16);
    font-size: 15px;
  }

  .shot-row > span:not(.shot-tag) { min-width: 0; }

  /* M: a row hugs its content (Account manager, Impacts), except the two signal rows, which LlDUC
     draws full width with the label filling between icon and tag */
  .shot-row--fill { align-self: stretch; }
  .shot-row--fill > span:not(.shot-tag) { flex: 1; }

  .shot-row--hl {
    padding: var(--space-6) var(--space-12);
    font-style: italic;
  }

  /* Only the signal's text is italic; its tag stays upright (MdIcB, rzo7w, JiNxy) */
  .shot-row--hl .shot-tag { font-style: normal; }

  .shot-group .is-dim,
  .shot-group.is-dim,
  .shot-group.is-dim .shot-group__head,
  .shot-group.is-dim .shot-count { color: var(--shot-dim); }

  .shot-group .is-dim .shot-tag,
  .shot-group.is-dim .shot-tag {
    border-color: color-mix(in srgb, var(--shot-tag) 45%, transparent);
    color: var(--shot-dim-tag);
  }

  .shot-group.is-dim .shot-count { border-color: color-mix(in srgb, var(--shot-count-edge) 45%, transparent); }

  /* ---------- Jira build ticket ---------- */
  .shot-jira-top {
    display: flex;
    flex-direction: column;
    gap: var(--space-14);
    padding: var(--space-24) var(--shot-pad) var(--space-20);
    box-shadow: inset 0 -1px 0 var(--line-2);
  }

  .shot-jira-crumbs {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    font-size: 13px;
    color: var(--ink-55);
  }

  .shot-jira-crumbs strong {
    font-weight: 500;
    color: var(--ink);
  }

  .shot-jira-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-16);
  }

  .shot-jira-title p {
    font-size: 20px;
    font-weight: 600;
    line-height: round(nearest, 1.05em, 1px);
    letter-spacing: -0.23px;
    color: var(--ink);
  }

  .shot-status {
    display: inline-flex;
    flex: none;
    align-items: center;
    height: 24px;
    padding-inline: 7px;
    border: 1px solid var(--shot-tag);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
    color: var(--shot-tag);
  }

  .shot-jira {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: var(--space-24) var(--shot-pad) var(--space-32);
    color: var(--ink);
  }

  .shot-jira__label {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-55);
  }

  .shot-jira .shot-key { font-size: 14px; }

  .shot-jira__problem {
    display: flex;
    flex-direction: column;
    gap: var(--space-10);
  }

  .shot-jira__text,
  .shot-ac__list p,
  .shot-ac__num {
    font-size: 15px;
    line-height: round(nearest, 1.6em, 1px);
  }

  .shot-jira__text.is-dim { color: var(--shot-dim-ink); }

  .shot-source {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    padding: var(--space-10) var(--space-14);
  }

  .shot-source__from {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    font-size: 12px;
    font-weight: 500;
    white-space: pre;
    color: var(--ink-55);
  }

  .shot-source__text {
    font-size: 15px;
    font-style: italic;
    line-height: round(nearest, 1.55em, 1px);
  }

  .shot-ac .shot-key { line-height: round(nearest, 1.6em, 1px); }

  .shot-ac__list > li {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    padding-block: var(--space-12);
    box-shadow: inset 0 -1px 0 var(--line-2);
  }

  .shot-ac__list p { flex: 1; min-width: 0; }

  .shot-ac__cites {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-6);
    width: 120px;
    padding-top: 2px;
  }

  .shot-cite {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding-inline: var(--space-8);
    border-radius: var(--radius-sm);
    background: var(--chip-superseded-bg);
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
    color: var(--ink-2);
  }

  .shot-cite--pending {
    padding-inline: 7px;
    border: 1px solid var(--ink-55);
    background: transparent;
    color: var(--ink-55);
  }

  .shot-ac.is-dim { color: var(--shot-dim-ink); }
  .shot-ac.is-dim .shot-cite { background: color-mix(in srgb, var(--chip-superseded-bg) 45%, var(--white)); color: var(--shot-dim-chip); }
  .shot-ac.is-dim .shot-cite--pending { border-color: color-mix(in srgb, var(--ink-55) 45%, transparent); background: transparent; color: var(--shot-dim-ink); }
  .shot-ac.is-dim .shot-ac__list > li { box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--line-2) 45%, transparent); }

  /* ---------- D and W layout, by the shot's own width ---------- */
  @container shot (width >= 440px) {
    .shot-slack-bar { padding-inline: var(--space-24); }
    .shot-slack { padding-inline: var(--space-24); }

    .shot-crumbs {
      flex-direction: row;
      align-items: center;
    }

    .shot > * { --shot-pad: var(--space-32); }

    .shot-record__title {
      font-size: 22px;
      letter-spacing: -0.48px;
    }

    .shot-meta { flex-direction: row; }
    .shot-doc__heading { font-size: 18px; }

    .shot-feature {
      flex-direction: row;
      align-items: center;
      padding-inline: var(--space-40);
    }

    .shot-feature__title {
      font-size: 22px;
      line-height: round(nearest, 1.05em, 1px);
      letter-spacing: -0.48px;
    }

    .shot-group { padding-inline: var(--space-40); }
    .shot-row { padding-left: var(--space-24); }
    /* The frame lets the highlighted row run 26px into the group's end padding (530 of 504) */
    .shot-row--hl {
      align-self: flex-start;
      width: max-content;
      max-width: calc(100% + 26px);
      padding-left: var(--space-12);
    }
    .shot-row--fill { align-self: flex-start; }
    .shot-row--fill > span:not(.shot-tag) { flex: 0 1 auto; }
    .shot-br-m { display: none; }

    .shot-jira-top,
    .shot-jira { padding-inline: 36px; }

    .shot-jira-title {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }

    .shot-jira-title p {
      font-size: 24px;
      letter-spacing: -0.48px;
    }

  }

  /* The source line and the criteria rows go side by side only where the ticket has the room the
     D frame gives them (804px of content); narrower D tickets keep the M stacking */
  @container shot (width >= 640px) {
    .shot-source {
      flex-direction: row;
      align-items: center;
    }

    .shot-ac__list > li { flex-direction: row; }
  }

  /* Forced colors drop the inset rules: draw the highlighted rows' rule and the shots' hairlines as borders */
  @media (forced-colors: active) {
    :is(.shot-hl, .shot-quote, .shot-row--hl, .shot-source) { border-left: 2px solid CanvasText; }
    :is(.shot-slack-bar, .shot-crumbs, .shot-jira-top) { border-bottom: 1px solid CanvasText; }
    :is(.shot-group, .shot-meta) { border-top: 1px solid CanvasText; }
  }
}
