/* InfoPortal-style layout for iPages */

:root {
  --mag-bg: #f4f4f2;
  --mag-yellow: #f7d046;
  --mag-yellow-hover: #f0c42e;
  --mag-radius: 16px;
  --mag-radius-sm: 12px;
  --mag-shadow: 0 12px 40px rgba(23, 25, 24, 0.06);
  --mag-overlay: rgba(16, 18, 16, 0.55);
}

html.dark {
  --mag-bg: #121412;
  --mag-yellow: #f0c832;
  --mag-yellow-hover: #e3bb28;
  --mag-shadow: 0 16px 48px rgba(0, 0, 0, 0.42);
  --mag-overlay: rgba(0, 0, 0, 0.72);
}

body {
  background: var(--mag-bg);
}

.wrap {
  max-width: 1280px;
}

/* ——— Header ——— */
.header {
  height: 72px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  background: color-mix(in srgb, var(--mag-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font: 800 22px Manrope, 'DM Sans', sans-serif;
  letter-spacing: -0.5px;
  justify-self: start;
}

.brand-mark {
  width: 22px;
  height: 28px;
  position: relative;
  flex-shrink: 0;
}

.brand-mark::before,
.brand-mark::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 22px;
  background: var(--mag-yellow);
  border-radius: 2px;
  top: 2px;
}

.brand-mark::before {
  left: 4px;
  transform: rotate(-14deg);
}

.brand-mark::after {
  left: 12px;
  transform: rotate(-14deg);
}

.brand-dot {
  display: none;
}

.nav {
  margin: 0;
  display: flex;
  gap: 28px;
  justify-self: center;
}

.nav button {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 8px 0;
  position: relative;
  opacity: 0.72;
}

.nav button:hover {
  opacity: 1;
}

.nav button.active {
  opacity: 1;
}

.nav button.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--mag-yellow);
  border-radius: 2px;
}

.head-right {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  flex-shrink: 0;
  gap: 7px;
}

.head-right-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.head-right-group--search {
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  gap: 2px;
}

.head-right-group--search .icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
}

.head-right-group--search .icon-btn:hover {
  background: var(--soft);
}

.head-right-group--search #bookmark.is-active {
  background: color-mix(in srgb, var(--mag-yellow) 28%, var(--card));
  border-radius: 50%;
}

.head-right-group--search .search.open {
  height: 36px;
  margin: 0 2px 0 0;
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
  background: var(--paper);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 16px;
  padding: 0;
}

.icon-btn:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, var(--line));
}

.icon-btn svg {
  display: block;
}

.head-right .icon-btn .fa-solid,
.head-right .icon-btn .fa-regular {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.head-right .icon-btn-search .fa-magnifying-glass {
  font-size: 16px;
}

.head-right .icon-btn-bookmark .fa-bookmark {
  font-size: 17px;
}

.head-right .icon-btn-profile .fa-user {
  font-size: 17px;
}

.head-right .icon-btn-theme .fa-moon,
.head-right .icon-btn-theme .fa-sun {
  font-size: 18px;
}

.icon-btn-profile:hover {
  border-color: color-mix(in srgb, var(--mag-yellow) 65%, var(--line));
  color: var(--ink);
}

#bookmark.is-active {
  border-color: color-mix(in srgb, var(--mag-yellow) 70%, var(--line));
  background: color-mix(in srgb, var(--mag-yellow) 22%, var(--card));
  color: #1a1a18;
}

.card-image--actions {
  position: relative;
}

.bookmark-toggle {
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.bookmark-toggle:hover {
  transform: scale(1.05);
}

.bookmark-toggle.is-saved {
  color: #1a1a18;
  background: var(--mag-yellow);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--mag-yellow) 45%, transparent);
}

.bookmark-toggle--card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.bookmark-toggle--article {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: none;
}

.article-masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.article-edit-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.article-edit-btn .fa-solid {
  font-size: 14px;
  line-height: 1;
}

.article-edit-btn:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, var(--line));
  background: var(--soft);
  transform: scale(1.05);
}

.article-masthead-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin-bottom: 2px;
}

.saved-page {
  padding: 24px 0 56px;
}

.saved-head h2 {
  font: 700 28px / 1.15 Manrope, sans-serif;
  margin: 0 0 10px;
  letter-spacing: -0.4px;
}

.saved-count {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 520px;
  line-height: 1.55;
}

.saved-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 14px;
}

.saved-empty .btn-subscribe {
  margin-top: 18px;
}

.feed-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.feed-empty-title {
  font: 700 22px / 1.2 Manrope, sans-serif;
  margin-bottom: 10px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.feed-empty-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

html.dark .bookmark-toggle--card {
  background: var(--card);
}

.search {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
  transition: width 0.2s, opacity 0.2s, padding 0.2s;
}

.search.open {
  width: 160px;
  min-width: 120px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 1;
  pointer-events: auto;
  height: 40px;
}

.btn-subscribe {
  background: var(--mag-yellow);
  color: #1a1a18;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
}

.btn-subscribe:hover {
  background: var(--mag-yellow-hover);
}

.admin-link {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
}

.admin-link:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ——— Main: hero ——— */
#app {
  padding-bottom: 48px;
}

.breaking {
  display: none;
}

.hero-magazine {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
  gap: 20px;
  padding: 28px 0 24px;
  align-items: stretch;
}

.hero-feature {
  position: relative;
  border-radius: var(--mag-radius);
  overflow: hidden;
  min-height: 380px;
  cursor: pointer;
  background: #2a3228;
  box-shadow: var(--mag-shadow);
}

.hero-feature .hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-feature .hero-bg-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #5c6b52 0%, #8fa07a 45%, #c4a574 100%);
}

.hero-feature::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.35) 45%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
}

.hero-feature-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 30px 26px;
  z-index: 1;
  color: #fff;
}

.pill-cat {
  display: inline-block;
  background: var(--mag-yellow);
  color: #1a1a18;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero-feature h2 {
  font: 700 clamp(24px, 2.8vw, 34px) / 1.15 Manrope, 'DM Sans', sans-serif;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
  width: 100%;
  max-width: none;
}

.hero-feature .hero-excerpt {
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.88;
  margin: 0 0 18px;
  width: 100%;
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-feature-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.read-time {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
}

.read-time::before {
  content: '◷';
  font-size: 13px;
}

.hero-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #171918;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

.hero-arrow:hover {
  background: var(--mag-yellow);
  transform: translateX(2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

.hero-arrow:active {
  transform: translateX(1px) scale(0.97);
}

.hero-arrow:focus-visible {
  outline: 2px solid var(--mag-yellow);
  outline-offset: 3px;
}

.hero-arrow .fa-chevron-right {
  font-size: 13px;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-side-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--card);
  border-radius: var(--mag-radius-sm);
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  flex: 1;
}

.hero-side-card:hover {
  border-color: var(--mag-yellow);
}

.hero-side-card .thumb {
  width: 108px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--soft);
}

.hero-side-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-side-card .side-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.hero-side-card h3 {
  font: 600 14px / 1.35 Manrope, sans-serif;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-side-card .read-time {
  color: var(--muted);
  font-size: 11px;
  opacity: 1;
}

/* ——— Filter bar ——— */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border-radius: var(--mag-radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 32px;
}

.filter-bar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.75;
  padding: 6px 4px;
}

.filter-bar button:hover {
  opacity: 1;
}

.filter-bar button.active {
  opacity: 1;
  background: color-mix(in srgb, var(--mag-yellow) 22%, var(--card));
  border-radius: 8px;
  padding: 6px 10px;
  margin: -6px -6px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mag-yellow) 40%, transparent);
}

.filter-bar .fi {
  font-size: 15px;
}

.icon-btn:focus-visible,
.nav button:focus-visible,
.filter-bar button:focus-visible,
.btn-subscribe:focus-visible,
.admin-link:focus-visible {
  outline: 2px solid var(--mag-yellow);
  outline-offset: 2px;
}

/* ——— Publications grid ——— */
.pub-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
}

.pub-section-head h2 {
  font: 700 26px / 1.2 Manrope, sans-serif;
  margin: 0;
  letter-spacing: -0.5px;
}

.pub-section-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  opacity: 0.7;
}

.pub-section-head a:hover {
  opacity: 1;
}

.pub-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 18px;
}

.article-card {
  background: var(--card);
  border-radius: var(--mag-radius-sm);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
  box-shadow: var(--mag-shadow);
  transform: translateY(-2px);
}

.card-image {
  height: 160px;
  border-radius: 0;
  margin-bottom: 0;
}

.card-body {
  padding: 14px 16px 16px;
}

.card-kicker {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-title {
  font: 600 16px / 1.3 Manrope, sans-serif;
  margin: 8px 0 10px;
  letter-spacing: -0.2px;
}

.card-description {
  display: none;
}

.card-meta {
  margin-top: 0;
  font-size: 11px;
}

.card-meta .dot {
  opacity: 0.4;
}

/* ——— Bottom: popular + newsletter ——— */
.bottom-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  margin-top: 48px;
  align-items: stretch;
}

.popular-block h2 {
  font: 700 22px / 1.2 Manrope, sans-serif;
  margin: 0 0 20px;
}

.popular-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.popular-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.popular-item:last-child {
  border-bottom: 1px solid var(--line);
}

.popular-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

.popular-item:first-child .popular-num {
  background: var(--mag-yellow);
  color: #1a1a18;
}

.popular-item h3 {
  font: 600 15px / 1.4 Manrope, sans-serif;
  margin: 0;
}

.popular-item .ext {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  transition: transform 0.15s, color 0.15s;
}

.popular-item:hover h3 {
  color: color-mix(in srgb, var(--ink) 85%, var(--mag-yellow));
}

.popular-item:hover .ext {
  transform: translate(2px, -2px);
  color: var(--mag-yellow-hover);
}

.pub-section-head a:hover {
  opacity: 1;
  color: color-mix(in srgb, var(--mag-yellow-hover) 40%, var(--ink));
}

.newsletter-cta {
  position: relative;
  border-radius: var(--mag-radius);
  overflow: hidden;
  min-height: 320px;
  padding: 28px 26px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--mag-shadow);
}

.newsletter-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=800&q=80') center / cover;
  z-index: 0;
}

.newsletter-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 12, 10, 0.92) 0%, rgba(10, 12, 10, 0.5) 100%);
  z-index: 1;
}

.newsletter-cta > * {
  position: relative;
  z-index: 2;
}

.newsletter-cta h3 {
  width: 100%;
  max-width: none;
  font: 700 22px / 1.25 Manrope, sans-serif;
  margin: 0 0 10px;
}

.newsletter-cta p {
  width: 100%;
  max-width: none;
  font-size: 13px;
  line-height: 1.55;
  opacity: 0.88;
  margin: 0 0 18px;
}

.newsletter-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.newsletter-form input {
  flex: 1;
  min-width: 140px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 13px;
  background: #fff;
  color: #121412;
}

.newsletter-form input:focus,
.newsletter-form input:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}

.newsletter-form button {
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  background: var(--mag-yellow);
  color: #1a1a18;
  font-weight: 700;
  font-size: 13px;
}

.newsletter-form button:hover {
  background: var(--mag-yellow-hover);
}

/* ——— Home SEO text ——— */
.home-seo {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.home-seo-title {
  font: 700 20px / 1.25 Manrope, sans-serif;
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}

.home-seo-body {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: none;
  font-size: 14px;
  line-height: 1.65;
  color: color-mix(in srgb, var(--ink) 72%, var(--muted));
}

.home-seo-body p {
  margin: 0;
}

.home-seo-body strong {
  color: var(--ink);
  font-weight: 600;
}

/* ——— Footer ——— */
.site-footer {
  margin-top: 56px;
  background: var(--card);
  border-top: 1px solid var(--line);
}

.site-footer > .wrap {
  padding: 40px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px 24px;
  padding-bottom: 36px;
}

.footer-brand p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 12px 0 0;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  color: var(--ink);
}

.footer-col a,
.footer-col span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 10px;
}

.footer-col h4 ~ a,
.footer-col h4 ~ span {
  position: relative;
  padding-left: 14px;
}

.footer-col h4 ~ a::before,
.footer-col h4 ~ span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mag-yellow);
  transform: translateY(-50%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mag-yellow) 35%, transparent);
}

.footer-col a:hover {
  color: var(--ink);
}

.footer-col h4 ~ a:hover::before {
  background: var(--mag-yellow-hover);
}

.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  width: 100%;
  box-sizing: border-box;
}

.footer-bottom span {
  margin: 0;
}

.footer-social {
  display: flex;
  gap: 16px;
}

.footer-social a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-social a:hover {
  color: var(--ink);
}

/* ——— Article page ——— */
.page-article-shell {
  max-width: 1220px;
  width: calc(100% - 64px);
  margin: 32px auto 64px;
  padding: 0 4px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.article-layout--with-aside {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
}

.page-article-shell .page-article--mag {
  max-width: none;
  margin: 0;
  padding: 0;
}

.article-more {
  position: sticky;
  top: 76px;
}

.article-more-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.article-more-list.hero-side {
  gap: 0;
}

.article-more-list .hero-side-card {
  padding: 12px 0;
}

.article-more-list .hero-side-card:first-child {
  padding-top: 0;
}

.page-article--mag {
  max-width: 760px;
  margin: 32px auto 64px;
  padding: 0 4px;
}

.back-pill {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 28px;
}

.back-pill:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 20%, var(--line));
}

.article-masthead {
  margin-bottom: 28px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.page-article .tag {
  background: var(--mag-yellow);
  color: #1a1a18;
  font-weight: 700;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}

.page-article--mag h1 {
  font: 700 clamp(30px, 4.5vw, 44px) / 1.1 Manrope, sans-serif;
  letter-spacing: -0.6px;
  margin: 0 0 16px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.article-meta-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mag-yellow);
  color: #1a1a18;
  font-weight: 800;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}

.article-meta-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.article-cover-wrap {
  margin: 0 0 32px;
  border-radius: var(--mag-radius);
  overflow: hidden;
  box-shadow: var(--mag-shadow);
}

.page-article--mag .article-cover {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  margin: 0;
  display: block;
}

.article-body--mag {
  font: 17px / 1.8 Manrope, 'DM Sans', sans-serif;
  white-space: normal;
}

.page-article--mag .article-body--mag p {
  margin: 0 0 1.15em;
}

.page-article--mag .article-body--mag h2,
.page-article--mag .article-body--mag h3 {
  font-family: Manrope, sans-serif;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-article--mag .article-body--mag h2 {
  margin: 1.5em 0 0.65em;
  font-size: 1.35em;
  line-height: 1.25;
}

.page-article--mag .article-body--mag h3 {
  margin: 1.25em 0 0.55em;
  font-size: 1.12em;
  line-height: 1.3;
}

.article-body--mag a {
  color: color-mix(in srgb, var(--mag-yellow-hover) 55%, #5a6b28);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.article-body--mag a:hover {
  color: var(--ink);
}

html.dark .article-body--mag a {
  color: var(--mag-yellow);
}

html.dark .article-body--mag a:hover {
  color: var(--ink);
}

.rte-editor a {
  color: color-mix(in srgb, var(--mag-yellow-hover) 55%, #5a6b28);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.rte-editor a:hover {
  color: var(--ink);
}

html.dark .rte-editor a {
  color: var(--mag-yellow);
}

html.dark .rte-editor a:hover {
  color: var(--ink);
}

.article-body blockquote {
  border-left-color: var(--mag-yellow);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--soft) 80%, transparent);
  padding: 12px 12px 12px 16px;
}

/* ——— Admin & crop modals ——— */
.overlay--mag {
  background: var(--mag-overlay);
  backdrop-filter: blur(4px);
}

.modal-admin,
.modal-crop,
#adminModal,
#cropOverlay .modal {
  border-radius: var(--mag-radius);
  border: 1px solid var(--line);
  box-shadow: var(--mag-shadow);
  padding: 28px 26px;
}

#adminModal {
  position: relative;
}

#adminModal > .close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#adminModal > .close:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 35%, var(--line));
  background: var(--soft);
}

#adminModal > .close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--mag-yellow) 70%, transparent);
  outline-offset: 2px;
}

#adminModal .modal-head {
  padding-right: 46px;
}

.admin-head-actions .admin-new-article-btn,
.admin-head-actions .admin-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
}

.admin-head-actions .admin-new-article-btn .fa-solid,
.admin-head-actions .admin-logout-btn .fa-solid {
  font-size: 14px;
  line-height: 1;
}

.modal-admin .modal-head h2,
.modal-crop .modal-head h2 {
  font: 700 24px / 1.2 Manrope, sans-serif;
  letter-spacing: -0.4px;
}

.modal-admin .eyebrow,
.modal-crop .eyebrow {
  color: var(--muted);
  font-size: 10px;
}

.admin-grid {
  gap: 20px;
}

.admin-tabs {
  gap: 6px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.admin-tab .fa-solid {
  width: 1.1em;
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  opacity: 0.88;
}

.admin-tab.active .fa-solid {
  opacity: 1;
}

.admin-tab.active {
  background: color-mix(in srgb, var(--mag-yellow) 28%, var(--soft));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mag-yellow) 45%, transparent);
}

.admin-tab:hover:not(.active) {
  background: var(--soft);
}

.modal .field input,
.modal .field textarea,
.modal #adminPanel input[style] {
  border-radius: 10px;
  border-color: var(--line);
}

.modal .field input:focus,
.modal .field textarea:focus {
  border-color: color-mix(in srgb, var(--mag-yellow) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mag-yellow) 20%, transparent);
}

.modal .primary,
.modal-admin .primary {
  background: var(--mag-yellow);
  color: #1a1a18;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  border: 0;
}

.modal .primary:hover {
  background: var(--mag-yellow-hover);
}

.modal .secondary {
  border-radius: 999px;
  font-weight: 600;
}

.modal-confirm {
  width: min(420px, 100%);
  padding: 24px 22px 22px;
  text-align: left;
}

.confirm-title {
  font: 700 20px / 1.25 Manrope, sans-serif;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.confirm-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 20px;
}

.confirm-actions {
  justify-content: flex-end;
  gap: 10px;
}

.confirm-danger {
  background: #c85a4d !important;
  color: #fff !important;
}

.confirm-danger:hover {
  background: #b34e42 !important;
}

#confirmOverlay {
  z-index: 50;
}

.chip {
  border-radius: 999px;
}

.chip.selected {
  background: var(--mag-yellow);
  border-color: var(--mag-yellow);
  color: #1a1a18;
  font-weight: 600;
}

.admin-item {
  border-bottom-color: var(--line);
  padding: 14px 0;
}

.admin-item--article {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.admin-item-thumb {
  width: 88px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--soft);
  border: 1px solid var(--line);
}

.admin-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-item-thumb--empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e8e4d8, #d4cbb8);
  color: #6b6558;
  font-size: 9px;
  font-weight: 700;
  font-family: Manrope, sans-serif;
  letter-spacing: -0.04em;
  border-color: color-mix(in srgb, #d4cbb8 70%, var(--line));
}

.admin-item-thumb--empty span {
  transform: scale(0.95);
}

html.dark .admin-item-thumb--empty {
  background: linear-gradient(135deg, #3d4238, #2c302a);
  color: #a8aea4;
  border-color: color-mix(in srgb, #3d4238 80%, var(--line));
}

.admin-item-body {
  min-width: 0;
}

.admin-item-actions {
  flex-shrink: 0;
}

.admin-item strong {
  font-family: Manrope, sans-serif;
  font-weight: 600;
}

.admin-item [data-delete],
.admin-item button[data-cat-delete] {
  color: #c85a4d;
  font-weight: 600;
}

.admin-item .secondary {
  font-size: 11px;
}

.rte {
  position: relative;
  border-radius: var(--mag-radius-sm);
  overflow: visible;
}

.rte-bubble {
  position: absolute;
  z-index: 12;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.rte-bubble[hidden] {
  display: none;
}

.rte-bubble button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.rte-bubble button:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, var(--line));
  background: var(--soft);
}

.rte-bubble button.rte-icon-btn {
  display: grid;
  place-items: center;
  padding: 0;
  font-weight: 400;
}

.rte-bubble button.rte-icon-btn .fa-solid,
.rte-bubble button.rte-icon-btn .fa-regular {
  font-size: 13px;
  line-height: 1;
}

.rte-bubble .sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 2px;
  align-self: center;
}

.modal-admin .rte:not(.rte-quill) {
  overflow: hidden;
}

.modal-admin .rte-quill .ql-toolbar.ql-snow {
  position: sticky;
  top: 0;
  z-index: 8;
  box-shadow: 0 1px 0 var(--line);
}

.rte-quill {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--mag-radius-sm);
}

.rte-quill .rte-quill-host {
  display: flex;
  flex-direction: column;
}

.rte-quill .ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--mag-radius-sm) var(--mag-radius-sm) 0 0;
  font-family: 'DM Sans', Arial, sans-serif;
}

.rte-quill .ql-container.ql-snow {
  border: none;
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.65;
}

.rte-quill .ql-editor {
  min-height: 200px;
  padding: 12px 14px;
  color: var(--ink);
}

/* Quill + Tailwind preflight сбрасывают margin у <p>; без этого «пустые» абзацы-разделители исчезают после save/prune */
.rte-quill .ql-editor p {
  margin: 0 0 1.15em;
}

.rte-quill .ql-editor h2 {
  margin: 1.35em 0 0.65em;
  font-size: 1.2em;
  font-weight: 700;
  line-height: 1.3;
}

.rte-quill .ql-editor h3 {
  margin: 1.15em 0 0.5em;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.35;
}

.rte-quill .ql-editor blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 3px solid var(--lime);
  color: var(--muted);
}

.rte-quill .ql-editor.ql-blank::before {
  color: var(--muted);
  font-style: normal;
  left: 14px;
  right: 14px;
}

.rte-quill .ql-snow .ql-stroke {
  stroke: var(--ink);
}

.rte-quill .ql-snow .ql-fill {
  fill: var(--ink);
}

.rte-quill .ql-snow .ql-picker,
.rte-quill .ql-snow .ql-picker-label {
  color: var(--ink);
}

.rte-quill .ql-snow.ql-toolbar button:hover,
.rte-quill .ql-snow .ql-toolbar button.ql-active,
.rte-quill .ql-snow.ql-toolbar .ql-picker-label:hover,
.rte-quill .ql-snow.ql-toolbar .ql-picker-label.ql-active {
  color: var(--ink);
}

.rte-quill .ql-snow.ql-toolbar button:hover .ql-stroke,
.rte-quill .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.rte-quill .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
.rte-quill .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke {
  stroke: var(--ink);
}

.rte-quill .ql-editor ul,
.rte-quill .ql-editor ol {
  margin: 0.5em 0 1em;
  padding-left: 1.4em;
  list-style-position: outside;
}

.rte-quill .ql-editor ul {
  list-style-type: disc;
}

.rte-quill .ql-editor ol {
  list-style-type: decimal;
}

.rte-quill .ql-editor li {
  display: list-item;
}

.rte-quill .ql-editor a {
  color: color-mix(in srgb, var(--mag-yellow-hover) 55%, #5a6b28);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

html.dark .rte-quill .ql-editor a {
  color: var(--mag-yellow);
}

.rte-quill .ql-snow.ql-toolbar button.ql-html-view {
  width: 28px;
  height: 24px;
  padding: 3px 5px;
  vertical-align: top;
}

.rte-quill .ql-snow.ql-toolbar button.ql-html-view svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0 auto;
}

.rte-html-panel {
  border-top: 1px solid #323232;
  background: #2b2b2b;
  overflow: hidden;
}

.rte-html-panel[hidden] {
  display: none !important;
}

.rte-html-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #3c3f41;
  border-bottom: 1px solid #323232;
}

.rte-html-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #cfcfcf;
}

.rte-html-panel-mark {
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #a9b7c6;
}

.rte-html-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rte-html-action {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #555a5f;
  border-radius: 8px;
  background: #45494a;
  color: #dfe1e5;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
}

.rte-html-action:hover {
  border-color: #7a7f85;
  background: #505457;
}

.rte-html-action.is-active {
  border-color: #7ec699;
  background: color-mix(in srgb, #7ec699 16%, #45494a);
  color: #e6ffe8;
}

.rte-html-cm-host .CodeMirror {
  height: auto;
  min-height: 400px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  user-select: text;
}

.rte-html-cm-host .CodeMirror-line,
.rte-html-cm-host .CodeMirror-code {
  user-select: text;
}

.rte-html-cm-host .CodeMirror-scroll {
  min-height: 400px;
}

.rte-html-cm-host .CodeMirror-selected {
  background: rgba(97, 140, 215, 0.38) !important;
}

.rte-html-cm-host .CodeMirror-focused .CodeMirror-selected {
  background: rgba(120, 162, 235, 0.48) !important;
}

.rte-html-cm-host .CodeMirror ::selection {
  background: rgba(120, 162, 235, 0.55);
}

.rte-html-source--plain {
  display: block;
  width: 100%;
  min-height: 400px;
  margin: 0;
  padding: 12px 14px;
  border: none;
  background: #2b2b2b;
  color: #a9b7c6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  resize: vertical;
  outline: none;
}

.rte-quill--html .ql-container {
  display: none;
}

.rte-quill--html .ql-toolbar button:not(.ql-html-view),
.rte-quill--html .ql-toolbar .ql-picker {
  pointer-events: none;
  opacity: 0.4;
}

.rte-quill--html .ql-html-view {
  opacity: 1;
  pointer-events: auto;
}

.rte-editor ul,
.rte-editor ol,
.article-body ul,
.article-body ol,
.article-body--mag ul,
.article-body--mag ol {
  margin: 0.5em 0 1em;
  padding-left: 1.4em;
  list-style-position: outside;
}

.rte-editor ul,
.article-body ul,
.article-body--mag ul {
  list-style-type: disc;
}

.rte-editor ol,
.article-body ol,
.article-body--mag ol {
  list-style-type: decimal;
}

.rte-editor li,
.article-body li,
.article-body--mag li {
  display: list-item;
  margin: 0.25em 0;
}

.rte-editor ul ul,
.article-body ul ul,
.article-body--mag ul ul {
  list-style-type: circle;
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border-radius: var(--mag-radius-sm) var(--mag-radius-sm) 0 0;
  overflow: visible;
}

.rte-toolbar .rte-clear {
  margin-left: auto;
}

.admin-icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.admin-icon-btn .fa-trash {
  font-size: 13px;
}

.admin-icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* Только нативный title — без тёмных data-tip, которые обрезались в модалке */
.modal-admin .rte-toolbar button[data-tip]:hover::after,
.modal-admin .rte-toolbar button[data-tip]:focus-visible::after {
  content: none;
}

#adminModal.modal-admin--panel {
  width: min(calc(100vw - 40px), 100%) !important;
  max-width: none;
  height: min(calc(100vh - 40px), 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#adminModal.modal-admin--panel > .modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  margin-bottom: 16px;
}

.admin-head-actions {
  margin-top: 0 !important;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

#adminModal.modal-admin--panel .admin-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#adminModal.modal-admin--panel #adminPanel {
  overflow: auto;
  min-height: 0;
  max-height: none;
}

.rte-toolbar button {
  border-radius: 8px;
}

.rte-toolbar button.is-active {
  background: var(--mag-yellow);
  border-color: var(--mag-yellow);
  color: #1a1a18;
}

.crop-frame {
  border-color: var(--mag-yellow) !important;
}

.image-choice {
  border-radius: var(--mag-radius-sm);
  background: var(--soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.image-choice.is-dragover {
  border-color: color-mix(in srgb, var(--mag-yellow) 70%, var(--line));
  background: color-mix(in srgb, var(--mag-yellow) 16%, var(--soft));
}

.toast--mag {
  border-radius: 12px;
  background: var(--ink);
  box-shadow: var(--mag-shadow);
}

html.dark .toast--mag {
  background: #1e221e;
  color: var(--ink);
}

.scroll-top-btn {
  position: fixed;
  right: max(20px, calc((100vw - 1220px) / 2 + 20px));
  bottom: 24px;
  z-index: 25;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #171918;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.2s,
    visibility 0.2s,
    transform 0.2s,
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.scroll-top-btn:not([hidden]) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:not([hidden]):hover {
  background: var(--mag-yellow);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

.scroll-top-btn:not([hidden]):active {
  transform: translateY(-1px) scale(0.97);
}

.scroll-top-btn:focus-visible {
  outline: 2px solid var(--mag-yellow);
  outline-offset: 3px;
}

.scroll-top-btn .fa-arrow-up {
  font-size: 13px;
  line-height: 1;
}

@media (max-width: 600px) {
  .scroll-top-btn {
    right: 16px;
    bottom: 20px;
    width: 42px;
    height: 42px;
  }
}

.primary {
  border-radius: 999px;
}

.error {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, #dc5144 12%, var(--card));
}

.success {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, #577b36 14%, var(--card));
}

/* ——— Dark theme fine-tuning ——— */
html.dark body {
  background: var(--mag-bg);
}

html.dark .header {
  background: color-mix(in srgb, var(--mag-bg) 90%, transparent);
}

html.dark .hero-side-card {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
}

html.dark .hero-side .hero-side-card {
  border-bottom-color: var(--line);
}

html.dark .article-card,
html.dark .filter-bar,
html.dark .icon-btn,
html.dark .back-pill {
  box-shadow: none;
}

html.dark .filter-bar button.active {
  background: color-mix(in srgb, var(--mag-yellow) 16%, var(--card));
}

html.dark .newsletter-form input {
  color: #121412;
}

html.dark .hero-arrow {
  background: var(--mag-yellow);
  color: #121412;
  border: 1px solid color-mix(in srgb, #fff 28%, transparent);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.55);
}

html.dark .hero-arrow:hover {
  background: color-mix(in srgb, var(--mag-yellow) 78%, #fff);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.62);
}

html.dark .hero-arrow:focus-visible {
  outline-color: color-mix(in srgb, var(--mag-yellow) 85%, #fff);
}

html.dark .scroll-top-btn {
  background: var(--mag-yellow);
  color: #121412;
  border: 1px solid color-mix(in srgb, #fff 28%, transparent);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.55);
}

html.dark .scroll-top-btn:not([hidden]):hover {
  background: color-mix(in srgb, var(--mag-yellow) 78%, #fff);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.62);
}

html.dark .scroll-top-btn:focus-visible {
  outline-color: color-mix(in srgb, var(--mag-yellow) 85%, #fff);
}

html.dark .site-footer {
  background: color-mix(in srgb, var(--card) 100%, transparent);
}

html.dark .toast--mag {
  color: #f2f4ee;
}

/* Компактная модалка — только форма входа */
.modal.modal-admin.modal-admin--login,
#adminModal.modal-admin--login,
.modal.modal-admin:has(#loginForm),
#adminModal:has(#loginForm) {
  width: min(400px, calc(100vw - 40px)) !important;
  padding: 22px 20px 24px;
}

.modal-admin--login .modal-head,
.modal-admin:has(#loginForm) .modal-head {
  margin-bottom: 14px;
  padding-right: 40px;
}

.modal-admin--login > .close,
.modal-admin:has(#loginForm) > .close {
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.modal-admin--login .modal-head h2,
.modal-admin:has(#loginForm) .modal-head h2 {
  font-size: 1.35rem;
}

.modal-admin--login #adminMsg:empty,
.modal-admin:has(#loginForm) #adminMsg:empty {
  display: none;
}

.modal-admin--login #loginForm,
.modal-admin:has(#loginForm) #loginForm {
  width: 100%;
  max-width: none;
  margin: 0;
}

.modal-admin #loginForm .primary,
.modal-admin--login #loginForm .primary {
  width: 100%;
  margin-top: 4px;
}

#adminPanel .form-row {
  flex-wrap: wrap;
}

.article-form-actions {
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.article-form-actions .primary,
.article-form-actions .secondary {
  padding: 10px 13px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 999px;
  box-sizing: border-box;
}

.article-form-actions .primary {
  border: 1px solid transparent;
}

@media (prefers-reduced-motion: reduce) {
  .article-card:hover {
    transform: none;
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .pub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-magazine {
    grid-template-columns: 1fr;
  }

  .hero-feature {
    min-height: 320px;
  }

  .article-layout--with-aside {
    grid-template-columns: 1fr;
  }

  .article-more {
    position: static;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 850px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
    justify-self: start;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 4px;
  }

  .head-right {
    grid-column: 2;
  }

  .brand {
    grid-column: 1;
  }

  .btn-subscribe {
    display: none;
  }

  .bottom-band {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .pub-grid {
    grid-template-columns: 1fr;
  }

  .hero-side-card {
    grid-template-columns: 88px 1fr;
  }

  .hero-side-card .thumb {
    width: 88px;
    height: 72px;
  }

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

}

/* Editorial homepage refinement based on the supplied magazine reference. */
:root {
  --mag-bg: #fff;
  --mag-yellow: #ffc928;
  --mag-yellow-hover: #f1b900;
  --mag-radius: 14px;
  --mag-radius-sm: 10px;
  --mag-shadow: 0 8px 28px rgba(20, 24, 31, 0.08);
}

html.dark {
  --mag-bg: #15171b;
  --mag-yellow: #ffc928;
  --mag-yellow-hover: #f1b900;
}

body {
  font-family: Manrope, 'DM Sans', Arial, sans-serif;
}

.wrap {
  max-width: 1280px;
  width: calc(100% - 72px);
}

.header {
  height: 64px;
  background: color-mix(in srgb, var(--mag-bg) 94%, transparent);
}

.header-inner {
  height: 64px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
}

.brand {
  font-size: 28px;
  letter-spacing: -1.3px;
}

.brand-mark {
  transform: scale(1.15);
  margin-right: 2px;
}

.nav {
  gap: clamp(12px, 2vw, 28px);
  overflow: hidden;
  white-space: nowrap;
}

.nav button {
  font-size: 13px;
}

.head-right {
  gap: 7px;
}

.head-right > .icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 50%;
}

.head-right > .icon-btn:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, var(--line));
  background: var(--card);
}

#theme {
  line-height: 1;
}

.btn-subscribe {
  padding: 10px 18px;
  white-space: nowrap;
}

.admin-link {
  padding: 9px 12px;
  white-space: nowrap;
}

.hero-magazine {
  grid-template-columns: minmax(0, 1.58fr) minmax(360px, 1fr);
  gap: 16px;
  padding: 34px 0 28px;
}

.hero-feature {
  min-height: 434px;
  box-shadow: none;
}

.hero-feature-body {
  padding: 28px 32px 26px;
}

.hero-feature h2 {
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 1.08;
  width: 100%;
  max-width: none;
  letter-spacing: -1.1px;
}

.hero-feature .hero-excerpt {
  width: 100%;
  max-width: none;
}

.hero-side {
  gap: 0;
}

.hero-side-card {
  grid-template-columns: minmax(145px, 44%) minmax(0, 1fr);
  gap: 16px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.hero-side-card:last-child {
  border-bottom: 0;
}

.hero-side-card:hover {
  border-color: var(--line);
}

.hero-side-card .thumb {
  width: 100%;
  height: 100%;
  min-height: 112px;
  border-radius: var(--mag-radius-sm);
}

.hero-side-card .side-cat {
  display: inline-block;
  padding: 4px 8px;
  background: var(--soft);
  border-radius: 6px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

.hero-side-card h3 {
  font-size: 15px;
  line-height: 1.3;
}

.hero-side-card .read-time {
  font-size: 11px;
}

.filter-bar {
  justify-content: space-between;
  gap: 8px;
  padding: 11px 24px;
  background: var(--soft);
  border: 0;
  border-radius: 14px;
  margin-bottom: 38px;
}

.filter-bar button {
  opacity: 1;
  padding: 7px 10px;
}

.filter-bar button.active {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.filter-bar .fi {
  font-size: 18px;
}

.pub-section-head {
  margin-bottom: 22px;
}

.pub-section-head h2 {
  font-size: 29px;
  letter-spacing: -0.9px;
}

.pub-section-head a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pub-grid {
  gap: 20px 16px;
}

.article-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.article-card:hover {
  box-shadow: none;
  transform: none;
}

.card-image {
  height: auto;
  aspect-ratio: 1.72;
  border-radius: 9px;
  overflow: hidden;
}

.card-body {
  padding: 10px 3px 0;
}

.card-kicker {
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.card-title {
  font-size: 15px;
  line-height: 1.3;
  margin: 6px 0 9px;
  letter-spacing: -0.25px;
}

.card-meta {
  color: var(--muted);
}

.bottom-band {
  grid-template-columns: minmax(330px, 0.62fr) minmax(0, 1fr);
  gap: 42px;
  margin-top: 26px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  align-items: stretch;
}

.popular-block h2 {
  font-size: 24px;
  margin-bottom: 14px;
}

.popular-item {
  grid-template-columns: 38px 1fr auto;
  gap: 14px;
  padding: 10px 0;
}

.popular-item h3 {
  font-size: 13px;
  line-height: 1.35;
}

.newsletter-cta {
  min-height: 0;
  height: 100%;
  padding: 30px 38px;
  justify-content: center;
  background: #20242d;
}

.newsletter-cta::before {
  background-position: center 48%;
}

.newsletter-cta::after {
  background: linear-gradient(90deg, rgba(19, 24, 34, 0.9), rgba(19, 24, 34, 0.16));
}

.newsletter-cta h3 {
  width: 100%;
  max-width: none;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.18;
  letter-spacing: -0.7px;
}

.newsletter-cta p {
  width: 100%;
  max-width: none;
}

.newsletter-form {
  flex-wrap: nowrap;
}

.newsletter-form input {
  border-radius: 9px;
}

#newsletterForm input:focus,
#newsletterForm input:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

.newsletter-form button {
  border-radius: 9px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .hero-magazine {
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  }

  .hero-feature {
    min-height: 390px;
  }

  .hero-side-card {
    grid-template-columns: 40% minmax(0, 1fr);
  }

  .hero-side-card .thumb {
    min-height: 96px;
  }
}

@media (max-width: 850px) {
  .wrap {
    width: calc(100% - 40px);
  }

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

  .nav {
    grid-column: 1 / -1;
    margin: 0;
  }

  .hero-magazine {
    grid-template-columns: 1fr;
  }

  .hero-side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .hero-side-card {
    display: block;
    border: 0;
  }

  .hero-side-card .thumb {
    height: auto;
    aspect-ratio: 1.5;
    margin-bottom: 9px;
  }

  .bottom-band {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .newsletter-cta {
    height: auto;
    min-height: 260px;
  }
}

@media (max-width: 600px) {
  .wrap {
    width: calc(100% - 32px);
  }

  .header,
  .header-inner {
    height: 64px;
  }

  .brand {
    font-size: 23px;
  }

  .head-right {
    gap: 2px;
  }

  .head-right-group--search #bookmark,
  .head-right #theme {
    display: none;
  }

  .btn-subscribe {
    padding: 9px 12px;
    font-size: 12px;
  }

  .hero-magazine {
    padding: 20px 0;
    gap: 12px;
  }

  .hero-feature {
    min-height: 360px;
  }

  .hero-feature-body {
    padding: 22px 19px;
  }

  .hero-feature h2 {
    width: 100%;
    max-width: none;
    font-size: 30px;
  }

  .hero-feature .hero-excerpt {
    max-width: 100%;
  }

  .hero-side {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero-side-card {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-side-card .thumb {
    width: 112px;
    min-height: 82px;
    aspect-ratio: auto;
    margin: 0;
  }

  .filter-bar {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    margin-bottom: 28px;
    padding: 9px 12px;
  }

  .filter-bar button {
    white-space: nowrap;
  }

  .pub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .card-image {
    aspect-ratio: 1.4;
  }

  .card-body {
    padding: 8px 1px 0;
  }

  .card-title {
    font-size: 14px;
  }

  .bottom-band {
    margin-top: 24px;
    padding-top: 24px;
  }

  .newsletter-cta {
    min-height: 260px;
    padding: 24px 20px;
  }

  .newsletter-form {
    flex-wrap: wrap;
  }

  .newsletter-form input,
  .newsletter-form button {
    width: 100%;
  }
}
