/* The Feed: its tabs and posts, the posts by day with their takeaway,
   Insights, and icons, the feed tabs, which Todo's horizon tabs share,
   and the feed's dialog. */
@layer views {
  /* The Feed: its posts scroll in one centered column. */

  /* The Feed: its tabs and posts in one column. */
  .feed-layout {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
  }
  .feed-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }
  /* The Feed's dialog: the Settings dialog's sheet with one page, the
     feed's name, instructions, and sources (a settings list) down it. */
  @media (min-width: 720px) {
    .feed-settings-sheet { grid-template-columns: minmax(0, 1fr); max-width: 600px; }
  }
  /* Name and Instructions are form fields and Sources a settings list
     (components.css). */
  .feed-settings-section + .feed-settings-section { margin-top: 24px; }
  .feed-settings-heading { margin: 0; }
  .feed-settings-section textarea.form-input { min-height: 160px; line-height: 1.5; }
  .feed-settings-section .form-actions { margin-top: 6px; }
  .feed-settings-section > .feed-settings-status { margin: 8px var(--row-inset) 0; }
  .feed-sources-list:not(:empty) { margin-bottom: 12px; }
  .feed-source-actions { display: flex; align-items: center; gap: 4px; }
  .feed-source-form { margin-top: 16px; }
  /* A phone's page head has no back chevron to make room for. */
  @media (max-width: 719.98px) {
    .feed-settings-page .settings-page-head { padding-left: var(--sheet-side); }
  }

  .feed-page {
    flex: 1;
    min-height: 0;
    /* The foot clears quick chat's round button. */
    padding: var(--page-top) var(--page-x) 96px;
    overflow: auto;
  }

  .feed-page > * {
    width: 100%;
    max-width: var(--column);
    margin-left: auto;
    margin-right: auto;
  }

  /* Spacing counts only what is shown, so a source filter leaves no gap. */
  .feed-run:not([hidden]) ~ .feed-run { margin-top: 32px; }
  /* A tour group under its own day's run reads on as the same day's posts. */
  .feed-run:not([hidden]) ~ .feed-run[data-feed-same-day] { margin-top: 24px; }

  .feed-run-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-bottom: 16px;
  }

  .feed-date { margin: 0; }

  .feed-since {
    color: var(--muted);
    font-size: 13px;
  }

  .feed-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
  }
  .feed-item:not([hidden]) ~ .feed-item { margin-top: 24px; }
  /* The item a notification's link opened. */
  .feed-item[data-feed-target] {
    border-radius: 4px;
    background: var(--green-bg);
    box-shadow: 0 0 0 8px var(--green-bg);
  }
  .feed-item:focus { outline: none; }

  .feed-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
  }

  /* The line above the posts while one source is chosen. */
  .feed-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 4px;
    margin-bottom: 12px;
    color: var(--muted);
  }

  .panel-row .feed-badge {
    flex: none;
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .feed-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .feed-title a {
    color: var(--ink);
    text-decoration: none;
  }
  .feed-title a:hover { text-decoration: underline; }

  .feed-summary {
    margin: 6px 0 0;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  /* A tour post has no badge; its body takes the badge's column too. */
  .feed-tour .feed-body { grid-column: 1 / -1; }
  .feed-tour .feed-summary + .feed-summary { margin-top: 10px; }

  .feed-image {
    display: block;
    width: 100%;
    max-height: 220px;
    margin: 10px 0;
    border-radius: 10px;
    object-fit: cover;
  }

  /* The takeaway: a footnote under the summary, smaller and muted, never
     read as a second summary line. */
  .feed-takeaway {
    margin: 8px 0 0;
    padding-left: 10px;
    border-left: 2px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .feed-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
  }
  .feed-image + .feed-actions { margin-top: 0; }

  /* The takeaway line doubles as the Insights toggle when the post has them:
     a button styled like the plain takeaway text, with a chevron at its end
     that flips and recolours once the panel under it opens. */
  button.feed-takeaway {
    display: inline-flex;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 2px 0 2px 10px;
    border: 0;
    border-left: 2px solid var(--line);
    appearance: none;
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
  }
  button.feed-takeaway:hover, button.feed-takeaway:focus-visible, button.feed-takeaway[aria-expanded="true"] { color: var(--ink); }
  .feed-insights-toggle .feed-icon { flex: none; align-self: flex-start; margin-top: calc((1.45em - 16px) / 2); transition: transform 120ms ease; transform: rotate(-90deg); }
  .feed-insights-toggle[aria-expanded="true"] .feed-icon { transform: rotate(0deg); }

  /* The bookmark, Discuss, and Dismiss icons. */
  .feed-icon-actions {
    display: flex;
    align-items: center;
    gap: 2px;
  }
  .feed-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--muted);
    cursor: pointer;
  }
  .feed-icon-button:hover { background: var(--hover-tint); color: var(--ink); }
  .feed-icon-button:disabled { cursor: default; }
  .feed-save-toggle[aria-pressed="true"] { color: var(--green); }

  /* Insights open directly under the takeaway line. */
  .feed-insights {
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--hover-tint);
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  /* One tab per feed (components.css .pane-tabs), under the page heading
     in its column, while there are two or more. */
  .feed-page > .pane-tabs { margin-bottom: 24px; }

  .feed-icon { flex: none; }

  .feed-reason {
    margin: 6px 0 0;
    color: var(--red);
    font-size: 13px;
  }

  @media (max-width: 719.98px) {
    .feed-icon-button { width: 44px; height: 44px; }
    .feed-item { grid-template-columns: 24px minmax(0, 1fr); }
    .feed-badge { width: 24px; height: 24px; }
  }
}

@layer views {
  .collection-updates { position: sticky; top: 62px; z-index: 5; height: 0; }
  .collection-new { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: auto; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-page); white-space: nowrap; }
  .collection-new[hidden] { display: none; }
  .collection-scroll-status { flex-wrap: wrap; color: var(--muted); font-size: 14px; }
  .collection-scroll-status button { padding: 8px 12px; border: 0; border-radius: 8px; background: var(--hover-tint); color: var(--ink); font: inherit; cursor: pointer; }
  .collection-scroll-status button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
  .collection-scroll-row:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
}
@layer views { #feed-runs .collection-scroll-row { padding-bottom: 24px; } #feed-runs .collection-scroll-heading { padding-top: 8px; } .feed-history-label { color: var(--muted); font-size: 13px; margin: 8px 0 0; } }
