/* Company pages: tests, responders, sign-in. Same tokens as style.css: rack grey, ports, LEDs, cable colours. */

@font-face {
  font-family: "Atkinson Next";
  src: url("/fonts/next-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("/fonts/next-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Mono";
  src: url("/fonts/mono-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --rack: #e3e7e4;
  --panel: #f6f7f5;
  --field: #ffffff;
  --rule: #c9d0cb;
  --ink: #18293a;
  --muted: #4f5d68;
  --port: #26323b;
  --mark: #26323b;
  --hole: #111a20;
  --port-ink: #eef2f0;
  --blue: #2458b8;
  --blue-ink: #ffffff;
  --link: #2bc44f;
  --activity: #f2a516;
  --led-off: #b7c0ba;
  --green: #22793c;
  --green-soft: #dcefe1;
  --yellow: #8a5a00;
  --yellow-soft: #fbeccb;
  --red: #b8322a;
  --red-soft: #f7e0de;
  --red-led: #f0463a;
  --sans: "Atkinson Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --rack: #151c21;
    --panel: #1d262c;
    --field: #151c21;
    --rule: #2f3b43;
    --ink: #e4eaec;
    --muted: #9aa8b0;
    --port: #232d34;
    --hole: #0b1014;
    --mark: #4a5a65;
    --blue: #6c95f0;
    --blue-ink: #0d1520;
    --led-off: #36434b;
    --green: #4fc06f;
    --green-soft: #173427;
    --yellow: #e8b73c;
    --yellow-soft: #3a2f12;
    --red: #f07b72;
    --red-soft: #3b1d1b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--rack); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--blue); text-underline-offset: 0.18em; }
h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.15; font-weight: 750; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 750; }
p { margin: 0; }
code { font: 14px/1.4 var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 20px; border-bottom: 1px solid var(--rule); background: var(--panel); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 17px; font-weight: 750; letter-spacing: -0.01em; text-decoration: none; }
.brand small { color: var(--muted); font-size: inherit; font-weight: 500; }
/* An RJ45 port with its link LED lit. */
.mark { position: relative; width: 20px; height: 16px; border-radius: 2px; background: var(--mark); clip-path: polygon(0 0, 100% 0, 100% 72%, 70% 72%, 70% 100%, 30% 100%, 30% 72%, 0 72%); }
.mark::after { content: ""; position: absolute; top: 3px; left: 3px; width: 5px; height: 3px; border-radius: 1px; background: var(--link); }
.top nav { display: flex; flex: 1; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { background: var(--rack); color: var(--ink); font-weight: 700; }
.who { color: var(--muted); }
.grow-nav { flex: 1; }
.top > a[hreflang] { color: var(--muted); text-decoration: none; }
.top > a[hreflang]:hover { color: var(--ink); text-decoration: underline; }
.top form { margin: 0; }

main { display: grid; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.card { padding: 18px; border: 1px solid var(--rule); border-radius: 10px; background: var(--panel); }
.card:target { outline: 2px solid var(--blue); outline-offset: 2px; }
.narrow { width: 100%; max-width: 420px; margin: 32px auto 0; }
.stack { display: grid; gap: 14px; }
.muted { color: var(--muted); }
/* Spaced items instead of strings joined with separators. */
.meta { display: flex; flex-wrap: wrap; gap: 2px 18px; color: var(--muted); }
.error { padding: 9px 12px; border-radius: 6px; background: var(--red-soft); color: var(--red); }
.banner { padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; background: var(--yellow-soft); }
.legend { font-size: 14px; }

label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
input, select { min-width: 0; padding: 9px 11px; border: 1px solid var(--rule); border-radius: 6px; background: var(--field); color: var(--ink); font: inherit; font-size: 15px; }
button { padding: 9px 16px; border: 1px solid var(--blue); border-radius: 6px; background: var(--blue); color: var(--blue-ink); font: inherit; font-weight: 700; cursor: pointer; }
button.ghost { border-color: var(--rule); background: none; color: var(--ink); }
button.danger { color: var(--red); }
button.link { padding: 0; border: 0; background: none; color: var(--blue); font-weight: 500; }
:is(button, input, select, a):focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Tests */
.new-test { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 12px; align-items: end; }
.new-test h2 { grid-column: 1 / -1; }
.new-test .wide { grid-column: span 4; }

.test-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.grow { display: grid; flex: 1; gap: 6px; min-width: 240px; }
/* The code as the same four ports the customer types into. Lit link LEDs: the code works. */
.code-plate { display: flex; gap: 8px; padding: 10px 12px 12px; border-radius: 8px; background: var(--port); }
.code-plate span {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 46px;
  padding-bottom: 8px;
  border-radius: 2px;
  background: var(--hole);
  color: var(--port-ink);
  font: 600 24px/1 var(--mono);
  clip-path: polygon(0 0, 100% 0, 100% 80%, 68% 80%, 68% 100%, 32% 100%, 32% 80%, 0 80%);
}
.code-plate span::before { content: ""; position: absolute; top: 4px; left: 4px; width: 7px; height: 4px; border-radius: 1px; background: var(--link); box-shadow: 0 0 5px var(--link); }
.code-plate.off span { color: #6b7880; }
.code-plate.off span::before { background: #36434b; box-shadow: none; }
.say { justify-self: start; padding: 7px 11px; border-radius: 6px; background: var(--green-soft); }
.actions { display: flex; align-items: center; gap: 8px; }
.actions form { margin: 0; }
.badge { padding: 1px 8px; border-radius: 99px; background: var(--rack); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: middle; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.revoked, .badge.expired { background: var(--red-soft); color: var(--red); }

/* contain: the table scrolls inside its box instead of widening every grid track up to the page. */
.scroll { margin-top: 14px; overflow-x: auto; contain: inline-size; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 9px; border-top: 1px solid var(--rule); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.warn { color: var(--red); font-weight: 700; }
tr[data-flag] { background: var(--red-soft); }
/* The outside leg of a Start tap sits right under its inside leg. */
tr.leg td { border-top: 1px dashed var(--rule); }
.new { padding: 1px 7px; border-radius: 99px; background: var(--blue); color: var(--blue-ink); font-size: 12px; }

/* Responders */
.intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.intro p { flex: 1 1 360px; }
.responder { position: relative; display: grid; gap: 12px; isolation: isolate; }
.responder-head { display: flex; align-items: center; gap: 12px; }
/* Health as a status LED. */
.dot { position: relative; flex: none; width: 14px; height: 8px; border-radius: 1.5px; background: var(--led-off); }
.dot.green { background: var(--link); box-shadow: 0 0 8px var(--link); }
.dot.yellow { background: var(--activity); box-shadow: 0 0 8px var(--activity); }
.dot.red { background: var(--red-led); box-shadow: 0 0 8px var(--red-led); }
.state { padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.state.green { background: var(--green-soft); color: var(--green); }
.state.yellow { background: var(--yellow-soft); color: var(--yellow); }
.state.red { background: var(--red-soft); color: var(--red); }
.reasons { margin: 0; padding-left: 20px; }
.install { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.command { display: flex; align-items: stretch; gap: 8px; }
.command code { flex: 1; padding: 10px 12px; overflow-x: auto; border-radius: 6px; background: var(--port); color: var(--port-ink); white-space: nowrap; contain: inline-size; }
details ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
summary { color: var(--muted); cursor: pointer; }

/* Setup checklist, fed by real responder state. LEDs: dark pending, amber blinking while we wait,
   amber steady when it is your move, green done. */
.setup { display: grid; gap: 8px; }
.steps { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: flex-start; gap: 12px; padding: 7px 10px; border-radius: 6px; color: var(--muted); }
.steps li.active { background: var(--rack); color: var(--ink); font-weight: 700; }
.steps li.done { color: var(--ink); }
.steps small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.led { flex: none; width: 12px; height: 7px; border-radius: 1.5px; background: var(--led-off); }
.steps .led { margin-top: 0.55em; }
.steps .active .led { background: var(--activity); box-shadow: 0 0 8px var(--activity); }
.steps .waiting .led { animation: blink 1s ease-in-out infinite; }
.steps .done .led { background: var(--link); box-shadow: 0 0 6px var(--link); }
@keyframes blink { 50% { opacity: 0.25; } }

/* Copy button: every label shares one grid cell, so the width stays put. */
.copy { display: inline-grid; }
.copy > span { display: inline-flex; grid-area: 1 / 1; align-items: center; justify-content: center; gap: 6px; transition: opacity 0.15s; }
.copy > span + span, .copy[data-state] > span:first-child { opacity: 0; }
.copy[data-state="done"] > span:nth-child(2), .copy[data-state="failed"] > span:nth-child(3) { opacity: 1; }
.copy[data-state="failed"] { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 15; stroke-dashoffset: 15; }
.copy[data-state="done"] svg { animation: draw 0.3s ease-out 0.05s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Switch: a drawn track next to a visually hidden native checkbox. */
.switch { position: relative; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.switch[hidden] { display: none; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.track { position: relative; flex: none; width: 32px; height: 18px; border-radius: 99px; background: var(--rule); transition: background-color 0.2s; }
.track::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.2s; }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::before { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 3px solid var(--blue); outline-offset: 2px; }

/* A responder turns green: the LED throws one ring, the card tint fades, once per transition. */
.just-green::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--green-soft); animation: fade-out 2.4s ease-out forwards; }
.just-green .dot::after { content: ""; position: absolute; inset: -3px; border: 2px solid var(--link); border-radius: 3px; opacity: 0; animation: ring 1.2s ease-out; }
.just-green .state { animation: fade-in 0.4s ease-out; }
@keyframes ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

@media (max-width: 860px) {
  .new-test { grid-template-columns: 1fr 1fr; }
  .new-test .wide, .new-test button { grid-column: 1 / -1; }
  .command { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .copy > span, .track, .track::before { transition: none; }
  .copy[data-state="done"] svg { animation: none; stroke-dashoffset: 0; }
  .steps .waiting .led, .just-green .state { animation: none; }
  .just-green::before, .just-green .dot::after { display: none; }
}

/* Responder placement: two radio options on one line. */
.placement { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; border: 0; }
.placement legend { margin-bottom: 5px; padding: 0; color: var(--muted); font-size: 13px; }
.placement label { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.placement input { margin: 0; padding: 0; accent-color: var(--blue); }
