/* The brief's overlay: its sheet, bar, items and their marks, and the
   notes at its foot. */
@layer views {
  /* The brief's overlay: the morning brief over whatever view is open, in one
     centered column of serif prose with the app's colors, so the theme
     reaches it like any view. Full screen on a phone. */

  .brief-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    padding: 24px 16px;
    background: var(--shadow-sheet);
  }

  .brief-sheet {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: 100%;
    padding: 0 40px 40px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 16px 48px var(--shadow-pop);
  }
  .brief-sheet:focus { outline: none; }

  .brief-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 -40px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }

  .brief-sheet > .instructions { margin: 24px 0 0; }

  .brief-state {
    margin: 32px 0 0;
    color: var(--ink-soft);
    font-family: var(--brief-serif);
    font-size: 18px;
  }

  .brief-doc {
    font-family: var(--brief-serif);
    font-size: 18px;
    line-height: 1.6;
  }

  .brief-head { margin: 32px 0 8px; }
  .brief-date {
    margin: 0;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
  }
  .brief-title {
    margin: 4px 0 0;
    font-size: 30px;
    font-weight: 400;
    line-height: 1.25;
  }

  .brief-newer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 16px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--amber-bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
  }

  .brief-lede { margin-top: 20px; }
  .brief-lede .brief-item { border-bottom: 0; }
  .brief-lede .brief-text { font-size: 20px; }

  .brief-section { margin-top: 16px; }
  .brief-section-label {
    margin: 0;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .brief-section-label-icon { display: flex; align-items: center; gap: 8px; }
  .brief-section-label-icon svg { width: 16px; height: 16px; flex: none; }

  .brief-item {
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--line);
  }
  .brief-section .brief-item:last-child { border-bottom: 0; }
  .brief-item[data-mark="dismissed"] .brief-text { color: var(--muted); }
  .brief-text { overflow-wrap: anywhere; }

  /* An item's marks fade in while the pointer is on it, at full strength only
     on the icons themselves (the row is as wide as the icons). A set mark, keyboard focus, or a touch screen keeps them shown. */
  .brief-marks {
    display: flex;
    width: fit-content;
    margin: 0 0 0 auto;
    gap: 2px;
    opacity: 0;
    transition: opacity 150ms ease;
  }
  .brief-item:hover .brief-marks,
  .brief-item:focus-within .brief-marks,
  .brief-item:has([aria-pressed="true"], .brief-note-toggle-filled) .brief-marks { opacity: 0.7; }
  .brief-item .brief-marks:hover,
  .brief-item .brief-marks:focus-within { opacity: 1; }
  @media (hover: none) {
    .brief-marks { opacity: 0.7; }
  }
  @media (prefers-reduced-motion: reduce) {
    .brief-marks { transition: none; }
  }
  .brief-mark,
  .brief-note-toggle {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--muted);
    cursor: pointer;
  }
  .brief-mark svg,
  .brief-note-toggle svg { display: block; }
  .brief-marks:hover .brief-mark,
  .brief-marks:hover .brief-note-toggle,
  .brief-marks:focus-within .brief-mark,
  .brief-marks:focus-within .brief-note-toggle { color: var(--ink-soft); }
  .brief-mark:hover,
  .brief-note-toggle:hover,
  .brief-mark:focus-visible,
  .brief-note-toggle:focus-visible {
    color: var(--ink);
    background: var(--hover-tint);
  }
  @media (hover: none) {
    .brief-mark,
    .brief-note-toggle,
    .brief-item:hover .brief-mark,
    .brief-item:hover .brief-note-toggle,
    .brief-item:focus-within .brief-mark,
    .brief-item:focus-within .brief-note-toggle {
      color: var(--muted);
      background: none;
    }
  }
  .brief-item .brief-mark-approved[aria-pressed="true"] { color: var(--green); }
  .brief-item .brief-mark-dismissed[aria-pressed="true"] { color: var(--red); }
  .brief-item .brief-note-toggle-filled { color: var(--amber); }
  .brief-item .brief-mark-approved[aria-pressed="true"] .brief-icon-path,
  .brief-item .brief-mark-dismissed[aria-pressed="true"] .brief-icon-path,
  .brief-item .brief-note-toggle-filled .brief-icon-path { fill: currentColor; fill-opacity: 0.18; }

  /* A note and the overall note are form fields (components.css). */
  .brief-note,
  .brief-foot {
    display: grid;
    gap: 6px;
    font-family: var(--sans);
    font-size: 14px;
  }
  .brief-note { margin-top: 10px; }

  .brief-foot {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }
  .brief-save-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 8px;
  }
  .brief-saved {
    margin: 0;
    color: var(--muted);
  }

  .brief-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  @media (max-width: 719.98px) {
    .brief-overlay { padding: 0; }
    .brief-sheet {
      max-width: none;
      max-height: none;
      height: 100%;
      border: 0;
      border-radius: 0;
      /* The last control scrolls clear of quick chat's button. */
      padding: 0 16px calc(var(--nav-bar-h) + 80px + env(safe-area-inset-bottom));
    }
    .brief-bar { margin: 0 -16px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; }
    .brief-title { font-size: 26px; }
  }
}
