/* =============================================================================
   Know.Travel — Article Page
   3-column layout: TOC | Content | Ads
   Template-specific styles only. Content components in general.css
   ============================================================================= */

/* ============================================
   PAGE LAYOUT — 3 columns
   ============================================ */
.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px) 300px;
  gap: 0 32px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px 60px;
  align-items: start;
}

/* No-ads: drop right column entirely, keep TOC + content */
.article-layout.no-ads {
  grid-template-columns: 220px minmax(0, 760px);
  max-width: 1080px;
}

/* no-ads: при ширине 980–1280px TOC снова видна (места хватает без правой колонки) */
@media (min-width: 981px) and (max-width: 1280px) {
  .article-layout.no-ads .toc-sidebar {
    display: block;
  }
}

/* no-ads: ≤980px — одна колонка (было ≤1024px с рекламой) */
@media (max-width: 980px) {
  .article-layout.no-ads {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
  }
}

/* No headings: collapse grid to 2 columns (same as ≤1280px) */
.article-layout.toc-empty {
  grid-template-columns: minmax(0, 760px) 300px;
  max-width: 1120px;
}

.article-layout.toc-empty.no-ads {
  grid-template-columns: minmax(0, 760px);
  max-width: 840px;
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb-row {
  grid-column: 1 / -1;
  padding: 20px 0 0;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
.breadcrumb-row a {
  color: var(--accent-blue);
  text-decoration: none;
}
.breadcrumb-row a:hover {
  text-decoration: underline;
}
.breadcrumb-row .bc-sep {
  margin: 0 6px;
  opacity: 0.5;
}

/* Tags — pushed to the right */
.bc-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
  padding-left: 16px;
}

.bc-tags .tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}

.bc-tags .tag:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--accent-blue-muted);
}


/* ============================================
   LEFT COLUMN — TOC Sidebar
   ============================================ */
.toc-sidebar {
  position: sticky;
  top: 80px;
  padding: 24px 0;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.toc-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  padding-left: 2px;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 2px;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toc-link.active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
  background: var(--accent-blue-muted);
}

.toc-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 16px;
  flex-shrink: 0;
}

.toc-link.active .toc-num {
  color: var(--accent-blue);
}

/* ============================================
   COLLAPSED TOC — sticky bar (tablets / when sidebar hidden)
   ============================================ */
.toc-collapsed {
  display: none;
  position: sticky;
  top: 64px;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  transition: background 0.35s, border-color 0.35s;
}

.toc-collapsed-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
}

.toc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.toc-toggle:hover {
  color: var(--text-primary);
}

.toc-toggle-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: transform 0.2s;
}

.toc-toggle.open .toc-toggle-icon {
  transform: rotate(180deg);
}

.toc-toggle-label {
  flex: 1;
  text-align: left;
}

.toc-toggle-current {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-dropdown {
  display: none;
  padding: 0 0 12px;
}

.toc-dropdown.open {
  display: block;
}

.toc-dropdown .toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-dropdown .toc-link {
  padding: 8px 10px;
  font-size: 14px;
  border-left: none;
  border-radius: 8px;
}

/* ============================================
   CENTER COLUMN — Article content
   ============================================ */
.article {
  padding: 24px 0 80px;
  min-width: 0;
}

/* ============================================
   ARTICLE META — author / dates / readtime / tags
   ============================================ */
.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

/* Left group: icon+text items */
.article-meta-info {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.meta-item-updated {
  color: var(--accent-blue);
  opacity: 0.85;
}

.meta-sep {
  color: var(--text-tertiary);
  opacity: 0.35;
  font-size: 13px;
  padding: 0 2px;
  user-select: none;
}

.meta-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.meta-item-updated .meta-icon {
  opacity: 1;
  color: var(--accent-blue);
}

/* Right group: tag badges */
.article-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* .tag from design system — overrides for article context */
.article-meta-tags .tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}

.article-meta-tags .tag:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--accent-blue-muted);
}

/* Headings */
.article h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 14px;
}

.article-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}

.article h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
  scroll-margin-top: 80px;
}

.article h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 28px 0 10px;
  scroll-margin-top: 80px;
}

/* Text */
.article p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 18px;
  transition: color 0.35s;
}

.article p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article a {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: none;
  position: relative;
}
.article a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent-blue);
  transition: width 0.3s;
}
.article a:hover::after {
  width: 100%;
}

/* ============================================
   LINK CLASSES — optional styles for <a> in articles
   Usage: <p class="link-offset">text with <a>links</a></p>
   Or on wrapper: <div class="link-glow">...</div>
   ============================================ */

/* .link-offset — underline sits lower, via text-underline-offset */
.link-offset a { border-bottom: none; position: static; text-decoration: underline; text-decoration-color: rgba(59,130,246,0.5); text-underline-offset: 4px; text-decoration-thickness: 1px; transition: text-decoration-color 0.2s; }
.link-offset a::after { display: none; }
.link-offset a:hover { text-decoration-color: var(--accent-blue); }

/* .link-plain — color only, no underline, fades on hover */
.link-plain a { border-bottom: none; position: static; transition: opacity 0.2s; }
.link-plain a::after { display: none; }
.link-plain a:hover { opacity: 0.7; }

/* .link-arrow — arrow › appears on hover */
.link-arrow a { border-bottom: none; position: static; }
.link-arrow a::after { content: ' ›'; position: static; width: auto; height: auto; background: none; opacity: 0; transition: opacity 0.2s, margin-left 0.2s; margin-left: -4px; }
.link-arrow a:hover::after { width: auto; opacity: 1; margin-left: 1px; }

/* .link-border — subtle border appears around link on hover */
.link-border a { border-bottom: none; position: static; padding: 0 4px; margin: 0 -4px; border-radius: 4px; border: 1px solid transparent; transition: border-color 0.2s; }
.link-border a::after { display: none; }
.link-border a:hover { border-color: rgba(59,130,246,0.3); }

/* .link-shift — blue → purple color transition */
.link-shift a { border-bottom: none; position: static; transition: color 0.3s; }
.link-shift a::after { display: none; }
.link-shift a:hover { color: var(--accent-purple); }

/* .link-double — double underline */
.link-double a { border-bottom: none; position: static; text-decoration: underline; text-decoration-style: double; text-decoration-color: rgba(59,130,246,0.3); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color 0.2s; }
.link-double a::after { display: none; }
.link-double a:hover { text-decoration-color: var(--accent-blue); }

/* .link-glow — soft text glow on hover */
.link-glow a { border-bottom: none; position: static; transition: text-shadow 0.2s; }
.link-glow a::after { display: none; }
.link-glow a:hover { text-shadow: 0 0 8px rgba(59,130,246,0.4); }

/* .link-highlight — subtle bg tint on hover */
.link-highlight a { border-bottom: none; position: static; padding: 1px 4px; margin: 0 -4px; border-radius: 4px; transition: background 0.2s; }
.link-highlight a::after { display: none; }
.link-highlight a:hover { background: var(--tint-blue-bg); }


/* CTA overrides — reset article link styles + disable animated underline */
.article a.cta-btn { position: static; }
.article a.cta-btn::after { display: none; }
.article a.cta-btn {
  border: 1px solid var(--border-default);
}
.article a.cta-btn:hover {
  border: 1px solid var(--accent-blue);
}
.article a.cta-primary {
  border: 1px solid var(--accent-blue);
}
.article a.cta-primary:hover {
  color: #fff;
}
.article a.cta-ghost,
.article a.cta-ghost:hover {
  border-color: transparent;
}
.article a.cta-underline,
.article a.cta-underline:hover,
.article a.cta-minimal,
.article a.cta-minimal:hover {
  border: none;
}
.article a.cta-glass {
  border: 1px solid rgba(128,128,128,0.15);
}
.article a.cta-glass:hover {
  border: 1px solid rgba(128,128,128,0.25);
}
.article a.cta-green { border-color: var(--status-success); }
.article a.cta-green:hover { border-color: var(--status-success); color: #fff; }
.article a.cta-orange { border-color: var(--accent-orange); }
.article a.cta-orange:hover { border-color: var(--accent-orange); color: #fff; }
.article a.cta-pink { border-color: var(--accent-pink); }
.article a.cta-pink:hover { border-color: var(--accent-pink); color: #fff; }
.article a.cta-dark { border-color: var(--text-primary); }
.article a.cta-dark:hover { border-color: var(--text-primary); color: var(--bg-base); }
.article .cta-inline {
  position: static;
  border: none;
  border-bottom: 1px dashed var(--accent-blue-muted);
}
.article .cta-inline::after { display: none; }
.article .cta-inline:hover {
  border: none;
  border-bottom: 1px solid var(--accent-blue);
}

/* Reset article list styles inside components */
.article .pros-col ul,
.article .cons-col ul,
.article .checklist {
  padding-left: 0;
  margin: 0;
}

.article .pros-col li,
.article .cons-col li {
  padding-left: 28px;
  margin-bottom: 0;
}

/* Hero image removed — using article-img-solo instead */

/* (Content components: info-box, callout, kv-grid, table, badges, app-cards — see general.css) */
/* (Image layouts: figure, solo, paired, zoom hint, lightbox — see general.css) */
/* (Lazy loading + Three Dots loader — see general.css) */

/* ============================================
   RIGHT COLUMN — Ad Sidebar
   ============================================ */
.ad-sidebar {
  position: sticky;
  top: 80px;
  padding: 24px 0;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow: clip;
}

.ad-sidebar-top {
  margin-bottom: 8px;
}

.ad-free-link {
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.45;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}

.ad-free-link:hover {
  opacity: 0.8;
  text-decoration: none;
}

.ad-group {
  display: none;
}

.ad-group .ad-slot {
  margin-bottom: 12px;
}

.ad-group .ad-slot:last-child {
  margin-bottom: 0;
}

/* Ad slot placeholder */
.ad-slot {
  width: 300px;
  min-height: 250px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px dashed var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  opacity: 0.5;
  transition: background 0.35s, border-color 0.35s;
}

.ad-slot-skyscraper {
  min-height: 600px;
}

.ad-slot-rectangle {
  min-height: 250px;
}

/* When real ads load, hide placeholder text */
.ad-slot ins {
  display: block;
}

/* ============================================
   RESPONSIVE — TABLET (hide left TOC, show collapsed)
   ============================================ */
@media (max-width: 1280px) {
  .article-layout {
    grid-template-columns: minmax(0, 760px) 300px;
    max-width: 1120px;
  }

  .breadcrumb-row {
    grid-column: 1 / -1;
  }

  .toc-sidebar {
    display: none;
  }

  .toc-collapsed {
    display: block;
  }
}

/* ============================================
   RESPONSIVE — SMALL TABLET (hide ads sidebar too)
   ============================================ */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
  }

  .ad-sidebar {
    display: none;
  }

  .toc-collapsed {
    top: 56px;
  }
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 640px) {
  .article-layout {
    padding: 0 16px;
  }

  .article h1 {
    font-size: 26px;
  }

  .article {
    padding: 20px 0 60px;
  }

  .article h2 {
    font-size: 21px;
    scroll-margin-top: 120px;
  }

  .article h3 {
    scroll-margin-top: 120px;
  }

  .toc-collapsed {
    top: 56px;
  }

  /* Breadcrumb tags: wrap to new row on mobile */
  .bc-tags {
    margin-left: 0;
    padding-left: 0;
    width: 100%;
    margin-top: 6px;
  }

  /* Meta: stack vertically on mobile */
  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .article-meta-info {
    gap: 3px;
  }

  .article-meta-tags {
    gap: 5px;
  }

  .article-meta-tags .tag {
    font-size: 11px;
    padding: 3px 9px;
  }

  .toc-collapsed-inner {
    padding: 0 16px;
  }
}
/* ============================================
   DEV TOGGLE — admin only, not rendered for guests
   ============================================ */
.dev-ad-toggle {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.dev-ad-toggle:hover {
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}
.dev-ad-toggle.active {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: var(--accent-blue-muted);
}

/* ============================================
   STICKY AD BAR — mobile (320x100) + tablet (728x90)
   ============================================ */
.mob-ad-bar {
  display: none; /* shown via media query */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  flex-direction: column;
  align-items: center;
}

/* Controls row */
.mob-ad-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  max-width: 320px;
  padding: 0 4px 2px;
  gap: 6px;
}

.mob-ad-free-link {
  font-size: 11px;
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
  transition: color 0.2s, text-decoration-color 0.2s;
  margin-right: auto;
  white-space: nowrap;
}

.mob-ad-free-link:hover {
  color: var(--accent-blue);
  text-decoration-color: var(--accent-blue);
}

.mob-ad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.mob-ad-btn:hover,
.mob-ad-btn:active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mob-ad-minimize svg {
  transition: transform 0.3s ease;
}

/* Ad slots */
.mob-ad-slot {
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mob-ad-slot-mobile { width: 100%; height: 280px; }
.mob-ad-slot-tablet { width: 100%; height: 280px; }

/* Both hidden by default — media queries show correct one */
.mob-ad-slot-mobile,
.mob-ad-slot-tablet { display: none; }

.mob-ad-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-default);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  opacity: 0.5;
  letter-spacing: 0.5px;
}

/* Mobile: <=640px */
@media (max-width: 640px) {
  .mob-ad-bar {
    display: flex;
  }
  .mob-ad-slot-mobile {
    display: flex;
  }
  .article {
    padding-bottom: 328px; /* 280px ad + 28px controls + 20px gap */
  }
}

/* Tablet: 641-1024px */
@media (min-width: 641px) and (max-width: 1024px) {
  .mob-ad-bar {
    display: flex;
  }
  .mob-ad-slot-tablet {
    display: flex;
  }
  .mob-ad-controls {
    max-width: 100%;
    padding: 0 16px 4px;
  }
  .article {
    padding-bottom: 328px; /* 280px ad + 28px controls + 20px gap */
  }
}

/* ============================================
   RELATED ARTICLES
   ============================================ */
.related-articles {
  border-top: 1px solid var(--border-default);
  padding: 48px 28px 64px;
  max-width: 1400px;
  margin: 0 auto;
  transition: border-color 0.35s;
}

.related-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.related-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s, background 0.35s;
  will-change: transform;
}

.related-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Image — lazy-wrapper делает position:relative и overflow:hidden сам,
   мы только задаём размеры и aspect-ratio */
.related-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  background: var(--bg-hover);
}

/* Картинка поверх loader (general.css: loader z-index:0, img z-index:1) */
.related-card-img .lazy-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1;
}

.related-card-img .lazy-image.loaded {
  opacity: 1;
}

.related-card:hover .lazy-image.loaded {
  transform: scale(1.03);
}

/* Body */
.related-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.related-card-body h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  margin: 0;
  transition: color 0.2s;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card:hover .related-card-body h3 {
  color: var(--accent-blue);
}

.related-card-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: auto;
}

@media (max-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .related-articles {
    padding: 36px 20px 48px;
  }
}

@media (max-width: 480px) {
  .related-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .related-articles {
    padding: 32px 16px 48px;
  }
  .related-card-body h3 {
    -webkit-line-clamp: 2;
  }
}