/* ——— Subscribe… ———
   The canvas's 4 (docs/planning/calendar-and-events.md, S6): a float off the
   toolbar's quiet button, its end on the button's end — the sentence whose
   words are menus, a row for each calendar to subscribe in, the link with
   Copy, and the line on what the link gives away, Reset in it. At the
   canvas's sizes: the sentence in the body size, each calendar's name and
   the link's small print two notches down, as the calendar's grid speaks
   (HANSHI, Deviations). */
@layer components {
  /* In the body size, where a float speaks one down: its lines keep the
     sentence's height. Two classes deep: this file sorts before
     popups.css, whose size, padding and margin would otherwise win. */
  .calendar-feed.popup {
    --popup-area: block-end span-inline-start;

    inline-size: 31.25rem;
    margin-block-start: 0.625rem;
    padding: 1.125rem 1.25rem 0.875rem;
    font-size: var(--text-normal);
  }

  /* On a phone no side of its button fits it: it takes the place of the
     options it came from (calendar.css stands them down), under the
     toolbar's circle, across the screen between the gutters every float
     keeps (popups.css), and scrolls rather than run past the screen's foot.
     The screen's width, not the sheet's: a float in the top layer hangs
     over the viewport (boosts.css says the same). */
  @media (width < 35rem) {
    .calendar-feed.popup {
      --popup-area: none;
      --popup-try: none;

      inset-block: anchor(--calendar_options bottom) var(--inline-space);
      inset-inline: 0;
      block-size: fit-content;
      margin-inline: auto;
    }
  }

  /* Unseen until its words arrive (month-picker.css does the same). */
  .calendar-feed:has(turbo-frame:empty) {
    opacity: 0;
  }

  .calendar-feed__sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-block-end: 0.875rem;
  }

  /* A word that is a menu (.input--chip), at the line's size and a notch
     bolder. */
  .calendar-feed__word {
    line-height: 1.125;
    font-weight: 500;
  }

  /* A project's Schedule is everyone's on it (S3): with one chosen there
     is no Mine to say, as the link leaves it out. */
  .calendar-feed__sentence:has([name=schedule] option:checked:not([value=""])) [name=whose] {
    display: none;
  }

  /* What it is beside its verbs; where they leave the words too narrow — a
     phone's Google row — the verbs go under, at the row's end, as an
     invitation card's answers do (invitation-cards.css). */
  .calendar-feed__target {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1rem;
    padding-block: 0.75rem;
    border-block-start: var(--border);

    > :first-child {
      flex: 1 1 13rem;
    }

    > :last-child {
      margin-inline-start: auto;
    }

    strong {
      --text-notch: 0.125rem;

      font-size: var(--text-normal);
      font-weight: 600;
    }
  }

  /* Open Google, in ink: where the copied link goes. */
  .calendar-feed__away {
    --btn-color: var(--color-ink);
    --btn-padding: 0.25rem 0.375rem;
    --icon-size: 0.8125rem;
  }

  /* Its label on a line of the float's own height, as the canvas sets it,
     the field a little under it. */
  .calendar-feed__link {
    padding-block: 0.75rem 0.25rem;
    border-block-start: var(--border);

    > .label {
      display: inline;
    }

    > .flex {
      margin-block-start: 0.25rem;
    }
  }

  /* The link, to read and to select, never to type in: a washed box. */
  .calendar-feed .calendar-feed__field {
    --text-notch: 0.125rem;

    flex: 1;
    min-inline-size: 0;
    block-size: 1.875rem;
    padding: 0 0.5rem;
    font-size: var(--text-small);
    color: var(--color-ink-subtle);
    background-color: var(--color-surface);
    border: var(--border);
    border-radius: var(--border-radius);
  }

  /* Reset link sits in it, a verb underlined in ink (.btn--underlined). */
  .calendar-feed__note {
    --text-notch: 0.125rem;

    margin-block-start: 0.5rem;
  }
}
