:root {
  --ink: #f3f6fb;
  --text: #f3f6fb;
  --muted: #b5bfce;
  --line: rgba(229, 236, 246, 0.16);
  --paper: rgba(14, 18, 27, 0.84);
  --wash: #080b11;
  --accent: #c62828;
  --accent-dark: #8f1d1d;
  --gold: #d39a2c;
  --teal: #167a76;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

#newsBackground {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #080b11;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(198, 40, 40, 0.18), transparent 28%, transparent 72%, rgba(22, 122, 118, 0.12)),
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.08), transparent 38%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header,
.site-footer {
  background: rgba(8, 11, 17, 0.78);
  border-bottom: 1px solid rgba(229, 236, 246, 0.14);
  backdrop-filter: blur(18px);
}

.topbar,
.category-nav,
.page-shell,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: block;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
}

.admin-toggle {
  min-height: 46px;
  border: 1px solid rgba(229, 236, 246, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.admin-toggle:hover,
.admin-toggle[aria-expanded="true"],
.admin-toggle.is-admin {
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
}

.admin-dock {
  position: fixed;
  top: 18px;
  right: max(16px, calc((100vw - 1180px) / 2));
  z-index: 20;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: none;
  gap: 12px;
}

body.admin-open .admin-dock {
  display: grid;
}

body.static-public .admin-toggle,
body.static-public .admin-dock {
  display: none;
}

.admin-dock .panel {
  background: rgba(14, 18, 27, 0.94);
  border-color: rgba(229, 236, 246, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.sidebar .admin-login-panel,
.sidebar .editor-panel,
.sidebar .manage-panel {
  display: none !important;
}

.ad {
  display: none;
}

.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 14px;
}

.category-button {
  border: 1px solid rgba(229, 236, 246, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 9px 14px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 700;
}

.category-button.active,
.category-button:hover {
  background: var(--accent);
  color: white;
}

.nav-link {
  border: 1px solid rgba(229, 236, 246, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 9px 14px;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 700;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  padding: 28px 0 36px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading p {
  margin: 0 0 8px;
  color: #ff6464;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading h1 {
  max-width: 850px;
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 4.3rem);
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--ink);
  text-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.featured-article {
  margin-bottom: 18px;
}

.featured-article .article-card {
  min-height: 340px;
  padding: clamp(22px, 4vw, 42px);
  color: white;
  background:
    linear-gradient(110deg, rgba(24, 33, 47, 0.92), rgba(143, 29, 29, 0.78)),
    url("https://images.unsplash.com/photo-1495020689067-958852a7765e?auto=format&fit=crop&w=1600&q=80") center/cover;
  border-color: transparent;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.featured-article .article-card p,
.featured-article .article-card time {
  color: rgba(255, 255, 255, 0.82);
}

.featured-article .article-card h2 {
  max-width: 720px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.article-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.article-card {
  padding: 20px;
}

.article-image {
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.article-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-image figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.article-image figcaption a {
  color: inherit;
}

.article-card h2 {
  margin: 12px 0 10px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.55rem;
  line-height: 1.06;
  letter-spacing: 0;
}

.article-card h2 a {
  color: inherit;
  text-decoration: none;
}

.article-card h2 a:hover {
  color: #f0bd57;
}

.article-card p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
}

.article-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 52px);
}

.article-page h1 {
  max-width: 800px;
  margin: 16px 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.article-page p {
  max-width: 760px;
  color: #d8dee8;
  font-size: 1.08rem;
  line-height: 1.78;
}

.article-body {
  max-width: 760px;
}

.article-body p {
  margin: 0 0 18px;
}

.article-image-large {
  max-width: 860px;
  margin: 10px 0 24px;
}

.article-source {
  margin-top: 18px;
  font-size: 0.92rem !important;
  line-height: 1.4 !important;
}

.article-source a {
  color: #f0bd57;
  font-weight: 800;
}

.article-page .article-lead {
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.55;
}

.article-byline {
  margin: 0 0 14px;
  color: var(--muted) !important;
  font-size: 0.92rem !important;
  line-height: 1.35 !important;
  font-weight: 700;
}

.back-button {
  margin-bottom: 22px;
  border: 1px solid rgba(229, 236, 246, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 800;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.article-category {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
}

.read-more,
form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.read-more:hover,
form button:hover {
  background: var(--accent-dark);
}

.card-delete-button {
  margin-left: 8px;
  background: #344054;
}

.card-delete-button:hover {
  background: #101828;
}

.article-admin-actions {
  min-height: 0;
  margin: -2px 0 18px;
}

.article-admin-actions:empty {
  display: none;
}

.article-admin-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #d8dee8;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(229, 236, 246, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
}

.logout-button {
  width: 100%;
  margin: -4px 0 14px;
  border: 1px solid rgba(229, 236, 246, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.manage-list {
  display: grid;
  gap: 10px;
}

.manage-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.manage-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.manage-item strong,
.manage-item span {
  display: block;
}

.manage-item strong {
  line-height: 1.25;
}

.manage-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.manage-item button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}

.popular-list {
  margin: 0;
  padding-left: 20px;
}

.popular-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  line-height: 1.25;
}

.popular-list li:last-child {
  border-bottom: 0;
}

.popular-list span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.site-footer {
  padding: 24px 0 28px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.footer-links a,
.info-panel a {
  color: #f0bd57;
  font-weight: 800;
}

.info-page {
  background:
    radial-gradient(circle at top left, rgba(198, 40, 40, 0.2), transparent 34%),
    linear-gradient(135deg, #080b11, #141923);
}

.info-shell {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 54px;
}

.info-brand {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 3rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 800;
}

.info-panel {
  padding: clamp(22px, 5vw, 48px);
}

.info-panel h1 {
  margin: 0 0 18px;
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
}

.info-panel h2 {
  margin: 28px 0 10px;
  color: var(--ink);
}

.info-panel p {
  color: #d8dee8;
  font-size: 1.06rem;
  line-height: 1.72;
}

.social-admin-page {
  background:
    radial-gradient(circle at top left, rgba(198, 40, 40, 0.18), transparent 34%),
    linear-gradient(135deg, #080b11, #141923);
}

.social-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.social-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 22px;
  margin-bottom: 22px;
}

.social-header p {
  margin: 0 0 6px;
  color: #ff6464;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.social-header h1 {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.social-login-panel {
  width: min(440px, 100%);
}

.social-workspace {
  display: grid;
  gap: 14px;
}

.social-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 18, 27, 0.84);
  padding: 14px;
}

.social-toolbar strong,
.social-toolbar span {
  display: block;
}

.social-toolbar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.social-toolbar .logout-button {
  width: auto;
  min-width: 118px;
  margin: 0;
}

.social-note {
  border: 1px solid rgba(211, 154, 44, 0.34);
  border-radius: 8px;
  background: rgba(211, 154, 44, 0.12);
  color: #f6dca4;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 700;
}

.social-list {
  display: grid;
  gap: 16px;
}

.social-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 18px;
}

.social-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.social-card h2 {
  margin: 7px 0 8px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.social-meta {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  font-weight: 700;
}

.social-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  text-decoration: none;
  white-space: nowrap;
}

.social-variant-list {
  display: grid;
  gap: 14px;
}

.social-variant {
  border: 1px solid rgba(229, 236, 246, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.social-variant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.social-variant-head strong {
  color: var(--ink);
  font-size: 1rem;
}

.social-variant-head span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.social-post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.social-post-box {
  display: grid;
  gap: 10px;
}

.social-post-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.social-post-title button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}

.social-post-title button:hover {
  background: var(--accent-dark);
}

.social-post-box textarea {
  min-height: 210px;
  line-height: 1.5;
}

.social-counter {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.social-counter.is-warning {
  color: #f0bd57;
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(24, 33, 47, 0.3);
}

dialog::backdrop {
  background: rgba(24, 33, 47, 0.62);
}

.modal-content {
  padding: clamp(22px, 4vw, 34px);
}

.modal-content h2 {
  margin: 8px 0 12px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.modal-content p {
  line-height: 1.7;
}

.close-modal {
  float: right;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.6rem;
}

@media (max-width: 920px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .social-post-grid {
    grid-template-columns: 1fr;
  }

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

  .editor-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .topbar,
  .category-nav,
  .page-shell,
  .site-footer {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    min-height: auto;
    padding: 16px 0;
  }

  .brand span {
    font-size: 3rem;
  }

  .category-nav {
    padding-bottom: 12px;
  }

  .category-button {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .top-actions {
    width: 100%;
    align-items: stretch;
  }

  .admin-toggle {
    min-width: 96px;
  }

  .admin-dock {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
  }

  .page-shell {
    gap: 18px;
    padding-top: 20px;
  }

  .section-heading h1 {
    font-size: 2.35rem;
    line-height: 1;
  }

  .news-grid,
  .sidebar {
    grid-template-columns: 1fr;
  }

  .featured-article .article-card {
    min-height: 330px;
  }

  .featured-article .article-card h2 {
    font-size: 2.15rem;
  }

  .article-card {
    padding: 17px;
  }

  .article-card h2 {
    font-size: 1.38rem;
  }

  .article-page {
    padding: 20px;
  }

  .article-page h1 {
    font-size: 2.35rem;
    line-height: 1;
  }

  .article-page .article-lead {
    font-size: 1.08rem;
  }

  .article-page p {
    font-size: 1rem;
    line-height: 1.68;
  }

  .read-more,
  .card-delete-button {
    min-height: 42px;
  }

  .card-delete-button {
    margin: 10px 0 0;
  }

  .manage-item {
    grid-template-columns: 1fr;
  }

  .manage-item button {
    min-height: 40px;
  }

  .social-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .social-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .social-toolbar,
  .social-card-head,
  .social-variant-head {
    grid-template-columns: 1fr;
  }

  .social-variant-head {
    display: grid;
  }

  .social-variant-head span {
    text-align: left;
  }

  .social-toolbar {
    align-items: stretch;
  }

  .social-toolbar .logout-button,
  .social-open-link {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .brand span {
    font-size: 2.55rem;
  }

  .section-heading h1,
  .article-page h1 {
    font-size: 2rem;
  }

  .featured-article .article-card {
    min-height: 300px;
  }

  .featured-article .article-card h2 {
    font-size: 1.85rem;
  }
}
