/* Zprávy: the daily brief, the day's cards and the feed controls.
   Moved out of base.css, shared-components.css and features.css in their
   original cascade order; loaded after features.css and before type.css. */

/* ── Zprávy ─── */
/* No bottom padding: both columns own scrollers that must reach the
   viewport edge, otherwise the brief and the feed are clipped mid-line by
   the area's overflow. The breathing room lives inside the scrollers. */
/* No right gutter on the page: the feed is the rightmost column and its
   scroller has to reach the window edge, so the thumb rides the edge of the
   screen instead of floating in the margin beside the cards. The gutter is
   not lost -- it moves inside the scroller, where it insets the content and
   leaves the scrollbar outside it. */
.zpravy-area { flex: 1; overflow: hidden; padding: var(--main-pad) 0 0 calc(var(--rail-width) + var(--main-pad)); display: none; }

.zpravy-wrap {
  width: 100%;
}

.zpravy-main {
  display: flex;
  flex-direction: column;
}

.zpravy-side {
  top: 0;
  display: flex;
  flex-direction: column;
}

.zpravy-upload-btn {
  border-radius: var(--r-sm);
  border: 1px solid rgba(34, 197, 94, 0.42);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.zpravy-title {
  color: var(--ink);
}

.zpravy-area {
  background: transparent;
}

.zpravy-side-controls {
  border-color: var(--border-input);
}

@media (max-width: 1100px) {
  .zpravy-area {
      padding: var(--main-pad) var(--main-pad) var(--main-pad) calc(var(--rail-width) + var(--main-pad));
    }

  .zpravy-layout {
      grid-template-columns: 1fr;
    }

  .zpravy-side {
      position: static;
      max-height: none;
    }
}
@media (max-width: 720px) {
  .zpravy-area {
      padding-left: var(--main-pad);
    }
}
/* ── Independent news timeline and daily brief ─────────── */
.zpravy-wrap {
  max-width: none;
}

/* One view at a time, the way the phone has always done it: the brief is a
   column of prose and the articles are a list, and side by side neither got
   the width it wanted. The header carries the choice between them, which is
   also what gives a header with two controls something to be. */
.zpravy-layout {
  /* One measure for the header and the column under it, so the title, the
     controls and the prose share their edges. */
  --zpravy-measure: var(--section-measure);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 0;
  row-gap: 0;
}

/* A reading measure, centred, rather than a column pinned to the left edge. */
/* The page scrolls as one, header included: the brief is a document, and
   pinning a header above an inner scroller meant two things to scroll and a
   band of chrome that never went away. */
/* No top padding: the bookmark hangs from the very top, and a gap above it
   reads as an empty row. */
.zpravy-area {
  overflow-y: auto;
  padding-top: 0;
  /* The gutter is held whether or not the day's articles overflow, so
     paging between days does not nudge both columns sideways. */
  scrollbar-gutter: stable;
}

.zpravy-wrap,
.zpravy-layout { height: auto; min-height: 0; }

.news-brief-scroll {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  /* The right gutter existed so the old inner scrollbar could reach the
     window edge past the cards. The page scrolls as one now, and that
     one-sided inset was throwing the centred feed 12px off the header. */
  padding-right: 0;
}

.zpravy-main,
.zpravy-side { height: auto; }

/* The columns span the area and the measure sits on what they hold. */
.zpravy-main,
.zpravy-side {
  width: 100%;
  margin: 0;
}

#news-brief-content,
#zpravy-feed {
  width: 100%;
  max-width: var(--zpravy-measure);
  margin: 0 auto;
}

/* The header sat against the top edge with a small caption for a title, which
   is most of why it read as a toolbar rather than a page. It now opens with
   room above it and a title at display size, with the day controls on that
   same line and the view tabs under them -- the shape both of the apps this
   was measured against use, and the shape that gives a header with two
   controls something to be. */
/* A row, laid out as one. The grid this used to be carried placements from
   the two-column design on every child, and empty tracks kept sizing
   themselves from them. */
/* A sticker rather than a bar: the header is a small upright card parked in
   the margin beside the column, so the reading width and the full height
   both belong to the text and the controls still travel with the reader. */
/* Two columns: the bookmark sits at the top of the left one with the
   articles running under it, and the brief takes the right the whole way
   down. */
.zpravy-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 28px;
}

/* The articles' header: the section name and the day on one line, on the
   same surface as the cards under it so the column reads as one stack. */
.zpravy-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 10px 16px 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: none;
}

/* The card hung off the top edge and wanted none of this; a plain heading
   needs the room above it that every other section's has. */
.zpravy-wrap { padding-top: 28px; }

/* The date takes its own line so the arrows keep full size: squeezed onto one
   row inside a 196px card they shrank to 24px, which is the complaint this
   whole cluster started from. */
.news-brief-nav {
  /* Pulled back by the first button's own padding so the arrow lines up
     with the title above it rather than its tap target's edge. */
  margin: 0 0 0 -10px;
  padding-top: 0;
  border-top: 0;
  width: auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.news-brief-nav-btn { flex: 0 0 auto; }

.news-brief-nav {
  grid-column: auto;
  grid-row: auto;
  margin-left: auto;
}

@media (min-width: 721px) {
  .news-brief-nav { margin-left: 0; }

  /* The rail already names this section, so the band carries only the day
       and the filter. Still a heading for anything reading the page -- it is
       taken out of the layout, not out of the document. */
  .zpravy-title {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      border: 0;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
}
.zpravy-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  grid-column: auto;
  grid-row: auto;
  /* The section's name is not what gives way when the band is tight -- it
     used to shrink, and clipped itself to "Zp". The filter beside it takes
     the squeeze instead. */
  flex: 0 0 auto;
  margin: 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.015em;
  white-space: nowrap;
}

.zpravy-side-controls {
  flex-direction: row;
}

.zpravy-main,
.zpravy-side {
  min-width: 0;
  min-height: 0;
}

/* The bookmark is the top of this column, not a band across both, so the
   articles begin directly under it rather than beside it. */
.zpravy-main { padding: 0; }

/* The brief runs the full height alongside, so it starts level with the
   bookmark rather than below it. No right padding: the scroller has to
   reach the column's rule so its thumb rides against it instead of hanging
   in the gap. */
.zpravy-side {
  position: static;
  max-height: none;
  gap: 0;
  padding: 0;
  /* The divider separated this column from the articles beside it; the
     column gap does that work now. */
  border-right: 0;
}

.zpravy-side-controls {
  /* Its own line, after the title row, and only with the articles. */
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* An export gets into Zprávy by being dropped on the tab, so there is no
   upload control at rest -- the header carries the day, not a button nobody
   presses. It appears as the status of a drop instead: a ring while the
   export uploads and ingests, the reason in red if it does not go through,
   and gone again once the day is in the feed. Non-admins never see it at
   all; `base.css` hides it with `!important` and that still wins. */
.zpravy-upload-btn {
  display: none;
  min-height: 38px;
  padding: 8px 13px;
  border-color: var(--border-input);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.zpravy-upload-btn:hover {
  border-color: var(--border-focus);
  background: var(--surface-page);
  color: var(--ink);
}

/* The status says what is happening beside the ring rather than instead of
   it: this is only on screen while a drop is being processed or has failed,
   so there is no resting width to preserve and no reason to make a bare
   spinner carry the message. The shared ring is white-on-dark, so it is
   re-tinted for this light surface. */
.zpravy-upload-btn.is-busy,
.zpravy-upload-btn.is-error {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.zpravy-upload-btn .btn-loading-ring {
  display: none;
  flex: 0 0 auto;
  border-color: rgba(39, 50, 68, .22);
  border-top-color: #273244;
}

.zpravy-upload-btn.is-busy { cursor: progress; }

.zpravy-upload-btn.is-busy .btn-loading-ring { display: block; }

.zpravy-upload-btn.is-error,
.zpravy-upload-btn.is-error:hover {
  border-color: var(--red);
  background: var(--card-hover-bg);
  color: var(--red);
}

/* One cluster, not two arrows at opposite ends of the header. The middle
   column used to be 1fr, which stretched the date to 500px and left the two
   controls that belong together 554px apart -- each a 34px circle. Sized to
   its content, the three sit within a thumb's travel of each other. */
.news-brief-nav {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 0;
}

/* Grid centring plus an SVG chevron: the ‹ › glyphs sat off-centre in the
   circle because they align to the text baseline, not the button box. */
.news-brief-nav-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.news-brief-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.news-brief-nav-btn:hover:not(:disabled) {
  background: var(--hover-bg);
  color: var(--ink);
}

.news-brief-nav-btn:disabled {
  color: var(--faint);
  cursor: default;
}

/* Not a scroller any more -- the page scrolls as one. Left as `auto` it kept
   the wheel: an overflow box that cannot scroll still swallows the event,
   and `overscroll-behavior: contain` stopped it chaining out to the page, so
   the brief would not move at all while the articles did. */
.news-brief-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  overscroll-behavior: auto;
}

.news-brief-content {
  width: 100%;
  min-height: 100%;
  /* 42px on the right = the brief's own 18px plus the 24px the column used
     to hold, so the text sits where it did and only the thumb moved. */
  padding: 18px 42px 56px 18px;
}

.news-brief-message {
  max-width: var(--content-width);
}

.news-brief-message .answer-text {
  padding-top: 0;
}

.news-brief-message .answer-text > h1:first-child {
  margin-top: 0;
}

/* A skeleton, not a ring. A spinner that appears for a moment and vanishes
   reads as a glitch; lines that fade in where the text will be read as the
   page still settling. Same shimmer as the chat and the library. */
.news-brief-loading {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 6px 2px;
}

.news-brief-loading span {
  display: block;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--skeleton);
  background-size: 220% 100%;
  animation: subtleSkeleton 1.9s ease-in-out infinite;
}

.news-brief-loading span:nth-child(2) { width: 82%; animation-delay: .12s; }

.news-brief-loading span:nth-child(3) { width: 64%; animation-delay: .24s; }

.news-brief-empty {
  max-width: var(--content-width);
  margin: 54px auto 0;
  color: var(--muted);
  font-size: var(--text-md);
  text-align: center;
}

@media (max-width: 1119px) {
  /* No bottom padding: it is a dead band the scroller cannot reach, so the
       last line of the brief was clipped by empty page rather than running to
       the edge. The breathing room lives inside the scrollers instead. */
  .zpravy-area {
      overflow: hidden;
      padding-right: var(--main-pad);
      padding-bottom: 0;
    }

  .zpravy-wrap,
    .zpravy-layout {
      height: 100%;
      min-height: 0;
    }

  .zpravy-layout {
      grid-template-columns: 1fr;
      grid-template-rows: auto minmax(0, 1fr);
    }

  .zpravy-toolbar {
      grid-column: 1;
      grid-row: 1;
      grid-template-columns: 1fr;
    }

  .news-brief-nav {
      padding: 0;
      border-right: 0;
    }

  .zpravy-side-controls {
      grid-column: 1;
      grid-row: 2;
      padding: 0 0 10px;
    }

  /* Bled to the right edge: the scroller has to reach it for its bar to sit
       against the window rather than float inside. The reading inset moves off
       the column and onto the content, so the text keeps its margin. */
  .zpravy-side,
    .zpravy-main {
      grid-column: 1;
      grid-row: 2;
      min-height: 0;
      margin-right: calc(var(--main-pad) * -1);
      padding: 0;
      border-right: 0;
    }

  .news-brief-scroll {
      min-height: 0;
      max-height: none;
    }

  /* The two-column brief carries an extra 24px on the right for the rule it
       sits beside. There is no rule here, and on a phone that asymmetry is a
       sixth of the screen. */
  .news-brief-content {
      padding: 10px var(--main-pad) 40px 0;
    }
}
@media (prefers-reduced-motion: reduce) {
  .news-brief-nav-btn {
      transition: none;
    }

  body[data-mode="zpravy"] .zpravy-side,
    body[data-mode="zpravy"] .zpravy-main {
      animation: none;
    }
}
@media (max-width: 720px) {
  .zpravy-area {
      padding-top: 0;
    }

  .zpravy-toolbar {
      position: static;
      grid-row: 2;
      z-index: 50;
      border-top: 1px solid var(--border-soft);
      border-bottom: 0;
      background: rgb(var(--surface-page-rgb) / .96);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }

  .zpravy-layout {
      grid-template-rows: minmax(0, 1fr) auto;
    }

  .zpravy-side,
    .zpravy-main {
      grid-row: 1;
    }

  .news-brief-content {
      padding-top: 18px;
    }
}
/* ── Zprávy: brief-first daily reading page ────────────────────────────
   The brief is the document. Articles are supporting material below it,
   with their rank expressed by card size rather than by another view. */
body[data-mode="zpravy"] .zpravy-area {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 var(--main-pad) 0 calc(var(--rail-width) + var(--main-pad));
  scrollbar-gutter: stable;
}

body[data-mode="zpravy"] .zpravy-wrap {
  box-sizing: border-box;
  width: min(100%, 1140px);
  max-width: 1140px;
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
}

body[data-mode="zpravy"] .zpravy-toolbar {
  position: static !important;
  inset: auto !important;
  z-index: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  /* On the brief's measure, so the day sits over the text it dates. */
  width: min(100%, var(--zpravy-measure));
  max-width: none;
  margin: 0 auto;
  padding: 42px 0 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none !important;
}

/* The day is the page's title. The two chevrons that turn it sit at the
   far end, clear of a date whose width changes from day to day. */
body[data-mode="zpravy"] .zpravy-title {
  position: static;
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  clip-path: none;
  margin: 0 auto 0 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
  /* Room above the cap height for the accents: at a tighter line the
     clipping that the ellipsis needs cuts the top off Ú and Č. */
  line-height: 1.3;
  letter-spacing: -.022em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-mode="zpravy"] .news-brief-nav {
  position: static;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

body[data-mode="zpravy"] .news-brief-nav-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: none;
}

body[data-mode="zpravy"] .zpravy-layout {
  --zpravy-measure: 780px;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
}

body[data-mode="zpravy"] .zpravy-side,
body[data-mode="zpravy"] .zpravy-main {
  position: static;
  width: 100%;
  height: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

body[data-mode="zpravy"] .zpravy-main[hidden] {
  display: none;
}

body[data-mode="zpravy"] .news-brief-scroll {
  width: 100%;
  height: auto;
  overflow: visible;
  padding: 0;
}

body[data-mode="zpravy"] .news-brief-content {
  box-sizing: border-box;
  width: min(100%, var(--zpravy-measure));
  max-width: var(--zpravy-measure);
  min-height: 0;
  margin: 0 auto;
  padding: 24px 0 8px;
}

body[data-mode="zpravy"] .news-brief-message {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body[data-mode="zpravy"] .news-brief-message .answer-text {
  max-width: none;
  padding: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.7;
}

body[data-mode="zpravy"] .news-brief-message .answer-text > :first-child {
  margin-top: 0;
}

body[data-mode="zpravy"] .news-brief-message .answer-text h2 {
  margin-top: 35px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.02em;
}

body[data-mode="zpravy"] .news-brief-empty {
  margin: 54px auto;
}

body[data-mode="zpravy"] .zpravy-side-controls {
  display: none !important;
}

/* ...except to report on a drop. Keyed off the button's own state so there is
   one place that decides whether an upload has anything to say. */
body[data-mode="zpravy"] .zpravy-side-controls:has(> .zpravy-upload-btn.is-busy),
body[data-mode="zpravy"] .zpravy-side-controls:has(> .zpravy-upload-btn.is-error) {
  display: flex !important;
  flex: 0 0 auto;
  width: auto;
}

/* ── The day's articles: a wall of cards under the brief ──
   Wider than the text above it: cards gain from the width that would make
   lines of prose too long to read. */
body[data-mode="zpravy"] .zpravy-main {
  width: 100%;
  margin: 0 auto;
  padding: 22px 0 40px;
  border-top: 1px solid var(--border);
}

/* A wall rather than a strip: every article in view at once, read like a
   page instead of hunted for past an edge. */
body[data-mode="zpravy"] #zpravy-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body[data-mode="zpravy"] .zpravy-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .16s ease;
}

body[data-mode="zpravy"] .zpravy-card[data-url] { cursor: pointer; }

body[data-mode="zpravy"] .zpravy-card[data-url]:hover {
  border-color: var(--border-focus);
}

body[data-mode="zpravy"] .zpravy-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Articles without a picture keep the same frame, so the titles still
   start on one line across a row. */
body[data-mode="zpravy"] .zpravy-card-image {
  flex: 0 0 auto;
  height: 112px;
  background: var(--surface-rail);
}

body[data-mode="zpravy"] .zpravy-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Four lines hold nearly every headline whole; the card is sized for them
   so a row is one height rather than following the longest title. */
body[data-mode="zpravy"] .zpravy-card-title {
  display: -webkit-box;
  height: calc(4 * 1.38em);
  margin: 11px 13px 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

body[data-mode="zpravy"] .zpravy-card-meta {
  margin: auto 13px 0;
  padding: 10px 0 12px;
  overflow: hidden;
  color: var(--faint);
  font-size: var(--text-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-mode="zpravy"] .zpravy-card-more {
  color: var(--accent);
}

@media (max-width: 900px) {
  body[data-mode="zpravy"] .zpravy-wrap {
      width: 100%;
    }
}
@media (max-width: 720px) {
  body[data-mode="zpravy"] .zpravy-area {
      padding: 0 16px;
    }

  body[data-mode="zpravy"] .zpravy-wrap {
      /* Clears the bar pinned below it, plus the phone's home indicator. */
      padding: 0 0 calc(74px + env(safe-area-inset-bottom, 0px));
    }

  /* The day picker belongs under the thumb, not at the top edge -- the same
       place Databáze and Knihovna put their controls. The page still scrolls
       as one; only the bar leaves the flow, so the brief starts at the top of
       the screen instead of a row below it. */
  body[data-mode="zpravy"] .zpravy-toolbar {
      /* `!important` only to answer the `!important` above: the desktop rule
         un-sticks this bar so the page scrolls as one document, and without
         matching its weight the bar stays at the top edge here. */
      position: fixed !important;
      inset: auto 0 0 !important;
      z-index: 50;
      gap: 10px;
      width: 100%;
      margin: 0;
      padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)) var(--rail-toggle-slot, 16px);
      border-radius: 0;
      border-top: 1px solid var(--border-soft);
      background: rgb(var(--surface-page-rgb) / .96);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }

  body[data-mode="zpravy"] .zpravy-title {
      font-size: clamp(18px, 5.4vw, 22px);
    }

  body[data-mode="zpravy"] .news-brief-content {
      padding: 32px 2px 8px;
    }

  body[data-mode="zpravy"] .news-brief-message .answer-text {
      font-size: var(--text-lg);
      line-height: 1.65;
    }

  body[data-mode="zpravy"] .zpravy-main {
      padding: 18px 0 28px;
    }

  body[data-mode="zpravy"] #zpravy-feed {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

  body[data-mode="zpravy"] .zpravy-card-image {
      height: 96px;
    }
}
@media (max-width: 410px) {
  body[data-mode="zpravy"] .zpravy-area {
      padding: 0 13px;
    }
}
