/* ============================================================
   Bytereign shared stylesheet
   One source of truth for every page. Light is the default,
   dark is a token reswap under [data-theme="dark"].
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  color-scheme: light;
  --bg: #FCFCFA;
  --ink: #111111;
  --body: #666666;
  --muted: #77776F;
  --row: #333333;
  --hairline: #EBEBE7;
  --faint: #B0B0AA;
  --link: #0B57D0;
  --accent: #C4302B;
  --kw: #7A5C2E;
  --st: #2E5E4E;
  --content: #3A3A38;
  --surface: #F4F4F0;
  --field: #FFFFFF;
  --field-border: #D8D8D2;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131311;
  --ink: #F3F2ED;
  --body: #A6A59D;
  --muted: #8E8D85;
  --row: #CFCEC7;
  --hairline: #2A2A27;
  --faint: #6E6E67;
  --link: #7FA8F0;
  --accent: #E8635C;
  --kw: #C9A96A;
  --st: #8FB39B;
  --content: #CFCEC7;
  --surface: #1C1C19;
  --field: #1C1C19;
  --field-border: #3A3A36;
}

/* ---- BASE ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Google Sans Flex", "Google Sans", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.page {
  max-width: clamp(640px, 60vw, 920px);
  margin: 0 auto;
  padding: clamp(40px, 7vh, 90px) clamp(20px, 4vw, 36px) 56px;
}
.page.doc { padding: clamp(48px, 7vh, 100px) clamp(20px, 4vw, 36px) 56px; }

/* ---- WORDMARK ACCENT ---- */
.rr { color: var(--accent); }

/* ---- HEADINGS AND INTRO ---- */
h1 { font-size: clamp(30px, 3.2vw, 52px); font-weight: 800; letter-spacing: -1px; line-height: 1.08; }
.tagline { font-size: clamp(14px, 1.1vw, 18px); color: var(--body); line-height: 1.75; margin-top: 14px; max-width: 60ch; }
.byline { font-size: clamp(13px, 1vw, 15px); color: var(--faint); margin-top: 12px; }
.byline a { color: var(--faint); text-decoration: none; }
.byline a:hover { opacity: 0.55; }
.rule { height: 1px; background: var(--ink); margin-top: 22px; }
.doc .rule { margin-top: 26px; }
.label { font-size: clamp(11px, 0.8vw, 12px); letter-spacing: 1.5px; color: var(--faint); margin-top: 22px; }
.doc .label { margin-top: 18px; }
.post-meta { font-size: clamp(12px, 0.9vw, 14px); color: var(--faint); }
.post-title { font-size: clamp(26px, 2.6vw, 42px); font-weight: 800; letter-spacing: -0.8px; line-height: 1.15; margin-top: 12px; }

/* ---- MASTHEAD ---- */
.masthead { font-size: clamp(15px, 1.2vw, 18px); font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.masthead a { color: var(--ink); font-weight: 700; text-decoration: none; letter-spacing: -0.2px; }
.masthead a:hover { opacity: 0.55; }
.masthead .tag { font-size: 11px; font-weight: 400; letter-spacing: 1.5px; color: var(--faint); margin-left: 8px; }

/* ---- HOME FEATURE, CATEGORIES, TOOLS ---- */
.feature { margin-top: 12px; }
.feature a.title { text-decoration: none; color: inherit; }
.feature h2 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 800; letter-spacing: -0.5px; line-height: 1.18; margin-top: 8px; }
.feature a.title:hover h2 { opacity: 0.55; }
.feature .blurb { font-size: clamp(14px, 1.1vw, 16px); color: var(--content); line-height: 1.85; margin-top: 12px; max-width: 64ch; }
.feature .blurb a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.feature .meta { font-size: clamp(12px, 0.9vw, 14px); color: var(--faint); margin-top: 12px; }
.cats { margin-top: 12px; }
.cats a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; font-size: clamp(15px, 1.15vw, 17px); color: var(--ink); text-decoration: none; }
.cats a:hover { opacity: 0.55; }
.cats .n { font-size: clamp(12px, 0.9vw, 13px); color: var(--faint); white-space: nowrap; }
.tools { margin-top: 12px; }
.tools a { display: block; padding: 9px 0; border-bottom: 1px solid var(--hairline); text-decoration: none; }
.tools a:last-child { border-bottom: none; }
.tools a:hover .tn { opacity: 0.55; }
.tools .tn { font-size: clamp(15px, 1.15vw, 17px); color: var(--ink); }
.tools .td { font-size: clamp(12px, 0.95vw, 14px); color: var(--muted); line-height: 1.6; margin-top: 2px; max-width: 60ch; }

/* ---- CATEGORY AND POST LISTS ---- */
.index { margin-top: 10px; }
.index a { display: block; font-size: clamp(13px, 1.05vw, 16px); color: var(--ink); text-decoration: none; line-height: 1.95; }
.index a:hover { opacity: 0.55; }
.latest { padding: 30px 0 4px; }
.latest a { text-decoration: none; color: inherit; }
.latest h2 { font-size: clamp(19px, 1.7vw, 26px); font-weight: 700; line-height: 1.3; margin-top: 8px; letter-spacing: -0.3px; }
.latest a:hover h2 { opacity: 0.55; }
.latest p { font-size: clamp(13px, 1.05vw, 16px); color: var(--muted); line-height: 1.75; margin-top: 8px; max-width: 62ch; }
.latest .readmore { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.latest .meta { font-size: clamp(12px, 0.9vw, 14px); color: var(--faint); margin-top: 8px; }
h3 { font-size: clamp(16px, 1.3vw, 20px); font-weight: 700; margin-top: 26px; letter-spacing: -0.2px; }
.list { margin-top: 6px; }
.list a { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; text-decoration: none; }
.list a:hover .t { opacity: 0.55; }
.list .t { font-size: clamp(13px, 1.05vw, 16px); color: var(--row); line-height: 1.5; }
.list .d { font-size: clamp(12px, 0.9vw, 14px); color: var(--faint); white-space: nowrap; }

/* ---- FOOTER ---- */
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 44px; font-size: clamp(11px, 0.85vw, 13px); color: var(--faint); }
.doc footer { margin-top: 48px; }
footer a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
footer a:hover { opacity: 0.55; }

/* ---- ARTICLE CONTENT ---- */
.content { margin-top: 26px; }
.content p { font-size: clamp(14px, 1.1vw, 18px); color: var(--content); line-height: 1.9; margin-top: 18px; max-width: 68ch; }
.content p:first-child { margin-top: 0; }
.content h4 { font-size: clamp(16px, 1.35vw, 21px); font-weight: 700; color: var(--ink); margin-top: 32px; letter-spacing: -0.2px; }
.content ul { margin-top: 14px; padding-left: 0; max-width: 68ch; list-style: none; }
.content li { font-size: clamp(14px, 1.1vw, 18px); color: var(--content); line-height: 1.75; padding-left: 16px; position: relative; }
.content li::before { content: "-"; position: absolute; left: 0; color: var(--faint); }
.tablewrap { margin-top: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content table { border-collapse: collapse; min-width: 100%; }
.content th { text-align: left; font-size: clamp(12px, 0.95vw, 15px); font-weight: 700; letter-spacing: 0.5px; color: var(--ink); padding: 8px 14px 8px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.content td { font-size: clamp(12px, 0.95vw, 15px); color: var(--content); font-family: ui-monospace, Menlo, Consolas, monospace; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.content blockquote { margin-top: 20px; padding-left: 18px; border-left: 2px solid var(--hairline); font-size: clamp(14px, 1.1vw, 18px); color: var(--muted); line-height: 1.9; max-width: 66ch; }
.content a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.content a:hover { opacity: 0.55; }
.content pre { margin-top: 18px; padding: 16px; background: var(--surface); border: 1px solid var(--hairline); overflow-x: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(12px, 0.95vw, 15px); line-height: 1.7; color: var(--content); }

/* ---- LINE-NUMBERED CODE BLOCK (posts) ---- */
.cb { margin-top: 18px; border: 1px solid var(--hairline); overflow-x: auto; }
.cb-bar { padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--hairline); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(12px, 0.95vw, 15px); color: var(--muted); }
.cb table { border-collapse: collapse; min-width: 100%; margin-top: 0; }
.cb td { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(12px, 0.95vw, 15px); line-height: 1.75; padding: 0; border-bottom: none; color: var(--content); vertical-align: top; }
.cb .ln { width: 1%; text-align: right; padding: 0 14px; color: var(--faint); border-right: 1px solid var(--hairline); user-select: none; white-space: nowrap; }
.cb .cl { padding: 0 16px; white-space: pre; }
.cb .kw { color: var(--kw); }
.cb .st { color: var(--st); }

/* ---- COMMAND SEARCH AND DETAIL ---- */
.searchbox { margin-top: 22px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--field-border); background: var(--field); padding: 12px 14px; border-radius: 8px; }
.searchbox:focus-within { border-color: var(--ink); }
.searchbox .p { color: var(--faint); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
.searchbox input { border: none; outline: none; flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 400; color: var(--ink); background: transparent; }
.searchbox input::placeholder { color: var(--faint); }
.count { font-size: 12px; color: var(--faint); margin: 14px 0 2px; letter-spacing: 0.5px; }
.list .rowitem { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.list .rowitem:hover .cmd { opacity: 0.55; }
.list .cmd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(13px, 1.05vw, 15px); font-weight: 400; color: var(--ink); }
.list .vnd { font-size: 11px; letter-spacing: 1px; color: var(--faint); white-space: nowrap; }
.empty { color: var(--muted); font-size: 15px; padding: 18px 0; }
.d-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.d-cmd { font-size: clamp(18px, 1.6vw, 22px); font-weight: 700; color: var(--ink); letter-spacing: -0.3px; }
.d-meta { font-size: 11px; letter-spacing: 1px; color: var(--faint); }
.d-rule { height: 1px; background: var(--ink); margin: 14px 0; }
.d-desc { font-size: clamp(14px, 1.1vw, 16px); color: var(--content); line-height: 1.8; max-width: 64ch; }
.lbl { font-size: 11px; letter-spacing: 1px; color: var(--faint); margin-top: 20px; }
.syn { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; font-weight: 400; color: var(--ink); margin-top: 5px; word-break: break-all; }
.term { border: 1px solid var(--hairline); margin-top: 6px; }
.term .bar { padding: 7px 12px; background: var(--surface); border-bottom: 1px solid var(--hairline); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }
.term .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.term pre { padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; color: var(--content); white-space: pre; }
.term .c { color: var(--kw); }
.notes { font-size: 14px; color: var(--content); line-height: 1.75; margin-top: 5px; max-width: 64ch; }
.rel { margin-top: 18px; font-size: 13px; }
.rel a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* ---- COMMONLY CONFUSED (http status page) ---- */
.cc { margin-top: 6px; }
.cc .pair { padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.cc .pk { font-size: clamp(15px, 1.2vw, 18px); font-weight: 700; letter-spacing: -0.2px; color: var(--ink); }
.cc .px { font-size: clamp(13px, 1.05vw, 15px); color: var(--content); line-height: 1.85; margin-top: 8px; max-width: 68ch; }
.cc .more { font-size: clamp(12px, 0.95vw, 14px); color: var(--muted); margin-top: 12px; line-height: 1.7; max-width: 68ch; }

/* ---- REFERENCE FILTER LISTS (http, ports) ---- */
.toolfilter { margin-top: 22px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--field-border); background: var(--field); padding: 12px 14px; border-radius: 8px; }
.toolfilter:focus-within { border-color: var(--ink); }
.toolfilter .p { color: var(--faint); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
.toolfilter input { border: none; outline: none; flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 400; color: var(--ink); background: transparent; }
.toolfilter input::placeholder { color: var(--faint); }
.fl { margin-top: 14px; }
.fl .row { display: flex; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.fl .k { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 600; color: var(--ink); min-width: 60px; }
.fl .n { font-size: 15px; color: var(--ink); }
.fl .m { font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 2px; max-width: 66ch; }
.fl .none { color: var(--muted); font-size: 15px; padding: 16px 0; }
.fl .cnt { font-size: 11px; letter-spacing: 0.5px; color: var(--faint); padding-bottom: 6px; }

/* ---- CABLE REFERENCE TABLES ---- */
.sec { font-size: 11px; letter-spacing: 1.5px; color: var(--faint); margin-top: 30px; }
.tblwrap { overflow-x: auto; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; min-width: 520px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: 0.5px; color: var(--ink); border-bottom: 1px solid var(--ink); padding: 8px 14px 8px 0; white-space: nowrap; }
.tbl td { font-size: 14px; color: var(--content); border-bottom: 1px solid var(--hairline); padding: 9px 14px 9px 0; vertical-align: top; }
.tbl td.m { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--ink); white-space: nowrap; }
.lead { font-size: 14px; color: var(--muted); line-height: 1.7; margin-top: 8px; max-width: 64ch; }

/* ---- SUBNET CALCULATOR ---- */
.modebar { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; border-bottom: 1px solid var(--hairline); padding-bottom: 10px; margin-top: 8px; }
.modebar button { background: none; border: none; font-family: inherit; font-size: 13px; letter-spacing: 0.3px; color: var(--muted); cursor: pointer; padding: 0 0 10px; margin-bottom: -11px; }
.modebar button:hover { color: var(--ink); }
.modebar button.on { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--accent); }
.panel { display: none; margin-top: 18px; }
.panel.on { display: block; }
.flabel { font-size: 11px; letter-spacing: 1.5px; color: var(--faint); margin-bottom: 6px; display: block; }
.in { border: 1px solid var(--field-border); background: var(--field); padding: 11px 14px; border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(14px, 1.1vw, 16px); font-weight: 400; color: var(--ink); outline: none; }
.in:focus { border-color: var(--ink); }
textarea.in { width: 100%; min-height: 84px; resize: vertical; line-height: 1.6; }
.row2 { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row2 .grow { flex: 1; min-width: 200px; }
.errline { font-size: 12px; color: var(--accent); margin-top: 8px; min-height: 14px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.kv { border-collapse: collapse; width: 100%; max-width: 560px; margin-top: 6px; }
.kv td.k { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--hairline); font-size: 11px; letter-spacing: 1px; color: var(--faint); white-space: nowrap; vertical-align: top; }
.kv td.v { padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: clamp(14px, 1.1vw, 16px); color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 400; }
.rt { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: clamp(12px, 0.95vw, 15px); }
.rt th { text-align: left; border-bottom: 1px solid var(--ink); padding: 7px 12px 7px 0; font-size: clamp(12px, 0.95vw, 15px); letter-spacing: 0.5px; color: var(--ink); white-space: nowrap; }
.rt td { border-bottom: 1px solid var(--hairline); padding: 8px 12px 8px 0; color: var(--content); vertical-align: top; font-weight: 400; }
.rt td.m { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--ink); white-space: nowrap; font-weight: 400; }
.lbl2 { font-size: 11px; letter-spacing: 1px; color: var(--faint); }
.note { font-size: clamp(13px, 1vw, 15px); color: var(--muted); margin-top: 8px; line-height: 1.7; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 400; }
.ok { color: var(--st); }
.bad { color: var(--accent); }
.bin { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(12px, 0.95vw, 15px); font-weight: 400; margin-top: 12px; word-break: break-all; line-height: 1.9; letter-spacing: 0.5px; }
.bin .net { color: var(--ink); font-weight: 400; }
.bin .host { color: var(--faint); font-weight: 400; }
.bin .dot { color: var(--faint); }
.bin .bnd { color: var(--muted); }
.binlegend { display: flex; gap: 18px; margin-top: 12px; font-size: clamp(11px, 0.9vw, 13px); color: var(--muted); }
.binlegend .sw { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: middle; }
.binlegend .sw.net { background: var(--ink); }
.binlegend .sw.host { background: var(--faint); }
.rt td.rel { color: var(--accent); }
.rt td.m2 { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--content); white-space: nowrap; font-weight: 400; }

/* ---- SETTINGS SECTION (injected by theme.js) ---- */
.settings { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.settings .slabel { font-size: clamp(11px, 0.8vw, 12px); letter-spacing: 1.5px; color: var(--faint); }
.theme-opts { display: flex; gap: 8px; margin-top: 12px; }
.theme-opts button { font-family: inherit; font-size: 13px; color: var(--muted); background: none; border: 1px solid var(--hairline); border-radius: 8px; padding: 7px 16px; cursor: pointer; }
.theme-opts button:hover { color: var(--ink); }
.theme-opts button.on { color: var(--ink); border-color: var(--ink); font-weight: 700; }

/* ---- RESPONSIVE ---- */
@media (max-width: 700px) {
  .page { max-width: 100%; padding: 40px 20px 44px; }
  h1 { font-size: 30px; }
  .post-title { font-size: 26px; }
  footer { flex-direction: column; }
}
