/* godoc — Go API documentation browser.
   Header copied from incubator.to (Outfit brand with the dot, sticky
   chrome, 72rem centered wrap); content after oida: dark first, monospace
   throughout, hairlines instead of boxes, one saturated accent. */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400-latin.woff2") format("woff2");
  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: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400-latin-ext.woff2") format("woff2");
  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: Outfit;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/outfit-400-latin.woff2") format("woff2");
  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: Outfit;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/outfit-400-latin-ext.woff2") format("woff2");
  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: Outfit;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/outfit-600-latin.woff2") format("woff2");
  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: Outfit;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/outfit-600-latin-ext.woff2") format("woff2");
  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;
}

:root {
  color-scheme: dark light;

  --font: ui-monospace, "SFMono-Regular", "SF Mono", "JetBrains Mono",
    "IBM Plex Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --ink-0: #07090c;
  --ink-1: #0b0f14;
  --ink-2: #10161d;
  --ink-3: #161f28;
  --line: #1c2630;
  --line-2: #2a3844;
  --text: #d5dee7;
  --text-dim: #8394a3;
  --text-faint: #5a6b79;

  /* The brand dot is the one saturated ink on the page. */
  --accent: #3cc1c0;
  --accent-ink: #07090c;
  --accent-wash: rgba(60, 193, 192, 0.12);
  --ok: #57b894;
  --warn: #d9a441;
  --bad: #e06c6c;
  --bad-wash: rgba(224, 108, 108, 0.1);

  --radius: 2px;

  /* The incubator.to chrome, verbatim: its tokens where the header and
     the centered wrap are concerned. */
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-body: Outfit, "Segoe UI", sans-serif;
  --gutter: 1.5rem;
  /* The central pane: 54rem at the 125% root is 1080px, and the header
     wrap shares the same measure so the chrome lines up with the table. */
  --measure-wide: 54rem;
  --header-h: 4.25rem;
  --touch-min: 2.75rem;
  --chrome: #07090c;
  --chrome-line: rgb(255 255 255 / 0.08);
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --step-1: 1.125rem;
  --step-3: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --ink-0: #f7f5f0;
    --ink-1: #fffdf9;
    --ink-2: #f1eee7;
    --ink-3: #e8e4db;
    --line: #ddd8cc;
    --line-2: #c3bcab;
    --text: #23201a;
    --text-dim: #5d574a;
    --text-faint: #857e6e;

    --accent: #0d7c7b;
    --accent-ink: #fffdf9;
    --accent-wash: rgba(13, 124, 123, 0.1);
    --ok: #1c6f56;
    --warn: #7d5800;
    --bad: #a63232;
    --bad-wash: rgba(166, 50, 50, 0.08);
  }
}

* {
  box-sizing: border-box;
}

/* Everything is sized in rem, so the root is the one dial for scale.
   125% of the reader's base size, as oida ships it. */
html {
  font-size: 125%;
  background: var(--ink-0);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--ink-0);
  color: var(--text);
  font: 400 0.8125rem/1.6 var(--font);
  font-variant-numeric: tabular-nums slashed-zero;
  -webkit-font-smoothing: antialiased;
}

/* Scanlines: atmosphere without an external request, as oida does it. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.4;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.014) 0 1px,
    transparent 1px 3px
  );
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ------------------------------------------------------------- header */

/* The incubator.to header, rule for rule: sticky chrome bar, a centered
   wrap inside it, the Outfit brand with the dot, nav pushed to the edge. */
.wrap {
  width: min(100% - (var(--gutter) * 2), var(--measure-wide));
  margin-inline: auto;
}

/* The chrome is dark in both color schemes, as on incubator.to, so its
   ink is pinned rather than taken from the flipping theme tokens. */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-h);
  padding-block: var(--space-3);
  background: var(--chrome);
  color: #f2f5f7;
  border-bottom: 1px solid var(--chrome-line);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  min-height: var(--touch-min);
  color: #f2f5f7;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.03em;
}

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

.brand__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  align-self: center;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-width: 0;
  margin-inline-start: auto;
}

.site-nav a {
  color: #aab4bd;
  text-decoration: none;
  font-family: var(--font-body);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover {
  color: #f2f5f7;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text-dim);
  font: inherit;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

/* ------------------------------------------------------------- layout */

/* Content sits in the same centered measure the incubator wrap uses.
   No sidebar on this site: the back link stacks above the full width
   content column. */
.godoc-main {
  width: min(100% - (var(--gutter) * 2), var(--measure-wide));
  margin-inline: auto;
  padding-block: 1.25rem 3rem;
}

.godoc-content {
  width: 100%;
  min-width: 0;
}

.godoc-breadcrumb {
  margin-bottom: 0.75rem;
}

.godoc-main > .godoc-breadcrumb {
  margin-bottom: 1rem;
}

.godoc-breadcrumb a {
  color: var(--text-faint);
  text-decoration: none;
}

.godoc-breadcrumb a:hover {
  color: var(--accent);
}

.godoc-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.godoc-nav-entry a {
  display: block;
  padding: 0.3rem 0.4rem;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

.godoc-nav-entry a:hover {
  background: var(--ink-2);
  color: var(--text);
}

/* --------------------------------------------------------------- type */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-3);
  letter-spacing: 0.01em;
  margin: 0.5rem 0 1rem;
}

h2 {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 0.4rem;
  margin: 2.5rem 0 1rem;
}

h3 {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 2rem 0 0.75rem;
}

h4 {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem;
}

p {
  margin: 0.6rem 0;
}

small {
  color: var(--text-faint);
}

.godoc-description p {
  color: var(--text-dim);
}

.function-body {
  border-left: 1px solid var(--line);
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

.function-body span {
  color: var(--text-faint);
}

/* -------------------------------------------------------------- tables */

/* Tables scroll sideways instead of breaking the measure, as in oida. */
.scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line-2);
}

.scroll table {
  margin-top: 0;
}

/* Inside the overflow wrapper sticky offsets resolve against the wrapper,
   which does not scroll vertically, so the header keeps its natural spot. */
.scroll th {
  top: 0;
}

.num {
  white-space: nowrap;
}

/* Status cells keep the dot and the word on one line. */
td:has(> .dot) {
  white-space: nowrap;
}

.pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  color: var(--text-faint);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-variant-numeric: tabular-nums slashed-zero;
}

th,
td {
  padding: 0.42rem 0.9rem 0.42rem 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: sticky;
  top: var(--header-h);
  z-index: 2;
  background: var(--ink-0);
  font-family: var(--font);
  color: var(--text-faint);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-2);
}

tbody tr:hover td {
  background: var(--ink-2);
}

tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Health at a glance: a real state, one per row, not decoration. */
.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--text-faint);
  vertical-align: 0.05em;
}

.dot--ok {
  background: var(--ok);
}

.dot--bad {
  background: var(--bad);
}

/* Ratings read as NN/100 in the brand ink, tabular so columns line up. */
.rating {
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- code */

code {
  font-family: var(--font);
  font-size: 0.92em;
  color: var(--text-dim);
}

pre {
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.55;
}

/* Highlight.js tokens, muted to keep the accent the loudest ink. */
.hljs-keyword,
.hljs-built_in {
  color: #7fb4d8;
}

.hljs-string,
.hljs-number,
.hljs-literal {
  color: #a3c9a0;
}

.hljs-comment,
.hljs-doctag {
  color: var(--text-faint);
  font-style: italic;
}

.hljs-title,
.hljs-type {
  color: #d8c07f;
}

/* --------------------------------------------------------------- forms */

input[type="text"] {
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.6rem;
  min-width: 20rem;
  max-width: 100%;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

select {
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.6rem;
  max-width: 100%;
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

/* The /packages filter row: everything on one wrapping line, inputs sized
   for their content rather than the global 20rem search width. */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.filter-bar input[type="text"] {
  min-width: 0;
  width: 11rem;
}

.filter-bar input[name="min"],
.filter-bar input[name="max"] {
  width: 8rem;
}

/* ------------------------------------------------------------ quality */

.scan-error {
  color: var(--bad);
}

.quality-overall b {
  color: var(--accent);
}

.quality .score {
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quality .score.bonus {
  color: var(--accent);
}

.quality .score.win {
  color: var(--accent);
  background: var(--accent-wash);
  box-shadow: inset 2px 0 0 var(--accent);
}

.quality-bar {
  width: 8rem;
}

/* Scores can exceed 100 (deviation above the waterlevel); the bar clips. */
.bar {
  width: 8rem;
  height: 0.45rem;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ----------------------------------------------------- toc and chart */

.js-toc {
  margin: 1rem 0;
}

.js-toc ol {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.js-toc a {
  color: var(--text-dim);
  text-decoration: none;
}

.js-toc a:hover,
.js-toc a.is-active-link {
  color: var(--accent);
}

#chart_div {
  width: 100%;
  max-width: 56rem;
  height: 30rem;
  margin: 1rem 0;
}

#chart_legend {
  color: var(--text-faint);
  text-align: center;
}

/* --------------------------------------------------------- responsive */

.overlay {
  display: none;
}

@media (max-width: 52rem) {
  .sidebar-toggle[data-has-sidebar] {
    display: block;
  }

  .site-nav {
    gap: var(--space-4);
  }

  .godoc-main {
    padding: 1rem;
  }

}
