﻿/* ===== Mobile refinements for "Инвестор с нуля" =====
   Loaded after each page's inline <style>, so these rules win. */

body{overflow-wrap:break-word}
code{overflow-wrap:anywhere}

/* Wide tables scroll instead of squeezing */
.table-scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:8px 0 22px;
  scrollbar-width:thin;
  scrollbar-color:#2b3b5c transparent;
}
.table-scroll table{min-width:520px;margin:0}
.table-scroll::-webkit-scrollbar{height:6px}
.table-scroll::-webkit-scrollbar-track{background:transparent}
.table-scroll::-webkit-scrollbar-thumb{background:#2b3b5c;border-radius:3px}

/* Footer legal links: wrap without dangling separators */
.footer-links{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:4px 14px;
  margin-top:12px;
  font-size:.85rem;
}
.footer-links a{padding:2px 0}

/* Back link at the top of long articles (mobile users shouldn't scroll to the end) */
.top-back{
  display:block;
  width:max-content;
  margin:0 0 14px;
  padding:4px 0;
  color:var(--muted);
  text-decoration:none;
  font-size:.9rem;
}
.top-back:hover{color:var(--accent)}

/* Content images */
.hero-media{
  margin:44px auto 0;
  max-width:920px;
}
.hero-media img,
.article-media img{
  display:block;
  width:100%;
  height:auto;
  border-radius:16px;
  border:1px solid var(--border);
}
.article-media{margin:0 0 30px}
@media (min-width:761px){
  .hero-media img{aspect-ratio:16/9;object-fit:cover}
}
@media (max-width:760px){
  .hero-media{margin-top:32px}
  .hero-media img,
  .article-media img{border-radius:12px}
  .article-media{margin-bottom:24px}
}

/* ---------- Phones and small tablets ---------- */
@media (max-width:760px){
  .container{padding-left:16px;padding-right:16px}

  /* Header: logo on its own row, nav wraps below */
  header{background:#0b1220}
  header .container{
    flex-wrap:wrap;
    justify-content:center;
    gap:2px 0;
    padding:10px 16px;
  }
  .logo{width:100%;text-align:center;font-size:1.1rem}
  nav{display:flex;flex-wrap:wrap;justify-content:center;gap:0 16px;width:100%}
  nav a{margin-left:0;padding:8px 0;font-size:.9rem}

  /* Hero and sections breathe less */
  .hero{padding:44px 0 36px}
  section{padding:40px 0}
  .lead{font-size:1rem;margin-bottom:24px}
  .card,.guide{padding:20px}
  .faq details{padding:16px 18px}

  /* Full-width buttons in the hero pair */
  .cta-row .btn{width:100%}

  /* Articles */
  .article-wrap{padding:32px 0 56px}
  h1{font-size:clamp(1.55rem,6.4vw,2.1rem)}
  h2{font-size:clamp(1.25rem,5vw,1.7rem);margin-top:34px}
  h3{font-size:1.08rem}
  ul,ol{margin-left:20px}
  .note,.warn{padding:14px 16px}
  .cta-box{padding:20px 18px}
  .cta-box .btn{display:block;text-align:center}
  table{font-size:.88rem}
  th,td{padding:8px 10px}
  .next-links a{padding:5px 0}

  /* Legal / about / contacts pages */
  main{padding:36px 0 56px}

  /* Anchor targets must not hide under the sticky header */
  section[id]{scroll-margin-top:96px}
}

@media (max-width:400px){
  h1{font-size:1.5rem}
  .logo{font-size:1rem}
  nav a{font-size:.84rem}
  th,td{padding:7px 8px}
  table{font-size:.84rem}
}
