/* Variables */
:root {
  --background: #1F1B2C;
  --background-rgb: 31, 27, 44;
  --foreground: #D9D8DF;
  --foreground-rgb: 217, 216, 223;
  --selected: #352E52;
  --selected-rgb: 53, 46, 82;
  --accent: #663EFA;
  --accent-rgb: 102, 62, 250;
  --shadow-rgb: 0, 0, 0;
  --page: #231947;
  --alpha-window: 0.76;
  --alpha-surface: 0.75;
  --alpha-hover: 0.25;
  --bar-height: 32px;
  --margin: 10px;
  --panel-width: 850px;
  --row-height: 32px;
  --list-indent: 40px;
  /* 0.6em glyph advance x 16.6667px = 10px per character */
  --font-size: 16.6667px;
  --line-height: 23px;
  --sidebar-ratio: 0.25;
  --badge-width: 88px;
  --badge-height: 31px;
  --color-input-width: 64px;
  --swatch-name-width: 120px;
  --copy-button-size: 23px;
  /* Nerd Font copy glyph ink sits 104 units right of center; this shifts it back */
  --copy-icon-offset: 0.208em;
}

/* Fonts */
@font-face {
  font-family: "JetBrainsMono Nerd Font";
  src: url("/assets/fonts/JetBrainsMonoNerdFont-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  /* Content area = 1.38em = 23px at 16.6667px; baseline stays at 17.5px */
  ascent-override: 105%;
  descent-override: 33%; }
@font-face {
  font-family: "JetBrainsMono Nerd Font";
  src: url("/assets/fonts/JetBrainsMonoNerdFont-Bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  ascent-override: 105%;
  descent-override: 33%; }

/* Base */
html, body {
  height: 100%;
  margin: 0; }

html {
  background: var(--page);
  scrollbar-color: var(--selected) var(--background);
  overflow-y: scroll;
  font-size: var(--font-size); }

body {
  color: var(--foreground);
  font-family: "JetBrainsMono Nerd Font", "JetBrainsMono NF", monospace;
  font-feature-settings: "zero" 1;
  line-height: var(--line-height);
  margin: 0;
  overflow-wrap: break-word;
  /* Stop mobile browsers from enlarging text on narrow screens */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 1rem; }

/* Layout */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh; }

/* Right gutter matches the bars, so no horizontal scrollbar appears */
.page-content {
  flex: 1;
  padding: var(--margin) calc(2 * var(--margin)) 0 var(--margin); }

/* Bars */
.bar {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--bar-height);
  box-sizing: border-box;
  background: rgba(var(--background-rgb), var(--alpha-window));
  margin: 0 calc(2 * var(--margin)) 0 var(--margin);
  z-index: 1; }

.bar-top {
  margin-top: var(--margin); }

.bar-bottom {
  margin-bottom: calc(2 * var(--margin));
  justify-content: center; }

/* Right shadow strip */
.bar::before {
  content: "";
  position: absolute;
  top: var(--margin);
  bottom: 0;
  left: 100%;
  width: var(--margin);
  background: rgba(var(--shadow-rgb), var(--alpha-surface));
  pointer-events: none; }

/* Bottom shadow strip */
.bar::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--margin);
  right: calc(-1 * var(--margin));
  height: var(--margin);
  background: rgba(var(--shadow-rgb), var(--alpha-surface));
  pointer-events: none; }

/* Nav links */
header.bar nav {
  display: flex;
  align-items: stretch;
  gap: var(--margin);
  height: 100%;
  margin-left: var(--margin); }

header.bar nav a {
  display: flex;
  align-items: center;
  padding: 0 var(--margin);
  color: var(--foreground);
  text-decoration: none; }

header.bar nav a:hover,
header.bar nav a:focus-visible,
header.bar nav a[aria-current="page"],
header.bar nav a.active {
  background: rgba(var(--foreground-rgb), var(--alpha-hover));
  color: var(--foreground); }

a.site-title-link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--margin);
  color: var(--foreground);
  text-decoration: none; }

a.site-title-link:visited {
  color: var(--foreground); }

a.site-title-link:hover {
  background: rgba(var(--foreground-rgb), var(--alpha-hover));
  color: var(--foreground);
  text-decoration: none; }

/* Logo */
header.bar-top a.site-title-link {
  padding-right: 0; }

header.bar-top a.site-title-link img {
  display: block;
  width: var(--bar-height);
  height: var(--bar-height);
  image-rendering: pixelated; }

/* Theme link */
header.bar-top .theme-toggle {
  position: absolute;
  right: var(--margin);
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--margin);
  color: var(--foreground);
  text-decoration: none; }

header.bar-top .theme-toggle:hover,
header.bar-top .theme-toggle:focus-visible {
  background: rgba(var(--foreground-rgb), var(--alpha-hover));
  color: var(--foreground);
  outline: none; }

/* Top bar wraps on narrow screens */
header.bar-top {
  height: auto;
  min-height: var(--bar-height);
  align-items: flex-start; }

header.bar-top a.site-title-link {
  flex: none;
  height: var(--bar-height);
  margin-left: var(--margin);
  padding: 0; }

header.bar-top nav {
  flex: 1 1 0;
  min-width: 0;
  height: auto;
  flex-wrap: wrap;
  gap: 0 var(--margin); }

header.bar-top nav a {
  height: var(--bar-height); }

header.bar-top .theme-toggle {
  position: static;
  flex: none;
  height: var(--bar-height);
  margin-left: auto;
  margin-right: var(--margin); }

/* Footer text */
.bar-text {
  margin: 0;
  text-align: center; }

/* Panel */
/* Bottom margin includes the shadow strip */
.panel {
  position: relative;
  display: flex;
  gap: var(--margin);
  max-width: var(--panel-width);
  margin: var(--margin) auto calc(2 * var(--margin));
  padding: var(--margin);
  box-sizing: border-box;
  background: rgba(var(--foreground-rgb), var(--alpha-hover)); }

/* Right shadow strip */
.panel::before {
  content: "";
  position: absolute;
  top: var(--margin);
  bottom: 0;
  left: 100%;
  width: var(--margin);
  background: rgba(var(--shadow-rgb), var(--alpha-surface));
  pointer-events: none; }

/* Bottom shadow strip */
.panel::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--margin);
  right: calc(-1 * var(--margin));
  height: var(--margin);
  background: rgba(var(--shadow-rgb), var(--alpha-surface));
  pointer-events: none; }

/* Sidebar 25%, content 75% */
.panel-sidebar {
  flex: 0 0 calc((100% - var(--margin)) * var(--sidebar-ratio));
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding: var(--margin);
  background: rgba(var(--background-rgb), var(--alpha-surface));
  align-self: stretch; }

.tab-list {
  display: flex;
  flex-direction: column;
  gap: var(--margin); }

/* Sidebar row; long labels wrap onto extra lines */
.tab {
  display: block;
  width: 100%;
  min-height: var(--row-height);
  /* Left padding is the marker width (0.6em glyph + margin) plus the edge margin;
     text-indent pulls the first line back so the marker sits at the edge and
     wrapped lines line up with the label text */
  padding: 0 var(--margin) 0 calc(2 * var(--margin) + 0.6em);
  text-indent: calc(-1 * (var(--margin) + 0.6em));
  margin: 0;
  border: 0;
  box-sizing: border-box;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  line-height: var(--row-height);
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  cursor: pointer; }

.tab:hover,
.tab.selected {
  background: rgba(var(--selected-rgb), var(--alpha-surface)); }

/* Marker space is always reserved so selecting a tab doesn't rewrap its label */
.tab::before {
  content: "\25b6";
  visibility: hidden;
  margin-right: var(--margin); }

.tab.selected::before {
  visibility: visible; }

.panel-content {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  padding: var(--margin);
  background: rgba(var(--background-rgb), var(--alpha-surface)); }

[hidden] {
  display: none !important; }

/* Stack sidebar and content on small screens */
@media (max-width: 640px) {
  .panel {
    flex-direction: column; }
  .panel-sidebar,
  .panel-content {
    flex: none;
    width: 100%; } }

.panel-header {
  min-height: var(--row-height);
  line-height: var(--row-height);
  padding: 0 var(--margin);
  margin-bottom: var(--margin);
  background: rgba(var(--accent-rgb), var(--alpha-surface));
  color: var(--foreground);
  overflow-wrap: anywhere; }

/* Content */
/* Cancels the last child's bottom margin */
.w {
  display: flow-root;
  margin: 0 0 calc(-1 * var(--margin));
  padding: 0;
  box-sizing: border-box; }

/* Lists are rows with hover fill */
.w ul {
  list-style: none;
  margin: 0;
  padding: 0; }

.w ul ul {
  padding-left: var(--margin); }

.w li {
  display: flex;
  align-items: stretch;
  min-height: var(--row-height);
  margin: 0 0 var(--margin);
  padding: 0 var(--margin);
  box-sizing: border-box; }

/* Link fills the whole row */
.w li > a {
  flex: 1;
  display: flex;
  align-items: center;
  margin: 0 calc(-1 * var(--margin));
  padding: 0 var(--margin); }

.w li > span,
.w li > time {
  color: var(--accent); }

/* Lists in post bodies flow like text */
.w article li {
  display: list-item;
  min-height: 0;
  padding: 0; }

/* Post lists */
.w article ol,
.w article ul {
  margin: var(--margin) 0;
  padding-left: var(--list-indent); }

.w article ul,
.w article ol {
  list-style: none; }

/* Markers are placed from the item's left edge */
.w article ul > li,
.w article ol > li {
  position: relative; }

.w article ol {
  counter-reset: item; }

.w article ol > li {
  counter-increment: item; }

.w article ol > li::before {
  content: counter(item) ".";
  position: absolute;
  left: calc(-3/4 * var(--list-indent));
  white-space: nowrap; }

/* Square bullet */
.w article ul > li::before {
  content: "";
  position: absolute;
  left: calc(-3/4 * var(--list-indent));
  top: 0.5em;
  width: var(--margin);
  height: var(--margin);
  background: currentColor; }

/* Link in a post list spans the full list width */
.w article li > a {
  display: flex;
  align-items: center;
  flex: none;
  height: var(--row-height);
  margin: var(--margin) 0 0 calc(-1 * var(--list-indent));
  padding: 0 var(--margin); }

/* Body paragraphs are rows */
.w > p {
  margin: var(--margin) 0;
  padding: var(--margin);
  background: rgba(var(--selected-rgb), var(--alpha-surface)); }

/* Last element keeps the bottom margin (pre, table, img have none by default) */
.w article > :last-child {
  margin-bottom: var(--margin); }

/* No top margin on the first content element */
.tab-pane > :first-child,
.tab-pane > :first-child > :first-child,
.panel-content > .w > :first-child {
  margin-top: 0; }

/* Home and certs: no indent */
.w.flush ul ul {
  padding-left: 0; }

.w.flush li.contact-label {
  display: block;
  margin: 0; }

.w.flush li.contact-label > ul {
  margin-top: var(--margin); }

/* Link rows are row-height tall */
.w.flush li {
  padding: 0;
  min-height: 0; }

.w.flush li > a {
  margin: 0;
  padding: 0 var(--margin);
  align-items: center;
  height: var(--row-height); }

.w.flush > p {
  padding: 0;
  background: none; }

hr {
  text-align: center;
  border: 0;
  margin: var(--margin) 0;
  color: var(--selected); }

hr:before {
  content: "/////"; }

hr:after {
  content: attr(data-content) "/////"; }

/* Typography */
/* Heading link row */
.heading-link {
  display: block;
  line-height: var(--row-height);
  padding: 0 var(--margin); }

h1, h2, h3, h4, h5, h6 {
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  margin: var(--margin) 0; }

p {
  margin: var(--margin) 0; }

li {
  margin: var(--margin) 0; }

/* Links */
a:link {
  color: var(--accent);
  text-decoration: none; }

a:visited {
  color: var(--accent); }

a:hover {
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  color: var(--foreground);
  text-decoration: none; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse; }

table th {
  background: rgba(var(--accent-rgb), var(--alpha-surface));
  color: var(--foreground);
  height: var(--row-height);
  padding: 0 var(--margin);
  text-align: left;
  vertical-align: middle; }

table td {
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  height: var(--row-height);
  padding: 0 var(--margin);
  vertical-align: middle; }

/* Blockquotes */
blockquote {
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  border-left: var(--margin) solid var(--accent);
  color: var(--foreground);
  font-style: italic;
  margin: var(--margin) 0;
  padding: var(--margin); }

blockquote p {
  margin: 0; }

/* Images */
img {
  max-width: 100%;
  display: block;
  margin: var(--margin) auto; }

/* Selection */
::selection {
  background-color: var(--accent);
  color: var(--background); }

/* Code */
/* Inline code */
code {
  margin: 0;
  padding: 0;
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  color: var(--foreground);
  font-family: "JetBrainsMono Nerd Font", "JetBrainsMono NF", monospace;
  font-size: 1em;
  line-height: inherit; }

/* Shell prompt: not selectable or copied */
code .prompt {
  -webkit-user-select: none;
  user-select: none; }

/* Padding is on the inner code so it scrolls with the text */
pre {
  margin: 0;
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  padding: 0;
  overflow-x: auto; }

pre code {
  display: inline-block;
  min-width: 100%;
  margin: 0;
  box-sizing: border-box;
  background: none;
  padding: var(--margin); }

/* Copy button: icon matches the code text size, shown on block hover */
.code-block {
  position: relative;
  margin: var(--margin) 0; }

.copy-button {
  position: absolute;
  top: var(--margin);
  right: var(--margin);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--copy-button-size);
  height: var(--copy-button-size);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  /* Solid #2B263C: background at alpha-window over the panel color
     (foreground at alpha-hover over the page background) */
  background-color: color-mix(in srgb,
    var(--background) calc(var(--alpha-window) * 100%),
    color-mix(in srgb, var(--foreground) calc(var(--alpha-hover) * 100%), var(--page)));
  color: var(--foreground);
  font: inherit;
  font-size: 1em;
  opacity: 0;
  cursor: pointer; }

.code-block:hover .copy-button,
.copy-button:focus-visible {
  opacity: 1; }

/* Nav hover tint layered over the solid background */
.copy-button:hover,
.copy-button:focus-visible {
  background-image: linear-gradient(
    rgba(var(--foreground-rgb), var(--alpha-hover)),
    rgba(var(--foreground-rgb), var(--alpha-hover)));
  outline: none; }

/* Glyphs share one box; padding-right shifts them so they're centered */
.copy-button .copy-icon,
.copy-button .check-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: var(--copy-icon-offset); }

.copy-button .check-icon {
  opacity: 0; }

.copy-button.copied .copy-icon {
  opacity: 0; }

.copy-button.copied .check-icon {
  opacity: 1; }



/* Buttons (88x31 badges on the home page) */
/* Labels above badge grids */
.w > .badge-label {
  margin: var(--margin) 0 calc(var(--margin) * 2); }

/* Grid above a label */
.w > .button-grid + .badge-label {
  margin-top: calc(var(--margin) * 2); }

/* Text after the last grid: 10px more space than the default */
.w > .button-grid + p {
  margin-top: calc(var(--margin) * 2); }

.button-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: calc(var(--margin) * 3);
  margin: var(--margin);
  image-rendering: pixelated; }

/* Grid gap is the only spacing */
.button-grid img {
  margin: 0;
  border: none;
  width: var(--badge-width);
  height: var(--badge-height);
  image-rendering: pixelated; }

.button-grid > * {
  margin: 0;
  display: block; }

/* Hover outline */
.button-grid > a:hover {
  outline: var(--margin) solid rgba(var(--selected-rgb), var(--alpha-surface));
  outline-offset: 0; }

/* Theme page */
/* Label above input */
.theme-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--margin);
  margin-bottom: var(--margin); }

.theme-field > span {
  color: var(--foreground); }

.theme-field input[type="text"] {
  flex: none;
  width: 100%;
  height: var(--row-height);
  box-sizing: border-box;
  padding: 0 var(--margin);
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  color: var(--foreground);
  font: inherit;
  -moz-appearance: none;
  appearance: none; }

/* No focus ring on the hex box */
.theme-field input[type="text"]:focus,
.theme-field input[type="text"]:focus-visible,
.theme-field input[type="text"]::-moz-focus-inner {
  outline: none;
  box-shadow: none;
  border: 0;
  background: rgba(var(--selected-rgb), var(--alpha-surface)); }

.theme-field input[type="color"] {
  align-self: flex-start;
  width: var(--color-input-width);
  height: var(--row-height);
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  cursor: pointer; }

.theme-field input[type="color"]:focus,
.theme-field input[type="color"]:focus-visible {
  outline: none; }

/* Remove swatch padding and border */
.theme-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0; }

.theme-field input[type="color"]::-webkit-color-swatch,
.theme-field input[type="color"]::-moz-color-swatch {
  border: 0; }

/* Reset button looks like a link */
.theme-button {
  display: block;
  width: 100%;
  height: var(--row-height);
  margin-bottom: var(--margin);
  padding: 0 var(--margin);
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer; }

.theme-button:hover {
  background: rgba(var(--selected-rgb), var(--alpha-surface));
  color: var(--foreground); }

.theme-error {
  color: var(--accent);
  margin: 0 0 var(--margin); }

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

.swatch-list li {
  display: flex;
  align-items: center;
  gap: var(--margin);
  height: var(--row-height);
  margin: 0 0 var(--margin); }

.swatch {
  display: block;
  width: var(--row-height);
  height: var(--row-height); }

.swatch-list li > span {
  flex: none;
  white-space: nowrap; }

.swatch-name {
  width: var(--swatch-name-width); }
