/* ── Rechtspraak RSS Reader — Plugin Stylesheet v1.1 ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;1,400&display=swap');

.rsprss-wrap {
  --ink:      #1a1a2e;
  --gold:     #c8973a;
  --gold-lt:  #e8c57a;
  --cream:    #f8f4ee;
  --warm:     #ede7db;
  --muted:    #7a6e62;
  --rule:     #d4c9b8;
  --red:      #8b2e2e;
  --active:   #fff8ee;
  --sidebar-w: 280px;
  --header-h:  52px;

  font-family: 'Source Sans 3', sans-serif;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 6px;
  /* 
   * No fixed height on mobile — let it grow naturally so the page scroll works.
   * On desktop (≥720px) we apply the configured height.
   */
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(26,26,46,.08);
}

@media (min-width: 720px) {
  .rsprss-wrap {
    height: var(--rsprss-height, 600px);
    overflow: hidden;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* ── HEADER ── */
.rsprss-header {
  height: var(--header-h);
  background: var(--ink);
  border-bottom: 3px solid var(--gold);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 .8rem;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.rsprss-hamburger {
  width: 34px; height: 34px;
  background: none; border: none;
  cursor: pointer;
  display: flex; flex-direction: column;
  justify-content: center; gap: 5px;
  padding: 4px; flex-shrink: 0;
}
.rsprss-hamburger span {
  display: block; height: 2px;
  background: #fff; border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.rsprss-wrap.menu-open .rsprss-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.rsprss-wrap.menu-open .rsprss-hamburger span:nth-child(2) { opacity: 0; }
.rsprss-wrap.menu-open .rsprss-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 720px) {
  .rsprss-hamburger { display: none; }
}

.rsprss-logo {
  width: 28px; height: 28px;
  background: var(--gold); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rsprss-logo svg { width: 16px; height: 16px; fill: var(--ink); }

.rsprss-header-title { flex: 1; overflow: hidden; }
.rsprss-header-title h2 {
  font-family: 'Playfair Display', serif;
  font-size: .88rem; font-weight: 900;
  color: #fff; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rsprss-sub {
  font-size: .62rem; color: var(--gold-lt);
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin: 0;
}

.rsprss-refresh {
  width: 30px; height: 30px;
  background: var(--gold); border: none; border-radius: 5px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.rsprss-refresh:hover { background: var(--gold-lt); }
.rsprss-refresh svg { width: 14px; height: 14px; fill: var(--ink); }
.rsprss-refresh.spinning svg { animation: rsprss-spin .8s linear infinite; }

@keyframes rsprss-spin { to { transform: rotate(360deg); } }

/* ── BACKDROP — floats above layout, inside wrap ── */
.rsprss-backdrop {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 15;
  /* pointer-events so tapping it closes menu */
  cursor: pointer;
}
.rsprss-wrap.menu-open .rsprss-backdrop { display: block; }

/* ── LAYOUT ── */
.rsprss-layout {
  flex: 1;
  display: flex;
  position: relative;
  /* overflow must NOT be hidden on mobile so sidebar can slide in and page scrolls */
  overflow: visible;
  min-height: 0;
}

@media (min-width: 720px) {
  .rsprss-layout { overflow: hidden; }
}

/* ── SIDEBAR ── */
.rsprss-sidebar {
  background: #fff;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

/* Mobile: slide-over panel */
@media (max-width: 719px) {
  .rsprss-sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: min(var(--sidebar-w), 88vw);
    transform: translateX(-110%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    /* allow internal scroll */
    overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0,0,0,.15);
    /* Make sure the sidebar itself is tall enough to scroll */
    min-height: 100%;
  }
  .rsprss-wrap.menu-open .rsprss-sidebar {
    transform: translateX(0);
  }
}

/* Desktop: fixed-width column */
@media (min-width: 720px) {
  .rsprss-sidebar {
    width: var(--sidebar-w);
    overflow: hidden;
    transition: none;
  }
}

.rsprss-search {
  padding: .55rem .7rem;
  background: var(--warm);
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 3;
}
.rsprss-search-input {
  width: 100%;
  padding: .38rem .55rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: inherit; font-size: .78rem;
  background: var(--cream); color: var(--ink);
  outline: none;
}
.rsprss-search-input:focus { border-color: var(--gold); }

/* On mobile sidebar scrolls as a whole; on desktop use inner div */
.rsprss-sidebar-scroll {
  flex: 1;
}
@media (min-width: 720px) {
  .rsprss-sidebar-scroll { overflow-y: auto; }
}

/* sidebar groups */
.rsprss-sg-head {
  display: flex; align-items: center; gap: .45rem;
  padding: .48rem .7rem;
  background: var(--warm);
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 2;
  cursor: pointer; user-select: none;
}
.rsprss-sg-head:first-child { border-top: none; }

.rsprss-sg-icon {
  width: 18px; height: 18px;
  background: var(--gold); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rsprss-sg-icon svg { width: 9px; height: 9px; fill: var(--ink); }
.rsprss-sg-label { font-size: .7rem; font-weight: 600; color: var(--ink); flex: 1; line-height: 1.3; }
.rsprss-sg-arrow { font-size: .6rem; color: var(--muted); transition: transform .2s; }
.rsprss-sg-head.collapsed .rsprss-sg-arrow { transform: rotate(-90deg); }

.rsprss-sg-feeds { list-style: none; margin: 0; padding: 0; }
.rsprss-sg-feeds.hidden { display: none; }

.rsprss-feed-btn {
  display: flex; align-items: center; gap: .45rem;
  width: 100%; padding: .55rem .7rem .55rem 1rem;
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: .78rem;
  color: var(--ink); text-align: left;
  border-bottom: 1px solid var(--rule);
  transition: background .12s; line-height: 1.3;
  /* Larger touch target on mobile */
  min-height: 44px;
}
.rsprss-feed-btn:last-child { border-bottom: none; }
.rsprss-feed-btn:hover { background: var(--cream); }
.rsprss-feed-btn.active {
  background: var(--active); color: var(--red);
  font-weight: 600;
  border-left: 3px solid var(--gold);
  padding-left: calc(1rem - 3px);
}

.rsprss-feed-dot {
  width: 5px; height: 5px;
  border-radius: 50%; background: var(--gold); flex-shrink: 0;
}
.rsprss-feed-btn.active .rsprss-feed-dot { background: var(--red); }

/* ── READER ── */
.rsprss-reader {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  min-width: 0;
}

.rsprss-reader-scroll {
  flex: 1;
  padding: .9rem .9rem 1.5rem;
  /* On mobile, no overflow — let page scroll. On desktop, internal scroll */
  overflow-y: visible;
}

@media (min-width: 720px) {
  .rsprss-reader-scroll { overflow-y: auto; }
}

/* states */
.rsprss-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .65rem; min-height: 200px;
  color: var(--muted); text-align: center;
  padding: 1.5rem 1rem;
}
.rsprss-state svg { width: 38px; height: 38px; fill: var(--rule); }
.rsprss-state p { font-size: .82rem; line-height: 1.55; max-width: 260px; margin: 0; }
.rsprss-state strong { color: var(--ink); }

.rsprss-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: rsprss-spin .7s linear infinite;
}

/* cards */
.rsprss-grid { display: grid; gap: .7rem; }

.rsprss-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 3px;
  padding: .8rem .9rem;
  cursor: pointer;
  animation: rsprss-fadeUp .3s ease both;
  transition: box-shadow .15s, border-left-color .15s;
}
.rsprss-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); border-left-color: var(--red); }

@keyframes rsprss-fadeUp {
  from { opacity:0; transform:translateY(7px); }
  to   { opacity:1; transform:none; }
}

.rsprss-art-meta {
  font-size: .66rem; color: var(--muted);
  margin-bottom: .25rem;
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.rsprss-art-source {
  background: var(--warm); padding: .06rem .32rem;
  border-radius: 3px; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rsprss-art-title {
  font-family: 'Playfair Display', serif;
  font-size: .88rem; font-weight: 700;
  color: var(--ink); line-height: 1.3;
  margin: 0 0 .3rem;
}
.rsprss-art-desc {
  font-size: .78rem; color: var(--muted); line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; margin: 0;
}
.rsprss-art-link {
  display: inline-flex; align-items: center; gap: .25rem;
  margin-top: .4rem; font-size: .7rem; font-weight: 600;
  color: var(--gold); text-decoration: none;
}
.rsprss-art-link:hover { color: var(--red); text-decoration: underline; }
.rsprss-art-link svg { width: 9px; height: 9px; fill: currentColor; }

/* ── MODAL ── */
.rsprss-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex; align-items: flex-start; justify-content: center;
  background: rgba(26,26,46,.55);
  padding: 1rem .75rem 2rem;
  overflow-y: auto;
  animation: rsprss-fadeIn .2s ease;
  -webkit-overflow-scrolling: touch;
}
.rsprss-overlay.rsprss-hidden { display: none; }
@keyframes rsprss-fadeIn { from{opacity:0;} to{opacity:1;} }

.rsprss-modal {
  background: #fff;
  border-top: 4px solid var(--gold);
  border-radius: 4px;
  width: 100%; max-width: 580px;
  padding: 1.1rem 1.1rem 1.6rem;
  position: relative;
  animation: rsprss-slideUp .2s ease;
  margin-top: .5rem;
}
@keyframes rsprss-slideUp {
  from { transform:translateY(12px); opacity:0; }
  to   { transform:none; opacity:1; }
}

.rsprss-modal-close {
  position: absolute; top: .7rem; right: .7rem;
  background: var(--warm); border: none; border-radius: 4px;
  width: 32px; height: 32px; cursor: pointer;
  font-size: .9rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  /* larger tap target */
  min-width: 44px; min-height: 44px;
}
.rsprss-modal-close:hover { background: var(--rule); }

.rsprss-modal-meta { font-size: .7rem; color: var(--muted); margin-bottom: .5rem; padding-right: 2.5rem; }
.rsprss-modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem; font-weight: 900; line-height: 1.3;
  margin: 0 0 .8rem; color: var(--ink); padding-right: 2.5rem;
}
.rsprss-modal-body {
  font-size: .82rem; line-height: 1.7; color: #333;
  border-top: 1px solid var(--rule); padding-top: .8rem;
  margin-bottom: .9rem; word-break: break-word;
}
.rsprss-modal-body a { color: var(--gold); }
.rsprss-modal-link {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--ink); color: #fff;
  padding: .5rem .9rem; border-radius: 4px;
  font-size: .78rem; font-weight: 600; text-decoration: none;
}
.rsprss-modal-link:hover { background: var(--red); color: #fff; }
.rsprss-modal-link svg { width: 11px; height: 11px; fill: #fff; }

/* scrollbar */
.rsprss-sidebar-scroll::-webkit-scrollbar,
.rsprss-sidebar::-webkit-scrollbar,
.rsprss-reader-scroll::-webkit-scrollbar,
.rsprss-overlay::-webkit-scrollbar { width: 4px; }
.rsprss-sidebar-scroll::-webkit-scrollbar-track,
.rsprss-sidebar::-webkit-scrollbar-track,
.rsprss-reader-scroll::-webkit-scrollbar-track,
.rsprss-overlay::-webkit-scrollbar-track { background: transparent; }
.rsprss-sidebar-scroll::-webkit-scrollbar-thumb,
.rsprss-sidebar::-webkit-scrollbar-thumb,
.rsprss-reader-scroll::-webkit-scrollbar-thumb,
.rsprss-overlay::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
