/* The Feed: its tabs and posts, the posts by day with their takeaway,
   Insights, and icons, 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-groups > .settings-list-block + .settings-list-block { margin-top: 16px; }
  .feed-sources-search { margin: 8px 0 16px; }
  .feed-settings-sources > .settings-list-block > .settings-list-head { margin-bottom: 8px; padding-right: 0; }
  #feed-settings-sources-heading { padding: 0; color: var(--ink); font-size: 15px; font-weight: 500; }
  .feed-settings-sources > .settings-list-block > .feed-settings-status { margin: 8px 0; }
  .feed-source .settings-list-title-line { flex-wrap: nowrap; }
  .feed-source .settings-list-title, .feed-source .settings-list-state { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed-source[data-source-kind="drive"] .settings-list-state,
  .feed-source[data-plain-page] .settings-list-state { white-space: normal; }
  .feed-source.is-renaming .settings-list-title { flex: 1; overflow: visible; }
  .feed-source-rename { width: 100%; min-height: 32px; font-size: inherit; }
  .feed-source-actions { display: flex; align-items: center; gap: 4px; }
  /* Settings Data’s Import memory panel: field, actions, and results in one card. */
  .feed-source-form { margin: 16px 0 24px; padding-block: var(--row-inset); grid-template-columns: minmax(0, 1fr); }
  .feed-source-results { display: grid; gap: 16px; }
  .feed-source-results:empty { display: none; }
  .feed-source-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
  .feed-source-controls > .button { white-space: nowrap; }
  .feed-source-search { margin: 0; }
  .feed-source-form.is-file-drop {
    border-color: var(--green);
    background: var(--green-bg);
    box-shadow: 0 0 0 2px var(--green);
  }
  .feed-source-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: attach-spin 0.8s linear infinite;
  }
  @media (prefers-reduced-motion: reduce) {
    .feed-source-spinner { animation-duration: 2.4s; }
  }
  .feed-source-results > .settings-list-block { margin-top: 0; }
  .feed-source-add { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 76px; }
  .feed-source-add.is-added { background: var(--green-bg); color: var(--green-dark); }
  .feed-source-note { font-size: 13px; margin-bottom: 16px; }
  .feed-source-result .settings-list-title-line { flex-wrap: nowrap; }
  .feed-source-result .settings-list-title, .feed-source-result .settings-list-state { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed-source-result[data-found^="webpage:"] .settings-list-state,
  .feed-source-result[data-found^="listings:"] .settings-list-state,
  .feed-source-result[data-found^="upload:"] .settings-list-state,
  .feed-source-result[data-source-kind="drive"] .settings-list-state { white-space: normal; }
  /* 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: 14px;
    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); }

  /* Bookmark, Discuss, Clear, and More like this. */
  .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 under the heading, while there are two or more: plain
     labels with no container, the chosen one in ink over a short bar that
     glides to it, the others a step quieter than muted text. The row
     reaches a tab's padding past the posts' column on each side, so the
     first label starts on the column's edge; it scrolls sideways, fading at
     an edge with more beyond, when the names outrun it. */
  .feed-page > .feed-tabs {
    --tab-pad: 12px;
    --tab-gap: 2px;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tab-gap);
    width: auto;
    max-width: none;
    margin: -6px calc(max(0px, (100% - var(--column)) / 2) - var(--tab-pad)) 18px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .feed-tabs::-webkit-scrollbar { display: none; }
  .feed-tabs[data-more-end] {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  }
  .feed-tabs[data-more-start] {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 48px);
    mask-image: linear-gradient(to right, transparent, #000 48px);
  }
  .feed-tabs[data-more-start][data-more-end] {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
  }
  .feed-tab {
    flex: none;
    height: 38px;
    padding: 0 var(--tab-pad) 2px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: color-mix(in srgb, var(--muted) 85%, transparent);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 200ms ease-out, background-color 200ms ease-out;
  }
  .feed-tab:hover { background: var(--hover-tint); color: var(--ink-soft); }
  .feed-tab[aria-selected="true"] { color: var(--ink); }
  .feed-tab[aria-selected="true"]:hover { background: none; }
  .feed-tab:focus-visible { outline-offset: -2px; }
  .feed-tab.is-drag-source { background: none; opacity: 0.35; }
  .feed-tab-bar {
    position: absolute;
    bottom: 3px;
    left: 0;
    width: 16px;
    height: 3px;
    border-radius: 3px;
    background: var(--ink);
    pointer-events: none;
  }
  .feed-tab-bar.is-gliding { transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  /* Where a dragged tab will land: a short upright line, the rail's color,
     taking no room between the tabs. */
  .feed-dropline {
    flex: none;
    align-self: center;
    width: 2px;
    height: 0.9em;
    margin: 0 calc(-1px - var(--tab-gap) / 2);
    border-radius: 2px;
    background: var(--green);
    pointer-events: none;
  }
  /* Before the first tab it stands at the row's start, inside it. */
  .feed-tab-bar + .feed-dropline { margin: 0 calc(-2px - var(--tab-gap)) 0 0; }
  @media (prefers-reduced-motion: reduce) {
    .feed-tab, .feed-tab-bar.is-gliding { transition: none; }
  }

  .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; } }

@layer views {

  .feed-templates:not(:empty) { margin-bottom: 24px; }
  .feed-settings-type { margin-top: 20px; }
  .feed-settings-type .theme-options { margin-top: 6px; }
  .feed-settings-type .theme-options label { min-height: 44px; }
  .feed-settings-type > .form-note { margin-top: 10px; }
  .feed-settings-shows { margin-top: 16px; }
  .feed-settings-shows .form-input { width: 88px; }
  .feed-closed { display: inline-block; margin: 4px 0; }
}

@layer views {
  .source-page-choice { flex-direction: row; justify-content: flex-start; }
  .source-page-choice > input { order: 1; margin-left: auto; }
  .source-page-choice .nav-page-glyph, .source-page-mark .nav-page-glyph { flex: none; width: 24px; height: 24px; }
  /* As wide as a provider's small tile, so names line up in every group. */
  .source-page-mark { display: flex; flex: none; align-items: center; justify-content: center; width: 28px; }
  .source-app-mark svg { flex: none; width: 24px; height: 24px; color: var(--muted); }
  /* A consumer's Sources list in its instructions panel: the brief's, Todo's, Ideas'. */
  .source-list { margin-top: 24px; }
  /* As far under its heading as the instructions' composer is under theirs. */
  .source-list > .instructions-heading + .settings-list-block { margin-top: 16px; }
  /* A list that came back with a problem says so under its heading. */
  .source-list > .instructions-heading + .settings-list-note { margin-top: 12px; margin-bottom: 20px; }
}
