:root {
  --bg: #060a14;
  --bg-soft: #10192f;
  --card: rgba(14, 24, 46, 0.85);
  --card-border: rgba(132, 162, 212, 0.24);
  --text: #eaf2ff;
  --muted: #9eb0cd;
  --brand: #00e5ff;
  --ok: #44ffb4;
  --danger: #ff6b7e;
  --edition-bg-start: #142446;
  --edition-bg-mid: #05070f;
  --edition-bg-end: #020308;
  --edition-grid-h: rgba(88, 132, 220, 0.07);
  --edition-grid-v: rgba(88, 132, 220, 0.06);
  --radius: 18px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.33);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 15%, var(--edition-bg-start) 0%, var(--edition-bg-mid) 44%, var(--edition-bg-end) 100%);
  color: var(--text);
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(var(--edition-grid-h) 1px, transparent 1px),
    linear-gradient(90deg, var(--edition-grid-v) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, #000 40%, transparent 100%);
}

.topbar {
  display: grid;
  gap: 0;
  padding: 0.3rem 0.65rem;
  border-bottom: 1px solid rgba(167, 198, 245, 0.15);
  background: rgba(4, 9, 18, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  min-width: 0;
  flex-shrink: 0;
  padding-bottom: 0.08rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: url('/favicon.svg') center / cover no-repeat;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.brand h1 {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 1.03rem;
  line-height: 1.48;
  letter-spacing: 0.04em;
  padding-bottom: 0.2em;
  display: block;
  overflow: visible;
}

.brand p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  border: 1px solid rgba(188, 212, 248, 0.25);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, #0de1ff, #58ffc1);
  color: #05111a;
  border: none;
}

.btn.ghost:hover,
.btn.primary:hover {
  transform: translateY(-1px);
}

.layout {
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.9rem 1.2rem;
}

body.overview-mode .layout {
  min-height: calc(100vh - 58px);
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 1.1rem 1rem 1rem;
}

.edition-overview {
  display: grid;
  gap: 0.75rem;
  width: min(1140px, 100%);
  text-align: center;
}

.overview-marketing {
  width: min(820px, 100%);
  margin: 0 auto 0.2rem;
  display: grid;
  gap: 0.45rem;
}

.overview-title {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.25rem, 2.3vw, 1.95rem);
  line-height: 1.32;
  padding-bottom: 0.28em;
  overflow: visible;
  display: inline-block;
}

.overview-copy {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.55vw, 1.12rem);
  line-height: 1.45;
}

.overview-legal-link {
  margin: 0.1rem 0 0;
}

.overview-legal-link a {
  color: #9fc6ff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 198, 255, 0.45);
}

.overview-legal-link a:hover {
  color: #d7e7ff;
  border-bottom-color: rgba(215, 231, 255, 0.8);
}

.edition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  justify-items: stretch;
}

.edition-card {
  display: grid;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
  background: rgba(12, 21, 40, 0.9);
  border: 1px solid rgba(131, 166, 225, 0.28);
  border-radius: 14px;
  padding: 0.85rem;
}

.edition-card:hover {
  border-color: rgba(0, 229, 255, 0.75);
}

.edition-title {
  margin: 0;
  font-size: 1rem;
}

.edition-description {
  margin: 0;
  color: #d2deef;
  font-size: 0.86rem;
}

.edition-slug {
  color: #8db7ff;
  font-size: 0.76rem;
}

.header-nav {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  gap: 0.4rem;
  overflow-x: auto;
  white-space: nowrap;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.header-nav-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  width: 0;
  flex: 1 1 0%;
  max-width: 100%;
  overflow: hidden;
  justify-content: flex-end;
}

.nav-scroll-btn {
  border: 1px solid rgba(148, 176, 223, 0.34);
  background: rgba(9, 17, 34, 0.7);
  color: #d4e3ff;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  line-height: 1;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-scroll-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.mobile-filter-btn {
  display: none;
  border: 1px solid rgba(148, 176, 223, 0.36);
  background: rgba(9, 17, 34, 0.7);
  color: var(--text);
  border-radius: 10px;
  padding: 0.34rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-block;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  padding: 0.36rem 0.62rem;
  border-radius: 12px;
  font-size: 0.82rem;
  transition: background 160ms ease, color 160ms ease;
}

.nav-toggle {
  border: 1px solid rgba(148, 176, 223, 0.3);
  background: rgba(9, 17, 34, 0.6);
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(84, 142, 255, 0.18);
}

.nav-link.inactive {
  opacity: 0.5;
}

.fav-toggle {
  min-width: 34px;
  width: 34px;
  height: 28px;
  padding: 0;
  text-align: center;
  font-weight: 700;
  flex-shrink: 0;
}

.content {
  display: block;
}

.feed-grid {
  --masonry-row: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: var(--masonry-row);
  grid-auto-flow: row dense;
  gap: 0.8rem;
  align-items: start;
}

.wall {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
  background: linear-gradient(160deg, rgba(9, 16, 32, 0.93), rgba(6, 11, 22, 0.93));
  box-shadow: var(--shadow);
  animation: fadeUp 360ms ease both;
}

.wall-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.wall-title {
  margin: 0;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.015em;
}

.wall-description {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.pill {
  font-size: 0.75rem;
  color: #0d1221;
  background: var(--ok);
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.article-card {
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.45rem;
  background: var(--card);
  border: 1px solid rgba(131, 166, 225, 0.22);
  border-radius: 14px;
  padding: 0.8rem;
  overflow: hidden;
  height: auto;
  max-height: 320px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
  position: relative;
  width: 100%;
  align-self: start;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 229, 255, 0.65);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.35);
}

.article-title {
  padding-right: 2rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-teaser {
  margin: 0;
  color: #d2deef;
  font-size: 0.89rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-image {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(137, 169, 226, 0.25);
  background: #081428;
}

.article-meta {
  margin-top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.byline {
  color: #8db7ff;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.date {
  color: #7f95b8;
  font-size: 0.72rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.bookmark-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  border: 1px solid rgba(179, 204, 245, 0.45);
  background: rgba(8, 14, 28, 0.72);
  color: #9db8e6;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.94rem;
  line-height: 1;
}

.bookmark-btn.marked {
  color: #0a1a23;
  background: linear-gradient(135deg, #1ce3ff, #6ffabf);
  border: none;
}

.btn.active-filter {
  border-color: rgba(0, 229, 255, 0.8);
  background: rgba(17, 91, 114, 0.35);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  place-items: center;
  padding: 1rem;
  z-index: 30;
}

.overlay.open {
  display: grid;
}

.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 12, 0.72);
  display: none;
  z-index: 25;
  padding: 0.75rem;
}

.filter-overlay.open {
  display: block;
}

.filter-sheet {
  width: min(560px, 100%);
  margin: 0 auto;
  background: rgba(8, 14, 28, 0.96);
  border: 1px solid rgba(131, 166, 225, 0.26);
  border-radius: 14px;
  padding: 0.7rem;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.filter-head h2 {
  margin: 0;
  font-size: 1rem;
  font-family: 'Syne', sans-serif;
}

.filter-list {
  display: grid;
  gap: 0.45rem;
}

.filter-list .nav-link {
  width: 100%;
  text-align: left;
}

.overlay-card {
  width: min(1100px, 100%);
  height: min(86vh, 900px);
  border-radius: 16px;
  border: 1px solid rgba(152, 180, 231, 0.35);
  background: rgba(6, 11, 23, 0.95);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.55rem;
  padding: 0.85rem;
}

.overlay-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
}

.overlay-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.overlay-actions {
  display: flex;
  gap: 0.45rem;
}

.overlay-meta {
  margin: 0;
  color: #98add1;
  font-size: 0.82rem;
}

.overlay-view-toggle {
  display: flex;
  gap: 0.45rem;
}

.overlay-body {
  min-height: 0;
  height: 100%;
}

#overlayFrame {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(140, 171, 224, 0.35);
  border-radius: 10px;
  background: #061022;
}

.overlay-reader {
  height: 100%;
  border: 1px solid rgba(140, 171, 224, 0.35);
  border-radius: 10px;
  background: #071125;
  padding: 0.9rem;
  overflow: auto;
}

.overlay-reader h3 {
  margin: 0;
  font-size: 1.05rem;
}

.reader-lead {
  margin: 0.45rem 0 0.75rem;
  color: #b5c7e4;
  line-height: 1.5;
}

.reader-content p {
  margin: 0 0 0.8rem;
  color: #dce6f7;
  line-height: 1.62;
}

.overlay-note {
  margin: 0;
  color: #86a2cc;
  font-size: 0.77rem;
}

.loader-screen {
  border: 1px dashed rgba(113, 149, 205, 0.35);
  border-radius: 14px;
  padding: 1.1rem;
  text-align: center;
  color: var(--muted);
}

.admin-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  place-items: center;
  padding: 1rem;
}

.admin-drawer.open {
  display: grid;
}

.admin-card {
  width: min(640px, 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: #081229;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.admin-head h2 {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
}

.admin-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.admin-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: #b8cae4;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(145, 169, 204, 0.35);
  background: rgba(4, 9, 19, 0.7);
  color: var(--text);
  padding: 0.6rem 0.7rem;
  font-family: inherit;
}

.form-message {
  min-height: 1.15rem;
  margin: 0;
  font-size: 0.84rem;
}

.form-message.error {
  color: var(--danger);
}

.form-message.ok {
  color: var(--ok);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .edition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 0.35rem 0.55rem 0.45rem;
  }

  .topbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .brand h1 {
    font-size: 1rem;
    line-height: 1.48;
    padding-bottom: 0.2em;
  }

  .header-nav {
    display: none;
  }

  .header-nav-wrap {
    width: 100%;
  }

  .nav-scroll-btn {
    display: none;
  }

  #headerFavToggle {
    display: none;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.34rem 0.56rem;
  }

  .mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
  }

  .wall {
    padding: 0.85rem;
  }

  body.overview-mode .layout {
    min-height: calc(100vh - 96px);
    padding: 0.8rem;
  }

  .edition-overview {
    text-align: left;
  }

  .edition-grid {
    grid-template-columns: 1fr;
  }

  .feed-grid {
    grid-template-columns: 1fr;
  }

  .article-image {
    height: 96px;
  }

  .overlay-card {
    height: min(92vh, 960px);
  }

  .overlay-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-overlay {
    padding: 0.5rem;
  }

  .filter-sheet {
    width: 100%;
  }
}
