/* css/style-news.css
   Astrobase News — clean, single-source stylesheet
   Fixes: mobile dropdown items/panel always full width (no narrow category column)
*/

/* ───────────────
   THEME
──────────────── */
:root{
  --bg0:#04050c;
  --bg1:#070912;
  --bg2:#14183a;

  --panel:rgba(7,9,18,.88);
  --glass:rgba(255,255,255,.06);

  --row:#14182e;
  --row2:#0f1328;
  --rowHover:#1a1f3a;

  --line:#262b52;
  --line2:rgba(255,255,255,.12);

  --ink:#eef0ff;
  --muted:#9aa0d4;
  --accent:#6f7cff;

  --maxw:1100px;
  --sans:system-ui,-apple-system,"Segoe UI",Inter,Roboto,Arial;

  --rCard:12px;
  --rBtn:10px;
  --padX:14px;
}

/* ───────────────
   BASE
──────────────── */
*{ box-sizing:border-box; }

html,body{
  margin:0;
  color:var(--ink);
  font-family:var(--sans);
  background:radial-gradient(circle at top, var(--bg2) 0%, var(--bg1) 60%, var(--bg0) 100%);
}

/* hide scrollbar but keep scrolling */
html, body{
  scrollbar-width:none;
  -ms-overflow-style:none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar{
  width:0;
  height:0;
}

/* ───────────────
   NAV
──────────────── */
.news-nav{
  position:sticky;
  top:0;
  z-index:10;
  background:var(--panel);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}

.news-nav-inner{
  max-width:var(--maxw);
  margin:0 auto;
  padding:10px var(--padX);
  position:relative;

  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

/* Desktop row */
.news-nav-desktop{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  width:100%;
}

.news-nav-link{
  appearance:none;
  border:0;
  background:transparent;
  cursor:pointer;
  font:inherit;

  font-size:.85rem;
  color:var(--muted);
  text-decoration:none;
  padding:6px 10px;
  border-radius:6px;
  transition:.15s ease;
}

.news-nav-link:hover{
  color:var(--ink);
  background:rgba(255,255,255,.05);
}

.news-nav-link.is-active{
  color:var(--ink);
  background:rgba(111,124,255,.15);
}

/* New entry (desktop) */
.news-new-btn{
  margin-left:auto;
  font-size:.8rem;
  text-decoration:none;
  color:#fff;
  padding:6px 12px;
  border:1px solid rgba(255,255,255,.25);
  background:linear-gradient(180deg,#2a2f6a,#1a1f45);
  transition:.15s ease;
  border-radius:8px;
}
.news-new-btn:hover{
  background:linear-gradient(180deg,#3a41a0,#252b6b);
  border-color:var(--accent);
}

/* ───────────────
   MOBILE DROPDOWN NAV
   (Fix: force full width in flex layout)
──────────────── */
.news-nav-mobile{
  display:none;
  position:relative;

  /* IMPORTANT: prevents “narrow column” */
  flex:1 1 100%;
  width:100%;
  min-width:0;
}

.news-nav-dd-toggle{
  width:100%;
  min-width:0;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;

  appearance:none;
  border:1px solid rgba(255,255,255,.14);
  background:var(--glass);
  color:var(--ink);
  font:inherit;

  padding:10px 12px;
  border-radius:var(--rBtn);
  cursor:pointer;
}

.news-nav-dd-title{
  display:block;
  min-width:0;

  font-size:.9rem;
  font-weight:650;
  letter-spacing:.2px;

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.news-nav-dd-caret{
  flex:0 0 auto;
  opacity:.85;
  transform:translateY(-1px);
}

/* Dropdown panel */
.news-nav-dd-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  right:0;

  width:100%;
  min-width:100%;

  background:rgba(10,12,24,.98);
  border:1px solid var(--line2);
  border-radius:12px;
  box-shadow:0 18px 40px rgba(0,0,0,.55);
  overflow:hidden;
}

/* Items */
.news-nav-dd-item{
  width:100%;
  display:block;

  appearance:none;
  border:0;
  background:transparent;
  color:var(--muted);
  font:inherit;
  text-decoration:none;

  padding:12px 12px;
  cursor:pointer;
  border-bottom:1px solid rgba(255,255,255,.06);

  text-align:left;
}

.news-nav-dd-item:hover{
  background:rgba(255,255,255,.06);
  color:var(--ink);
}

.news-nav-dd-item.is-active{
  color:var(--ink);
  background:rgba(111,124,255,.14);
}

.news-nav-dd-new{
  display:block;
  text-decoration:none;
  padding:12px 12px;
  color:#fff;
  background:linear-gradient(180deg,#2a2f6a,#1a1f45);
}
.news-nav-dd-new:hover{
  background:linear-gradient(180deg,#3a41a0,#252b6b);
}

/* ───────────────
   LIST
──────────────── */
.news-list{
  max-width:var(--maxw);
  margin:0 auto;
  padding:12px 10px 24px;
}

.news-empty{
  padding:40px;
  text-align:center;
  color:var(--muted);
}

/* ───────────────
   ROW (card + right action)
──────────────── */
.news-row-wrap{
  display:flex;
  align-items:stretch;
  gap:10px;
  width:100%;
  margin-bottom:6px;

  background:linear-gradient(180deg,var(--row), var(--row2));
  border:1px solid var(--line);
  transition:.15s ease;
}

.news-row-wrap:hover{
  background:linear-gradient(180deg,var(--rowHover), #12163a);
  border-color:#3a4280;
}

.news-row{
  flex:1 1 auto;
  min-width:0;

  display:grid;
  grid-template-columns:64px 1fr;
  gap:12px;

  padding:10px 12px;
  text-decoration:none;
  color:inherit;
}

.news-row-actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  padding:10px 12px;
}

/* Image */
.news-row-img{
  width:64px;
  height:48px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#050715;

  display:flex;
  align-items:center;
  justify-content:center;
}
.news-row-img img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.news-row-img-empty{
  width:100%;
  height:100%;
  background:linear-gradient(45deg,#0c1024,#050715);
}

/* Meta */
.news-row-meta{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
  min-width:0;
}

.news-row-title{
  font-size:.95rem;
  font-weight:650;
  line-height:1.25;

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.news-row-sub{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:.75rem;
  color:var(--muted);
}
.news-row-dot{ opacity:.6; }

/* Buttons (Display) */
.btn-small{
  appearance:none;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--ink);
  font:inherit;

  font-size:.8rem;
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  line-height:1;
  white-space:nowrap;
  transition:.15s ease;
}
.btn-small:hover{ background:rgba(255,255,255,.10); }

.btn-display{
  border-color:rgba(111,124,255,.35);
}
.btn-display:hover{
  background:rgba(111,124,255,.14);
  border-color:rgba(111,124,255,.55);
}

.news-row-wrap[hidden]{ display:none !important; }

@media (max-width:700px){
  /* Switch nav to dropdown */
  .news-nav-inner{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .news-nav-desktop{ display:none; }
  .news-nav-mobile{ display:block; }

  /* Mobile sizing tokens */
  .news-list{
    --mPad:12px;
    --mGap:12px;
    --thumbW:110px;
    --thumbH:80px;
  }

  /* Card wrapper becomes vertical so actions can sit below */
  .news-row-wrap{
    flex-direction:column;
    gap:0;
    margin-bottom:10px;
    border-radius:12px;     /* optional */
    overflow:hidden;
  }

  /* Main clickable row */
  .news-row{
    grid-template-columns:var(--thumbW) 1fr;
    gap:var(--mGap);
    padding:var(--mPad);
    min-height:96px;
  }

  .news-row-img{
    width:var(--thumbW);
    height:var(--thumbH);
    border-radius:10px;     /* optional */
    overflow:hidden;
  }

  /* Allow 2 lines for title on mobile */
  .news-row-title{
    font-size:0.98rem;
    line-height:1.25;
    white-space:normal;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }

  .news-row-sub{
    font-size:0.78rem;
    gap:8px;
  }

  /* Actions: place below the meta text, aligned with it */
  .news-row-actions{
    padding:0 var(--mPad) var(--mPad);
    display:flex;
    justify-content:flex-start;
    align-items:center;
  }

  /* Push the button under the meta column (not under the thumbnail) */
  .news-row-actions .btn-small{
    margin-left:calc(var(--thumbW) + var(--mGap));
    font-size:0.82rem;
    padding:10px 12px;
  }
}

@media (max-width:700px){

  /* --- Display link instead of button --- */
  .news-row-actions{
    padding:4px 12px 10px;     /* tighter vertical spacing */
    margin-top:-40px;           /* pull it closer to date */
  }

  .news-row-actions .btn-small{
    background:none;
    border:none;
    padding:0;
    margin:0;

    font-size:0.78rem;
    font-weight:500;
    color:var(--accent);
    text-decoration:underline;
    cursor:pointer;

    /* align with text column */
    margin-left:calc(var(--thumbW) + var(--mGap));
  }

  .news-row-actions .btn-small:hover{
    color:#9aa6ff;
    text-decoration-thickness:2px;
  }
}


/* === Mobile fine-tune: reduce top gap + align text with thumbnail top === */
@media (max-width:700px){

  /* Less vertical padding in the sticky nav */
  .news-nav-inner{
    padding-top:6px;
    padding-bottom:8px;
  }

  /* Less gap between nav and first card */
  .news-list{
    padding-top:8px;
  }

  /* Make the grid row align to the top (not centered) */
  .news-row{
    align-items:start;          /* key */
  }

  /* Make meta start at top like the image */
  .news-row-meta{
    justify-content:flex-start; /* key */
    padding-top:2px;            /* tiny nudge to line up perfectly */
  }

  /* Optional: slightly tighter spacing inside meta */
  .news-row-meta{ gap:3px; }
}
