:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-subtle: #f1f1ee;
  --ink: #171719;
  --muted: #68686f;
  --line: #e1e1dc;
  --line-strong: #cfcfc8;
  --accent: #4c50d8;
  --accent-hover: #3f43c3;
  --accent-soft: #f0f0ff;
  --danger: #b42318;
  --danger-soft: #fff2f0;
  --ok: #16875b;
  --ok-soft: #edf8f3;
  --radius: 12px;
  --container: 1180px;
  color: var(--ink);
  background: var(--bg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
img, svg { display: block; }
.hidden { display: none !important; }

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 650; transition: transform 140ms ease; }
.skip-link:focus { transform: translateY(0); }

.site-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 0 max(20px, calc((100vw - var(--container)) / 2)); border-bottom: 1px solid var(--line); background: rgba(247, 247, 245, .94); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; min-width: 0; font-size: 15px; font-weight: 760; letter-spacing: -.025em; }
.wordmark span[translate="no"] { white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; }
.site-header nav, .site-footer nav { display: flex; align-items: center; gap: 22px; }
.site-header nav a, .site-footer nav a { color: var(--muted); font-size: 14px; font-weight: 550; }
.site-header nav a:hover, .site-footer nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] { font-weight: 680; }

main { display: block; }
.hero { max-width: var(--container); min-height: 650px; margin: 0 auto; padding: clamp(72px, 9vw, 112px) 20px; display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(360px, .97fr); align-items: center; gap: clamp(48px, 7vw, 96px); }
.hero-copy { max-width: 650px; }
.eyebrow { margin: 0 0 16px; color: var(--accent); font-size: 12px; font-weight: 760; letter-spacing: .13em; text-transform: uppercase; }
.hero h1, .section-heading h2, .final-cta h2, .prose h1 { text-wrap: balance; }
.hero h1 { margin: 0; max-width: 680px; font-size: clamp(52px, 6.2vw, 82px); line-height: .98; letter-spacing: -.06em; }
.lede { max-width: 610px; margin: 25px 0 0; color: var(--muted); font-size: clamp(18px, 1.8vw, 21px); line-height: 1.58; text-wrap: pretty; }
.hero-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: 9px; background: var(--ink); color: #fff; font-weight: 680; line-height: 1.2; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease; }
.button:hover { background: #29292d; border-color: #29292d; }
.button:active { transform: translateY(1px); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.button.secondary:hover { border-color: #b8b8b1; background: var(--surface-subtle); }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.ghost:hover { border-color: var(--line); background: var(--surface-subtle); color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 0; color: var(--ink); font-weight: 650; border-bottom: 1px solid var(--line-strong); }
.text-link:hover { border-color: var(--ink); }

.google-button { position: relative; width: min(100%, 400px); min-height: 44px; padding: 9px 16px 9px 44px; border: 1px solid #747775; border-radius: 4px; background: #fff; color: #1f1f1f; font-family: Roboto, Arial, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: .1px; box-shadow: none; }
.google-button:hover { border-color: #6f7274; background: #f8fafd; color: #1f1f1f; }
.google-button:active { background: #f1f3f4; transform: none; }
.google-icon { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); }

.hero-visual { width: 100%; max-width: 520px; margin-left: auto; }
.node { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.node span { font-weight: 690; }
.node b { color: var(--muted); font-size: 12px; font-weight: 600; }
.node.relay { border-color: #aeb0f4; background: #fbfbff; }
.node.device-node { position: relative; padding-right: 94px; }
.node .pulse { position: absolute; right: 16px; padding: 4px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 11px; font-style: normal; font-weight: 650; }
.rail { position: relative; height: 58px; display: grid; place-items: center; }
.rail span { position: absolute; inset: 0 auto; width: 1px; background: var(--line-strong); }
.rail i { position: relative; padding: 3px 8px; background: var(--bg); color: var(--muted); font-size: 11px; font-style: normal; }

.principles { max-width: var(--container); margin: 0 auto; padding: 0 20px 72px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.principles > div { min-height: 210px; padding: 36px 34px 0 0; }
.principles > div + div { padding-left: 34px; border-left: 1px solid var(--line); }
.principles span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.principles h2 { margin: 28px 0 9px; font-size: 21px; line-height: 1.2; letter-spacing: -.025em; }
.principles p { max-width: 330px; margin: 0; color: var(--muted); font-size: 15px; }

.workspace { padding: clamp(72px, 9vw, 112px) 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.workspace > * { max-width: var(--container); margin-left: auto; margin-right: auto; }
.section-heading { max-width: 720px; margin-bottom: 45px; }
.section-heading h2, .final-cta h2 { margin: 0; font-size: clamp(38px, 5vw, 58px); line-height: 1.02; letter-spacing: -.05em; }
.section-heading > p:last-child, .final-cta > p { max-width: 620px; margin: 16px 0 0; color: var(--muted); font-size: 18px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.auth-pane, .endpoint-pane { min-width: 0; padding: 34px 0 38px; }
.auth-pane { padding-right: 48px; border-right: 1px solid var(--line); }
.endpoint-pane { padding-left: 48px; }
.auth-pane h3, .endpoint-pane h3, .pair-panel h3, .devices-panel h3, .oauth-card h2 { margin: 0 0 9px; font-size: 20px; line-height: 1.25; letter-spacing: -.025em; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
label { display: block; margin: 10px 0 6px; color: #343438; font-size: 13px; font-weight: 650; }
.stack label { margin: 3px 0 -4px; }
input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); transition: border-color 140ms ease, box-shadow 140ms ease; }
input:hover { border-color: #b9b9b2; }
input:focus-visible { border-color: var(--accent); }
.button-row { display: flex; gap: 9px; margin-top: 5px; }
.divider { display: flex; align-items: center; gap: 11px; margin: 7px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.error { min-height: 20px; margin: 2px 0 0; color: var(--danger); font-size: 13px; }
.identity { display: flex; align-items: center; gap: 11px; }
.identity small { display: block; color: var(--muted); }
.status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.command-row, .pairing-output { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: start; margin-top: 20px; }
.command-row code, .pairing-output code, .code-block { overflow: auto; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.copy-button { min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 650; }
.copy-button:hover { background: var(--surface-subtle); }
.endpoint-facts { margin: 28px 0 0; border-top: 1px solid var(--line); }
.endpoint-facts div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.endpoint-facts dt { color: var(--muted); }
.endpoint-facts dd { margin: 0; text-align: right; font-weight: 650; }
.device-workspace { margin-top: 52px; }
.pair-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.pairing-output { grid-column: 1 / -1; }
.pairing-output p { grid-column: 1 / -1; margin: 0; }
.devices-panel { padding-top: 34px; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.device-list { margin-top: 14px; border-top: 1px solid var(--line); }
.device { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.device strong { font-size: 15px; }
.device .muted { overflow-wrap: anywhere; font-size: 13px; }
.online, .offline { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; }
.online { color: var(--ok); }
.offline { color: var(--muted); }
.danger { min-height: 38px; padding: 8px 11px; border: 1px solid #e7c3be; border-radius: 8px; background: transparent; color: var(--danger); font-weight: 650; }
.danger:hover { background: var(--danger-soft); }

.final-cta { max-width: var(--container); margin: 0 auto; padding: clamp(72px, 9vw, 112px) 20px; }
.final-cta .text-link { margin-top: 24px; }
.site-footer { max-width: var(--container); min-height: 86px; margin: 0 auto; padding: 22px 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 26px; border-top: 1px solid var(--line); font-size: 13px; }
.site-footer p { margin: 0; color: var(--muted); text-align: right; }

.doc-shell { width: min(100%, var(--container)); margin: 0 auto; padding: 64px 20px 112px; display: grid; grid-template-columns: 190px minmax(0, 760px); gap: clamp(48px, 8vw, 96px); }
.doc-nav { position: sticky; top: 28px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.doc-nav a { padding: 8px 10px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 550; }
.doc-nav a:hover { background: var(--surface-subtle); color: var(--ink); }
.doc-nav a[aria-current="page"] { background: var(--surface-subtle); color: var(--ink); font-weight: 680; }
.prose { min-width: 0; }
.prose h1 { margin: 0 0 22px; max-width: 740px; font-size: clamp(42px, 5.5vw, 62px); line-height: 1.02; letter-spacing: -.05em; }
.prose h2 { scroll-margin-top: 28px; margin: 52px 0 12px; font-size: 25px; line-height: 1.2; letter-spacing: -.035em; }
.prose h3 { scroll-margin-top: 28px; margin: 31px 0 8px; font-size: 18px; }
.prose p, .prose li { color: #505057; font-size: 16px; text-wrap: pretty; }
.prose p { margin: 0 0 16px; }
.prose a { color: #3538ae; text-decoration: underline; text-decoration-color: #a5a7e9; text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: #3538ae; }
.prose pre { overflow: auto; margin: 18px 0 24px; padding: 16px; border-radius: 10px; background: #1e1e21; color: #f4f4f2; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.prose :not(pre) > code { padding: 2px 5px; border-radius: 5px; background: var(--surface-subtle); color: #34343a; }
.prose hr { margin: 46px 0; border: 0; border-top: 1px solid var(--line); }
.prose .notice { margin: 28px 0; padding: 16px 18px; border: 1px solid #d8d8f7; border-radius: 9px; background: var(--accent-soft); }
.prose .notice p { margin: 5px 0 0; }

.oauth-shell { min-height: calc(100svh - 68px); display: grid; place-items: center; padding: 56px 20px 80px; }
.oauth-card { width: min(100%, 520px); padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.oauth-card .eyebrow { margin-bottom: 11px; }
.oauth-card > p:first-child { margin-top: 0; }
.oauth-card .google-button { width: 100%; }
.scope-list { margin: 24px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.scope-list li { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.scope-list strong { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; }
.oauth-actions { display: flex; gap: 9px; margin-top: 18px; }
.oauth-meta { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.footer-mini { margin: 26px 0 0; color: var(--muted); font-size: 12px; }
.footer-mini a { text-decoration: underline; text-underline-offset: 3px; }

input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(76, 80, 216, .28); outline-offset: 2px; }

@media (max-width: 900px) {
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 76px; padding-bottom: 76px; }
  .hero-copy { max-width: 700px; }
  .hero-visual { max-width: 680px; margin: 4px 0 0; }
  .principles { grid-template-columns: 1fr; padding-bottom: 58px; }
  .principles > div, .principles > div + div { min-height: auto; padding: 28px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .principles > div:last-child { border-bottom: 0; }
  .workspace-grid { grid-template-columns: 1fr; }
  .auth-pane { padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .endpoint-pane { padding-left: 0; }
  .doc-shell { grid-template-columns: 1fr; gap: 38px; padding-top: 42px; }
  .doc-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
  .site-footer { grid-template-columns: 1fr; }
  .site-footer nav { flex-wrap: wrap; }
  .site-footer p { text-align: left; }
}

@media (max-width: 620px) {
  .site-header { min-height: 62px; padding: 0 16px; }
  .site-header { gap: 12px; }
  .site-header nav { gap: 10px; }
  .site-header nav a { font-size: 12.5px; }
  .hero { padding: 58px 18px 64px; }
  .hero h1 { font-size: clamp(46px, 14vw, 60px); }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .hero-actions .button, .hero-actions .text-link { width: 100%; justify-content: center; }
  .node { align-items: flex-start; flex-direction: column; gap: 3px; }
  .node.device-node { padding-right: 18px; }
  .node .pulse { top: 15px; }
  .workspace, .final-cta { padding-left: 18px; padding-right: 18px; }
  .button-row, .oauth-actions { flex-direction: column; }
  .button-row .button, .oauth-actions .button { width: 100%; }
  .pair-panel { grid-template-columns: 1fr; }
  .pair-panel .button { justify-self: start; }
  .panel-title { align-items: flex-start; flex-direction: column; }
  .command-row, .pairing-output { grid-template-columns: 1fr; }
  .copy-button { justify-self: start; }
  .endpoint-facts div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .endpoint-facts dd { text-align: left; }
  .site-footer { padding: 24px 18px; }
  .site-footer nav { gap: 14px; }
  .doc-shell { padding: 34px 18px 80px; }
  .doc-nav { overflow-x: auto; flex-wrap: nowrap; margin: 0 -18px; padding: 0 18px 16px; }
  .doc-nav a { white-space: nowrap; }
  .oauth-shell { min-height: calc(100svh - 62px); padding: 28px 14px 60px; place-items: start center; }
  .oauth-card { padding: 22px 18px; }
  .scope-list li { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
