/* ==========================================================================
   PosadMesh — сообщество MeshCore в Сергиевом Посаде
   Светлая и тёмная темы переключаются классом на <html>
   ========================================================================== */

:root {
  --bg:            #f5f8f7;
  --bg-alt:        #ffffff;
  --surface:       #ffffff;
  --surface-2:     #eef4f2;
  --text:          #10201b;
  --text-soft:     #3d524c;
  --muted:         #667a74;
  --border:        #dde7e3;
  --border-strong: #c7d6d0;

  --accent:        #0e9c6c;
  --accent-soft:   #e2f6ee;
  --accent-2:      #2f6fed;
  --accent-2-soft: #e6efff;
  --amber:         #b9760a;
  --amber-soft:    #fdf1dd;
  --danger:        #c4453a;
  --danger-soft:   #fdecea;

  --shadow-sm: 0 1px 2px rgba(16, 32, 27, .06), 0 2px 8px rgba(16, 32, 27, .05);
  --shadow-md: 0 6px 24px rgba(16, 32, 27, .09);
  --shadow-lg: 0 18px 50px rgba(16, 32, 27, .13);

  --radius:    16px;
  --radius-lg: 24px;
  --shell:     1120px;

  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg:            #080e0d;
  --bg-alt:        #0c1513;
  --surface:       #101a18;
  --surface-2:     #16221f;
  --text:          #e9f2ef;
  --text-soft:     #c3d3ce;
  --muted:         #8fa39d;
  --border:        #1f2d29;
  --border-strong: #2b3d38;

  --accent:        #2ee6a8;
  --accent-soft:   #102c23;
  --accent-2:      #6fa8ff;
  --accent-2-soft: #10203a;
  --amber:         #f0b056;
  --amber-soft:    #2c2113;
  --danger:        #ff8b7e;
  --danger-soft:   #33201d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, .5);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent-2); }
a:hover { text-decoration: none; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 19px;
  letter-spacing: -.01em;
  flex: none;
}
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-text strong { font-weight: 800; color: var(--accent); }

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, color .18s ease, transform .18s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:active { transform: scale(.97); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* ------------------------------------------------------------------ hero -- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 64px;
  background:
    radial-gradient(1200px 520px at 12% -10%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 460px at 92% 0%, var(--accent-2-soft), transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.hero-mesh {
  position: absolute;
  inset: -12% -6% 0 -6%;
  opacity: .5;
  pointer-events: none;
  mask-image: radial-gradient(70% 70% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000 30%, transparent 78%);
}
.hero-mesh svg { width: 100%; height: 100%; }
.mesh-lines path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.3;
  opacity: .45;
  stroke-dasharray: 5 9;
  animation: dash 26s linear infinite;
}
.mesh-nodes circle {
  fill: var(--accent);
  opacity: .7;
  animation: pulse 4.5s ease-in-out infinite;
}
.mesh-nodes circle:nth-child(2n) { animation-delay: 1.1s; }
.mesh-nodes circle:nth-child(3n) { animation-delay: 2.2s; }

@keyframes dash { to { stroke-dashoffset: -420; } }
@keyframes pulse {
  0%, 100% { opacity: .35; r: 5; }
  50%      { opacity: .85; r: 8; }
}

.hero-inner { position: relative; }

.kicker {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.08;
  letter-spacing: -.025em;
  font-weight: 800;
}
.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.16;
  letter-spacing: -.02em;
  font-weight: 800;
}
h3 { font-size: 19px; margin: 0 0 8px; letter-spacing: -.01em; }
h4 { font-size: 15px; margin: 0 0 8px; }

h2.sub { margin-top: 52px; font-size: clamp(21px, 2.2vw, 26px); }

.lead { font-size: 19px; color: var(--text-soft); margin: 0 0 26px; max-width: 74ch; }
.lead.narrow { max-width: 68ch; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- cta & stats */

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 46px; }

.btn {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-note { font-size: 12.5px; font-weight: 600; opacity: .78; letter-spacing: .01em; }

.btn-primary {
  background: var(--accent);
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #04120d;
  box-shadow: var(--shadow-md);
}
html[data-theme="dark"] .btn-primary { color: #04120d; }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-wide { width: 100%; align-items: center; text-align: center; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0;
  padding: 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat dt {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent);
  line-height: 1.1;
}
.stat dd { margin: 6px 0 0; font-size: 14px; color: var(--muted); line-height: 1.4; }

/* --------------------------------------------------------------- sections -- */

.section { padding: 76px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .22s ease, border-color .22s ease;
}
.card p { margin: 0; color: var(--text-soft); font-size: 16px; }
.card p + p { margin-top: 10px; }

.card-accent:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.card-icon { font-size: 26px; line-height: 1; margin-bottom: 12px; }

.card-link {
  display: inline-block;
  margin-top: 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.link-card { display: block; text-decoration: none; color: inherit; }
.link-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.link-card h3 { color: var(--text); }

.chip {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 12px;
  background: var(--surface-2);
  color: var(--text-soft);
}
.chip-green { background: var(--accent-soft); color: var(--accent); }
.chip-blue  { background: var(--accent-2-soft); color: var(--accent-2); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }

.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 9px;
  vertical-align: middle;
}

.callout {
  margin: 28px 0 0;
  padding: 18px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 4px solid var(--accent-2);
  background: var(--accent-2-soft);
  color: var(--text-soft);
  font-size: 16px;
}
.callout strong { color: var(--text); }
.callout.ok   { border-color: var(--accent);  background: var(--accent-soft); }
.callout.warn { border-color: var(--amber);   background: var(--amber-soft); }

/* -------------------------------------------------------------- timeline -- */

.timeline { margin: 34px 0 0; border-left: 2px solid var(--border); padding-left: 0; }

.tl-item {
  position: relative;
  padding: 0 0 26px 30px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item p { margin: 0; color: var(--text-soft); max-width: 88ch; }

/* ----------------------------------------------------------------- table -- */

.table-wrap {
  overflow-x: auto;
  margin: 26px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.table { border-collapse: collapse; width: 100%; font-size: 15.5px; min-width: 720px; }
.table caption {
  text-align: left;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table th, .table td {
  text-align: left;
  vertical-align: top;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.table thead th {
  background: var(--surface-2);
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.table td:first-child { font-weight: 600; white-space: nowrap; }

.check-list { margin: 18px 0 0; padding: 0; list-style: none; }
.check-list li {
  position: relative;
  padding: 0 0 12px 30px;
  color: var(--text-soft);
}
.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  color: var(--accent);
  font-weight: 800;
}

/* --------------------------------------------------------------- flasher -- */

.flasher-card {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
  margin: 30px 0 0;
  align-items: start;
}

.flasher-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.flasher-main::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.flasher-head h3 { margin-top: 4px; font-size: 21px; }

.feature-list { margin: 18px 0 0; padding: 0; list-style: none; }
.feature-list li { position: relative; padding: 0 0 12px 24px; color: var(--text-soft); }
.feature-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.flasher-side { display: grid; gap: 14px; }

.mini-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.mini-box h4 { color: var(--muted); text-transform: uppercase; font-size: 12.5px; letter-spacing: .05em; }
.mini-box ul { margin: 0; padding-left: 20px; }
.mini-box li { color: var(--text-soft); font-size: 15px; margin-bottom: 6px; }
.mini-box p { margin: 0; font-size: 15px; color: var(--text-soft); }
.mini-warn { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); background: var(--amber-soft); }
.mini-warn h4 { color: var(--amber); }

/* ------------------------------------------------------------- note band -- */

.note-band {
  margin: 30px 0 0;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
}
.note-band p { margin: 0; color: var(--text-soft); }

/* ---------------------------------------------------------------- footer -- */

.site-footer {
  padding: 54px 0 34px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.footer-brand strong { color: var(--accent); }
.footer-inner .muted { margin: 0; max-width: 52ch; font-size: 15px; }

.footer-links { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-links a {
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  background: var(--surface);
  transition: border-color .18s ease, color .18s ease;
}
.footer-links a:hover { border-color: var(--accent); color: var(--accent); }

.footer-fine {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.footer-fine p { margin: 0; font-size: 14px; color: var(--muted); max-width: 80ch; }

/* ------------------------------------------------------------ animation -- */

html.js .reveal { opacity: 0; transform: translateY(18px); }
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, .8, .28, 1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  html.js .reveal { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1080px) {
  .theme-toggle-label { display: none; }
}

@media (max-width: 1000px) {
  .flasher-card { grid-template-columns: 1fr; }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
  .site-nav { display: none; }
}

@media (max-width: 820px) {
  .hero { padding: 58px 0 48px; }
  .section { padding: 58px 0; }
  .cards-2, .cards-3 { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .shell { padding: 0 16px; }
  body { font-size: 16px; }
  .stats { grid-template-columns: 1fr; }
  .card, .flasher-main { padding: 20px 18px; }
  .tl-item { padding-left: 24px; }
}

/* ------------------------------------------------------------------ print */

@media print {
  .site-header, .hero-mesh, .theme-toggle, .cta-row { display: none; }
  body { background: #fff; color: #000; }
  html.js .reveal { opacity: 1 !important; transform: none !important; }
}
