:root {
  color-scheme: light;
  --bg: #eaf8fb;
  --text: #092733;
  --muted: rgba(9, 39, 51, .68);
  --panel: rgba(255, 255, 255, .66);
  --panel-strong: rgba(255, 255, 255, .86);
  --line: rgba(12, 145, 174, .22);
  --accent: #008fb0;
  --accent-2: #12c8c2;
  --shadow: rgba(0, 159, 191, .22);
  --danger: #ffb25f;
  --control-bg: rgba(255, 255, 255, .72);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07131a;
  --text: #eefcff;
  --muted: rgba(224, 246, 250, .74);
  --panel: rgba(8, 31, 40, .58);
  --panel-strong: rgba(8, 34, 45, .82);
  --line: rgba(124, 238, 255, .25);
  --accent: #62edff;
  --accent-2: #b1fff3;
  --shadow: rgba(24, 220, 255, .34);
  --control-bg: rgba(4, 18, 25, .68);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; text-decoration: none; }

button {
  color: inherit;
  font: inherit;
}

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg) center / cover no-repeat;
  transform: translateZ(0);
  will-change: opacity;
  contain: strict;
  transition: opacity .28s ease;
}

body.home .site-bg { background-image: var(--home-bg, url("/assets/img/hub-light.webp")); }
body.service .site-bg { background-image: var(--page-bg); }

html[data-theme="dark"] body.home { --home-bg: url("/assets/img/hub-dark.webp"); }
html[data-theme="light"] body.home,
html:not([data-theme]) body.home { --home-bg: url("/assets/img/hub-light.webp"); }

.site-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(81, 236, 255, .28), transparent 26rem),
    linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .34));
  opacity: .8;
  transform: translateZ(0);
  will-change: opacity;
  transition: opacity .25s ease;
}

html[data-theme="light"] .site-bg::after {
  background:
    radial-gradient(circle at 50% 50%, rgba(24, 196, 223, .30), transparent 28rem),
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(230,249,252,.32));
}

html[data-theme="dark"] body.service .site-bg::after {
  background:
    radial-gradient(circle at 50% 45%, rgba(26, 168, 190, .16), transparent 24rem),
    linear-gradient(180deg, rgba(0, 0, 0, .52), rgba(0, 0, 0, .72));
  opacity: .94;
}

body.node-active .site-bg::after { opacity: .8; }

html[data-theme="dark"] body.service.node-active .site-bg::after { opacity: .94; }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 4vw, 54px);
  pointer-events: none;
}

.brand, .top-actions, .menu-panel { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  box-shadow: 0 16px 34px rgba(0,0,0,.13);
  backdrop-filter: blur(12px);
  transform: translateZ(0);
  font-weight: 800;
  letter-spacing: .04em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 2px solid var(--accent);
  border-radius: 9px 9px 13px 13px;
  position: relative;
  box-shadow: inset 0 -8px 0 rgba(98, 237, 255, .22), 0 0 18px var(--shadow);
}

.brand-mark::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 7px;
  top: -8px;
  left: 6px;
  border: 2px solid var(--accent);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
}

.icon-button, .lang-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(0,0,0,.13);
  transform: translateZ(0);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.icon-button:hover, .lang-button:hover { transform: translate3d(0, -1px, 0); border-color: rgba(98,237,255,.75); }

.theme-icon, .menu-icon {
  width: 18px;
  height: 18px;
  position: relative;
}

.theme-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid currentColor;
  box-shadow: 8px 0 0 -4px currentColor;
}

.menu-icon, .menu-icon::before, .menu-icon::after {
  border-top: 2px solid currentColor;
}

.menu-icon::before, .menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
}

.menu-icon::before { top: 6px; }
.menu-icon::after { top: 14px; }

.lang {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--control-bg);
  backdrop-filter: blur(12px);
  transform: translateZ(0);
}

.lang-button {
  width: 40px;
  height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.lang-button.is-active {
  background: rgba(98, 237, 255, .18);
  color: var(--text);
}

.menu-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(330px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0,0,0,.30);
  transform-origin: top right;
  transform: translate3d(0, -8px, 0) scale(.96);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
  transition: opacity .18s ease, transform .18s ease;
}

.menu-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.menu-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 700;
}

.menu-panel a:hover {
  color: var(--text);
  background: rgba(98, 237, 255, .13);
}

.login-link { color: var(--text) !important; background: rgba(98, 237, 255, .15); }

.main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 100px clamp(18px, 4vw, 54px) 32px;
}

.home-shell {
  min-height: calc(100vh - 132px);
  display: grid;
  place-items: center;
}

.hub {
  width: min(980px, 100%);
  min-height: min(680px, calc(100vh - 150px));
  position: relative;
  display: grid;
  place-items: center;
}

@media (min-width: 901px) {
  .home .hub {
    transform: translateY(-54px);
  }
}

.center-cloud, .node-cloud, .cta-pill {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.18), var(--panel));
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 54px rgba(0,0,0,.20), 0 0 32px var(--shadow);
  transform: translateZ(0);
}

.center-cloud {
  width: clamp(230px, 34vw, 360px);
  min-height: 176px;
  border: 0;
  border-radius: 28px;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  position: relative;
  z-index: 2;
  will-change: opacity;
  transition: opacity .25s ease, border-color .18s ease, box-shadow .18s ease;
}

.center-cloud::before, .center-cloud::after {
  display: none;
}

.center-cloud::before {
  width: 44%;
  height: 70%;
  left: 10%;
  top: -22%;
  border-radius: 50%;
}

.center-cloud::after {
  width: 58%;
  height: 82%;
  right: 8%;
  top: -29%;
  border-radius: 50%;
}

.center-title {
  font-size: clamp(46px, 7vw, 86px);
  line-height: .9;
  font-weight: 900;
  text-shadow: 0 0 24px rgba(98,237,255,.42);
}

.center-subtitle {
  margin-top: 12px;
  font-size: clamp(14px, 1.5vw, 18px);
  color: var(--muted);
  font-weight: 700;
}

.home-tags {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.home-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(98, 237, 255, .24);
  border-radius: 999px;
  background: rgba(98, 237, 255, .10);
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.node-cloud {
  --x: 0px;
  --y: 0px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(128px, 15.3vw, 187px);
  min-height: 71px;
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(.98);
  border-radius: 24px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px 17px;
  font-size: clamp(15px, 1.6vw, 19px);
  font-weight: 900;
  will-change: opacity, transform;
  transition: opacity .25s ease, transform .28s ease, border-color .18s ease, box-shadow .18s ease;
}

.node-cloud:hover, .node-cloud:focus-visible {
  border-color: rgba(98,237,255,.78);
  box-shadow: 0 24px 64px rgba(0,0,0,.24), 0 0 48px rgba(98,237,255,.48);
}

.n-dev { --x: -340px; --y: -230px; }
.n-prototype { --x: -380px; --y: -55px; }
.n-pcb { --x: -350px; --y: 125px; }
.n-print { --x: -230px; --y: 275px; }
.n-mqtt { --x: 340px; --y: -230px; }
.n-smart { --x: 380px; --y: -55px; }
.n-proxy { --x: 350px; --y: 125px; }
.n-library { --x: 230px; --y: 275px; }

.cta-pill {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 35;
  min-width: 0;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 900;
}

.cta-pill:hover { border-color: rgba(98,237,255,.75); }

.service-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  min-height: calc(100vh - 120px);
  display: grid;
  align-content: center;
  gap: 28px;
}

.breadcrumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hero-title {
  max-width: 820px;
}

.hero-title h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 96px);
  line-height: .9;
  font-weight: 950;
  text-shadow: 0 0 30px rgba(98,237,255,.32);
}

.hero-title p {
  margin: 22px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 24px);
  line-height: 1.38;
  font-weight: 650;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.info-card, .need-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 46px rgba(0,0,0,.15);
  transform: translateZ(0);
}

.info-card {
  min-height: 158px;
  padding: 18px;
}

.info-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.info-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.info-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.need-panel {
  padding: clamp(20px, 3vw, 30px);
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 22px;
}

.need-panel h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
}

.need-list {
  display: grid;
  gap: 12px;
}

.need-list span,
.need-list a {
  display: block;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(98, 237, 255, .10);
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.need-list a:hover {
  border-color: var(--accent);
  background: rgba(98, 237, 255, .18);
}

.page-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action, .secondary-action {
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-weight: 900;
  backdrop-filter: blur(12px);
  transform: translateZ(0);
}

.primary-action {
  background: linear-gradient(135deg, rgba(98,237,255,.92), rgba(177,255,243,.82));
  color: #04212b;
}

.secondary-action {
  background: var(--control-bg);
}

.library-shell {
  padding-bottom: 60px;
}

.library-intro p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.library-section {
  display: grid;
  gap: 16px;
  content-visibility: auto;
  contain-intrinsic-size: 520px;
}

.library-section h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.library-link {
  color: inherit;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.library-link:hover {
  transform: translate3d(0, -2px, 0);
  border-color: rgba(98,237,255,.70);
  background: rgba(98, 237, 255, .12);
}

html[data-theme="light"] .icon-button:hover,
html[data-theme="light"] .lang-button:hover,
html[data-theme="light"] .cta-pill:hover {
  color: #03070a;
  border-color: rgba(10, 14, 18, .92);
  background: rgba(10, 14, 18, .16);
  box-shadow: 0 14px 32px rgba(10, 14, 18, .22), 0 0 0 2px rgba(10, 14, 18, .14);
}

html[data-theme="light"] .menu-panel a:hover,
html[data-theme="light"] .library-link:hover {
  color: #020609;
  border-color: rgba(10, 14, 18, .86);
  background: rgba(10, 14, 18, .18);
  box-shadow: inset 0 0 0 1px rgba(10, 14, 18, .16);
}

html[data-theme="light"] .node-cloud:hover,
html[data-theme="light"] .node-cloud:focus-visible {
  color: #020609;
  border-color: rgba(10, 14, 18, .92);
  background: linear-gradient(145deg, rgba(10, 14, 18, .20), rgba(255,255,255,.68));
  box-shadow: 0 24px 56px rgba(10, 14, 18, .24), 0 0 0 2px rgba(10, 14, 18, .16);
}

.article-stack {
  display: grid;
  gap: 16px;
}

.article-block {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 46px rgba(0,0,0,.15);
  padding: clamp(18px, 3vw, 28px);
  content-visibility: auto;
  contain-intrinsic-size: 420px;
  transform: translateZ(0);
}

.article-block h2 {
  margin: 0 0 14px;
  font-size: clamp(22px, 2.4vw, 32px);
}

.article-block ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.article-block li + li {
  margin-top: 8px;
}

.article-block pre {
  margin: 14px 0 0;
  padding: 16px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(98, 237, 255, .18);
  border-radius: 16px;
  background: rgba(2, 10, 15, .78);
  color: #dffcff;
  font-size: 13px;
  line-height: 1.45;
  tab-size: 2;
}

.article-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (hover: hover) and (min-width: 901px) {
  .home .center-cloud {
    opacity: .86;
  }

  .home .center-cloud:hover,
  .home .center-cloud:focus-visible {
    opacity: .94;
  }

  .home .node-cloud {
    opacity: .34;
    pointer-events: auto;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)));
  }

  .home .hub:hover .node-cloud,
  .home .hub:focus-within .node-cloud {
    opacity: .68;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)));
  }

  .home .node-cloud:hover,
  .home .node-cloud:focus-visible {
    opacity: 1;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)));
  }
}

@media (max-width: 900px) {
  html[data-theme="dark"] body.home,
  html[data-theme="light"] body.home,
  html:not([data-theme]) body.home {
    --home-bg: url("/assets/img/hub-mobile-20260712.webp");
  }

  .site-bg {
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: 100vw;
    height: 120vh;
    height: 120lvh;
    min-height: 820px;
    background-attachment: scroll;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
  }
  .site-bg::after {
    inset: 0;
    height: 100%;
  }
  .topbar { padding: 14px 14px; }
  .brand { padding: 8px 11px; }
  .brand span:last-child { display: none; }
  .main { padding: 88px 14px 92px; }
  .home-shell { align-items: start; padding-top: 18px; }
  .hub {
    width: min(760px, 100%);
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "center center"
      "dev mqtt"
      "prototype smart"
      "pcb proxy"
      "print library";
    gap: 13px;
    justify-items: stretch;
    align-items: center;
  }
  .center-cloud {
    grid-column: 1 / -1;
    grid-area: center;
    justify-self: center;
    width: min(330px, 88vw);
    min-height: 142px;
    margin: 18px auto 18px;
  }
  .node-cloud {
    position: static;
    width: auto;
    min-height: 78px;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    font-size: 15px;
    padding: 14px;
  }
  .n-dev { grid-area: dev; }
  .n-mqtt { grid-area: mqtt; }
  .n-smart { grid-area: smart; }
  .n-proxy { grid-area: proxy; }
  .n-prototype { grid-area: prototype; }
  .n-pcb { grid-area: pcb; }
  .n-print { grid-area: print; }
  .n-library { grid-area: library; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .need-panel { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .top-actions { gap: 6px; }
  .icon-button { width: 38px; height: 38px; }
  .lang-button { width: 34px; height: 30px; }
  .center-title { font-size: 48px; }
  .center-subtitle {
    max-width: 260px;
    margin: 10px auto 0;
    font-size: 14px;
  }
  .home-tags {
    margin-top: 12px;
    gap: 5px;
  }
  .home-tags span {
    min-height: 22px;
    padding: 0 7px;
    font-size: 10px;
  }
  .hub {
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "dev"
      "mqtt"
      "smart"
      "proxy"
      "prototype"
      "pcb"
      "print"
      "library";
    gap: 11px;
  }
  .center-cloud {
    width: min(320px, 90vw);
    min-height: 176px;
    margin: 12px auto 8px;
    padding: 22px 18px;
  }
  .node-cloud {
    width: min(320px, 100%);
    min-height: 62px;
    justify-self: center;
    border-radius: 22px;
    padding: 12px 10px;
    font-size: 14px;
  }
  .cards { grid-template-columns: 1fr; }
  .info-card { min-height: auto; }
  .hero-title h1 { font-size: 44px; }
  .hero-title p { font-size: 17px; }
  .cta-pill {
    right: 14px;
    bottom: 14px;
    min-height: 40px;
    padding: 0 14px;
  }
}

@media (max-width: 900px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .library-grid { grid-template-columns: 1fr; }
}
