/* natakmesh.com design system: "Instrument" (D9).
   Dark, IBM Plex Sans + Plex Mono, brand orange as the only accent.
   Every component is shown on /styleguide.html. Keep this file under 30 KB. */

/* ===== Fonts (self-hosted, OFL: /assets/fonts/OFL.txt) ===== */
@font-face {
  font-family: "Plex Sans";
  src: url("../fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ===== Tokens ===== */
:root {
  /* Contrast vs --bg: text 15.0, muted 7.4, faint 5.4, accent 5.9 (WCAG AA).
     --bg on --accent (buttons) is 5.9. */
  --bg: #0f1011;
  --bg-raised: #16181a;
  --line: #26292c;
  --line-strong: #3a3e42;
  --text: #e6e4df;
  --muted: #a3a19b;
  --faint: #8a8882;
  --accent: #f85b18;
  --accent-hover: #ff6f2e;
  --photo-bg: #dcdbd8;

  --sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 68ch;
  --rail: 11rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 82rem;
  --header-h: 4rem;

  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
[id] { scroll-margin-top: 1.5rem; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); letter-spacing: -0.01em; margin-bottom: 1.25rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
h4 {
  font: 500 0.75rem/1.4 var(--mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 0.5rem;
}

p, ul, ol, dl, blockquote { margin: 0 0 1rem; }
p, li { max-width: var(--measure); }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: 0.35rem; }
li::marker { color: var(--faint); }
strong, b { font-weight: 600; }
small, .small { font-size: 0.9rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

code, kbd, samp, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
code {
  padding: 0.1em 0.3em;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 2px;
}
pre {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  font-size: 0.85rem; line-height: 1.6;
  max-width: 52rem;
}
pre code { padding: 0; background: none; border: 0; font-size: inherit; }
kbd {
  padding: 0.05em 0.35em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 2px;
  font-size: 0.8em;
}

blockquote {
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  max-width: var(--measure);
}

::selection { background: var(--accent); color: var(--bg); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== Skip link ===== */
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--accent); color: var(--bg);
  font: 500 0.85rem var(--mono);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--bg); outline-color: var(--text); }

/* ===== Layout ===== */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ===== Header and nav ===== */
.site-header { position: relative; border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 2rem; min-height: var(--header-h); }
.logo { display: block; flex-shrink: 0; }
.logo img { height: 44px; width: auto; }

.nav { margin-left: auto; }
.nav ul { display: flex; align-items: center; gap: 1.75rem; margin: 0; padding: 0; list-style: none; }
.nav li { margin: 0; max-width: none; }
.nav a {
  font: 400 0.8rem var(--mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); text-decoration: none;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); box-shadow: 0 2px 0 var(--accent); padding-bottom: 0.2rem; }

.menu-toggle {
  display: none; margin-left: auto; cursor: pointer;
  background: none; border: 1px solid var(--line-strong); border-radius: 2px;
  color: var(--text);
  font: 500 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.5rem 0.75rem;
}
.menu-toggle:hover { border-color: var(--muted); }
.menu-toggle[aria-expanded="true"] { border-color: var(--accent); }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  font: 500 0.8rem/1 var(--mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  text-decoration: none;
  padding: 0.85rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}
.btn-buy, .nav .btn-buy { background: var(--accent); color: var(--bg); }
.btn-buy:hover, .nav .btn-buy:hover { background: var(--accent-hover); color: var(--bg); }
.btn-buy:focus-visible { outline-color: var(--text); }
.nav .btn-buy { padding: 0.6rem 0.9rem; }
.btn-line { border-color: var(--line-strong); color: var(--text); background: none; }
.btn-line:hover { border-color: var(--accent); color: var(--text); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 2rem; }
.actions a:not(.btn) { font: 400 0.85rem var(--mono); }

/* ===== Page intro (hero) ===== */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 26rem);
  gap: clamp(2rem, 5vw, 5rem);
  padding-top: clamp(2.5rem, 6vw, 5rem);
  padding-bottom: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
.hero .wrap > :only-child { grid-column: 1 / -1; }
.eyebrow {
  font: 400 0.8rem var(--mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); margin-bottom: 1rem;
}
.eyebrow b { color: var(--accent); font-weight: 500; }
.lede { font-size: 1.25rem; line-height: 1.5; margin-top: 1.5rem; max-width: 40rem; }
.hero p:not(.lede):not(.eyebrow) { color: var(--muted); max-width: 40rem; }

/* Key figures: a readout, not cards */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 2.5rem 0 0; max-width: 44rem;
  border-top: 1px solid var(--line-strong);
}
.readout div { padding: 0.85rem 1rem 0.85rem 0; border-bottom: 1px solid var(--line); }
.readout dt { font: 400 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.readout dd { margin: 0.2rem 0 0; font: 500 1rem var(--mono); }

/* ===== Figures ===== */
figure { margin: 0; }
figure img { width: 100%; background: var(--photo-bg); border: 1px solid var(--line-strong); }
figcaption { margin-top: 0.6rem; font: 400 0.75rem/1.5 var(--mono); color: var(--faint); max-width: var(--measure); }
figcaption b { color: var(--text); font-weight: 500; margin-right: 0.5em; }
figure.narrow { max-width: 22rem; }
/* Phone screenshots: shown at phone size, never stretched */
figure.phone { max-width: 18rem; }
figure.phone img { background: var(--bg); }

/* ===== Numbered sections with a label rail ===== */
.sec { border-top: 1px solid var(--line); }
.sec > .wrap {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 4vw, 4rem);
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.sec-label {
  margin: 0;
  font: 400 0.75rem/1.4 var(--mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); padding-top: 0.55rem;
}
.sec-label span { display: block; color: var(--accent); font-weight: 500; margin-bottom: 0.25rem; }
.sec-body { min-width: 0; }
.sec-body > * + * { margin-top: 1.5rem; }
.sec-body > h2 + * { margin-top: 0; }
.sec-body > h3 { margin-top: 2.5rem; }
.sec-body > h3 + * { margin-top: 0.5rem; }

/* ===== Content shapes ===== */
.split {
  display: grid;
  grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
  gap: 2rem clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}
.split > div > * + h3 { margin-top: 2rem; }
.cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: 2.5rem clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}
.fig-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.fig-row img { aspect-ratio: 3 / 4; object-fit: cover; }

/* ===== Tables ===== */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
caption {
  text-align: left; padding-bottom: 0.6rem;
  font: 500 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text);
}
th, td { text-align: left; vertical-align: top; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--line); }
thead th {
  font: 400 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); border-bottom-color: var(--line-strong); padding-top: 0;
}
tbody th { font-weight: 400; color: var(--muted); }
.spec tbody th { width: 48%; }
td.v, td.num { font-family: var(--mono); font-size: 0.875rem; }
td.num, th.num { text-align: right; }
td:last-child, th:last-child { padding-right: 0; }
td code, th code { white-space: nowrap; }

/* Default/status marker in tables */
.status { font: 400 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.status::before {
  content: ""; display: inline-block;
  width: 0.45rem; height: 0.45rem; margin-right: 0.5rem; vertical-align: 0.08em;
}
.status.on::before { background: var(--accent); }
.status.opt { color: var(--faint); }
.status.opt::before { border: 1px solid var(--faint); }

/* ===== Lists ===== */
.link-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-strong); max-width: 52rem; }
.link-list li {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem;
  margin: 0; padding: 0.7rem 0; max-width: none;
  border-bottom: 1px solid var(--line);
}
.link-list li span { color: var(--muted); }

/* Short key/value facts (addresses, IDs, ports) */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1.5rem; max-width: 52rem; }
.facts dt { font: 400 0.75rem/1.9 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.facts dd { margin: 0; font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }

/* ===== Blocks ===== */
.buy {
  max-width: 52rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
}
.buy h2 { margin-bottom: 1rem; }
.buy .actions { margin-top: 1.5rem; }

/* Note: a limit, caveat or untested claim, stated plainly */
.note {
  max-width: var(--measure);
  padding: 0.75rem 1rem;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 0.95rem;
}
.note-label {
  display: block; margin-bottom: 0.25rem;
  font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent);
}

/* ===== Video facade =====
   A thumbnail link to YouTube. site.js swaps in a youtube-nocookie iframe on
   click, so nothing loads from YouTube before that. Without JS it's a link. */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 2rem 1.5rem; }
.yt {
  position: relative; display: block; aspect-ratio: 16 / 9;
  background: var(--bg-raised); border: 1px solid var(--line-strong);
  text-decoration: none;
}
.yt img { width: 100%; height: 100%; object-fit: cover; border: 0; background: none; }
.yt-play {
  position: absolute; left: 0.75rem; bottom: 0.75rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-strong);
  font: 500 0.7rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
}
.yt-play::before {
  content: ""; display: inline-block; margin-right: 0.5rem;
  border-style: solid; border-width: 0.3rem 0 0.3rem 0.5rem;
  border-color: transparent transparent transparent var(--accent);
}
a.yt:hover .yt-play { border-color: var(--accent); }
.yt iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); color: var(--faint); font: 400 0.8rem/1.7 var(--mono); }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 1.5rem 3rem; padding-top: 2.5rem; padding-bottom: 2.5rem;
}
.site-footer ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-footer li { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 0; }
.site-footer .footer-meta { flex-basis: 100%; max-width: none; padding-top: 1.5rem; border-top: 1px solid var(--line); }

/* ===== Colour swatches (styleguide) ===== */
.swatch { display: inline-block; width: 0.9rem; height: 0.9rem; margin-right: 0.6rem; vertical-align: -0.1em; border: 1px solid var(--line-strong); }
.sw-bg { background: var(--bg); }
.sw-bg-raised { background: var(--bg-raised); }
.sw-line { background: var(--line); }
.sw-line-strong { background: var(--line-strong); }
.sw-text { background: var(--text); }
.sw-muted { background: var(--muted); }
.sw-faint { background: var(--faint); }
.sw-accent { background: var(--accent); }
.sg-h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.sg-h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 600; letter-spacing: -0.01em; }
.sg-h3 { font-size: 1.05rem; font-weight: 600; }
.sg-h4 { font: 500 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
td .lede, td .eyebrow { display: block; margin: 0; }

/* ===== Responsive ===== */
@media (max-width: 64rem) {
  .fig-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 76rem) {
  /* Nav collapses below the full width of the logo and primary links (~1,160 px).
     The menu collapses only when JS has set .js on <html>.
     Without JS the links stay visible and wrap. */
  .js .menu-toggle { display: block; }
  .js .nav {
    display: none; position: absolute; left: 0; right: 0; top: var(--header-h); z-index: 10;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .js .nav.open { display: block; }
  .js .nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 0.5rem var(--gutter) 1.25rem; }
  .js .nav li a { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
  .js .nav li:last-child a { margin-top: 1rem; text-align: center; border: 0; }
  .js .nav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--accent); padding: 0.85rem 0 0.85rem 0.75rem; }

  html:not(.js) .site-header .wrap { flex-wrap: wrap; gap: 0.75rem 2rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
  html:not(.js) .nav { margin-left: 0; flex-basis: 100%; }
  html:not(.js) .nav ul { flex-wrap: wrap; gap: 0.75rem 1.25rem; }
}

@media (max-width: 54rem) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero figure { max-width: 22rem; }

  .sec > .wrap { grid-template-columns: minmax(0, 1fr); }
  .sec-label { padding-top: 0; margin-bottom: 1rem; display: flex; gap: 0.75rem; }
  .sec-label span { display: inline; margin: 0; }

  .split { grid-template-columns: minmax(0, 1fr); }
  .split figure { max-width: 22rem; }
  .logo img { height: 36px; }
  .link-list li { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (max-width: 30rem) {
  .fig-row { gap: 0.75rem; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important; animation: none !important; scroll-behavior: auto !important;
  }
}

@media print {
  :root {
    --bg: #fff; --bg-raised: #fff; --text: #111; --muted: #333; --faint: #555;
    --line: #ccc; --line-strong: #999; --accent: #b83c08;
    color-scheme: light;
  }
  body { font-size: 11pt; }
  .nav, .menu-toggle, .skip-link, .btn, .site-footer ul { display: none !important; }
  @page { margin: 16mm; }
  .site-header .wrap { min-height: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  /* One column on paper: the label rail moves above the body. */
  .hero .wrap { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; padding-bottom: 1rem; }
  .sec > .wrap { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; padding-bottom: 1rem; }
  .sec-label { padding-top: 0; margin-bottom: 0.5rem; display: flex; gap: 0.75rem; }
  .sec-label span { display: inline; margin: 0; }
  .hero figure, figure.narrow { max-width: 14rem; }
  figure.phone { max-width: 12rem; }
  .yt-play { display: none; }
  a { text-decoration: none; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: var(--muted); overflow-wrap: anywhere; }
  .buy, .note, figure, tr { break-inside: avoid; }
  h2, h3, caption { break-after: avoid; }
}
