/* FlyLegal Portugal (by AltVision)
   Softened AltVision look: dark, green accent, readable. */

/* Fonts are loaded via <link> in each page head (an @import here would chain-block first paint). */

:root {
  --bg: #0a0e0b;
  --bg-2: #0e1410;
  --surface: #121a15;
  --surface-2: #17211b;
  --border: #223028;
  --border-strong: #2f4237;
  --text: #e4ece6;
  --text-dim: #a3b2a9;
  --text-faint: #8a9b90;
  --accent: #3ddc84;
  --accent-strong: #5cf09a;
  --accent-soft: rgba(61, 220, 132, 0.12);
  --accent-line: rgba(61, 220, 132, 0.35);
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.1);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.1);
  --info: #6cb8ff;
  --info-soft: rgba(108, 184, 255, 0.1);
  --author: #c79bff;
  --author-soft: rgba(199, 155, 255, 0.1);

  --tier-basic: #8fd3a8;
  --tier-standard: #3ddc84;
  --tier-pro: #f2d14b;

  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1160px;
  --readw: 760px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: #0a0e0b; scroll-padding-top: 76px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
::selection { background: var(--accent); color: #04140a; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 700; margin-top: 2.2em; }
h3 { font-size: 1.2rem; font-weight: 650; margin-top: 1.8em; }
p { margin: 0 0 1em; }
code, kbd { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }

.mono { font-family: var(--mono); }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 14, 11, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.02em; }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent); font-family: var(--mono); font-size: 14px; font-weight: 600;
}
.logo small { display: block; font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--text-dim); letter-spacing: 0.02em; text-transform: none; line-height: 1; margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--text-dim); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--text); }
.nav a.btn-primary, .nav a.btn-primary:hover { color: #04140a; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 14px; min-height: 40px; font: inherit; font-size: 15px; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px;
  font: inherit; font-weight: 650; font-size: 16px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #04140a; }
.btn-primary:hover { background: var(--accent-strong); color: #04140a; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Landing ---------- */
.hero { position: relative; padding: 88px 0 72px; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 360px at 85% -10%, rgba(61,220,132,0.16), transparent 70%),
    linear-gradient(transparent 0 calc(100% - 1px), rgba(61,220,132,0.05) 0) 0 0 / 100% 32px,
    linear-gradient(90deg, transparent 0 calc(100% - 1px), rgba(61,220,132,0.05) 0) 0 0 / 32px 100%;
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.hero .wrap { position: relative; z-index: 2; }
.hero::before { z-index: 1; }

/* Background FPV video (hidden until a poster or video actually loads) */
.hero-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; display: none; animation: media-in .6s ease both; background: var(--bg) center / cover no-repeat; }
.hero.has-media .hero-media { display: block; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.hero-video.playing { opacity: 1; }
/* Readability: dark on the left and bottom, where the text is; slight brand-green tint */
.hero-media::after { content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10,14,11,.9) 0%, rgba(10,14,11,.72) 35%, rgba(10,14,11,.25) 68%, rgba(10,14,11,.1) 100%),
    linear-gradient(0deg, rgba(10,14,11,1) 0%, rgba(10,14,11,0) 25%),
    rgba(61,220,132,.06); }
.hero.has-media::before { opacity: .2; }
.hero.has-media h1, .hero.has-media .lead { text-shadow: 0 2px 18px rgba(0,0,0,.55); }
.hero.has-media .lead { color: var(--text); }
@media (max-width: 720px) {
  .hero-media::after { background: linear-gradient(0deg, rgba(10,14,11,1) 0%, rgba(10,14,11,.86) 45%, rgba(10,14,11,.6) 100%), rgba(61,220,132,.07); }
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 22px;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: 1.2rem; color: var(--text-dim); max-width: 60ch; margin-bottom: 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px 26px; font-family: var(--mono); font-size: 14px; color: var(--text-dim); padding: 0; margin: 0; list-style: none; }
.hero-facts li::before { content: "✓ "; color: var(--accent); }

.section { padding: 80px 0; border-bottom: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--text-dim); font-size: 1.08rem; }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 10px; display: block; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card h3 { margin-top: 0; font-size: 1.08rem; }
.card p:last-child { margin-bottom: 0; }
.card .icon { font-family: var(--mono); color: var(--accent); font-size: 13px; margin-bottom: 12px; display: block; }

.pain { border-left: 3px solid var(--danger); }
.pain h3 { color: var(--text); }

/* Cost table on landing */
.cost-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cost-list li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.cost-list li:last-child { border-bottom: 0; }
.cost-list .price { font-family: var(--mono); color: var(--accent); white-space: nowrap; font-weight: 600; }
.cost-list .price.maybe { color: var(--warn); }
.cost-list small { display: block; color: var(--text-faint); font-size: 14px; }

/* Pricing */
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; }
.plan.featured { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(61,220,132,0.08), var(--surface) 45%); box-shadow: 0 0 0 1px var(--accent-line), 0 20px 50px -20px rgba(61,220,132,0.25); }
.plan-badge { position: absolute; top: -12px; left: 24px; background: var(--accent); color: #04140a; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-family: var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.plan-name { font-family: var(--mono); font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px; }
.plan-price { font-size: 2.8rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.plan-price span { font-size: 1rem; font-weight: 500; color: var(--text-dim); }
.plan-desc { color: var(--text-dim); font-size: 15px; min-height: 3em; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 24px; flex: 1; }
.plan li { padding: 7px 0 7px 26px; position: relative; font-size: 15px; border-bottom: 1px dashed var(--border); }
.plan li:last-child { border-bottom: 0; }
.plan li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.plan li.muted { color: var(--text-faint); }
.plan li.muted::before { content: "—"; color: var(--text-faint); }
.plan li.plus { font-weight: 600; color: var(--text-dim); }
.plan li.plus::before { content: "+"; }

/* About the author */
.about { display: grid; grid-template-columns: 1fr; gap: 48px; align-items: center; }
.about.has-media { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.about-media { display: none; position: relative; aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; border: 1px solid var(--border-strong); background: var(--surface) center / cover no-repeat; box-shadow: 0 30px 60px -30px rgba(0,0,0,.7); }
.about.has-media .about-media { display: block; }
.about-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.about-video.playing { opacity: 1; }
/* No darkening: the author's face should look natural. Only a thin brand-green inner edge. */
.about-media::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(61,220,132,.15); border-radius: inherit; }
.about-text { max-width: 680px; }
.about-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.about-head h2 { margin: 0; }
.avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 2px solid var(--accent-line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-text > p { color: var(--text-dim); }
.about-facts { list-style: none; padding: 0; margin: 26px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.about-facts li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.about-facts b { display: block; font-family: var(--mono); color: var(--accent); font-size: 1.15rem; font-weight: 600; white-space: nowrap; }
.about-facts span { display: block; font-size: 13.5px; color: var(--text-dim); line-height: 1.35; margin-top: 2px; }
.about-quote { margin: 0 0 22px; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); }
.about-quote p { font-size: 1.2rem; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.about-quote footer { font-size: 14px; color: var(--text-faint); }
.ig-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); }
.ig-link:hover { border-color: var(--accent-line); color: var(--text); }
.ig-link svg { color: var(--accent); }
.ig-followers { color: var(--text-dim); font-weight: 500; }
@media (max-width: 980px) {
  .about.has-media { grid-template-columns: 1fr; }
  .about-media { max-width: 420px; }
  .about-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Payment method badges */
.pay-methods { margin-top: 26px; text-align: center; }
.pm-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pm { display: inline-flex; align-items: center; justify-content: center; gap: 3px; height: 30px; min-width: 50px; padding: 0 10px; border-radius: 6px; background: #fff; color: #111; font: 700 13px/1 var(--font); letter-spacing: .01em; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.pm-visa { color: #1a1f71; font-style: italic; font-weight: 800; letter-spacing: .04em; }
.pm-mc { gap: 0; }
.pm-mc i { display: block; width: 16px; height: 16px; border-radius: 50%; background: #eb001b; }
.pm-mc i + i { background: #f79e1b; margin-left: -6px; mix-blend-mode: multiply; }
.pm-amex { background: #2e77bc; color: #fff; }
.pm-apple { background: #000; color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.25); font-weight: 600; }
.pm-google { font-weight: 600; color: #3c4043; }
.pm-mbway { color: #d4001a; font-weight: 800; }
.pm-mbway b { color: #111; font-weight: 800; margin-left: 2px; }
.pm-mb { background: #1b4f9c; color: #fff; }
.pm-paypal { color: #009cde; font-style: italic; }
.pm-paypal b { color: #003087; }
.pm-note { margin: 10px 0 0; font-size: 13.5px; color: var(--text-faint); }
.pay-methods.compact { margin-top: 12px; text-align: left; }
.pay-methods.compact .pm-row { justify-content: flex-start; gap: 6px; }
.pay-methods.compact .pm { height: 24px; min-width: 40px; padding: 0 7px; font-size: 11.5px; }
.pay-methods.compact .pm-mc i { width: 13px; height: 13px; }

/* Tourist tier: compact horizontal card above the main plans */
.tourist-plan { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 16px; padding: 22px 24px; margin-bottom: 22px; }
.tourist-plan h3 { margin: 0 0 6px; font-size: 1.2rem; }
.tourist-plan p.dim { margin: 0; font-size: 15px; }
.tourist-plan .plan-price { font-size: 2.2rem; margin-bottom: 12px; }
@media (max-width: 720px) { .tourist-plan { grid-template-columns: 1fr; } }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--accent); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 20px 18px; color: var(--text-dim); }

/* Footer */
.site-footer { padding: 40px 0 48px; color: var(--text-faint); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.site-footer a { color: var(--text-dim); }
.disclaimer { max-width: 70ch; }

/* ---------- Guide layout ---------- */
.guide { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 48px; max-width: var(--maxw); margin: 0 auto; padding: 32px 16px 80px; }
.sidebar { position: sticky; top: 86px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 6px; font-size: 14.5px; }
.sidebar-title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.sidebar-title:first-child { margin-top: 0; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-dim); text-decoration: none; line-height: 1.35; }
.sidebar a:hover { background: var(--surface); color: var(--text); }
.sidebar a.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar .num { font-family: var(--mono); color: var(--text-faint); font-size: 12.5px; min-width: 20px; padding-top: 1px; }
.sidebar a.active .num { color: var(--accent); }
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s ease; }
.progress-label { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

.article { max-width: var(--readw); min-width: 0; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; font-family: var(--mono); font-size: 13px; color: var(--text-faint); }
.article h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.article .lead { font-size: 1.15rem; color: var(--text-dim); }
.article ul, .article ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.article li { margin-bottom: 0.4em; }
.article li::marker { color: var(--accent); }

.tier { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; border: 1px solid; }
.tier-tourist { color: var(--tier-basic); border-color: rgba(143,211,168,.4); background: rgba(143,211,168,.08); }
.tier-full { color: var(--tier-standard); border-color: var(--accent-line); background: var(--accent-soft); }
.tier-basic { color: var(--tier-basic); border-color: rgba(143,211,168,.4); background: rgba(143,211,168,.08); }
.tier-standard { color: var(--tier-standard); border-color: var(--accent-line); background: var(--accent-soft); }
.tier-pro { color: var(--tier-pro); border-color: rgba(242,209,75,.4); background: rgba(242,209,75,.08); }

/* TL;DR box */
.tldr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 24px 0 32px; }
.tldr-title { font-family: var(--mono); font-size: 12.5px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.tldr ul { margin: 0; }
.tldr li { margin-bottom: 0.35em; }

/* Callouts */
.callout { border: 1px solid; border-left-width: 4px; border-radius: var(--radius-sm); padding: 14px 18px; margin: 22px 0; font-size: 16px; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: 4px; display: block; }
.callout.tip { border-color: var(--accent-line); background: var(--accent-soft); }
.callout.tip .callout-title { color: var(--accent); }
.callout.warn { border-color: rgba(242,184,75,.4); background: var(--warn-soft); }
.callout.warn .callout-title { color: var(--warn); }
.callout.danger { border-color: rgba(255,107,107,.4); background: var(--danger-soft); }
.callout.danger .callout-title { color: var(--danger); }
.callout.info { border-color: rgba(108,184,255,.4); background: var(--info-soft); }
.callout.info .callout-title { color: var(--info); }
.callout.money { border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-soft), transparent); }
.callout.money .callout-title { color: var(--accent); }
/* Author note: reminders for the guide's author, hidden in "sale mode" */
.callout.author { border-color: rgba(199,155,255,.45); background: var(--author-soft); border-style: dashed; }
.callout.author .callout-title { color: var(--author); font-family: var(--mono); font-size: 13px; letter-spacing: .04em; }
body.sale-mode .callout.author { display: none; }
/* Draft: fact not yet confirmed by an official source */
.callout.check { border-color: rgba(242,184,75,.5); background: var(--warn-soft); border-style: dashed; }
.callout.check .callout-title { color: var(--warn); font-family: var(--mono); font-size: 13px; letter-spacing: .04em; }

/* ---------- One-page draft ---------- */
.draft-banner { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0 28px; font-size: 15px; }
.draft-banner b { font-family: var(--mono); }
.draft-banner .n-check { color: var(--warn); }
.draft-banner .n-author { color: var(--author); }
.draft-banner label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--text-dim); }
body.hide-notes .callout.check, body.hide-notes .callout.author { display: none; }
.chapter-block { padding-top: 24px; margin-top: 56px; border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.chapter-block:first-of-type { margin-top: 0; border-top: 0; }
.chapter-block a, .chapter-block code { overflow-wrap: anywhere; }
.chapter-block > h1 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.chapter-block h2, .chapter-block h3 { scroll-margin-top: 72px; }
.loading { color: var(--text-faint); font-family: var(--mono); font-size: 14px; }

.locked-card { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 20px 22px; }
.locked-card p { color: var(--text-dim); }

/* ---------- Section navigation ---------- */
.read-progress { position: fixed; top: 62px; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 49; box-shadow: 0 0 8px var(--accent); transition: width .1s linear; }

.toc-search { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-bottom: 10px; }
.toc-search input { width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 8px 32px; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f8076' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; }
.toc-search input:focus { border-color: var(--accent-line); }
.toc-empty { color: var(--text-faint); font-size: 14px; padding: 8px 10px; display: none; }

.toc-sub { list-style: none; margin: 2px 0 8px 30px !important; padding: 0 0 0 10px !important; border-left: 1px solid var(--border); display: none; }
.toc-ch.open > .toc-sub { display: block; }
.sidebar .toc-sub a { padding: 4px 8px; font-size: 13.5px; color: var(--text-faint); }
.sidebar .toc-sub a:hover { color: var(--text); }
.sidebar .toc-sub a.active { background: none; box-shadow: none; color: var(--accent); }
.toc-ch.hidden, .toc-sub li.hidden, .sidebar-title.hidden { display: none; }
mark.toc-hit { background: rgba(61,220,132,.25); color: inherit; border-radius: 3px; padding: 0 1px; }

.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; margin-top: 40px; }
.chapter-nav a { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.35; }
.chapter-nav a:hover { border-color: var(--accent-line); }
.chapter-nav small { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.chapter-nav .next { text-align: right; grid-column: 3; }
.chapter-nav .top { grid-column: 2; align-self: center; font-family: var(--mono); font-size: 13px; color: var(--text-dim); padding: 10px 12px; }

.fab { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: rgba(18,26,21,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; padding: 10px 14px; border-radius: 999px; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.fab:hover { border-color: var(--accent-line); }
.fab-top { opacity: 0; pointer-events: none; transition: opacity .2s; }
.fab-top.show { opacity: 1; pointer-events: auto; }
.fab-toc { display: none; bottom: 16px; left: 16px; right: auto; }
.fab-toc .cur { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.drawer-backdrop { display: none; }

@media (max-width: 720px) {
  /* One-page guide on phones: the sidebar becomes a slide-in drawer */
  body.onepage .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, 340px); max-height: none; margin: 0; z-index: 80; border-radius: 0; border: 0; border-right: 1px solid var(--border); background: var(--bg); padding: 16px 14px 80px; overflow-y: auto; transform: translateX(-102%); transition: transform .22s ease; }
  body.onepage.drawer-open .sidebar { transform: none; }
  body.onepage .sidebar .sidebar-toggle { display: none !important; }
  body.onepage .sidebar.collapsed .sidebar-body { display: block; }
  body.onepage .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.onepage.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  body.onepage.drawer-open { overflow: hidden; }
  body.onepage .fab-toc { display: inline-flex; }
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-nav .top { display: none; }
  .chapter-nav .next { grid-column: 2; }
}

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0 !important; margin: 24px 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 22px 52px; margin: 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--accent-line); color: var(--accent);
}
.steps > li::after { content: ""; position: absolute; left: 17px; top: 36px; bottom: 4px; width: 1px; background: var(--border-strong); }
.steps > li:last-child::after { display: none; }
.steps > li > strong:first-child { display: block; color: var(--text); margin-bottom: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; font-size: 13.5px; color: var(--text-dim); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .yes { color: var(--accent); font-weight: 600; }
td .no { color: var(--danger); font-weight: 600; }
td .cond { color: var(--warn); font-weight: 600; }

/* Checklist */
.checklist { list-style: none; padding: 0 !important; margin: 18px 0 26px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checklist li { margin: 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 12px; padding: 11px 16px; cursor: pointer; align-items: flex-start; }
.checklist input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin-top: 3px; border: 1.5px solid var(--border-strong); border-radius: 5px; background: var(--bg-2); cursor: pointer; display: grid; place-items: center; }
.checklist input:checked { background: var(--accent); border-color: var(--accent); }
.checklist input:checked::after { content: "✓"; color: #04140a; font-size: 14px; font-weight: 800; line-height: 1; }
.checklist input:checked + span { color: var(--text-faint); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.checklist-actions { display: flex; gap: 10px; margin: -14px 0 26px; }
.checklist-actions button { background: none; border: 1px solid var(--border); color: var(--text-dim); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.checklist-actions button:hover { color: var(--text); border-color: var(--border-strong); }

/* Key-value facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 22px 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.fact b { display: block; font-family: var(--mono); color: var(--accent); font-size: 1.2rem; font-weight: 600; }
.fact span { font-size: 14px; color: var(--text-dim); line-height: 1.4; display: block; }

/* Link list */
.links { list-style: none; padding: 0 !important; }
.links li { padding: 10px 0; border-bottom: 1px dashed var(--border); margin: 0; }
.links li a { font-weight: 600; }
.links li span { display: block; color: var(--text-dim); font-size: 15px; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent-line); }
.pager small { display: block; font-family: var(--mono); font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.pager .next { text-align: right; grid-column: 2; }

.updated { margin-top: 40px; font-family: var(--mono); font-size: 13px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 16px; }

/* Guide home: chapter cards */
.chapter-list { display: grid; gap: 10px; margin: 20px 0 36px; padding: 0; list-style: none; }
.chapter-list a { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.chapter-list a:hover { border-color: var(--accent-line); }
.chapter-list .num { font-family: var(--mono); color: var(--accent); font-size: 14px; min-width: 24px; }
.chapter-list .t { flex: 1; font-weight: 600; }
.chapter-list .t small { display: block; font-weight: 400; color: var(--text-dim); font-size: 14px; }

/* ---------- Responsive ---------- */
/* Medium screens: the guide keeps its left sidebar, just narrower */
@media (max-width: 1100px) {
  .guide { grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
  .sidebar { font-size: 14px; }
}
@media (max-width: 980px) {
  .pricing { grid-template-columns: 1fr; max-width: 460px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
/* Phones: no room for a side column */
@media (max-width: 720px) {
  .guide { grid-template-columns: 1fr; gap: 0; padding-top: 20px; }
  .sidebar { position: static; max-height: none; overflow: visible; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 28px; background: var(--bg-2); }
  .sidebar.collapsed .sidebar-body { display: none; }
  .sidebar-toggle { display: flex !important; }
}
.sidebar-toggle { display: none; width: 100%; justify-content: space-between; align-items: center; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.sidebar:not(.collapsed) .sidebar-toggle { margin-bottom: 12px; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav .btn { margin-top: 12px; }
  .nav-toggle { display: inline-block; }
  .hero { padding: 56px 0 48px; }
  .section { padding: 56px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .cost-list li { flex-direction: column; gap: 4px; }
}

@media print {
  .site-header, .sidebar, .pager, .checklist-actions, .callout.author { display: none !important; }
  body { background: #fff; color: #111; }
  .guide { display: block; }
  a { color: #0a6b38; }
}

/* ---------- UI iteration 1 ---------- */
@keyframes media-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero-media { animation: none; } html { scroll-behavior: auto; } }
.btn { min-height: 44px; }
.btn-sm { min-height: 40px; }
.plan-badge { font-size: 12px; }
.plan li.muted { color: var(--text-faint); }
@media (max-width: 720px) {
  .hero-cta .btn { width: 100%; }
  .plan { padding: 24px 18px; }
  .plan-desc { min-height: 0; }
  .plan-price { font-size: 2.4rem; }
  .logo small { font-size: 12px; }
  .nav a { min-height: 44px; display: flex; align-items: center; }
  .nav a.btn { justify-content: center; }
}

/* ---------- Legal pages (/legal/*, /ru/legal/*) and owner notes ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 36px 16px 80px; line-height: 1.6; }
.legal h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); margin-bottom: 18px; }
.legal h2, .legal h3, .legal h4 { margin: 32px 0 10px; }
.legal p, .legal li { color: var(--text-dim); }
.legal ul, .legal ol { padding-left: 1.4em; margin: 10px 0 14px; }
.legal li { margin-bottom: 6px; }
.legal hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.legal .callout { margin: 12px 0 16px; }
.legal-links { margin: 8px 0 6px; }
.legal-links a { color: var(--text-dim); }
/* owner notes ([ПРОВЕРИТЬ …]): visible while editing, hidden in sale mode */
.author-note { color: var(--author); }
body.sale-mode .author-note { display: none; }
