/* KryX Linux — Ultra-fast, text-first, zero-JS stylesheet.
 * Single font system: Atkinson Hyperlegible Next / Atkinson Hyperlegible only.
 * Soft, eye-friendly light & dark themes (no harsh #000000 or #ffffff).
 */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src:
    local("Atkinson Hyperlegible Next"),
    local("Atkinson Hyperlegible"),
    url("/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src:
    local("Atkinson Hyperlegible Next Italic"),
    local("Atkinson Hyperlegible Italic"),
    url("/fonts/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src:
    local("Atkinson Hyperlegible Next Bold"),
    local("Atkinson Hyperlegible Bold"),
    url("/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src:
    local("Atkinson Hyperlegible Next Bold Italic"),
    local("Atkinson Hyperlegible Bold Italic"),
    url("/fonts/atkinson-hyperlegible-next-latin-700-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font-main: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", sans-serif;

  /* Soft light palette (never harsh #fff / #000) */
  --bg: #f6f7fa;
  --bg-subtle: #eceff5;
  --bg-code: #e7ebf3;
  --fg: #1d2230;
  --fg-muted: #4c556a;
  --border: #cfd6e4;
  --accent: #2c3e8c;
  --accent-hover: #5b3bb8;
  --accent-soft: #dfe5f6;
  --ok: #1f6b47;
  --warn: #8a5600;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Soft dark palette harmonized with kryx.svg / kryx-full.svg (#212128, #1CE2F5, #7B53D6) */
    --bg: #191a21;
    --bg-subtle: #21222b;
    --bg-code: #262834;
    --fg: #e2e6ef;
    --fg-muted: #a2abc0;
    --border: #36394a;
    --accent: #52e3f4;
    --accent-hover: #a78bfa;
    --accent-soft: #262b3d;
    --ok: #5dd39e;
    --warn: #e9b85b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-main);
  font-size: 100%;
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 auto;
  max-width: 72ch;
  padding: 1.5rem 1.25rem 3rem;
  background: var(--bg);
  color: var(--fg);
  overflow-wrap: break-word;
}

/* Enforce Atkinson Hyperlegible everywhere (including code, pre, kbd, tables) */
h1, h2, h3, h4, h5, h6,
p, li, dt, dd, th, td, blockquote,
code, pre, kbd, samp, tt, nav, footer, input, button {
  font-family: var(--font-main);
}

/* Skip link for keyboard & screen-reader accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent-soft);
  color: var(--fg);
}

/* Header & top navigation */
.site-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.9rem;
  margin-bottom: 2rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.brand-link:hover {
  color: var(--accent);
}

.brand-logo {
  width: 28px;
  height: 25px;
  vertical-align: middle;
  flex-shrink: 0;
}

.brand-tagline {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.95rem;
  font-size: 0.97rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--accent);
  padding: 0.1rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.site-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

/* Headings & clickable anchor links */
h1, h2, h3, h4 {
  line-height: 1.28;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  color: var(--fg);
}

h1 {
  font-size: 1.85rem;
  margin-top: 0.25rem;
}

h2 {
  font-size: 1.38rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.15rem;
}

.heading-anchor {
  margin-left: 0.35rem;
  text-decoration: none;
  color: var(--fg-muted);
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0.55;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
  color: var(--accent);
}

/* Links */
a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
}

/* Paragraphs, lists, blockquotes */
p {
  margin: 0 0 1.05rem;
}

ul, ol {
  margin: 0 0 1.1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.3rem;
}

blockquote {
  margin: 1.2rem 0;
  padding: 0.65rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  color: var(--fg);
}

blockquote p:last-child {
  margin-bottom: 0;
}

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

/* Code blocks & inline code (Atkinson Hyperlegible + tabular numerals) */
code, kbd, samp {
  background: var(--bg-code);
  padding: 0.12em 0.34em;
  border-radius: 3px;
  font-size: 0.94em;
  font-variant-numeric: tabular-nums;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1rem 0 1.25rem;
  font-variant-numeric: tabular-nums;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: 0.94rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.4rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 700;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border);
}

tbody tr:hover {
  background: var(--bg-subtle);
}

/* Table of Contents */
.toc {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  margin: 1.25rem 0 1.75rem;
  font-size: 0.95rem;
}

.toc-title {
  font-weight: 700;
  margin: 0 0 0.45rem;
}

.toc ul {
  margin: 0;
  padding-left: 1.2rem;
}

.toc li {
  margin-bottom: 0.2rem;
}

.toc .toc-l3 {
  margin-left: 1rem;
  font-size: 0.92em;
}

/* Alphabetical jump bar & metadata boxes */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  padding: 0.6rem 0.8rem;
  margin: 1rem 0 1.4rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.92rem;
}

.alpha-nav a {
  text-decoration: none;
  font-weight: 700;
}

.alpha-nav span {
  color: var(--fg-muted);
}

.meta-note {
  color: var(--fg-muted);
  font-size: 0.92rem;
  margin-top: -0.35rem;
  margin-bottom: 1.25rem;
}

.callout {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  margin: 1.2rem 0;
}

.badge-ok {
  color: var(--ok);
  font-weight: 700;
}

.badge-warn {
  color: var(--warn);
  font-weight: 700;
}

.dep-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  list-style: none;
  padding-left: 0;
  margin: 0.35rem 0 1rem;
}

.dep-list li {
  margin: 0;
}

.dep-list a,
.dep-list span {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.9rem;
  text-decoration: none;
}

.man-dl dt {
  font-weight: 700;
  margin-top: 0.75rem;
}

.man-dl dd {
  margin-left: 1.5rem;
  margin-bottom: 0.4rem;
}

.ci-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.ci-badges img {
  height: 20px;
  vertical-align: middle;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--fg-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

/* Print stylesheet: clean Handbook PDF export */
@media print {
  :root {
    --bg: #ffffff;
    --bg-subtle: #f4f4f4;
    --bg-code: #f4f4f4;
    --fg: #111111;
    --fg-muted: #444444;
    --border: #cccccc;
    --accent: #111111;
  }

  body {
    max-width: none;
    margin: 0;
    padding: 0;
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .site-header,
  .site-nav,
  .site-footer,
  .alpha-nav,
  .heading-anchor,
  .skip-link,
  .no-print {
    display: none !important;
  }

  a {
    color: #111111;
    text-decoration: underline;
  }

  pre, blockquote, table {
    break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
  }
}
