/* SPDX-License-Identifier: MIT
 * Copyright (c) 2026 Toske-Programer (Web Security Scanner contributors)
 * =============================================
   BLOG COMMON CSS — Web Security Scanner
   Shared styles for all blog pages
   ============================================= */

/* === RESET & BASE === */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Global horizontal-overflow safety net: if any child element (table,
   pre, long URL, oversized image, misconfigured grid) tries to be wider
   than the viewport, we clip instead of giving the whole page a
   horizontal scroll bar. Each wide element should still have its own
   local scroll (pre has overflow-x:auto, tables get the same via the
   rule further down) so nothing becomes unreadable — but the <body>
   itself never scrolls sideways on any screen size. */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  font-family: 'Inter', sans-serif;
  background: #0a0c15;
  color: #e8eaf6;
  min-height: 100vh;
  line-height: 1.8;
}
a { color: #a78bfa; }
/* Prevent very long inline code (URLs, paths, tokens) from pushing the
   page wider than the viewport on mobile. */
code { word-break: break-word; overflow-wrap: break-word; }
/* Images should never exceed their container. This is a defensive
   default in case a blog article forgets the max-width on an inline
   <img> tag. */
img { max-width: 100%; height: auto; }

/* === LANGUAGE TOGGLE === */
.sr { display: block; } .en { display: none; }
body.lang-en .sr { display: none; } body.lang-en .en { display: block; }
/* inline variants */
span.sr { display: inline; } span.en { display: none; }
body.lang-en span.sr { display: none; } body.lang-en span.en { display: inline; }

/* === GLOBAL HEADER === */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,12,21,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #252a4a;
  padding: 0.6rem 1.5rem;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.header-brand {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: #e8eaf6;
  font-weight: 700; font-size: 0.95rem;
}
.header-brand svg { width: 22px; height: 22px; flex-shrink: 0; }
.header-version {
  font-size: 0.58rem; color: #7c3aed; background: rgba(124,58,237,0.12);
  padding: 0.1rem 0.35rem; border-radius: 4px; font-weight: 600;
  letter-spacing: 0.03em; margin-left: 0.15rem; cursor: default;
}
.header-nav {
  display: flex; align-items: center; gap: 0.3rem;
}
.header-nav a {
  color: #7b83a6; text-decoration: none; font-size: 0.8rem;
  padding: 0.35rem 0.7rem; border-radius: 6px; transition: all 0.2s;
}
.header-nav a:hover { color: #e8eaf6; background: #1a1e38; }
.header-nav a.active { color: #a78bfa; background: #1a1e38; }

/* Pro upsell CTA in the header — visually distinct from editorial nav links.
   Accent background so it reads as a premium action, not another article.
   On the pricing page itself it gets .active which inverts the colors. */
.header-nav a.nav-pro-cta {
  color: #0a0c15;
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border: 1px solid #a78bfa;
  margin-left: 0.25rem;
}
.header-nav a.nav-pro-cta:hover {
  background: linear-gradient(135deg, #c4b5fd, #ddd6fe);
  color: #0a0c15;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.3);
}
.header-nav a.nav-pro-cta.active {
  background: #0a0c15;
  color: #a78bfa;
  border-color: #a78bfa;
}

.lang-toggle { display: flex; gap: 0.3rem; margin-left: 0.5rem; }
.lang-btn {
  background: #1a1e38; border: 1px solid #252a4a; color: #7b83a6;
  border-radius: 6px; padding: 3px 8px; font-size: 0.72rem;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.lang-btn.active { background: #6c63ff; border-color: #6c63ff; color: #fff; }
.hamburger {
  display: none; background: none; border: none;
  color: #7b83a6; font-size: 1.4rem; cursor: pointer; padding: 0.3rem;
}

/* === LAYOUT: TIMELINE + CONTENT === */
.blog-layout {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 200px 1fr;
  gap: 0; padding: 2rem 1.5rem 0;
}
/* Ultra-wide screens (34" monitors, 3440x1440 and similar): let the
   blog layout breathe with a wider container, bigger timeline sidebar,
   and more padding so the content does not look like a narrow column
   stuck in the middle of a black viewport. Content column itself stays
   readable because .blog-content retains its own max-width. */
@media (min-width: 1800px) {
  .blog-layout {
    max-width: 1500px;
    grid-template-columns: 260px 1fr;
    padding: 3rem 2rem 0;
  }
}

/* === TIMELINE SIDEBAR === */
.timeline-nav {
  position: sticky; top: 70px; align-self: start;
  padding-right: 1.5rem;
  max-height: calc(100vh - 90px); overflow-y: auto;
}
.timeline-nav ol {
  list-style: none; padding: 0; margin: 0; position: relative;
}
.timeline-nav ol::before {
  content: ''; position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: #252a4a; border-radius: 2px;
}
.timeline-nav li {
  position: relative; padding-left: 22px; margin-bottom: 0.4rem;
}
.timeline-nav li::before {
  content: ''; position: absolute;
  left: 1px; top: 8px; width: 10px; height: 10px;
  border-radius: 50%; background: #252a4a;
  border: 2px solid #0a0c15; transition: all 0.3s; z-index: 1;
}
.timeline-nav li.active::before {
  background: #6c63ff;
  box-shadow: 0 0 8px rgba(108,99,255,0.5);
}
.timeline-nav a {
  color: #7b83a6; text-decoration: none;
  font-size: 0.75rem; line-height: 1.4;
  display: block; padding: 2px 0; transition: color 0.2s;
}
.timeline-nav li.active a { color: #a78bfa; font-weight: 600; }
.timeline-nav a:hover { color: #e8eaf6; }
.timeline-title {
  font-size: 0.7rem; font-weight: 700; color: #6c63ff;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.8rem; padding-left: 22px;
}

/* === BLOG CONTENT AREA === */
.blog-content {
  max-width: 760px; padding-bottom: 2rem;
}

/* === TYPOGRAPHY === */
h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; line-height: 1.3; }
h2[id] { scroll-margin-top: 80px; }
.subtitle { color: #7b83a6; margin-bottom: 2.5rem; font-size: 0.9rem; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 2.5rem 0 1rem; color: #a78bfa; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.7rem; color: #e8eaf6; }
p, li { color: #c0c4db; font-size: 0.93rem; margin-bottom: 0.7rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1.2rem; }

/* === CODE === */
code {
  background: #1a1e38; padding: 2px 6px;
  border-radius: 4px; font-size: 0.85rem; color: #a78bfa;
}
pre {
  background: #1a1e38; border: 1px solid #252a4a;
  border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 1rem 0;
}
pre code { background: none; padding: 0; color: #c0c4db; }

/* === CALLOUTS === */
.callout {
  background: #12152a; border-left: 4px solid #6c63ff;
  padding: 1rem 1.2rem; border-radius: 0 8px 8px 0; margin: 1.5rem 0;
}
.callout-warn { border-left-color: #f97316; }
.callout-danger { border-left-color: #ef4444; }
.callout strong { color: #a78bfa; }

/* === TABLE ===
   Tables default to full-width on desktop. On narrow screens we
   turn the table itself into a horizontally-scrollable block so
   wide tables (GDPR fine amounts, feature comparisons with many
   columns, etc.) do not push the page layout. The inner <thead>
   and <tbody> stay inline-table so the column layout is preserved
   when scrolled. */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
th, td {
  text-align: left; padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #252a4a; font-size: 0.88rem; color: #c0c4db;
  word-break: break-word;
}
th { color: #a78bfa; font-weight: 600; }
@media (max-width: 720px) {
  /* Mobile: let the table scroll horizontally inside its own box
     instead of forcing the whole page to scroll. */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  th, td { font-size: 0.82rem; padding: 0.5rem 0.6rem; }
}

/* === REFERENCES === */
.ref { font-size: 0.82rem; color: #7b83a6; }
.ref a { color: #7b83a6; }

/* === STAT CARDS === */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
}
.stat-card {
  background: #12152a; border: 1px solid #252a4a;
  border-radius: 8px; padding: 1rem; text-align: center;
}
.stat-num { font-size: 1.8rem; font-weight: 800; color: #6c63ff; }
.stat-label { font-size: 0.78rem; color: #7b83a6; }

/* === TOC (in-page) === */
.toc {
  background: #12152a; border: 1px solid #252a4a;
  border-radius: 8px; padding: 1.2rem 1.5rem; margin: 1.5rem 0;
}
.toc h3 { margin-top: 0; color: #a78bfa; }
.toc ol { margin-bottom: 0; }
.toc a { text-decoration: none; color: #c0c4db; }
.toc a:hover { color: #a78bfa; }

/* === NAV LINKS (related articles) === */
.nav-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2rem 0; }
.nav-links a {
  background: #1a1e38; border: 1px solid #252a4a;
  padding: 0.4rem 0.8rem; border-radius: 6px;
  font-size: 0.82rem; text-decoration: none;
}
.nav-links a:hover { border-color: #6c63ff; }

/* === CTA BUTTON === */
.cta {
  display: inline-block;
  background: linear-gradient(135deg, #6c63ff, #8b5cf6);
  color: #fff; padding: 0.8rem 2rem; border-radius: 10px;
  text-decoration: none; font-weight: 700; margin: 1.5rem 0;
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(108,99,255,0.3);
}

/* === GLOBAL FOOTER ===
   Two-column layout on desktop: the LEFT column is left-aligned and
   groups Security + SEO editorial links; the RIGHT column is
   right-aligned and groups Performance + GDPR. This matches the
   user request for 'dve kolone, leva ravna, desna ravna' and gives
   a visually balanced footer on wide monitors without wasting
   vertical space on long stacked lists.

   On phones (below 720px) both columns stack into a centered
   single-column layout for readability. */
.site-footer {
  background: #080a13; border-top: 1px solid #252a4a;
  padding: 3rem 1.5rem 1.5rem; margin-top: 3rem;
}
.footer-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid;
  /* Desktop: normal 4-column layout via auto-fit. Renders up to
     4-5 columns depending on container width. This is the original
     behaviour before the short-lived 2-col experiment. */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
  min-width: 0;
}
.footer-col { min-width: 0; }
.footer-col h4 {
  color: #a78bfa; font-size: 0.82rem; font-weight: 700;
  margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.footer-col a {
  display: block; color: #7b83a6; text-decoration: none;
  font-size: 0.8rem; padding: 0.2rem 0; transition: color 0.2s;
  word-break: break-word;
}
.footer-col a:hover { color: #a78bfa; }

/* Ultra-wide (>=1800px): footer can breathe into wider container
   for better use of 34" widescreen real estate. Original 4-col
   auto-fit grid keeps its behavior but with more max-width and gap. */
@media (min-width: 1800px) {
  .footer-grid { max-width: 1500px; gap: 2rem 3rem; }
  .site-footer { padding: 3.5rem 2rem 2rem; }
}
/* LEGAL ROW — horizontal list between the blog grid and the copyright line.
   Explicitly separate from blog content so users know these are binding
   policy links, not educational articles. */
.footer-legal {
  max-width: 1100px; margin: 0 auto 1.4rem;
  border-top: 1px solid #1a1e38;
  padding-top: 1.2rem;
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 1.2rem 2rem;
  font-size: 0.82rem;
}
.footer-legal a {
  color: #a78bfa; text-decoration: none;
  padding: 0.25rem 0.1rem;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s, color 0.2s;
}
.footer-legal a:hover {
  color: #c4b5fd;
  border-bottom-color: #a78bfa;
}
.footer-bottom {
  max-width: 1100px; margin: 0 auto;
  border-top: 1px solid #1a1e38; padding-top: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-bottom p { color: #7b83a6; font-size: 0.78rem; }
.footer-bottom a { color: #a78bfa; }
.footer-cta {
  display: inline-block;
  background: linear-gradient(135deg, #6c63ff, #8b5cf6);
  color: #fff; padding: 0.5rem 1.5rem; border-radius: 8px;
  text-decoration: none; font-weight: 600; font-size: 0.82rem;
}
.footer-cta:hover { box-shadow: 0 4px 20px rgba(108,99,255,0.3); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .blog-layout { grid-template-columns: 1fr; }
  .timeline-nav { display: none; }
  .header-nav {
    display: none; position: absolute;
    top: 100%; left: 0; right: 0;
    background: rgba(10,12,21,0.98);
    border-bottom: 1px solid #252a4a;
    flex-direction: column; padding: 1rem; gap: 0.3rem;
  }
  .header-nav.open { display: flex; }
  .hamburger { display: block; }
  /* MOBILE FOOTER LAYOUT: 2-column asymmetric.
     LEFT col  = Security (top) + SEO (bottom)   — left-aligned
     RIGHT col = Performance (top) + GDPR (bottom) — right-aligned
     This is the only breakpoint where the 4 section grid is
     forced into an explicit 2-col layout with pin-up. Desktop
     keeps its original auto-fit 4-col behavior.
     Gives less vertical scroll on phones and a visually balanced
     left/right split instead of a single long centered stack. */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem 1rem;
  }
  .footer-col:nth-child(1) { grid-column: 1; grid-row: 1; text-align: left; }
  .footer-col:nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; }
  .footer-col:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
  .footer-col:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
}
@media (max-width: 480px) {
  .footer-grid { gap: 1.3rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-legal {
    gap: 0.6rem 1rem;
    font-size: 0.76rem;
    padding: 1rem 0.5rem 0;
  }
  .footer-legal a { padding: 0.2rem 0.05rem; }
  .site-footer { padding: 2.5rem 1rem 1.5rem; }
  .footer-cta { font-size: 0.78rem; padding: 0.5rem 1rem; }
  /* Blog content tight mode — smaller side padding and smaller
     headings so 320px phones don't waste screen estate. */
  .blog-content { padding: 0 0.25rem 1.5rem; }
  .blog-content h1 { font-size: 1.5rem; }
  .blog-content h2 { font-size: 1.15rem; }
  .blog-content h3 { font-size: 1rem; }
  /* Stat cards: single column on very narrow screens to avoid
     the 150px min-column squeeze on 320-360px phones. */
  .stat-grid { grid-template-columns: 1fr; }
}
