:root {
  --bg: #02040a;
  --bg-deep: #0a1628;
  --panel: rgba(15, 35, 52, 0.86);
  --line: rgba(57, 255, 158, 0.25);
  --text: #f4fbf7;
  --muted: #9ab2ab;
  --muted-deep: #5c7a70;
  --bio: #39ff9e;
  --bio-soft: #8ede6b;
  --sky: #5fc7e6;
  --sky-soft: #4fd1c5;
  --surface: rgba(15, 35, 52, 0.7);
  --surface-deep: rgba(8, 18, 26, 0.85);
  --glow: rgba(57, 255, 158, 0.15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(70% 45% at 8% 0%, rgba(57, 255, 158, .08), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.content-shell {
  width: min(100% - 3rem, 1240px);
  margin-inline: auto;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 8, 16, 0.86);
  backdrop-filter: blur(20px);
}
.nav-shell {
  width: min(100% - 3rem, 1240px);
  min-height: 78px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.brand { display: inline-flex; align-items: center; }
.biosat-logo { position: relative; display: inline-block; width: 124px; line-height: 0; }
.biosat-logo__img { display: block; width: 100%; height: auto; }
.biosat-logo__earth { position: absolute; display: block; pointer-events: none; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a, .admin-access {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: 'Chakra Petch', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"], .admin-access:hover { color: var(--bio); }
.admin-access { padding: .75rem 1rem; border: 1px solid var(--line); }
.news-hero {
  position: relative;
  min-height: 440px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #02040a;
}
.news-hero .hero-content {
  position: relative;
  z-index: 1;
}
.logo-hero-inline {
  width: clamp(220px, 28vw, 420px);
  flex-shrink: 0;
}
.hero-orbit {
  position: absolute;
  width: 460px;
  height: 460px;
  right: 8%;
  top: -170px;
  border: 1px solid rgba(57,255,158,.34);
  border-radius: 50%;
  box-shadow: 0 0 90px rgba(57,255,158,.1), inset 0 0 70px rgba(95,199,230,.06);
}
.hero-orbit::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  right: 12%;
  bottom: 12%;
  border-radius: 50%;
  background: var(--bio);
  box-shadow: 0 0 24px var(--bio);
}
.hero-content { position: relative; z-index: 2; padding-block: 5.5rem; }
.eyebrow {
  margin: 0 0 1rem;
  color: var(--bio);
  font-family: 'Chakra Petch', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
}
.hero-content h1, .section-heading h2, .admin-heading h2, .dialog-card h2, .article-card h2 {
  margin: 0;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 500;
  letter-spacing: -.035em;
}
.hero-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(3.3rem, 9vw, 7rem);
  line-height: .95;
  margin: 0;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 500;
  letter-spacing: -.035em;
}
.logo-hero-inline {
  width: clamp(220px, 28vw, 420px);
  flex-shrink: 0;
}
.hero-content > p:last-child {
  max-width: 620px;
  margin: 1.8rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}
.news-section {
  padding-block: 6rem 7rem;
  background: rgba(15, 35, 52, 0.55);
}
.section-heading, .admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.7rem;
}
.section-heading h2, .admin-heading h2 { font-size: clamp(2rem, 5vw, 3.5rem); }
.search-field {
  width: min(100%, 360px);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  background: rgba(5, 25, 32, .62);
}
.search-field svg { width: 18px; fill: none; stroke: var(--muted-deep); stroke-width: 1.8; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-field input::placeholder { color: var(--muted-deep); }
.status-message { color: var(--muted); padding: 1rem 0; }
.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; }
.news-card {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  backdrop-filter: blur(10px);
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.news-card:hover {
  transform: translateY(-4px);
  border-color: rgba(94,231,164,.55);
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}
.news-card__image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--deep); }
.news-card__body { padding: 1.5rem; }
.news-card__date { color: var(--bio); font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; }
.news-card h3 { margin: .85rem 0 .8rem; font: 500 1.35rem/1.3 'Chakra Petch', sans-serif; }
.news-card__excerpt { color: var(--muted); font-size: .92rem; line-height: 1.65; }
.read-more { margin-top: 1.2rem; color: var(--text); background: none; border: 0; padding: 0; font-weight: 600; }
.empty-state { padding: 4rem 1rem; text-align: center; border: 1px dashed var(--line); }
.empty-state h3 { margin: 0; font: 500 1.5rem 'Chakra Petch', sans-serif; }

.admin-section {
  padding-block: 5rem 7rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #02040a, #0a1628);
}
.admin-heading p { color: var(--muted); }
.admin-heading strong { color: var(--bio); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 1.5rem; align-items: start; }
.editor-card, .manage-card {
  border: 1px solid var(--line);
  background: rgba(9, 34, 41, .92);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.editor-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.editor-card-heading h3 { margin: 0; font: 500 1.25rem 'Chakra Petch', sans-serif; }
.field { display: grid; gap: .55rem; margin-bottom: 1.2rem; }
.field label { color: #dceae5; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #081f27;
  color: var(--text);
  padding: .85rem .95rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--bio); box-shadow: 0 0 0 2px rgba(57,255,158,.12); }
.field textarea { min-height: 190px; resize: vertical; line-height: 1.6; }
.field input[type="file"] { padding: .65rem; color: var(--muted); }
.field input[type="file"]::file-selector-button { margin-right: .8rem; border: 0; background: var(--bio); color: #020a05; padding: .55rem .8rem; font-weight: 700; }
.field-help { margin: 0; color: var(--muted-deep); font-size: .78rem; }
.button {
  border: 1px solid var(--bio);
  background: transparent;
  color: var(--bio);
  padding: .8rem 1.2rem;
  font-family: 'Chakra Petch', sans-serif;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}
.button:hover { background: var(--bio); color: #020a05; }
.button-primary { background: var(--bio); color: #020a05; }
.button-primary:hover { background: #7af0b8; }
.button-ghost { border-color: var(--line); color: var(--muted); }
.button-full { width: 100%; }
.button:disabled { opacity: .5; cursor: wait; }
.text-button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; }
.form-message { min-height: 1.3rem; margin: .5rem 0 1rem; color: #ff8d8d; font-size: .86rem; }
.form-message.success { color: var(--bio); }
.image-preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; margin-top: .8rem; }
.image-preview { position: relative; aspect-ratio: 1; border: 1px solid var(--line); overflow: hidden; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview button { position: absolute; top: .35rem; right: .35rem; width: 25px; height: 25px; border: 0; background: rgba(0,0,0,.8); color: #fff; }
.count-badge { min-width: 28px; padding: .25rem .55rem; border: 1px solid var(--line); color: var(--bio); text-align: center; font-size: .75rem; }
.manage-list { display: grid; gap: .7rem; max-height: 620px; overflow-y: auto; }
.manage-item { padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.manage-item:last-child { border-bottom: 0; }
.manage-item h4 { margin: 0 0 .35rem; font: 500 1rem/1.35 'Chakra Petch', sans-serif; }
.manage-item p { margin: 0 0 .65rem; color: var(--muted); font-size: .75rem; }
.manage-actions { display: flex; gap: .5rem; }
.manage-actions button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: .4rem .65rem; font-size: .72rem; }
.manage-actions button:hover { color: var(--bio); border-color: var(--bio); }
.manage-actions .danger:hover { color: #ff8d8d; border-color: #ff8d8d; }
.manage-empty { color: var(--muted); font-size: .85rem; }
dialog { color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(7px); }
.login-dialog, .article-dialog { width: min(100% - 2rem, 620px); max-height: 90vh; border: 1px solid var(--line); background: #081e26; padding: 0; }
.article-dialog { width: min(100% - 2rem, 860px); }
.dialog-card, .article-card { position: relative; padding: clamp(1.5rem, 5vw, 3rem); }
.dialog-close { position: absolute; top: .8rem; right: .9rem; width: 36px; height: 36px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 1.4rem; }
.dialog-close:hover { color: var(--bio); border-color: var(--bio); }
.dialog-card h2, .article-card h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.dialog-description { color: var(--muted); margin: .8rem 0 1.8rem; }
.article-header { padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.article-date { margin: 0 0 .7rem; color: var(--bio); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; }
.article-card h2 { margin-top: .35rem; }
.article-body { margin: 1.6rem 0 2rem; color: #c3d4ce; font-size: 1.02rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.article-gallery-section { padding-top: 1.4rem; border-top: 1px solid var(--line); }
.article-gallery-label { margin: 0 0 .9rem; color: var(--muted); font-family: 'Chakra Petch', sans-serif; font-size: .72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
.article-gallery { display: flex; gap: .75rem; overflow-x: auto; padding: 0 .1rem .6rem; scroll-snap-type: x proximity; }
.article-gallery-button { flex: 0 0 150px; aspect-ratio: 16 / 10; padding: 0; border: 1px solid var(--line); background: var(--surface-deep); overflow: hidden; scroll-snap-align: start; transition: border-color .2s ease, transform .2s ease; }
.article-gallery-button:hover, .article-gallery-button:focus-visible { border-color: var(--bio); transform: translateY(-2px); outline: none; }
.article-gallery-button img { width: 100%; height: 100%; object-fit: cover; }
.gallery-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; border: 0; background: var(--bg); color: var(--text); }
.gallery-viewer { position: relative; width: 100%; height: 100%; display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; align-items: center; gap: 1rem; padding: 1.5rem; }
.gallery-viewer figure { min-width: 0; height: 100%; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; }
.gallery-viewer img { max-width: 100%; max-height: calc(100vh - 6rem); object-fit: contain; box-shadow: 0 20px 70px rgba(0,0,0,.45); }
.gallery-viewer figcaption { color: var(--muted); font-size: .8rem; letter-spacing: .12em; }
.gallery-arrow { width: 54px; height: 54px; border: 1px solid var(--line); background: rgba(8,30,38,.88); color: var(--bio); font-size: 2.5rem; line-height: 1; transition: background .2s ease, color .2s ease; }
.gallery-arrow:hover { background: var(--bio); color: #020a05; }
.gallery-arrow--prev { justify-self: start; }
.gallery-arrow--next { justify-self: end; }
.gallery-close { z-index: 3; }
.toast { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 80; max-width: 360px; padding: .9rem 1.1rem; border: 1px solid var(--bio); background: var(--surface-deep); color: var(--text); opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: #ff8d8d; }
.empty-state p { color: var(--muted); }

/* ---- fondo del hero: planeta Tierra difuminado (igual que el inicio) ---- */
.stars {
  background-image:
    radial-gradient(1.2px 1.2px at 12% 22%, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 68% 14%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.4px 1.4px at 37% 64%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 84% 52%, rgba(255,255,255,.38), transparent),
    radial-gradient(1.2px 1.2px at 8% 76%, rgba(255,255,255,.32), transparent),
    radial-gradient(1px 1px at 52% 38%, rgba(255,255,255,.25), transparent),
    radial-gradient(1.2px 1.2px at 28% 9%, rgba(255,255,255,.30), transparent),
    radial-gradient(1px 1px at 92% 84%, rgba(255,255,255,.25), transparent);
  background-repeat: no-repeat;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle {
  0% { opacity: .6; }
  100% { opacity: 1; }
}
.earth-bg {
  position: absolute;
  inset: 0;
  background-image: url('earth-bg.png');
  background-size: cover;
  background-position: 100% 100%;
  background-repeat: no-repeat;
  opacity: .9;
  -webkit-mask-image: radial-gradient(120% 100% at 78% 88%, #000 0%, rgba(0,0,0,.85) 42%, transparent 72%);
  mask-image: radial-gradient(120% 100% at 78% 88%, #000 0%, rgba(0,0,0,.85) 42%, transparent 72%);
}

@media (max-width: 900px) {
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .manage-list { max-height: none; }
}
@media (max-width: 640px) {
  .content-shell, .nav-shell { width: min(100% - 2rem, 1240px); }
  .nav-shell { min-height: 68px; }
  .biosat-logo { width: 102px; }
  .nav-links { gap: .8rem; }
  .nav-links a { display: none; }
  .admin-access { font-size: .62rem; padding: .65rem .7rem; }
  .news-hero { min-height: 380px; }
  .hero-content { padding-block: 4rem; }
  .news-section, .admin-section { padding-block: 4rem; }
  .section-heading, .admin-heading { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .news-grid { grid-template-columns: 1fr; }
  .image-preview-grid { grid-template-columns: repeat(3, 1fr); }
  .article-dialog { width: 100%; max-height: 100vh; }
  .article-card { padding: 1.4rem; }
  .article-body { font-size: .96rem; }
  .article-gallery-button { flex-basis: 125px; }
  .gallery-viewer { grid-template-columns: 48px minmax(0, 1fr) 48px; gap: .35rem; padding: .7rem; }
  .gallery-arrow { width: 42px; height: 42px; font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
