:root{
  --brand:#1f6feb;

  /* Dark site shell */
  --bg:#0f1720;
  --text:#eaeaea;
  --muted:#9aa7b2;
  --line:#1b2432;
  --shadow:0 8px 24px rgba(0,0,0,.25);

  /* Article (white) */
  --articleBg:#ffffff;
  --articleText:#0b1220;
  --articleMuted:#334155;
  --articleBorder:#e5e7eb;
  --articleLink:#1f6feb;

  /* Accents */
  --accentDark:#071023;   /* note/table head bg */
  --accentDark2:#0b152b;  /* author box bg */
  --radius:16px;
}

/* =======================================================================
   BASE
   ======================================================================= */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Inter,system-ui,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Links (default for dark shell) */
a{color:#9ec4ff;text-underline-offset:2px}
a:hover{opacity:.96}
a:focus-visible{
  outline:2px solid var(--brand);
  outline-offset:2px;
  border-radius:10px;
}

/* =======================================================================
   LAYOUT
   ======================================================================= */
.container{
  max-width:980px;
  margin:32px auto;
  padding:24px;
}

/* Default card (useful for blocks) */
.card{
  border-radius:var(--radius);
  padding:24px;
  box-shadow:var(--shadow);
}

/* Article main card = WHITE (эталон) */
main.card{
  background:var(--articleBg);
  color:var(--articleText);
  border:1px solid var(--articleBorder);
}

/* Ensure article typography colors */
main.card .meta,
main.card .small{ color:var(--articleMuted); }

main.card a{
  color:var(--articleLink);
  font-weight:700;
}
main.card a:hover{ opacity:.95 }

/* HR inside article */
main.card hr{
  border:0;
  border-top:1px solid var(--articleBorder);
  margin:20px 0;
}

/* =======================================================================
   TYPOGRAPHY
   ======================================================================= */
h1{font-size:34px; margin:10px 0 14px; line-height:1.18}
h2{font-size:24px; margin:24px 0 10px; line-height:1.25}
h3{font-size:18px; margin:18px 0 8px; line-height:1.28}

.meta{
  font-size:14px;
  margin-top:-6px;
  margin-bottom:16px;
}
.small{font-size:12px}

/* =======================================================================
   HEADER (smart baseline)
   ======================================================================= */
.header{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin-bottom:16px;
  text-align:center;
}
.header img{ max-width:120px; height:auto }
.badge{
  display:inline-block;
  border:1px solid var(--brand);
  color:var(--brand);
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
}
@media (min-width:600px){
  .header{
    flex-direction:row;
    justify-content:flex-start;
    text-align:left;
  }
  .badge{margin-left:8px}
}

/* =======================================================================
   HERO (cross-browser safe)
   ======================================================================= */
.hero{
  display:block;
  width:100%;
  height:min(56.25vw,420px);
  object-fit:cover;
  object-position:center;
  border-radius:12px;
  margin:0 auto 16px;
  box-shadow:0 10px 26px rgba(0,0,0,.22);
}
@supports (aspect-ratio:1/1){
  .hero{ height:auto; aspect-ratio:1200/630; }
}

/* =======================================================================
   BUTTONS (эталон)
   ======================================================================= */
.btn,
.btn-cta{
  display:inline-block;
  text-decoration:none;
  padding:12px 18px;
  border-radius:10px;
  margin:10px 8px 10px 0;
  font-weight:800;
  transition:transform .08s ease, box-shadow .2s ease, opacity .2s ease;
  color:#fff !important;
}
.btn:active,
.btn-cta:active{ transform:translateY(1px) }

.btn{
  background:var(--brand);
  box-shadow:0 4px 12px rgba(31,111,235,.45);
}
.btn:hover{ opacity:.98; box-shadow:0 6px 16px rgba(31,111,235,.55) }

.btn-cta{
  background:linear-gradient(90deg,#1f6feb,#3291ff);
  box-shadow:0 6px 16px rgba(31,111,235,.45);
}
.btn-cta:hover{
  opacity:1;
  box-shadow:0 10px 22px rgba(31,111,235,.55);
}

/* =======================================================================
   CALLOUTS (NOTE / TIP / WARN) — эталон: тёмный блок на белой статье
   ======================================================================= */
.note,.tip,.warn{
  border-radius:12px;
  padding:14px 16px;
  margin:16px 0;
  background:var(--accentDark);
  border:1px solid var(--line);
  color:#eaeaea;
}
.note strong,.tip strong,.warn strong{font-weight:900}
.note a,.tip a,.warn a{
  color:#9ec4ff !important;
  font-weight:900;
  text-decoration:underline;
  text-underline-offset:2px;
}

.warn{
  background:rgba(255,99,71,.10);
  border:1px solid rgba(255,99,71,.32);
  color:var(--articleText);
}
.warn a{ color:var(--articleLink) !important; }

/* Fix: NEVER allow opacity/filter inheritance bugs */
.note,.tip,.warn,
.note *,.tip *,.warn *{
  opacity:1 !important;
  filter:none !important;
  -webkit-filter:none !important;
  mix-blend-mode:normal !important;
}

/* =======================================================================
   TABLES — ALWAYS WHITE + BLACK (HARD FIX)
   ======================================================================= */
.table-scroll{
  overflow-x:auto;
  margin:16px 0;
  border-radius:14px;
  border:1px solid var(--articleBorder);
  background:#fff !important;
  -webkit-overflow-scrolling:touch;
}

.table-scroll table{
  border-collapse:collapse;
  width:100%;
  min-width:760px;
  background:#fff !important;
  color:#000 !important;
}

.table-scroll caption{
  caption-side:top;
  text-align:left;
  padding:10px 12px;
  font-weight:900;
  color:#000 !important;
}

.table-scroll th,
.table-scroll td{
  border:1px solid #dbe3ef;
  padding:10px 12px;
  font-size:14px;
  color:#000 !important;
  background:#fff !important;
  vertical-align:top;
}

.table-scroll th{
  background:var(--accentDark) !important;
  color:#fff !important;
  border-color:#0b152b !important;
  font-weight:900;
}

.table-scroll tbody tr:nth-child(even) td{
  background:#f7fafc !important;
}
.table-scroll tbody tr:hover td{
  background:#eef6ff !important;
}

/* links inside tables = high contrast */
.table-scroll a{
  color:#0037a6 !important;
  font-weight:900;
  text-decoration:underline;
  text-underline-offset:2px;
}

/* =======================================================================
   SVG DIAGRAMS — ALWAYS READABLE (HARD FIX + responsive)
   ======================================================================= */
.svg-card{
  background:#fff !important;
  border:1px solid var(--articleBorder) !important;
  border-radius:12px;
  padding:12px;
  margin:16px 0;
}

.svg-title{
  font-weight:900;
  margin:0 0 8px;
  color:#000 !important;
}

.svg-scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.svg-scroll svg{
  max-width:100%;
  height:auto;
  display:block;
  color:#000 !important;
}

/* Force text visibility always */
.svg-scroll svg text{
  fill:#000 !important;
  font-weight:800 !important;
}

/* Force lines/borders contrast (если внутри svg не задано) */
.svg-scroll svg *{
  opacity:1 !important;
  filter:none !important;
  -webkit-filter:none !important;
}

/* =======================================================================
   YOUTUBE
   ======================================================================= */
.yt{
  position:relative;
  padding-bottom:56.25%;
  height:0;
  overflow:hidden;
  border-radius:12px;
  box-shadow:0 10px 26px rgba(0,0,0,.22);
  margin:14px 0;
}
.yt iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
}

/* =======================================================================
   AUTHOR BOX (эталон)
   ======================================================================= */
.author-box{
  display:flex;
  align-items:center;
  gap:16px;
  background:var(--accentDark2);
  padding:18px;
  border-radius:12px;
  margin-top:24px;
  color:#d0d8e0;
  box-shadow:0 10px 26px rgba(0,0,0,.22);
}
.author-box img{
  width:64px;height:64px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid var(--brand);
}
.author-box h3{margin:0;color:#fff;font-size:16px}
.author-box p{margin:6px 0 0;font-size:14px}

/* =======================================================================
   DISCLOSURES
   ======================================================================= */
.disclosures{
  background:var(--accentDark);
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  margin-top:18px;
  font-size:14px;
  color:#9aa7b2;
}
.disclosures a{ color:#9ec4ff !important; font-weight:900 }

/* =======================================================================
   COOKIE BANNER (white, readable)
   ======================================================================= */
#cookie-banner{
  position:fixed;
  bottom:16px;
  left:16px;
  right:16px;
  max-width:520px;
  margin:auto;
  background:#fff;
  color:#000;
  border-radius:14px;
  box-shadow:0 12px 32px rgba(0,0,0,.35);
  padding:14px 16px;
  font-size:14px;
  z-index:9999;
  display:none;
}
#cookie-banner.show{
  display:block;
  animation:fadeIn .35s ease;
}
#cookie-banner a{ color:var(--brand) !important; font-weight:900; text-decoration:underline; }
#cookie-banner button{
  background:var(--brand);
  color:#fff;
  border:0;
  border-radius:10px;
  padding:8px 14px;
  font-weight:900;
  cursor:pointer;
}
@keyframes fadeIn{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}

/* =======================================================================
   ✅ ZOOM MODAL (tables + SVG) — эталон
   ======================================================================= */
.zoom-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.75);
  z-index:99999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.zoom-overlay.show{ display:flex; }

.zoom-modal{
  width:min(1200px, 96vw);
  height:min(86vh, 860px);
  background:#0b1220;
  border:1px solid #1b2432;
  border-radius:14px;
  box-shadow:0 18px 60px rgba(0,0,0,.55);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.zoom-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  background:var(--accentDark);
  border-bottom:1px solid #1b2432;
  color:#fff;
}
.zoom-bar .hint{ font-size:12px; color:#cbd5e1; }

.zoom-btn{
  background:var(--brand);
  color:#fff;
  border:0;
  border-radius:10px;
  padding:8px 12px;
  font-weight:800;
  cursor:pointer;
}
.zoom-btn.secondary{ background:#111827; }

.zoom-stage{
  flex:1;
  position:relative;
  background:#000;
  overflow:hidden;
  touch-action:none; /* pinch/pan */
}

.zoom-canvas{
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%,-50%) scale(1);
  transform-origin:center center;
  will-change:transform;
}

/* Always readable in zoom too */
.zoom-canvas table{
  background:#fff !important;
  color:#000 !important;
}
.zoom-canvas th, .zoom-canvas td{
  color:inherit !important;
}
.zoom-canvas svg{
  max-width:none !important;
  height:auto !important;
  background:#fff;
}
.zoom-canvas svg text{
  fill:#000 !important;
  font-weight:800 !important;
}
