/* SPDX-License-Identifier: GPL-3.0-or-later
   Copyright (C) 2026 Dobrev IT Ltd — RetiMesh Node product site. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..900&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ─────────────────────────────  tokens  ───────────────────────────── */
:root {
  --ink:        #070907;
  --ink-2:      #0b0e0c;
  --panel:      #0f1310;
  --panel-2:    #141915;
  --line:       #1d241f;
  --line-hi:    #2b342d;

  --text:       #dde5de;
  --dim:        #8c988e;
  --faint:      #5a655c;

  --signal:     #57e389;   /* live / software / go */
  --signal-ink: #041108;
  --amber:      #f5a524;   /* caution / in development */
  --rf:         #6cc0ff;   /* radio / RF layer */

  --glow:       0 0 0 1px rgba(87,227,137,.25), 0 0 28px -6px rgba(87,227,137,.35);

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --rail: 132px;          /* left spine width on desktop */
  --pad: clamp(18px, 4vw, 44px);
  --maxw: 1240px;
}

/* ─────────────────────────────  reset  ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* atmosphere: grid + vignette + grain, fixed behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(87,227,137,.09), transparent 62%),
    radial-gradient(820px 560px at 4% 22%, rgba(108,192,255,.055), transparent 60%),
    repeating-linear-gradient(0deg,   rgba(255,255,255,.016) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg,  rgba(255,255,255,.016) 0 1px, transparent 1px 88px);
}
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 0; pointer-events: none; opacity: .3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
main, header, footer { position: relative; z-index: 1; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--signal); color: var(--signal-ink); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

/* ─────────────────────────────  type  ───────────────────────────── */
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 700; line-height: 1.02; letter-spacing: -.02em; }
h1, h2 { font-stretch: 125%; text-transform: uppercase; }
h3 { font-stretch: 110%; }

.mono { font-family: var(--mono); }
.tag {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
}
p { text-wrap: pretty; }
.lede { color: var(--dim); font-size: clamp(15px, 1.4vw, 18px); max-width: 62ch; }

/* ─────────────────────────  shared shells  ────────────────────────── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.022), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
}
/* technical-drawing corner brackets */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
  border-color: var(--line-hi); border-style: solid; border-width: 0;
}
.panel::before { top: -1px; left: -1px;  border-top-width: 1px; border-left-width: 1px;  }
.panel::after  { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

.led {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 8px var(--signal); flex: none;
  animation: pulse 2.6s ease-in-out infinite;
}
.led.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.led.rf    { background: var(--rf);    box-shadow: 0 0 8px var(--rf); }
.led.off   { background: var(--faint); box-shadow: none; animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ────────────────────────────  status bar  ─────────────────────────── */
.statusbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,9,7,.82);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.statusbar .wrap {
  display: flex; align-items: center; gap: 22px;
  height: 58px;
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand b {
  font-stretch: 125%; font-size: 15px; letter-spacing: .01em;
  text-transform: uppercase; font-weight: 800;
}
.brand span { color: var(--dim); font-weight: 500; }

.nav { display: flex; gap: 20px; margin-left: auto; }
.nav a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--dim); position: relative; padding: 4px 0;
  transition: color .18s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--signal); transition: right .28s cubic-bezier(.2,.8,.2,1);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { right: 0; }

.ver {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  color: var(--signal); border: 1px solid rgba(87,227,137,.3);
  background: rgba(87,227,137,.07); padding: 4px 9px; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
@media (max-width: 940px) { .nav { display: none; } .statusbar .wrap { gap: 12px; } .ver { margin-left: auto; } }

/* ────────────────────────────  buttons  ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 13px 20px; border: 1px solid var(--line-hi);
  color: var(--text); background: var(--panel-2);
  position: relative; overflow: hidden; transition: border-color .2s, color .2s, transform .2s;
}
.btn::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(87,227,137,.16), transparent);
  transform: translateX(-105%); transition: transform .55s cubic-bezier(.2,.8,.2,1);
}
.btn:hover { border-color: var(--signal); color: #fff; }
.btn:hover::after { transform: translateX(105%); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--signal); color: var(--signal-ink); border-color: var(--signal);
  font-weight: 600; box-shadow: var(--glow);
}
.btn.primary:hover { color: var(--signal-ink); filter: brightness(1.1); }

/* ─────────────────────────────  hero  ───────────────────────────── */
.hero { padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 72px); }
.hero-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 46px; }

.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 26px; }
.eyebrow .chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--line); padding: 4px 10px;
  display: inline-flex; align-items: center; gap: 7px;
}
.eyebrow .chip.dev { color: var(--amber); border-color: rgba(245,165,36,.32); background: rgba(245,165,36,.06); }

.hero h1 {
  font-size: clamp(36px, 6.6vw, 82px);
  font-weight: 800; letter-spacing: -.035em; margin-bottom: 24px;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--signal); }
.hero .lede { font-size: clamp(16px, 1.7vw, 20px); line-height: 1.55; max-width: 60ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* staggered entrance */
.rise { opacity: 0; transform: translateY(16px); animation: rise .8s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
.d1 { animation-delay: .05s } .d2 { animation-delay: .15s } .d3 { animation-delay: .27s }
.d4 { animation-delay: .4s }  .d5 { animation-delay: .55s }

/* ───────────────────────  hero signal diagram  ──────────────────── */
.chain { border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--ink-2)); position: relative; }
.chain-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--faint);
}
.chain-head .sep { margin-left: auto; }
.chain-svg { overflow-x: auto; overscroll-behavior-x: contain; }
.chain svg { width: 100%; height: auto; }
@media (max-width: 760px) {
  /* below this the diagram's labels stop being readable — scroll it instead */
  .chain svg { min-width: 700px; }
  .chain-svg { border-bottom: 1px solid var(--line); }
}
.chain-foot {
  padding: 11px 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.5;
}
.chain-foot b { color: var(--dim); font-weight: 500; }

.dg-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; fill: var(--faint); }
.dg-name  { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .04em; fill: var(--text); }
.dg-box   { fill: #10150f; stroke: var(--line-hi); }
.dg-box.node { stroke: rgba(87,227,137,.45); fill: rgba(87,227,137,.05); }
.dg-path  { fill: none; stroke: var(--line-hi); stroke-width: 1; }
.dg-path.rf { stroke: rgba(108,192,255,.4); stroke-dasharray: 3 3; }
.dg-arc   { fill: none; stroke: rgba(108,192,255,.22); stroke-width: 1; }

/* ─────────────────────────  stat strip  ─────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-bottom: 0; }
.stats div { padding: 20px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: rgba(15,19,16,.55); }
.stats div:last-child { border-right: 0; }
.stats b {
  display: block; font-size: clamp(26px, 3.4vw, 38px); font-weight: 800;
  font-stretch: 125%; line-height: 1; letter-spacing: -.03em; color: var(--text);
}
.stats b .u { font-size: .42em; color: var(--signal); margin-left: 5px; letter-spacing: 0; }
.stats span { display: block; margin-top: 9px; }

/* ───────────────────────────  sections  ─────────────────────────── */
section { padding: clamp(60px, 8vw, 108px) 0; border-top: 1px solid var(--line); }
.sec {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: 0 40px; align-items: start;
}
.sec-rail { position: sticky; top: 86px; }
.sec-rail .idx {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--signal);
  display: block; margin-bottom: 10px;
}
.sec-rail .ttl { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); display: block; }
.sec-rail .ticks { margin-top: 16px; display: grid; grid-template-columns: minmax(0,1fr); gap: 5px; }
.sec-rail .ticks i { display: block; height: 1px; background: var(--line-hi); width: 26px; }
.sec-rail .ticks i:nth-child(2n) { width: 15px; }

.sec h2 { font-size: clamp(26px, 3.6vw, 44px); margin-bottom: 18px; text-wrap: balance; }
.sec > div > .lede { margin-bottom: 38px; }

@media (max-width: 860px) {
  .sec { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .sec-rail { position: static; display: flex; gap: 14px; align-items: center; }
  .sec-rail .idx { margin: 0; }
  .sec-rail .ticks { display: none; }
}

/* ────────────────────────────  pillars  ─────────────────────────── */
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pillar { background: var(--panel); padding: 26px 24px 28px; position: relative; transition: background .25s; }
.pillar:hover { background: var(--panel-2); }
.pillar .n { font-family: var(--mono); font-size: 11px; color: var(--signal); letter-spacing: .14em; }
.pillar h3 { font-size: 19px; margin: 14px 0 10px; text-transform: uppercase; letter-spacing: -.01em; }
.pillar p { color: var(--dim); font-size: 14.5px; }
.pillar .bar { position: absolute; left: 0; top: 0; width: 2px; height: 0; background: var(--signal); transition: height .35s cubic-bezier(.2,.8,.2,1); }
.pillar:hover .bar { height: 100%; }

.note {
  margin-top: 28px; padding: 18px 20px; border-left: 2px solid var(--rf);
  background: rgba(108,192,255,.05); color: var(--dim); font-size: 14.5px;
}
.note b { color: var(--text); font-weight: 600; }
.note.warn { border-left-color: var(--amber); background: rgba(245,165,36,.05); }

/* ────────────────────────────  tables  ──────────────────────────── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 14px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; background: var(--ink-2); position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .18s; }
tbody tr:hover { background: rgba(255,255,255,.022); }
td.k { font-family: var(--mono); font-size: 12.5px; color: var(--text); white-space: nowrap; }
td small, th small { color: var(--faint); }
.muted { color: var(--dim); }
code {
  font-family: var(--mono); font-size: .88em; color: var(--signal);
  background: rgba(87,227,137,.08); padding: .5px 3px; border-radius: 2px;
}
.cmp td.on  { color: var(--signal); font-family: var(--mono); font-size: 12.5px; }
.cmp td.off { color: var(--faint);  font-family: var(--mono); font-size: 12.5px; }
.cmp col.me, .cmp .me { background: rgba(87,227,137,.05); }
.cmp th.me { color: var(--signal); }

/* ───────────────────────────  features  ─────────────────────────── */
.feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.feat { background: var(--panel); padding: 22px; position: relative; overflow: hidden; }
.feat::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(320px 160px at var(--mx,50%) var(--my,0%), rgba(87,227,137,.09), transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.feat:hover::after { opacity: 1; }
.feat h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .02em; display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.feat p { color: var(--dim); font-size: 13.8px; line-height: 1.55; }
.feat p code { font-size: 12px; }

/* ───────────────────────────  hardware  ─────────────────────────── */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.board { padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: border-color .25s, transform .25s; }
.board:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.board .top { display: flex; align-items: flex-start; gap: 10px; }
.board h3 { font-size: 15.5px; line-height: 1.25; letter-spacing: -.005em; flex: 1; }
.board .env { font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .06em; }
.board dl { display: grid; grid-template-columns: 58px 1fr; gap: 6px 12px; font-size: 12.5px; margin: 0; }
.board dt { font-family: var(--mono); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; color: var(--faint); padding-top: 2px; }
.board dd { margin: 0; color: var(--dim); }
.board .st {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; display: flex; align-items: center; gap: 8px; color: var(--dim);
}
.board .st.ok  { color: var(--signal); }
.board .st.dev { color: var(--amber); }

/* ───────────────────────────  flasher  ──────────────────────────── */
.flash-grid { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); gap: 18px; }
@media (max-width: 900px) { .flash-grid { grid-template-columns: minmax(0,1fr); } }

.flasher { padding: 24px; }
.flasher .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.flasher .hd h3 { font-size: 17px; text-transform: uppercase; }
label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--faint); margin: 16px 0 6px;
}
select {
  width: 100%; background: var(--ink-2); color: var(--text); border: 1px solid var(--line-hi);
  padding: 11px 12px; font-family: var(--mono); font-size: 13px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  transition: border-color .2s;
}
select:hover, select:focus { border-color: var(--signal); }
.hint { font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.55; margin-top: 10px; }
.installrow { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
esp-web-install-button {
  --esp-tools-button-color: var(--signal);
  --esp-tools-button-text-color: var(--signal-ink);
  --esp-tools-font-family: var(--mono);
}
.warn-txt { color: var(--amber); font-family: var(--mono); font-size: 12px; line-height: 1.5; }

pre {
  font-family: var(--mono); font-size: 12px; line-height: 1.65; color: var(--text);
  background: var(--ink-2); border: 1px solid var(--line); padding: 14px;
  overflow-x: auto; white-space: pre; margin: 0;
}
pre .c { color: var(--faint); }
.steps { counter-reset: s; display: grid; grid-template-columns: minmax(0,1fr); gap: 0; }
.steps li {
  list-style: none; counter-increment: s; position: relative;
  padding: 14px 0 14px 42px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--dim);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 14px;
  font-family: var(--mono); font-size: 11px; color: var(--signal);
  border: 1px solid rgba(87,227,137,.3); padding: 2px 6px; line-height: 1;
}
.steps b, .steps strong { color: var(--text); font-weight: 600; }
.subhd { font-family: var(--mono); font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--faint); margin: 0 0 12px; }
.stack { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; }
.pane { padding: 22px; }

/* ────────────────────────────  licence  ─────────────────────────── */
.lic { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 780px) { .lic { grid-template-columns: minmax(0,1fr); } }
.lic > div { background: var(--panel); padding: 26px 24px; }
.lic h3 { font-size: 16px; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 9px; }
.lic p { color: var(--dim); font-size: 14px; }
.lic p + p { margin-top: 12px; }
.gpl {
  font-family: var(--mono); font-size: clamp(30px, 5vw, 52px); font-weight: 600;
  color: var(--signal); letter-spacing: -.02em; line-height: 1; margin-bottom: 14px;
  text-shadow: 0 0 34px rgba(87,227,137,.3);
}
.linklist { display: grid; grid-template-columns: minmax(0,1fr); gap: 0; margin-top: 6px; }
.linklist a {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px;
  color: var(--dim); transition: color .2s, padding-left .25s;
}
.linklist a:last-child { border-bottom: 0; }
.linklist a:hover { color: var(--signal); padding-left: 8px; }
.linklist a .arw { margin-left: auto; color: var(--faint); }
.linklist a:hover .arw { color: var(--signal); }

/* ────────────────────────────  footer  ──────────────────────────── */
footer { border-top: 1px solid var(--line); padding: 44px 0 56px; background: var(--ink-2); }
.foot { display: flex; flex-wrap: wrap; gap: 26px 40px; align-items: flex-start; justify-content: space-between; }
.foot > div:first-child { flex: 1 1 440px; min-width: 0; }
.foot p { font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.7; max-width: 70ch; }
.foot a { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-hi); }
.foot a:hover { color: var(--signal); }
.footnav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footnav a { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.footnav a:hover { color: var(--signal); }

/* scroll reveal */
.rv { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.2,.8,.2,1); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } }

/* active section in the status bar */
.nav a.act { color: var(--signal); }
.nav a.act::after { right: 0; }

/* esp-web-tools slotted button sits flush with our own */
esp-web-install-button[install-supported="false"] .btn { display: none; }

/* belt-and-braces against max-content overflow inside the flasher column */
.flash-grid > *, .stack > *, .pane, .flasher { min-width: 0; }
pre { max-width: 100%; }
