/* ble-mesh.esp32.eu.org - the flyer stylesheet.
   Colour accents come from palette.css, which is generated from real colour
   temperatures; nothing here hard-codes an accent except structural greys. */

:root {
  --bg: #0e0f12;
  --bg-raised: #131519;
  --line: #22262d;
  --line-strong: #2f353e;
  --ink: #e8e6e1;
  --ink-mid: #9aa1ab;
  --ink-dim: #6b7280;
  --warm-2700: var(--cct-2700);
  --cool-6500: var(--cct-6500);
  --ok: #7fb069;
  --measure: 74ch;
  --gap: clamp(1rem, 2.6vw, 2rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 clamp(15px, 0.55vw + 13px, 17px)/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "kern", "liga", "calt";
  text-rendering: optimizeLegibility;
}

a { color: var(--cct-3400); text-decoration-color: color-mix(in srgb, var(--cct-3400) 45%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--cct-5000); }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
code { background: #171a1f; border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; color: #d7dbe1; }
pre { background: #12151a; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.15rem; overflow-x: auto; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; }

h1, h2, h3 { line-height: 1.18; letter-spacing: -0.015em; font-weight: 620; }
h2 { font-size: clamp(1.35rem, 1.5vw + .9rem, 2rem); margin: 0 0 .35em; }
/* a page heading that is an h1 for semantics and an h2 for size */
h1.title { font-size: clamp(1.35rem, 1.5vw + .9rem, 2rem); margin: .1em 0 .35em; max-width: none; }
h3 { font-size: 1.06rem; margin: 1.4em 0 .4em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

.wrap { width: min(1180px, 100% - 2 * var(--gap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.dim { color: var(--ink-mid); }
.dimmer { color: var(--ink-dim); }
.kicker { font: 600 .74rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--cct-2700); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* the top bar carries the pages and nothing else: the product is named by the first
   screenful, so repeating it here would only cost the hero its height */
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: stretch; justify-content: flex-end; gap: 1.4rem; padding: 0; }
.nav ul { list-style: none; display: flex; gap: 1.15rem; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a { color: var(--ink-mid); text-decoration: none; font-size: .92rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--cct-2700); }

/* the examples entry opens a list of the nodes. It is a <details> element, not a script:
   it opens on tap and on the keyboard as well as on hover, and the page that lists every
   node is the first thing inside it, so the entry is never a dead end on a touch screen.
   The items stretch to the bar's height so the pointer never crosses a gap and closes the
   panel on its way down. */
.nav a, .nav summary { display: inline-flex; align-items: center; padding: .8rem 0; }
.nav-dd-wrap { position: relative; }
.nav-dd summary { list-style: none; cursor: pointer; color: var(--ink-mid); font-size: .92rem; }
.nav-dd summary::-webkit-details-marker { display: none; }
.nav-dd summary:hover, .nav-dd[open] > summary { color: var(--cct-2700); }
.nav-dd .caret { margin-left: .35rem; font-size: .62em; opacity: .75; }
.nav-dd .nav-panel {
  display: none; position: absolute; right: 0; top: 100%; z-index: 30;
  min-width: 300px; max-width: min(340px, calc(100vw - 2 * var(--gap)));
  list-style: none; margin: 0; padding: .35rem 0; gap: 0;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 22px 46px -20px rgb(0 0 0 / .8);
}
.nav-dd[open] .nav-panel, .nav-dd-wrap:hover .nav-panel, .nav-dd:focus-within .nav-panel { display: block; }
.nav-dd .nav-panel li { padding: 0; }
.nav-dd .nav-panel a { display: flex; justify-content: space-between; align-items: baseline; gap: 1.2rem;
  padding: .5rem .95rem; color: var(--ink); font-size: .9rem; border-radius: 0; }
.nav-dd .nav-panel a:hover { background: #1b1f26; color: var(--cct-2700); }
.nav-dd .nav-panel .count { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem; color: var(--ink-dim); white-space: nowrap; }
.nav-dd .nav-panel .all { color: var(--cct-2700); border-bottom: 1px solid var(--line);
  border-radius: 0 0 0 0; margin-bottom: .3rem; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
/* the photograph is the product's argument, so it stays a photograph: the scrim only
   darkens the column the words stand in, and the picture is lifted rather than buried.
   The alpha stops are read back by tools/check.py, which computes the worst contrast any
   word in this column can have against the pixels behind it. */
.hero .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  object-position: 50% 42%; filter: brightness(1.35) saturate(1.08); }
/* only the geometry lives here; the layers themselves are generated by tools/scrim.py
   into hero.css, so the stylesheet and the contrast check cannot disagree */
.hero .scrim { position: absolute; inset: 0; }
.hero .wrap { position: relative; padding: clamp(3.5rem, 9vh, 7.5rem) 0 clamp(2.5rem, 6vh, 5rem); }
.hero h1 { font-size: clamp(2rem, 3.1vw + .9rem, 3.5rem); margin: .35em 0 .3em; max-width: 22ch; }
.hero h1 em { font-style: normal; color: var(--cct-2700); }
.hero .lede { max-width: 60ch; font-size: clamp(1rem, .5vw + .9rem, 1.14rem); color: #c8ccd2; }

.cta { display: inline-flex; align-items: center; gap: .55rem; margin-top: 1.9rem; padding: .72rem 1.15rem; border-radius: 8px;
  background: var(--cct-2700); color: #1a1206; font-weight: 620; text-decoration: none; }
.cta:hover { background: var(--cct-3400); color: #1a1206; }
.cta.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); font-weight: 500; }
.cta.ghost:hover { border-color: var(--cct-2700); color: var(--cct-2700); }

/* ---------- sections ---------- */
section { padding: clamp(2.8rem, 7vh, 5rem) 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.section-head p { margin: .3em 0 0; max-width: 62ch; color: var(--ink-mid); }

.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.cell { background: var(--bg-raised); padding: 1.3rem 1.4rem; }
.cell h3 { margin: .1em 0 .5em; }
.cell .ids { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .9rem; }
.id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; padding: .12rem .42rem; border-radius: 4px;
  border: 1px solid var(--line-strong); color: var(--ink-mid); background: #16191e; }
.id.server { color: var(--cct-2700); border-color: color-mix(in srgb, var(--cct-2700) 35%, var(--line-strong)); }
.id.setup { color: #b39a6a; border-style: dashed; }
.id.client { color: #4fb3c8; border-color: #24444c; }
.thumb { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; margin-bottom: .95rem; background: #0a0b0d; }

/* numbers strip */
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.numbers div { background: var(--bg); padding: 1.15rem clamp(.9rem, 2vw, 1.4rem); }
.numbers b { display: block; font-size: clamp(1.5rem, 1.4vw + 1rem, 2.1rem); font-weight: 620; letter-spacing: -0.02em; }
.numbers span { font-size: .82rem; color: var(--ink-mid); }

/* code + notes */
.split { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.note { border-left: 2px solid var(--cct-2700); padding: .1rem 0 .1rem 1rem; }
.note.warn { border-color: #b06a4a; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding-left: 1.35em; position: relative; margin-bottom: .5em; }
ul.clean li::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 1px; background: var(--cct-2700); }
ul.clean.no li::before { background: #8a5a4a; }

/* a gap the owner has not filled, drawn as a gap */
.todo { display: inline-block; font-size: .84rem; padding: .12rem .5rem; border-radius: 5px;
  border: 1px dashed color-mix(in srgb, var(--cct-2700) 55%, var(--line-strong)); color: var(--cct-3400);
  background: color-mix(in srgb, var(--cct-2700) 7%, transparent); }

dl.qa { margin: 0; }
dl.qa dt { font-weight: 600; margin-top: 1.1em; }
dl.qa dd { margin: .3em 0 0; color: var(--ink-mid); max-width: var(--measure); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
caption { text-align: start; color: var(--ink-mid); font-size: .86rem; padding-bottom: .6rem; }
th, td { text-align: start; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); font-weight: 600; }
tbody tr:hover { background: #14171c; }
td.n, th.n { font-variant-numeric: tabular-nums; }
.scroller { overflow-x: auto; }

/* diagram frames */
/* a diagram is drawn at a size where its type is readable, so it is never stretched to the
   container: stretching made the one-element picture render at 60px letters and the
   five-element one at 7px. A wider picture scrolls sideways instead. */
figure.diagram { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  overflow-x: auto; overscroll-behavior-x: contain; }
figure.diagram > svg, figure.diagram img { display: block; width: auto; max-width: none; height: auto; margin-inline: auto; }
figure.diagram img { max-width: 100%; }
figure.diagram figcaption { padding: .8rem 1rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--ink-mid); background: var(--bg-raised); }

/* filter controls on /models */
.controls { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.controls button { font: inherit; font-size: .85rem; padding: .34rem .7rem; border-radius: 999px; background: #16191e; color: var(--ink-mid); border: 1px solid var(--line-strong); cursor: pointer; }
.controls button[aria-pressed="true"] { color: #1a1206; background: var(--cct-2700); border-color: var(--cct-2700); }

footer { padding: 2.6rem 0 3.4rem; color: var(--ink-dim); font-size: .88rem; }
footer .wrap { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
footer a { color: var(--ink-mid); }

@media print {
  :root { --bg: #fff; --bg-raised: #fff; --ink: #14161a; --ink-mid: #3d434c; --ink-dim: #6b7280; --line: #d4d7dc; --line-strong: #b9bec6; }
  body { background: #fff; }
  .nav, .cta, .controls, .hero .backdrop { display: none; }
  .hero .scrim { background: none; }
  a { color: #14161a; text-decoration: none; }
  section { break-inside: avoid; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .backdrop { animation: none; }
}
