/* http://meyerweb.co5/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/**
* By Jayson Lennon<jayson@jaysonlennon.dev>
* Stuff to make b33f work
**/

/* UNIFIED VERTICAL RHYTHM: This handles ALL vertical spacing */
* + *:not(.MathJax, .MathJax *, li, ul *, ol *, .grid *, #spotlight, #spotlight *, .image-grid, .image-grid *) {
  margin-top: var(--line-height);
}

#marmite-search-bar-result, .marmite-search-bar-result,  table.header, .site-nav * {
  margin: 0 !important;
}

/**
 * RESET ELEMENT MARGINS
 * We zero these out so they don't interfere with the * + * rule.
 **/
p, pre, blockquote, h1, h2, h3, h4, h5, h6, ul, ol, figure, .markdown-alert, .term-container, table {
  margin-top: 0;
  margin-bottom: 0;
}

html {
  text-rendering: geometricPrecision;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;

  /* 3. Disable Kerning (Prevents the browser from shifting 'i' closer to 'l') */
  font-kerning: none;
  letter-spacing: 0px;
  text-rendering: geometricPrecision;
  font-variant-numeric: tabular-nums;
}

* {
  box-sizing: border-box;
}

#page-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* clips the generated characters to the page content */
#hex-clipper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

#hex-layer {
  width: 100%;
  height: 100%;

  white-space: pre;
  user-select: none;
  pointer-events: none;

  background-repeat: repeat;
  background-attachment: local;
  /* Ensures gradient scrolls with the text */
  -webkit-background-clip: text;
  background-clip: text;
  /* Make the actual text transparent so the gradient shows through */
  color: transparent;
  transition: opacity 0.5s;
  /* Smooth transition when changing themes */
}

/* Diagnostic Overlay Mode */
#hex-layer.debug-mode {
  background-clip: initial;
  -webkit-background-clip: initial;
  /* White text with a black shadow to make it pop against any color */
  color: #fff;
  text-shadow: 1px 1px 0px #000;
  opacity: 0.8;
}

#content {
  position: relative;
  z-index: 2;
}

/* highlight js override */
.hljs {
  padding: 0 !important;
}

/* alerts */

.markdown-alert > p {
  margin-top: 0;
}

.markdown-alert > p:last-child {
  margin-bottom: 0;
}
.markdown-alert-title {
  font-weight: var(--font-weight-bold);
}

.markdown-alert {
  position: relative;
  /* Box Math: Border (2px) + Padding Left = 2ch */
  padding-left: calc(2ch - var(--border-thickness-large));
  /* Box Math: Top/Bottom Padding = 1 Line Height exactly */
  padding-top: var(--line-height);
  padding-bottom: var(--line-height);
  padding-right: 2ch;
  
  border-left: var(--border-thickness-large) solid var(--alert-note-border);
  font-style: italic;
  
  /* Reset margins so *+* handles the flow */
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-alert-note {
  background: var(--alert-note-color);
  border-color: var(--alert-note-border);
}

.markdown-alert-tip {
  background: var(--alert-tip-color);
  border-color: var(--alert-tip-border);
}

.markdown-alert-important {
  background: var(--alert-important-color);
  border-color: var(--alert-important-border);
}

.markdown-alert-warning {
  background: var(--alert-warning-color);
  border-color: var(--alert-warning-border);
}

.markdown-alert-caution {
  background: var(--alert-caution-color);
  border-color: var(--alert-caution-border);
}

/* ascii/ansi art */
pre.ansi {
  overflow-x: hidden;
  /* letter-spacing: -0.05em; */
  /* line-height: 1; */
}

/* footnotes */
sup::before {
  content: "(";
}

sup::after {
  content: ")";
}

/* github checklists */
ul:has(li > input[type="checkbox"]) {
  list-style-type: none;
  padding: 0;
}

/* definition */
dd {
  margin-left: 4ch;
}

/* spoiler */
.spoiler {
  position: relative;
  display: inline-block;
  background-color: var(--text-color);
  /* Hides the actual text */
  color: transparent;
  transition: all 0.2s ease;
  cursor: help;
  user-select: none;
}

/* The Overlaying Question Mark */
.spoiler::after {
  content: "?";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--background-color);
  font-weight: bold;
  opacity: 1;
  transition: opacity 0.1s;
}

/* Reveal State */
.spoiler:hover {
  background-color: var(--background-color);
  /* Shows the original text color */
  color: inherit;
  /* Allows text selection once revealed */
  user-select: text;
}

.spoiler:hover::after {
  opacity: 0;                                       /* Hides the "?" */
}

/* gherkin stuff */
.Macro { color: var(--gherkin-macro) }
.cucumberUnparsed {}
.cucumberGivenAndRegion {}
.Conditional { color: var(--gherkin-conditional) }
.Function { color: var(--gherkin-function) }
.cucumberGivenRegion {}
.Type { color: var(--gherkin-type) }
.Define { color: var(--gherkin-define) }
.cucumberWhenRegion {}
.cucumberThenRegion {}


/* terminal stuff */

.term-container {
  border: var(--border-thickness) solid var(--border-color);
  /* MATH: Padding + Border must = exactly 1 line-height (18px) */
  padding-top: calc(var(--line-height) - calc(var(--border-thickness)));
  padding-bottom: calc(var(--line-height) - calc(var(--border-thickness)));
  padding-left: 2ch;
  padding-right: 2ch;

  overflow-x: auto;
  white-space: pre;
}

.term-container img { max-width: 100%; }

.term a { color: inherit; text-decoration: underline; text-decoration-style: dashed; }
.term a:hover { color: #2882F9 }

@keyframes blink-animation {
  to {
    visibility: hidden;
  }
}

/* spotlight/lightbox */

#spotlight {
  left: 0;
}

.spotlight img {
  max-width: min(calc(1ch * 50), 100%);
  width: auto;
  height: auto;
  margin: 0 auto; /* Optional: centers the image horizontally */
}

/* 2. Responsive Grid CSS */
.image-grid {
    display: grid;
    /* This creates columns at least 250px wide, filling all available space */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
}

.grid-item {
    display: block;
    width: 100%;
    height: calc(1ch * 30);
    overflow: hidden;
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.grid-item:hover {
    transform: scale(1.02);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures images fill the box without stretching */
    cursor: pointer;
}

/**
 * By Oskar Wickström
 * Licensed under the MIT License (https://github.com/owickstrom/the-monospace-web/blob/main/LICENSE.md)
 **/

:root {
  --font-family: "JetBrains Mono", monospace;
  /* CRITICAL: Use whole integers for line height to avoid sub-pixel drift */
  --line-height: 18px; 
  --border-thickness: round(nearest, 1px, 1px);
  --border-thickness-large: 2px;
  --text-color: #000;
  --text-color-alt: #666;
  --background-color: #fff;
  --background-color-alt: #eee;

  --anchor-color: #fb85ea;
  --inline-code-color: #00c3ff;
  --border-color: #666;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 800;

  --alert-tip-bg: #e6f7e6;
  --alert-tip-border: #48c774;
  --alert-tip-color: #2a623d;
  --alert-note-bg: #f5f5ff;
  --alert-note-border: #5b85ea;
  --alert-note-color: #2d4393;
  --alert-important-bg: #fffbea;
  --alert-important-border: #ffdd57;
  --alert-important-color: #8a6d1a;
  --alert-warning-bg: #fff6f6;
  --alert-warning-border: #ff6b6b;
  --alert-warning-color: #9d2525;
  --alert-caution-bg: #fdf2e9;
  --alert-caution-border: #ff9f43;
  --alert-caution-color: #805526;

  --gherkin-macro: #b39df3;
  --gherkin-conditional: #fc5d7c;
  --gherkin-function: #9ed072;
  --gherkin-type: #76cce0;
  --gherkin-define: var(--gherkin-conditional);

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: var(--font-weight-normal);
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 15px; 
  line-height: var(--line-height);
}

@media (prefers-color-scheme: dark) {}


html {
  image-rendering: auto;
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  color: var(--text-color);
}

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--line-height) 2ch;
  max-width: calc(min(80ch, round(down, 100%, 1ch)));
  line-height: var(--line-height);
  overflow-x: hidden;
}

@media screen and (max-width: 480px) {
  :root {
    /* font-size: 14px; */
  }
  body {
    padding: var(--line-height) 1ch;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  /* Use margins that are exact multiples of line-height */
  margin-top: calc(var(--line-height) * 2); 
  margin-bottom: var(--line-height);
  line-height: var(--line-height);
}



h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  margin-bottom: calc(var(--line-height) * 2);
  text-transform: uppercase;
}
h2 {
  font-size: 1rem;
  text-transform: uppercase;
  text-decoration: underline;
}

h3 {
  text-decoration: underline;
}

.related-content h3 {
  margin-top: 0;
}

.item-title {
  text-decoration: none;
  text-transform: none;
}

hr {
  position: relative;
  display: block;
  height: var(--line-height);
  margin: calc(var(--line-height)) 0;
  border: none;
  color: var(--text-color);
}
hr:after {
  display: block;
  content: "";
  position: absolute;
  top: calc(var(--line-height) / 2 - var(--border-thickness));
  left: 0;
  width: 100%;
  border-top: calc(var(--border-thickness) * 3) double var(--border-color);
  height: 0;
}


a {
  text-decoration-thickness: var(--border-thickness);
  color: var(--anchor-color);
}

a:link, a:visited {
  color: var(--anchor-color);
}

a.site-title {
  color: var(--text-color);
  text-decoration: none;
}

p {
  margin-bottom: var(--line-height);
}

strong {
  font-weight: var(--font-weight-bold);
}
em {
  font-style: italic;
}

sub {
  position: relative;
  display: inline-block;
  margin: 0;
  vertical-align: sub;
  line-height: 0;
  width: calc(1ch / 0.75);
  font-size: .75rem;
}

table {
  position: relative;
  top: 0; /* Reset top adjustment to avoid subpixel mess */
  width: calc(round(down, 100%, 1ch));
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
}

th, td {
  border: var(--border-thickness) solid var(--border-color);
  /* Math for Box Height:
     Padding Top + Padding Bottom + Border Top (collapsed) + Border Bottom (collapsed)
     must equal Integer * LineHeight.
  */
  padding-top: calc(0.5 * var(--line-height) - var(--border-thickness));
  padding-bottom: calc(0.5 * var(--line-height));
  padding-left: 1ch;
  padding-right: 1ch;
  
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}

/* Ensure first row doesn't break grid */
table tbody tr:first-child > * {
  padding-top: calc(0.5 * var(--line-height) - var(--border-thickness));
}

th {
  font-weight: 700;
}
.width-min {
  width: 0%;
}
.width-auto {
  width: 100%;
}

.header {
  margin-bottom: calc(var(--line-height) * 2);
}
.header h1 {
  margin: 0;
}
.header tr td:last-child {
  text-align: right;
}

p {
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

img, video {
  display: block;
  width: 100%;
  object-fit: contain;
  overflow: hidden;
}
img {
  font-style: italic;
  color: var(--text-color-alt);
}

details {
  border: var(--border-thickness) solid var(--border-color);
  /* Math: Padding (17px) + Border (1px) = 18px */
  padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
  margin-bottom: var(--line-height);
}

details,
table {
    background-color: var(--background-color);
}

summary {
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
details[open] summary {
  margin-bottom: var(--line-height);
}

details[open] > summary::marker {
  content: '▼ ';
}

details:not([open]) > summary::marker {
  content: '▶ ';
}

details :last-child {
  margin-bottom: 0;
}

pre {
  white-space: pre;
  overflow-x: auto;
  margin: var(--line-height) 0;
  overflow-y: hidden;
}
figure pre {
  margin: 0;
}

pre:has(code) {
  display: block;
  border: var(--border-thickness) solid var(--border-color);
   
  /* MATH: Padding + Border must = exactly 1 line-height (18px) */
  padding-top: calc(var(--line-height) - calc(var(--border-thickness))); 
  padding-bottom: calc(var(--line-height) - calc(var(--border-thickness))); 
  padding-left: 2ch;
  padding-right: 2ch;
   
  margin-bottom: 0; 
  background: var(--background-color) !important;
  overflow-x: auto;
}
 
pre code {
  display: block;
  line-height: var(--line-height);
  margin: 0;
  padding: 0;
}

pre, code {
  font-family: "JetBrains Mono", "SUSE Mono", monospace;
  font-variant-ligatures: none;
  font-optical-sizing: none;
  font-feature-settings: "calt" 0;
  letter-spacing: normal;
  word-spacing: normal;
  text-rendering: optimizeSpeed;
}

code {
  font-weight: var(--font-weight-normal);
  overflow-y: hidden;
  /* highlight js override */
  background: var(--background-color) !important;
}

code:not(pre code) {
  color: var(--inline-code-color);
}

blockquote {
  padding-left: calc(2ch - var(--border-thickness-large));
  margin: var(--line-height) 0;
  border-left: var(--border-thickness-large) solid var(--border-color);
  font-style: italic;
}


figure {
  margin: calc(var(--line-height) * 2) 3ch;
  overflow-x: auto;
  overflow-y: hidden;
}

figcaption {
  display: block;
  font-style: italic;
  margin-top: var(--line-height);
}

ul, ol {
  padding: 0;
  margin: 0 0 var(--line-height);
}

ul {
  list-style-type: square;
  padding-left: 3ch;
}

ol {
    list-style-type: none;
    list-style-position: outside;
    padding-left: 3ch;
}

.content-toc ul ul {
  margin: 0;
}

ol ul,
ol ol,
ul ol,
ul ul {
  padding-left: 3ch;
  margin: var(--line-height) 0 var(--line-height);
}

li {
  margin: 0;
  padding: 0;
}

/* ONLY direct OL children increment/reset counter */
ol > li {
  counter-increment: item;
}

ol > li::marker {
  content: counter(item) ". ";
  font-weight: var(--font-weight-medium);
  line-height: 0; /* Scoped to OL only */

}

/* Nested OL (if any): chain counters */
ol ol > li::marker {
  content: counters(item, ".") ". ";
  font-weight: var(--font-weight-medium);
  line-height: 0;
}

/* UL: native bullets (no overrides) */
ul li::marker {
  line-height: 0;  /* Prevent marker from affecting line height */
}


::-webkit-scrollbar {
    height: var(--line-height);
}

input, button, textarea, select {
  color: var(--text-color);
  border: var(--border-thickness) solid var(--border-color);
  
  /* Math: Height forced to 2 lines (36px). Padding accounts for borders */
  padding: 
    calc(var(--line-height) / 2 - var(--border-thickness))
    calc(1ch - var(--border-thickness));
    
  margin: 0;
  font: inherit;
  font-weight: inherit;
  height: calc(var(--line-height) * 2);
  width: auto;
  overflow: visible;
  background: var(--background-color);
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;
  -webkit-appearance: none;
}

select {
  -webkit-appearance: auto;
}

input, textarea {
  color: var(--text-color);
}

button {
  color: var(--anchor-color);
}

input[type=checkbox],
input[type=radio] {
  display: inline-grid;
  place-content: center;
  vertical-align: top;
  width: 2ch;
  height: var(--line-height);
  cursor: pointer;
}
input[type=checkbox]:checked:before,
input[type=radio]:checked:before {
  content: "";
  width: 1ch;
  height: calc(var(--line-height) / 2);
  background: var(--text-color);
}
input[type=radio],
input[type=radio]:before {
  border-radius: 100%;
}

button:focus, input:focus {
  --border-thickness: 3px;
  outline: none;
}

input {
  width: calc(round(down, 100%, 1ch));
}
::placeholder {
  color: var(--text-color-alt);
  opacity: 1;
}
::-ms-input-placeholder {
  color: var(--text-color-alt);
}
button::-moz-focus-inner {
  padding: 0;
  border: 0
}

button {
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

button:hover {
  background: var(--background-color-alt);
}
button:active {
  transform: translate(2px, 2px);
}

label {
  display: block;
  width: calc(round(down, 100%, 1ch));
  height: auto;
  line-height: var(--line-height);
  font-weight: var(--font-weight-medium);
  margin: 0;
}

label input {
  width: 100%;
}

.tree, .tree ul {
  position: relative;
  padding-left: 0;
  list-style-type: none;
  line-height: var(--line-height);
}
.tree ul {
  margin: 0;
}
.tree ul li {
  position: relative;
  padding-left: 1.5ch;
  margin-left: 1.5ch;
  border-left: var(--border-thickness) solid var(--text-color);
}
.tree ul li:before {
  position: absolute;
  display: block;
  top: calc(var(--line-height) / 2);
  left: 0;
  content: "";
  width: 1ch;
  border-bottom: var(--border-thickness) solid var(--text-color);
}
.tree ul li:last-child {
  border-left: none;
}
.tree ul li:last-child:after {
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  content: "";
  height: calc(var(--line-height) / 2);
  border-left: var(--border-thickness) solid var(--text-color);
}

.grid {
  --grid-cells: 0;
  display: flex;
  gap: 1ch;
  width: calc(round(down, 100%, (1ch * var(--grid-cells)) - (1ch * var(--grid-cells) - 1)));
  margin-bottom: var(--line-height);
}

.grid > *,
.grid > input {
  flex: 0 0 calc(round(down, (100% - (1ch * (var(--grid-cells) - 1))) / var(--grid-cells), 1ch));
}
.grid:has(> :last-child:nth-child(1)) { --grid-cells: 1; }
.grid:has(> :last-child:nth-child(2)) { --grid-cells: 2; }
.grid:has(> :last-child:nth-child(3)) { --grid-cells: 3; }
.grid:has(> :last-child:nth-child(4)) { --grid-cells: 4; }
.grid:has(> :last-child:nth-child(5)) { --grid-cells: 5; }
.grid:has(> :last-child:nth-child(6)) { --grid-cells: 6; }
.grid:has(> :last-child:nth-child(7)) { --grid-cells: 7; }
.grid:has(> :last-child:nth-child(8)) { --grid-cells: 8; }
.grid:has(> :last-child:nth-child(9)) { --grid-cells: 9; }

/* DEBUG UTILITIES */

.debug .debug-grid {
  --color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background-image:
    repeating-linear-gradient(var(--color) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%);
  
  /* STRICT GRID SIZING: Must exactly match Line-Height to detect drift */
  background-size: 1ch var(--line-height);
  margin: 0;
}

.debug .off-grid {
  background: rgba(255, 0, 0, 0.1);
}

.debug-toggle-label {
  text-align: right;
}

