:root {
  color-scheme: dark;
  --page: #111213;
  --panel: #1b1c20;
  --panel-hover: #202126;
  --line: #30343c;
  --text: #f1f1f3;
  --muted: #b2b5be;
  --accent: #aaa0ff;
  --accent-strong: #a69bff;
  --blue: var(--accent);
  --font: "Inter", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: #16151d; }
a { color: var(--accent); text-decoration: none; transition: color .18s, background .18s, border-color .18s; }
a:hover { color: #c4bdff; }
.container, .nav-inner { width: min(100% - 64px, 1472px); margin-inline: auto; }

/* Header geometry and navigation */
.site-header { position: sticky; z-index: 10; top: 0; border-bottom: 1px solid var(--line); background: #111213f2; backdrop-filter: blur(14px); transition: transform .24s ease; }
.site-header.header-hidden { transform: translateY(-105%); pointer-events: none; }
.nav-inner { display: flex; min-height: 78px; align-items: center; gap: 42px; }
.brand { flex: 0 0 auto; color: var(--text); font-size: 27px; font-weight: 800; letter-spacing: -.06em; }
.brand span { color: var(--blue); }
.site-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(17px, 2.25vw, 38px); }
.site-header nav a, .nav-action { color: var(--text); font-size: 15px; font-weight: 600; }
.site-header nav a:hover, .nav-action:hover { color: var(--accent); }
.nav-action { display: inline-flex; min-width: 132px; min-height: 52px; align-items: center; justify-content: center; gap: 9px; margin-left: auto; padding: 0 19px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.github-icon { display: block; width: 19px; height: 19px; flex: 0 0 19px; }
.github-label { color: inherit; }

/* Hero */
.hero { padding: clamp(62px, 8vw, 110px) 0 62px; border-bottom: 1px solid #ffffff0a; }
.hero .container { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); grid-template-rows: auto auto auto auto auto; align-items: center; column-gap: clamp(42px, 8vw, 120px); text-align: left; }
.badge-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.badge { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 500; }
.badge-blue { color: var(--blue); }
.badge-yellow { color: var(--accent); }
.badge-dark { color: var(--muted); }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); }
.hero-tag, .section-label { margin-bottom: 10px; color: var(--blue); font-size: 14px; font-weight: 600; letter-spacing: .015em; }
.hero-tag { grid-column: 1; grid-row: 2; }
.hero h1 { grid-column: 1; grid-row: 3; margin: 0 0 12px; font-size: clamp(56px, 7.5vw, 112px); font-weight: 800; line-height: 1.02; letter-spacing: -.065em; }
.accent { color: var(--accent); }
.hero-sub { grid-column: 1; grid-row: 4; max-width: 860px; color: var(--muted); font-size: clamp(22px, 2.3vw, 34px); font-weight: 500; line-height: 1.55; }
.hero-desc { grid-column: 1; grid-row: 5; max-width: 800px; margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.hero-links { grid-column: 1; grid-row: 6; display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.btn { display: inline-flex; min-width: 180px; min-height: 58px; align-items: center; justify-content: center; padding: 12px 22px; border: 2px solid var(--line); border-radius: 11px; font-size: 16px; font-weight: 700; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #191821; }
.btn-primary:hover { background: #c0b9ff; color: #191821; }
.btn-secondary { color: var(--muted); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.repo-bar { grid-column: 1 / -1; grid-row: 7; display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.repo-stat { color: var(--muted); font-size: 13px; }
.repo-stat span { margin-left: 5px; color: var(--text); font-weight: 600; }
.vitals-strip { grid-column: 2; grid-row: 2 / span 5; display: grid; grid-template-columns: 1fr; gap: 13px; width: 100%; max-width: 380px; justify-self: end; }
.vital-card { min-width: 0; padding: 18px 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.vital-icon { float: right; color: var(--muted); font-size: 19px; }
.vital-label, .vital-unit { color: var(--muted); font-size: 12px; font-weight: 600; }
.vital-label { text-transform: uppercase; letter-spacing: .04em; }
.vital-value { display: inline-block; margin-top: 5px; color: var(--text); font-size: 36px; font-weight: 700; line-height: 1.15; letter-spacing: -.04em; }
.vital-unit { margin-left: 7px; }
.vc-red, .vc-blue, .vc-yellow { border-top: 1px solid var(--line); }

/* Content sections */
section:not(.hero) { padding: clamp(54px, 7vw, 92px) 0; }
section:not(.hero) + section:not(.hero) { border-top: 1px solid #ffffff0a; }
.section-label { margin-bottom: 8px; }
h2 { margin: 0 0 28px; color: var(--text); font-size: clamp(30px, 4vw, 46px); font-weight: 750; line-height: 1.15; letter-spacing: -.05em; }
h3 { margin: 42px 0 17px; font-size: 24px; letter-spacing: -.035em; }
p { color: var(--muted); }
.link { color: var(--accent); }
.link:hover { color: #c7c1ff; }
.feat-grid, .hw-grid, .proto-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.feat-item, .hw-card, .proto-card, .cloud-var, .step, .author-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); transition: background .2s, border-color .2s, transform .2s; }
.feat-item, .hw-card, .proto-card { padding: 25px; }
.feat-item:hover, .hw-card:hover, .proto-card:hover { transform: translateY(-2px); border-color: #494359; background: var(--panel-hover); }
.feat-dot { width: 8px; height: 8px; margin-bottom: 15px; border-radius: 50%; background: var(--blue); }
.fd-blue { background: var(--blue); }
.fd-yellow { background: var(--accent); }
.fd-dark { background: #747985; }
.feat-title, .hw-name, .proto-title { margin-bottom: 7px; color: var(--text); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.feat-text, .hw-desc, .proto-detail { color: var(--muted); font-size: 14px; line-height: 1.75; }
.hw-num, .hw-role { color: var(--blue); font-size: 12px; font-weight: 600; }
.hw-name { margin: 10px 0 3px; }
.hw-role { margin-bottom: 13px; color: var(--muted); }
.proto-tag { margin-bottom: 13px; color: var(--blue); font-size: 13px; font-weight: 600; }
.proto-i2c .proto-tag, .proto-1wire .proto-tag, .proto-mqtt .proto-tag, .proto-wifi .proto-tag { color: var(--blue); }
.proto-title { font-size: 17px; }

/* Tables and code */
.pin-table { width: 100%; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; overflow: hidden; border-radius: 13px; background: var(--panel); font-size: 14px; }
.pin-table th, .pin-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.pin-table th { color: var(--text); background: #202126; font-weight: 700; }
.pin-table tr:last-child td { border-bottom: 0; }
.pin-table td { color: var(--muted); }
.pin-sensor { color: var(--text) !important; }
.pin-gpio, .pin-power { color: var(--accent) !important; }
.arch-diagram { overflow: hidden; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.arch-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 11px 0; }
.arch-row + .arch-row { border-top: 1px solid var(--line); }
.arch-node { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; background: #202126; font-size: 12px; }
.an-yellow, .an-blue, .an-dim { color: var(--text); }
.arch-arrow { color: var(--muted); font-size: 12px; }
.code-block { overflow: auto; max-width: 100%; margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); font: 13px/1.8 var(--font); white-space: pre; }
.code-comment { color: var(--muted); }
.code-key, .code-val, .code-str { color: var(--accent); }
.cloud-vars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cloud-var { padding: 17px; }
.cv-name { color: var(--text); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.cv-type, .cv-policy { margin-top: 6px; color: var(--muted); font-size: 12px; }
.inline-code { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: #202126; color: var(--accent); font: .9em var(--font); overflow-wrap: anywhere; }

/* Setup and author */
.steps { display: grid; gap: 13px; counter-reset: install-step; }
.step { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; }
.step-num { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); background: #202126; font-size: 12px; font-weight: 700; }
.step-num::before { counter-increment: install-step; content: counter(install-step); }
.step-content { min-width: 0; }
.step h4 { margin: 0 0 5px; color: var(--text); font-size: 16px; }
.step p { margin: 0; font-size: 14px; }
.author-card { display: flex; gap: 20px; align-items: center; padding: 25px; }
.author-avatar { display: grid; flex: 0 0 60px; place-items: center; width: 60px; height: 60px; border: 1px solid #48415e; border-radius: 50%; background: #272434; color: var(--accent); font-size: 18px; font-weight: 700; }
.author-name { color: var(--text); font-size: 21px; font-weight: 700; }
.author-detail { margin-top: 6px; color: var(--muted); font-size: 14px; }
footer { padding: 18px 0 45px; text-align: center; }
.divider { height: 1px; margin-bottom: 28px; background: var(--line); }
.footer-brand { color: var(--text); font-size: 22px; font-weight: 800; letter-spacing: -.05em; }
.footer-brand span { color: var(--accent); }
.footer-copy { margin-top: 10px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .container, .nav-inner { width: min(100% - 44px, 800px); }
  .nav-inner { min-height: 72px; gap: 24px; }
  .site-header nav { gap: 17px; }
  .site-header nav a { font-size: 13px; }
  .nav-action { min-width: 100px; min-height: 45px; }
  .hero .container { grid-template-columns: minmax(0, 1fr) minmax(230px, .65fr); column-gap: 30px; }
  .hero h1 { font-size: clamp(52px, 8vw, 82px); }
  .vital-card { padding: 15px; }
  .vital-value { font-size: 31px; }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 56px; }
  .container, .nav-inner { width: calc(100% - 36px); }
  .nav-inner { min-height: 54px; flex-wrap: nowrap; gap: 13px; }
  .brand { margin: 0; font-size: 22px; }
  .site-header nav { order: 0; width: auto; min-width: 0; flex: 1; flex-wrap: nowrap; gap: 16px; overflow-x: auto; padding: 0; white-space: nowrap; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { font-size: 11px; }
  .nav-action { width: 36px; min-width: 36px; height: 36px; min-height: 36px; flex: 0 0 36px; padding: 0; border-radius: 50%; }
  .github-icon { width: 18px; height: 18px; flex-basis: 18px; }
  .github-label { display: none; }
  .hero { padding: 50px 0 42px; }
  .hero .container { grid-template-columns: 1fr; grid-template-rows: auto; gap: 0; }
  .badge-row, .hero-tag, .hero h1, .hero-sub, .hero-desc, .hero-links, .repo-bar, .vitals-strip { grid-column: 1; grid-row: auto; }
  .badge-row { margin-bottom: 24px; }
  .hero h1 { margin-bottom: 10px; font-size: clamp(54px, 13vw, 82px); }
  .hero-sub { font-size: clamp(20px, 5vw, 27px); }
  .hero-desc { margin-top: 12px; }
  .vitals-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; justify-self: stretch; margin-top: 28px; }
  .vital-card { padding: 13px 10px; }
  .vital-value { font-size: 27px; }
  .vital-label, .vital-unit { font-size: 10px; }
  .repo-bar { gap: 10px 18px; margin-top: 28px; }
  .feat-grid, .hw-grid, .proto-grid { grid-template-columns: 1fr; }
  .cloud-vars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .container, .nav-inner { width: calc(100% - 28px); }
  .nav-inner { gap: 10px; }
  .site-header nav { gap: 13px; }
  .badge-row { gap: 6px; }
  .badge { padding: 5px 9px; font-size: 10px; }
  .hero-links { gap: 9px; }
  .btn { min-width: 0; min-height: 52px; flex: 1; padding: 10px; font-size: 14px; }
  .vitals-strip { gap: 7px; }
  .vital-card { padding: 11px 8px; border-radius: 10px; }
  .vital-value { font-size: 23px; }
  .vital-label, .vital-unit { font-size: 9px; }
  .vital-icon { font-size: 14px; }
  section:not(.hero) { padding: 48px 0; }
  .feat-item, .hw-card, .proto-card { padding: 20px; }
  .pin-table th, .pin-table td { padding: 9px 6px; font-size: 10px; }
  .code-block { padding: 14px; font-size: 11px; }
  .arch-diagram { padding: 12px; }
  .arch-row { gap: 6px; }
  .arch-node, .arch-arrow { font-size: 10px; }
  .author-card { gap: 13px; align-items: flex-start; padding: 18px 14px; }
  .author-avatar { flex-basis: 48px; width: 48px; height: 48px; }
  .author-detail { font-size: 12px; }
}
/* Compact navigation for phones and tablets */
.menu-toggle { display: none; }
@media (max-width: 1024px) {
  .nav-inner { position: relative; min-height: 64px; justify-content: flex-start; }
  .menu-toggle {
    display: flex; width: 44px; height: 44px; flex: 0 0 44px;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    padding: 0; border: 1px solid var(--line); border-radius: 11px;
    background: var(--panel); color: var(--text); cursor: pointer;
    touch-action: manipulation;
  }
  .menu-toggle span { display: block; width: 19px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .16s ease, opacity .12s ease; }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-7px) rotate(-45deg); }
  .site-header nav {
    position: absolute; z-index: 12; top: calc(100% + 8px); left: 0;
    display: flex; width: min(280px, calc(100vw - 28px)); min-width: 0;
    flex-direction: column; align-items: stretch; gap: 2px; overflow: visible;
    padding: 9px; border: 1px solid var(--line); border-radius: 14px;
    background: #191a1ef7; box-shadow: 0 18px 42px #0008;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-6px); transition: opacity .14s ease, transform .14s ease, visibility .14s;
  }
  .site-header.menu-open nav { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
  .site-header nav a { display: block; padding: 11px 13px; border-radius: 8px; font-size: 14px; }
  .site-header nav a:hover, .site-header nav a:focus-visible { background: var(--panel-hover); }
  .nav-action { margin-left: auto; }
  .site-header.header-hidden { transform: none; pointer-events: auto; }
}
@media (max-width: 700px) {
  .nav-inner { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
