/* ============================================================================
   TPS505 brand — base stylesheet for nodexdevices.com
   Implements BRAND.md sections 3–7. Every page links this file.

   Nodex Devices is a product site: it keeps its own name and product copy
   (BRAND.md §1) and inherits tokens, type, layout and components from here.

   Rules this file is holding to, so they are not quietly lost later:
     - page is --paper, never white; --surface is for cards on top of it
     - one accent (--green). no second accent, no gradients anywhere
     - separate with 1px --line borders, not shadows. --shadow is for
       floating elements only, of which this site currently has none
     - 6px controls, 10px cards, 999px pills
     - sentence case, British English
   ============================================================================ */

:root {
  --font-display: "Bricolage Grotesque Variable", "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --paper: #f7f5ef;       /* page background */
  --surface: #ffffff;     /* cards, panels, inputs */
  --surface-2: #efece3;   /* bands, table stripes, quoted blocks, footer */
  --ink: #16181b;         /* headings and body text */
  --ink-2: #4a4f57;       /* secondary text, captions, small print */
  --line: #d9d5c8;        /* borders and dividers */

  --green: #0b6b45;       /* brand: logo, primary button, links */
  --green-ink: #ffffff;   /* text on green */
  --green-soft: #dcefe4;  /* tinted backgrounds, success notes */
  --green-deep: #064a30;  /* hover on green; large dark fields (banners) */

  --warn: #8a4b00;        --warn-soft: #fbecd3;
  --danger: #a3261b;      --danger-soft: #f9dedb;
  --focus: #1a5fd0;       /* keyboard focus ring only */

  --radius-sm: 6px;       /* buttons, inputs, chips */
  --radius: 10px;         /* cards, panels, images */
  --radius-pill: 999px;

  --shadow: 0 1px 2px #0000000f, 0 4px 16px #0000000d;  /* floating elements only */

  --maxw: 1120px;
  --gutter: 16px;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px;

  color-scheme: light;
}

html { background: var(--paper); color: var(--ink); font-family: var(--font-body); }
body { margin: 0; font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
a:hover { color: var(--green-deep); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
img, svg { max-width: 100%; }

/* ---------------------------------------------------------------- type (§4) */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; }
h1 { font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 18px; line-height: 1.3; font-weight: 600; }
p  { margin: 0; }

.display-xl {
  font-family: var(--font-display);
  font-size: 56px; line-height: 1.02; font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
}
@media (max-width: 720px) { .display-xl { font-size: 40px; } }

.body-sm { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.label {
  font-size: 13px; line-height: 1.4; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase;        /* §4: uppercase is allowed on labels only */
  color: var(--ink-2);
}
.mono { font-family: var(--font-mono); font-size: 14px; line-height: 1.5; }
.prose { max-width: 65ch; }         /* §4: ~70 characters */
.lead { font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 65ch; }

/* -------------------------------------------------------------- layout (§5) */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
@media (min-width: 768px) { .wrap { padding-inline: 24px; } }

section { padding-block: var(--space-8); }
@media (min-width: 768px) { section { padding-block: var(--space-12); } }

.band { background: var(--surface-2); padding-block: var(--space-8); }
@media (min-width: 768px) { .band { padding-block: var(--space-12); } }

.stack      { display: grid; gap: var(--space-6); }
.stack-4    { display: grid; gap: var(--space-4); }
.stack-2    { display: grid; gap: var(--space-2); }
.section-head { display: grid; gap: var(--space-3); max-width: 65ch; margin-bottom: var(--space-8); }

/* -------------------------------------------------------------- header (§6) */
.site-header {
  display: flex; align-items: center; gap: var(--space-6);
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--space-4) var(--gutter);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 768px) { .site-header { padding-inline: 24px; } }
.site-header nav ul { display: flex; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.site-header nav a { color: var(--ink); text-decoration: none; font-size: 15px; }
.site-header nav a:hover { color: var(--green); }
.site-header .btn { margin-left: auto; }
/* §6: never a hamburger that hides the quote button — the nav drops, the CTA stays */
@media (max-width: 720px) { .site-header nav { display: none; } }

/* LOGO SLOT — needs the brand pack's svg/ files, which were not supplied.
   §2.8 says never recreate a logo in CSS, text or an icon font, so nothing is
   drawn here: this is the product's existing text wordmark, set in the display
   face at the 32px header height, standing in until the real file lands.
   Replace the markup with <img src="/brand/nodex-logo.svg" ...> — see README. */
.logo { display: inline-flex; align-items: center; text-decoration: none; height: 32px; }
.logo .word { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.015em; color: var(--ink); }
.logo .word span { color: var(--green); }

/* ------------------------------------------------------------- buttons (§6) */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font: 600 15px/1 var(--font-body);
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--green); color: var(--green-ink); }
.btn-primary:hover { background: var(--green-deep); color: var(--green-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--green); }
.btn-ghost:hover { color: var(--green-deep); }

/* ------------------------------------------------------- cards, notes (§6) */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--space-6);
}
.card-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: var(--space-4); }
.card-link:hover { border-color: var(--ink-2); color: inherit; }
.note        { background: var(--green-soft); border-radius: var(--radius); padding: var(--space-4); }
.note-warn   { background: var(--warn-soft);  color: var(--warn);  border-radius: var(--radius); padding: var(--space-4); }
.note-danger { background: var(--danger-soft);color: var(--danger);border-radius: var(--radius); padding: var(--space-4); }

.grid-2 { display: grid; gap: var(--space-6); }
.grid-3 { display: grid; gap: var(--space-6); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* chips / pills */
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.pill {
  font-size: 13px; line-height: 1.4; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 4px var(--space-3); background: var(--surface);
}
.pill-green { background: var(--green-soft); border-color: var(--green-soft); color: var(--green-deep); }

/* --------------------------------------------------------------- forms (§6) */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px var(--space-3); min-height: 44px; width: 100%; box-sizing: border-box;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
textarea { min-height: 112px; resize: vertical; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: var(--space-1); }
.hint { font-size: 14px; color: var(--ink-2); margin-top: var(--space-1); }

/* -------------------------------------------------------------- tables (§6) */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--ink-2); border-bottom: 1px solid var(--line);
}
tbody tr:nth-child(even) { background: var(--surface-2); }
td code, th code { font-family: var(--font-mono); font-size: 14px; }

/* -------------------------------------------------------------- footer (§6) */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--line); margin-top: var(--space-12); }
.site-footer .inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--space-8) var(--gutter); display: grid; gap: var(--space-4);
}
@media (min-width: 768px) { .site-footer .inner { padding-inline: 24px; } }
.site-footer .strap { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; margin: 0; padding: 0; font-size: 14px; }
.site-footer .legal { margin: 0; font-size: 13px; color: var(--ink-2); }
.site-footer .cols { display: grid; gap: var(--space-6); }
@media (min-width: 720px) { .site-footer .cols { grid-template-columns: repeat(3, 1fr); } }
.site-footer .cols h3 { font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); font-family: var(--font-body); font-weight: 600; margin-bottom: var(--space-2); }
.site-footer .cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: 14px; }

/* ============================================================================
   Site patterns — built only from the tokens above.
   ============================================================================ */

/* hero: §5 says type on paper, optionally with a green block to one side */
.hero { padding-block: var(--space-8) var(--space-8); }
@media (min-width: 768px) { .hero { padding-block: var(--space-12); } }
.hero-grid { display: grid; gap: var(--space-8); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } }
.hero-copy { display: grid; gap: var(--space-4); align-content: start; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--green); }

/* the green block that a device sits in */
.showcase {
  background: var(--green-deep); border-radius: var(--radius);
  padding: var(--space-8); display: grid; gap: var(--space-4); justify-items: center;
}
.showcase .caption { font-size: 14px; color: var(--green-soft); text-align: center; }
.showcase .dots { display: flex; gap: var(--space-2); }
.showcase .dots i { width: 7px; height: 7px; border-radius: var(--radius-pill); background: #ffffff40; }
.showcase .dots i.on { background: var(--green-soft); }

/* ---- device depictions -------------------------------------------------
   These show what the hardware displays. They are built from brand tokens
   only: an --ink panel, --green header bar, --surface text. No glow and no
   pixel-grid overlay, because §2.2 forbids gradients and §2.3 keeps shadows
   off anything that is not floating. */
.device { width: 100%; max-width: 320px; }
.panel {
  background: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius);
  padding: var(--space-3); font-family: var(--font-mono); display: grid; gap: var(--space-2);
}
.panel.square { aspect-ratio: 1 / 1; align-content: start; }
.panel .bar {
  background: var(--green); color: var(--green-ink);
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel .rows { display: grid; gap: var(--space-1); align-content: start; }
.panel .row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 14px; color: var(--surface); }
.panel .row .r { font-variant-numeric: tabular-nums; flex: none; }
.panel .row.due { color: var(--green-soft); }
.panel .big { font-size: 28px; font-weight: 700; color: var(--surface); font-family: var(--font-display); }
.panel .foot { font-size: 13px; color: #ffffff8a; }

/* a 20x4 character LCD: backlit glass, so a solid green-deep field */
.lcd { background: var(--green-deep); border-radius: var(--radius-sm); padding: var(--space-3); display: grid; gap: var(--space-1); container-type: inline-size; }
/* 20 characters are sized against the glass so they fill it, but capped so a
   wide card does not blow the type up out of proportion with its neighbours. */
  .lcd .line { font-family: var(--font-mono); font-size: min(6.4cqw, 17px); letter-spacing: 0.08em; white-space: pre; color: var(--green-soft); }
.panel .lcd .line { font-size: 6.4cqw; }

/* ---- numbered steps ---------------------------------------------------- */
.steps { display: grid; gap: var(--space-4); list-style: none; margin: 0; padding: 0; counter-reset: step; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(2, 1fr); } }
.steps > li {
  counter-increment: step;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-6); display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: start;
}
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 14px; color: var(--green);
  background: var(--green-soft); border-radius: var(--radius-sm);
  width: 34px; height: 34px; display: grid; place-items: center;
}
.steps h3 { margin-bottom: var(--space-1); }
.steps p { color: var(--ink-2); font-size: 15px; }
.steps p + p { margin-top: var(--space-2); }

/* ---- capability badges -------------------------------------------------
   Our own claims, not the "Works with Home Assistant" or "Made for ESPHome"
   certification marks — see README. */
.badges { display: flex; flex-wrap: wrap; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.badge {
  display: inline-flex; align-items: center; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.badge svg { width: 22px; height: 22px; flex: none; color: var(--green); }
.badge .txt { display: grid; }
.badge .txt b { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); }
.badge .txt span { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---- inline code ------------------------------------------------------- */
code, .chip-mono {
  font-family: var(--font-mono); font-size: 0.92em;
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 2px 6px; overflow-wrap: anywhere;
}

/* ---- utilities --------------------------------------------------------- */
.muted { color: var(--ink-2); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* §7: the TPS505 wordmark in the footer, where the tile would be noise.
   §7 sets a 24px minimum for the logo files, so the wordmark sits at 24px and
   gets --space-6 of clear space around it. */
.site-footer .legal.parent { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.site-footer .legal.parent img { display: block; height: 24px; width: auto; }
