/* ===================================================================
   DH-Media — design tokens + base layout
   =================================================================== */

:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-muted: #f6f8fb;
  --bg-soft: #eff3f8;
  --text: #0b1220;
  --text-strong: #050811;
  --text-muted: #4b5563;
  --text-faint: #6b7280;
  --border: #e5e9f0;
  --border-strong: #cdd5e0;
  --accent: #0b5fff;
  --accent-hover: #0040d6;
  --accent-soft: #dbe7ff;
  --accent-on: #ffffff;
  --success: #0a8f5e;
  --critical: #c4310f;
  --shadow-1: 0 1px 2px rgba(11, 18, 32, 0.04), 0 1px 3px rgba(11, 18, 32, 0.06);
  --shadow-2: 0 4px 16px rgba(11, 18, 32, 0.08), 0 1px 3px rgba(11, 18, 32, 0.06);
  --shadow-3: 0 16px 48px rgba(11, 18, 32, 0.12);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --content-max: 1280px;
  --reading-max: 720px;
  --gutter: 24px;

  --serif: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", Consolas, monospace;

  --type-h1: clamp(2.4rem, 1.6rem + 2.6vw, 4rem);
  --type-h2: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem);
  --type-h3: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem);
  --type-body: 1.0625rem;
  --type-body-lg: 1.1875rem;
  --type-small: 0.875rem;
  --type-tiny: 0.75rem;

  --duration-fast: 120ms;
  --duration: 200ms;
  --easing: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a0e1a;
  --bg-elev: #0f1424;
  --bg-muted: #131a2c;
  --bg-soft: #1a2238;
  --text: #e6ebf5;
  --text-strong: #ffffff;
  --text-muted: #a4afc4;
  --text-faint: #7d8aa3;
  --border: #232c44;
  --border-strong: #364259;
  --accent: #5b8cff;
  --accent-hover: #82a8ff;
  --accent-soft: #1a2542;
  --accent-on: #0a0e1a;
  --success: #2dd49a;
  --critical: #ff7d6b;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 22px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 20px 56px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

/* respect OS-level preference if user hasn't toggled */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0e1a;
    --bg-elev: #0f1424;
    --bg-muted: #131a2c;
    --bg-soft: #1a2238;
    --text: #e6ebf5;
    --text-strong: #ffffff;
    --text-muted: #a4afc4;
    --text-faint: #7d8aa3;
    --border: #232c44;
    --border-strong: #364259;
    --accent: #5b8cff;
    --accent-hover: #82a8ff;
    --accent-soft: #1a2542;
    --accent-on: #0a0e1a;
    color-scheme: dark;
  }
}

/* ----- reset & base ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--type-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11", "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--duration) var(--easing), color var(--duration) var(--easing);
}
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color var(--duration-fast) var(--easing); }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }
::selection { background: var(--accent-soft); color: var(--text-strong); }

/* ===================================================================
   Koenig editor support classes
   (required by Ghost theme validator + actually used by editor markup)
   =================================================================== */
.kg-width-wide { max-width: 1080px; margin-left: auto; margin-right: auto; }
.kg-width-full { width: 100vw; max-width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.kg-image { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.kg-card { margin: 1.6em 0; }
.kg-card figcaption { text-align: center; font-size: var(--type-small); color: var(--text-faint); margin-top: 10px; font-family: var(--sans); }
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; max-width: 1080px; margin: 0 auto; }
.kg-gallery-row { display: flex; gap: 8px; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.kg-bookmark-card { margin: 1.6em 0; }
.kg-bookmark-container {
  display: flex; gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  color: inherit;
  text-decoration: none;
  transition: background var(--duration-fast) var(--easing), border-color var(--duration-fast) var(--easing);
}
.kg-bookmark-container:hover { background: var(--bg-muted); border-color: var(--border-strong); color: inherit; }
.kg-bookmark-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kg-bookmark-title {
  font-weight: 700;
  color: var(--text-strong);
  font-size: 1.0625rem;
  line-height: 1.3;
}
.kg-bookmark-description {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kg-bookmark-metadata {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 10px;
  font-size: var(--type-tiny);
  color: var(--text-faint);
}
.kg-bookmark-icon { width: 16px; height: 16px; flex: none; }
.kg-bookmark-author { color: var(--accent); font-weight: 600; }
.kg-bookmark-publisher { color: var(--text-faint); }
.kg-bookmark-thumbnail { flex: none; width: 160px; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 600px) {
  .kg-bookmark-container { flex-direction: column; }
  .kg-bookmark-thumbnail { width: 100%; }
}
.kg-callout-card { padding: 18px 22px; border-radius: var(--radius-md); background: var(--bg-muted); border-left: 3px solid var(--accent); margin: 1.6em 0; }
.kg-toggle-card { padding: 16px; border-radius: var(--radius-md); background: var(--bg-muted); margin: 1.4em 0; }
.kg-toggle-heading { font-weight: 700; color: var(--text-strong); }
.kg-product-card { padding: 18px; border-radius: var(--radius-md); background: var(--bg-elev); border: 1px solid var(--border); }
.kg-button-card { text-align: center; margin: 2em 0; }
.kg-header-card { padding: 48px 0; text-align: center; }

/* ----- container ----- */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }
.reading-container { max-width: var(--reading-max); margin: 0 auto; padding: 0 var(--gutter); }

/* ===================================================================
   header
   =================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
  color: var(--text-strong);
}
.brand .brand__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  align-self: center;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.nav { display: flex; gap: 22px; flex: 1; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 6px 0;
  position: relative;
}
.nav a:hover { color: var(--text-strong); }
.nav a.is-active { color: var(--text-strong); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--accent);
  border-radius: 2px;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--easing);
}
.icon-button:hover { background: var(--bg-muted); color: var(--text-strong); border-color: var(--border-strong); }
.icon-button svg { width: 18px; height: 18px; }
.subscribe-cta {
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--text-strong);
  color: var(--bg);
  font-weight: 600; font-size: 0.875rem;
  transition: opacity var(--duration-fast) var(--easing);
}
.subscribe-cta:hover { opacity: 0.85; color: var(--bg); }

@media (max-width: 720px) {
  .site-header__inner { gap: 16px; height: 60px; }
  .nav { display: none; }
  .nav.nav--mobile { display: flex; gap: 14px; overflow-x: auto; }
  .subscribe-cta { padding: 0 12px; font-size: 0.8125rem; }
}

/* ===================================================================
   hero (главная)
   =================================================================== */
.hero {
  padding: 36px 0 12px;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 36px;
}
@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; gap: 24px; }
}

.hero-card {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background: var(--bg-muted);
  min-height: 480px;
  color: inherit;
  box-shadow: var(--shadow-1);
  transition: transform var(--duration) var(--easing), box-shadow var(--duration) var(--easing);
}
.hero-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); color: inherit; }
.hero-card__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
}
.hero-card__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 40%, rgba(5,8,17,0.85) 100%);
  z-index: -1;
}
.hero-card--no-image { background: linear-gradient(135deg, var(--accent) 0%, #2a2dd6 100%); color: #ffffff; }
.hero-card--no-image .hero-card__overlay { display: none; }
.hero-card__body {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  color: #ffffff;
}
.hero-card__tag {
  display: inline-flex;
  align-self: flex-start;
  align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  font-size: var(--type-tiny);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  margin-bottom: 14px;
}
.hero-card__title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 12px;
}
.hero-card__dek {
  font-size: 1.0625rem;
  line-height: 1.5;
  opacity: 0.9;
  max-width: 60ch;
}
.hero-card__meta {
  margin-top: 18px;
  font-size: var(--type-small);
  opacity: 0.85;
}

/* secondary stack — 2 small in column */
.hero-stack { display: flex; flex-direction: column; gap: 20px; }
.stack-card {
  display: flex; gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  transition: transform var(--duration-fast) var(--easing);
}
.stack-card:hover { transform: translateX(2px); color: inherit; }
.stack-card:last-child { border-bottom: 0; padding-bottom: 0; }
.stack-card__img {
  width: 132px; height: 92px; flex: none;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  overflow: hidden;
}
.stack-card__img img { width: 100%; height: 100%; object-fit: cover; }
.stack-card__body { flex: 1; min-width: 0; }
.stack-card__tag { font-size: var(--type-tiny); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.stack-card__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.25;
  margin: 6px 0 6px;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.stack-card:hover .stack-card__title { color: var(--accent); }
.stack-card__meta { font-size: var(--type-tiny); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* ===================================================================
   section header
   =================================================================== */
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  padding: 36px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.section-head__title {
  font-family: var(--serif);
  font-size: var(--type-h3);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-head__title-accent { color: var(--accent); }
.section-head__more { color: var(--text-muted); font-size: var(--type-small); font-weight: 500; }
.section-head__more:hover { color: var(--accent); }

/* ===================================================================
   feed grid (2/3 + side)
   =================================================================== */
.feed {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
}
@media (max-width: 960px) {
  .feed { grid-template-columns: 1fr; gap: 32px; }
}

.feed__main { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 28px; }
@media (max-width: 720px) { .feed__main { grid-template-columns: 1fr; gap: 28px; } }

.feed__side {
  display: flex; flex-direction: column; gap: 32px;
  position: sticky; top: 96px; align-self: start;
}
@media (max-width: 960px) {
  .feed__side { position: static; }
}

/* ----- main card (article-card) ----- */
.card {
  display: flex; flex-direction: column;
  gap: 14px;
  color: inherit;
  transition: transform var(--duration-fast) var(--easing);
}
.card:hover { color: inherit; }
.card__img {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-muted);
}
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--easing); }
.card:hover .card__img img { transform: scale(1.03); }
.card__no-img {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-soft) 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px;
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.card__no-img::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 10%, rgba(11,95,255,0.28), transparent 50%);
  pointer-events: none;
}
.card__no-img-tag {
  font-family: var(--sans);
  font-size: var(--type-tiny);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
}
.card__no-img-title {
  font-family: var(--serif);
  font-size: 1.375rem; font-weight: 700; line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 6px;
}
.card__tag { font-size: var(--type-tiny); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.card__title {
  font-family: var(--serif);
  font-size: 1.375rem; line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  margin: 4px 0 6px;
}
.card:hover .card__title { color: var(--accent); }
.card__dek { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.45; }
.card__meta {
  font-size: var(--type-tiny); color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; gap: 10px; align-items: center;
}
.card__meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }

/* small list card on side */
.list-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.list-card:first-child { padding-top: 0; }
.list-card:last-child { border-bottom: 0; padding-bottom: 0; }
.list-card__num {
  font-family: var(--serif); font-weight: 800;
  font-size: 1.5rem; color: var(--text-faint);
  flex: none;
  line-height: 1;
  width: 28px;
}
.list-card__body { flex: 1; }
.list-card__title {
  font-family: var(--serif); font-weight: 700;
  font-size: 1rem; line-height: 1.3;
  color: var(--text-strong);
  margin: 0 0 4px;
}
.list-card:hover .list-card__title { color: var(--accent); }
.list-card__meta { font-size: var(--type-tiny); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* ----- side panel (sidebar block) ----- */
.side-panel {
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
}
.side-panel__title {
  font-family: var(--sans);
  font-size: var(--type-tiny);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 18px;
}

.side-panel--newsletter { background: linear-gradient(160deg, var(--accent) 0%, #2a2dd6 100%); color: #ffffff; border: 0; }
.side-panel--newsletter .side-panel__title { color: rgba(255,255,255,0.8); }
.side-panel--newsletter h3 {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 700; line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: #ffffff;
}
.side-panel--newsletter p { color: rgba(255,255,255,0.85); margin: 0 0 16px; font-size: 0.9375rem; }
.side-panel--newsletter form { display: flex; flex-direction: column; gap: 8px; }
.side-panel--newsletter input[type="email"] {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font: inherit;
}
.side-panel--newsletter input[type="email"]::placeholder { color: rgba(255,255,255,0.7); }
.side-panel--newsletter button {
  height: 42px;
  border: 0; border-radius: var(--radius-md);
  background: #ffffff; color: var(--accent);
  font-weight: 700;
  transition: opacity var(--duration-fast) var(--easing);
}
.side-panel--newsletter button:hover { opacity: 0.9; }

/* topic list */
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.topic-list a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500; font-size: 0.9375rem;
  transition: background var(--duration-fast) var(--easing);
}
.topic-list a:hover { background: var(--bg); color: var(--accent); }
.topic-list .count { color: var(--text-faint); font-size: var(--type-tiny); }

/* ===================================================================
   pagination
   =================================================================== */
.pagination {
  display: flex; justify-content: center; gap: 12px;
  padding: 56px 0;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center;
  height: 42px; padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-weight: 500; font-size: 0.9375rem;
  transition: all var(--duration-fast) var(--easing);
}
.pagination a:hover { background: var(--bg-muted); color: var(--accent); border-color: var(--border-strong); }

/* ===================================================================
   footer
   =================================================================== */
.site-footer {
  margin-top: 80px;
  padding: 56px 0 36px;
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
}
.site-footer__grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 36px;
}
@media (max-width: 720px) { .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.footer-col h4 {
  font-size: var(--type-tiny); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); font-weight: 700;
  margin: 0 0 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--text); font-size: 0.9375rem; }
.footer-col a:hover { color: var(--accent); }
.site-footer__bottom {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding-top: 36px; margin-top: 36px;
  border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: var(--type-small);
}
