/* Link portal. Colours and type follow the tool pages it fronts.
   One idea carries the look: every module is a DIN rail, every page a device clipped onto it. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB; }

:root {
  color-scheme: light;
  --bg: #e9edf1;
  --surface: #f7f9fb;
  --ink: #15202b;
  --muted: #566473;
  --line: #c5ced8;
  --accent: #1d4fc4;
  --accent-ink: #ffffff;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --ok: #1f6b3a;
  --ok-bg: #e3f1e7;
  --rail: #b4bec9;
  --rail-hi: #d3dae1;
  --rail-lo: #8f9ba8;
  --tag-bg: #e2e7ed;
  --font-display: "Barlow Semi Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gap: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #11161c; --surface: #19212a; --ink: #e7ecf1; --muted: #9aa7b5; --line: #303c49;
    --accent: #86aaff; --accent-ink: #0d1626; --err: #ff8a80; --err-bg: #3a1b19;
    --ok: #7fd184; --ok-bg: #16301c;
    --rail: #4a5665; --rail-hi: #65717f; --rail-lo: #2f3945; --tag-bg: #27313d;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
h1, h2 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
h1 { font-weight: 700; font-size: clamp(26px, 5vw, 36px); line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-weight: 600; font-size: 24px; line-height: 1.15; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: 0.86em; background: var(--tag-bg); padding: 1px 5px; border-radius: 3px; overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.btn { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: 0.02em; padding: 9px 16px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }

input[type="text"], input[type="password"], input[type="search"] {
  width: 100%; font: inherit; font-size: 17px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--ink); appearance: none;
}
input::placeholder { color: var(--muted); opacity: 0.8; }

.notice { font-size: 15px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--tag-bg); }
.notice.error { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.notice.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }

/* The rail: galvanised strip with a row of slots down the middle. */
.rail, .slot::before, .slot:last-child::after {
  height: 14px;
  background:
    repeating-linear-gradient(90deg, var(--bg) 0 14px, transparent 14px 26px) 0 50% / 100% 4px no-repeat,
    linear-gradient(180deg, var(--rail-hi) 0 2px, var(--rail) 2px 12px, var(--rail-lo) 12px);
}

/* ---- sign in ---- */
.login-page { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.login-stage { position: relative; width: 100%; max-width: 380px; }
.login-stage .rail { position: absolute; top: 30px; left: 50%; width: 100vw; transform: translateX(-50%); }
.device { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 26px 24px 24px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; }
.device h1 { font-size: clamp(26px, 7vw, 32px); }
.device .sub { color: var(--muted); margin-bottom: 6px; }
.device label { font-weight: 500; font-size: 15px; margin-top: 6px; }
.device label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); margin-top: 8px; cursor: pointer; }
.device label.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.device .btn { margin-top: 12px; padding-block: 12px; font-size: 18px; }

/* ---- dashboard ---- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 64px; display: flex; flex-direction: column; gap: 36px; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.who { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 15px; }
.who b { color: var(--ink); font-weight: 600; }
.who form { margin: 0; }
.find { max-width: 420px; }
.find input { background: var(--surface); }

#modules { display: flex; flex-direction: column; gap: 40px; }
.module { display: flex; flex-direction: column; gap: 14px; }
.module-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; }
.module-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.module-desc { color: var(--muted); max-width: 64ch; }
.module-meta { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.module-meta .folder { overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); padding: 16px; border: 1.5px dashed var(--line); border-radius: 6px; max-width: 70ch; }

.rail-row { list-style: none; margin: -4px; padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 236px), 1fr)); gap: var(--gap); overflow: hidden; }
.slot { position: relative; display: flex; min-width: 0; }
.slot::before { content: ""; position: absolute; top: 24px; left: calc(var(--gap) * -1); right: calc(var(--gap) * -1); }
.slot:last-child::after { content: ""; position: absolute; top: 24px; left: 100%; width: 100vw; }
.tile { position: relative; z-index: 1; flex: 1; min-width: 0; min-height: 124px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface); color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-top: 4px solid var(--rail-lo); border-radius: 4px; }
.tile:hover, .tile:focus-visible { border-top-color: var(--accent); }
.tile:hover .tile-title { color: var(--accent); }
.tile-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.tile-desc { font-size: 14px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.tile-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tile-kind { flex: none; font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.04em; padding: 1px 7px; border-radius: 3px; background: var(--tag-bg); color: var(--muted); }
.tile-src { font-family: var(--font-mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- plain message page (not found, refused) ---- */
.message { max-width: 520px; margin: 0 auto; padding: 15vh 16px 48px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.message .status { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

@media (max-width: 520px) {
  .wrap { gap: 28px; padding-top: 20px; }
  .who { width: 100%; justify-content: space-between; }
  .module-meta .count { display: none; }
  /* one tile per row: the rail has no gaps to show through */
  .slot::before, .slot:last-child::after { display: none; }
}
