/* ==========================================================================
   rssnews.io reading view (?a=<id>), js/reader-view.js
   Workspace redesign phases 3-4 (2026-10-31). Spec WORKSPACE-PHASE34-SPEC.md §1;
   brief §6, §7.3, §9.2, §11. Mockup: right half of mockups/workspace-2026-10-31.webp
   (without its reading time, pull quote and topic chips: no data behind them).

   Tokens only (editorial.css: --ink --muted --rule --rule-strong --accent --paper
   --surface --hover --nav-active --fav-plate --font-* --r-*; workspace.css:
   --appbar-h --bottomnav-h). Dark theme comes from the tokens (:root.dark).

   Layout
     >= 768   a surface panel in the main column (rails stay), the reading column
              centred in it: body 18px / 1.7, about 70 characters per line
     <  768   full width, a sticky bar under the app bar (Πίσω, bookmark, share);
              core may set --rv-top: 0px when it hides the app bar while reading

   No layout shift: the picture's 16:9 box is reserved; labels that change keep
   their width (both labels share one grid cell); the copy confirmation is a
   fixed-position toast; the skeleton stands where the text will be.
   ========================================================================== */

.rv-host { display: block; }
.rv-host[hidden],
.rv [hidden] { display: none !important; }

/* custom.css sets every p/li/span/div to 1rem/1.6: inside the view they follow
   their parent instead (one class beats the element selector) */
.rv :where(p, li, span, div, blockquote, figure, ol, ul) {
  font-size: inherit;
  line-height: inherit;
}

.rv {
  --rv-col: 732px;          /* 684px of text + 2 x 24px padding */
  --rv-pad: 24px;
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel, 10px);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 48px;
}
/* Mounted inside the feed's own panel: no second frame */
#content-container .rv { border: 0; border-radius: 0; }

.rv-col {
  max-width: var(--rv-col);
  margin: 0 auto;
  padding: 0 var(--rv-pad);
}

.rv-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.rv :is(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* The headline takes focus on show so screen readers start there; it is not a
   control, so no ring */
.rv-title:focus { outline: none; }

.rv-icon { flex: none; display: block; }

/* ----- Buttons ----- */
.rv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ui, 6px);
  background: var(--surface);
  color: var(--ink);
  font: 600 14px/1.2 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rv-btn:hover { background: var(--hover); }
.rv-btn:disabled { opacity: 0.55; cursor: default; }
.rv-btn:disabled:hover { background: var(--surface); }

.rv-icon-btn {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-color: transparent;
}

/* Bookmark: one name and one label in both states ("Αποθήκευση"); the saved state is
   aria-pressed, shown by the filled icon, the accent edge and the tint */
.rv-bm[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--nav-active);
}
.rv-bm[aria-pressed="true"] .rv-icon { color: var(--accent); }
.rv-bm[aria-pressed="true"] .rv-icon path { fill: currentColor; }
.rv-bm-bar[aria-pressed="true"] { border-color: transparent; }

/* Share: a disclosure over a small list, positioned over the page (nothing moves) */
.rv-share-wrap {
  position: relative;
  display: inline-flex;
}
.rv-share .rv-icon-chevron { margin-left: -2px; transition: transform 0.15s ease; }
.rv-share[aria-expanded="true"] { background: var(--hover); }
.rv-share[aria-expanded="true"] .rv-icon-chevron { transform: rotate(180deg); }
.rv-share-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 45;
  min-width: 232px;
  padding: 6px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-panel, 10px);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.rv-share-wrap-bar .rv-share-menu { left: auto; right: 0; }
.rv-share-list { margin: 0; padding: 0; list-style: none; }
.rv-share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ui, 6px);
  background: transparent;
  color: var(--ink);
  font: 500 15px/1.3 var(--font-ui);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.rv-share-item:hover { background: var(--hover); }
.rv-share-item .rv-icon { color: var(--muted); }
.rv .rv-share-item:focus-visible { outline-offset: -2px; }

/* ----- Top bar: Πίσω + breadcrumb (+ bookmark, share on phones) ----- */
.rv-bar { border-bottom: 1px solid var(--rule); }
.rv-bar-inner {
  display: flex;
  align-items: center;
  gap: 4px 12px;
  max-width: var(--rv-col);
  min-height: 52px;
  margin: 0 auto;
  padding: 6px var(--rv-pad);
}
.rv-back {
  border-color: transparent;
  margin-left: -10px;
  padding: 0 12px 0 8px;
  gap: 6px;
}
.rv-crumbs { min-width: 0; flex: 1 1 auto; }
.rv-crumbs-list {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 400 14px/1.4 var(--font-ui);
  color: var(--muted);
}
.rv-crumb {
  display: flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}
.rv-crumb + .rv-crumb { flex: 0 1 auto; }
.rv-crumb-sep { margin: 0 8px; color: var(--muted); }
.rv-crumb-link {
  display: inline-block;
  max-width: 100%;
  line-height: 32px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
}
.rv-crumb-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rv-crumb:last-child .rv-crumb-link { color: var(--ink); font-weight: 600; }
.rv-bar-actions { display: none; margin-left: auto; gap: 4px; }

/* ----- Headline, meta, actions ----- */
.rv-head { padding-top: 22px; }
.rv-title {
  margin: 0 0 14px;
  font: 700 36px/1.2 var(--font-headline);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.rv-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font: 400 14px/1.45 var(--font-ui);
  color: var(--muted);
}
.rv-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rv-source { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
/* One run of text, so a narrow screen breaks after the dot, never before it
   (a no-break space joins the dot to the exact time) */
.rv-when { display: block; flex: 0 1 auto; min-width: 0; }
.rv-when > * { display: inline; }
.rv-ago::before,
.rv-seen::before {
  content: "\00a0·\0020";
  content: "\00a0·\0020" / "";
}

.rv-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ----- Favicons ----- */
.rv-fav {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}
.rv-fav-img {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--fav-plate);
}
.rv-fav-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--rule);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* ----- Picture: the box is there before the image ----- */
.rv-figure {
  margin: 24px 0 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-img, 6px);
  background: var(--paper);
}
.rv-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* The picture failed directly and through the proxy: the box keeps its size (the
   text under it never moves) and shows the publisher, quietly. An inset line, not
   a border, so the box's size is untouched. */
.rv-figure.is-failed,
.rv-rel-thumb.is-failed {
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.rv-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-panel, 10px);
  background: var(--rule);
}
.rv-ph-fav {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--fav-plate);
}
.rv-ph-initial {
  color: var(--ink);
  font: 700 24px/1 var(--font-ui);
}
.rv-rel-thumb .rv-ph { width: 36px; height: 36px; border-radius: var(--r-ui, 6px); }
.rv-rel-thumb .rv-ph-fav { width: 20px; height: 20px; border-radius: 4px; }
.rv-rel-thumb .rv-ph-initial { font-size: 16px; }

/* ----- Text ----- */
.rv-body {
  margin-top: 24px;
  font-family: var(--font-reading);
  color: var(--ink);
}
.rv-lead {
  margin: 0 0 22px;
  font-size: 19px;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.rv-preview { margin: 0 0 8px; }
.rv-preview-label {
  margin: 0 0 10px;
  font: 500 14px/1.4 var(--font-ui);
  color: var(--muted);
}
.rv-preview-text {
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--rule-strong);
}
.rv-preview-text p {
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.rv-preview-text p:last-child { margin-bottom: 0; }

.rv-cta-wrap { margin: 28px 0 0; }
.rv-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--r-ui, 6px);
  background: var(--ink);
  color: var(--surface);
  font: 700 16px/1.3 var(--font-ui);
  text-decoration: none;
}
.rv-cta:hover { text-decoration: underline; text-underline-offset: 3px; }
.rv .rv-cta:focus-visible { outline-color: var(--ink); outline-offset: 3px; }

/* ----- Skeletons (loading state; text area while the preview is asked) ----- */
.rv-skel { padding: 2px 0; }
.rv-skel-line {
  display: block;
  height: 14px;
  margin: 15px 0;
  border-radius: 4px;
  background: var(--rule);
}
.rv-skel-line[data-w="100"] { width: 100%; }
.rv-skel-line[data-w="98"] { width: 98%; }
.rv-skel-line[data-w="96"] { width: 96%; }
.rv-skel-line[data-w="92"] { width: 92%; }
.rv-skel-line[data-w="70"] { width: 70%; }
.rv-skel-line[data-w="60"] { width: 60%; }
.rv-skel-line[data-w="45"] { width: 45%; }
.rv-skel-line[data-w="40"] { width: 40%; height: 48px; margin-top: 28px; }
.rv-skel-line[data-w="30"] { width: 30%; }
.rv-skel-line[data-w="0"] { background: transparent; }
.rv-skel-crumbs { padding-top: 10px; }
.rv-skel-title .rv-skel-line { height: 34px; margin: 10px 0; }
.rv-skel-figure .rv-skel-line {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 24px 0 0;
  border-radius: var(--r-img, 6px);
  background: var(--paper);
  border: 1px solid var(--rule);
}
@media (prefers-reduced-motion: no-preference) {
  .rv-skel-line:not([data-w="0"]) { animation: rv-pulse 1.6s ease-in-out infinite; }
}
@keyframes rv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ----- Related coverage, section link, social ----- */
.rv-related {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.rv-related-title {
  margin: 0 0 4px;
  font: 700 20px/1.3 var(--font-headline);
  color: var(--ink);
}
.rv-rel-list { margin: 8px 0 0; padding: 0; list-style: none; }
.rv-rel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.rv-rel:first-child { border-top: 0; }
.rv-rel.has-thumb { grid-template-columns: minmax(0, 1fr) auto 96px; }
.rv-rel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin-bottom: 4px;
  font: 400 13px/1.4 var(--font-ui);
  color: var(--muted);
}
.rv-rel-time { font-variant-numeric: tabular-nums; }
.rv-rel-source { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.rv-rel-title {
  font: 600 16px/1.4 var(--font-headline);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: break-word;
}
.rv-rel-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.rv-rel-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-ui, 6px);
  color: var(--muted);
}
.rv-rel-ext:hover { color: var(--ink); background: var(--hover); }
.rv-rel-thumb {
  width: 96px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--r-img, 6px);
  background: var(--paper);
}
.rv-rel-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rv-rel-more { margin-top: 8px; }

.rv-section { margin: 28px 0 0; }
.rv-section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font: 600 15px/1.4 var(--font-ui);
  color: var(--accent);
  text-decoration: none;
}
.rv-section-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.rv-social { margin-top: 32px; }
.rv-social:empty { display: none; }

/* ----- Missing ----- */
.rv-missing { padding-top: 40px; padding-bottom: 16px; }
.rv-missing-title {
  margin: 0 0 20px;
  font: 700 22px/1.35 var(--font-headline);
}
.rv-missing .rv-missing-back {
  margin-left: 0;
  padding: 0 16px 0 12px;
  border-color: var(--rule-strong);
}

/* ----- Copy confirmation: fixed, so nothing moves ----- */
.rv-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(92vw, 560px);
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--r-ui, 6px);
  background: var(--ink);
  color: var(--surface);
  font: 500 14px/1.4 var(--font-ui);
  overflow-wrap: anywhere;
  transform: translateX(-50%);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.rv-toast:empty { padding: 0; box-shadow: none; }
.rv-copy-buffer {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

/* ----- Tablet ----- */
@media (min-width: 768px) and (max-width: 1199px) {
  .rv-title { font-size: 34px; }
}

/* ----- Phones ----- */
@media (max-width: 767px) {
  .rv {
    --rv-pad: 16px;
    border: 0;
    border-radius: 0;
  }
  .rv-bar {
    position: sticky;
    top: var(--rv-top, var(--appbar-h, 56px));
    z-index: 40;
    background: var(--surface);
  }
  .rv-bar-inner { min-height: 52px; padding-top: 4px; padding-bottom: 4px; gap: 4px 8px; }
  .rv-back { margin-left: -8px; padding: 0 10px 0 6px; }
  .rv-bar-actions { display: flex; }
  .rv-actions .rv-bm,
  .rv-actions .rv-share,
  .rv-actions .rv-share-wrap { display: none; }
  .rv-head { padding-top: 16px; }
  .rv-title { font-size: 30px; line-height: 1.22; }
  .rv-figure {
    margin-left: calc(-1 * var(--rv-pad));
    margin-right: calc(-1 * var(--rv-pad));
    border-radius: 0;
  }
  .rv-lead { font-size: 18px; line-height: 1.65; }
  .rv-preview-text p { font-size: 17px; }
  .rv-cta { display: flex; justify-content: center; width: 100%; text-align: center; }
  .rv-rel.has-thumb { grid-template-columns: minmax(0, 1fr) auto 80px; }
  .rv-rel-thumb { width: 80px; }
  .rv-toast { bottom: calc(var(--bottomnav-h, 56px) + 16px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 359px) {
  .rv-crumb:first-child,
  .rv-crumb:first-child + .rv-crumb .rv-crumb-sep { display: none; }
}

/* ----- Touch: 44px targets ----- */
@media (pointer: coarse) {
  .rv-btn { min-height: 44px; }
  .rv-icon-btn { width: 44px; }
  .rv-share-item { min-height: 44px; }
  .rv-crumb-link { line-height: 44px; }
  .rv-rel-ext { width: 44px; height: 44px; margin-top: -6px; }
  .rv-section-link { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .rv * { animation: none !important; transition: none !important; }
}

@media print {
  .rv-bar, .rv-actions, .rv-social, .rv-toast, .rv-rel-more { display: none !important; }
  .rv { border: 0; }
}
