/*
! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com
*/

/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/

*,
::before,
::after {
  box-sizing: border-box;
  /* 1 */
  border-width: 0;
  /* 2 */
  border-style: solid;
  /* 2 */
  border-color: #e5e7eb;
  /* 2 */
}

::before,
::after {
  --tw-content: '';
}

/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
*/

html {
  line-height: 1.5;
  /* 1 */
  -webkit-text-size-adjust: 100%;
  /* 2 */
  -moz-tab-size: 4;
  /* 3 */
  -o-tab-size: 4;
     tab-size: 4;
  /* 3 */
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  /* 4 */
  font-feature-settings: normal;
  /* 5 */
  font-variation-settings: normal;
  /* 6 */
}

/*
1. Remove the margin in all browsers.
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
*/

body {
  margin: 0;
  /* 1 */
  line-height: inherit;
  /* 2 */
}

/*
1. Add the correct height in Firefox.
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
3. Ensure horizontal rules are visible by default.
*/

hr {
  height: 0;
  /* 1 */
  color: inherit;
  /* 2 */
  border-top-width: 1px;
  /* 3 */
}

/*
Add the correct text decoration in Chrome, Edge, and Safari.
*/

abbr:where([title]) {
  -webkit-text-decoration: underline dotted;
          text-decoration: underline dotted;
}

/*
Remove the default font size and weight for headings.
*/

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

/*
Reset links to optimize for opt-in styling instead of opt-out.
*/

a {
  color: inherit;
  text-decoration: inherit;
}

/*
Add the correct font weight in Edge and Safari.
*/

b,
strong {
  font-weight: bolder;
}

/*
1. Use the user's configured `mono` font family by default.
2. Correct the odd `em` font sizing in all browsers.
*/

code,
kbd,
samp,
pre {
  font-family: JetBrains Mono, ui-monospace, monospace;
  /* 1 */
  font-size: 1em;
  /* 2 */
}

/*
Add the correct font size in all browsers.
*/

small {
  font-size: 80%;
}

/*
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/*
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
3. Remove gaps between table borders by default.
*/

table {
  text-indent: 0;
  /* 1 */
  border-color: inherit;
  /* 2 */
  border-collapse: collapse;
  /* 3 */
}

/*
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
3. Remove default padding in all browsers.
*/

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  /* 1 */
  font-feature-settings: inherit;
  /* 1 */
  font-variation-settings: inherit;
  /* 1 */
  font-size: 100%;
  /* 1 */
  font-weight: inherit;
  /* 1 */
  line-height: inherit;
  /* 1 */
  color: inherit;
  /* 1 */
  margin: 0;
  /* 2 */
  padding: 0;
  /* 3 */
}

/*
Remove the inheritance of text transform in Edge and Firefox.
*/

button,
select {
  text-transform: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/

button,
[type='button'],
[type='reset'],
[type='submit'] {
  -webkit-appearance: button;
  /* 1 */
  background-color: transparent;
  /* 2 */
  background-image: none;
  /* 2 */
}

/*
Use the modern Firefox focus style for all focusable elements.
*/

:-moz-focusring {
  outline: auto;
}

/*
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
*/

:-moz-ui-invalid {
  box-shadow: none;
}

/*
Add the correct vertical alignment in Chrome and Firefox.
*/

progress {
  vertical-align: baseline;
}

/*
Correct the cursor style of increment and decrement buttons in Safari.
*/

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

/*
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/

[type='search'] {
  -webkit-appearance: textfield;
  /* 1 */
  outline-offset: -2px;
  /* 2 */
}

/*
Remove the inner padding in Chrome and Safari on macOS.
*/

::-webkit-search-decoration {
  -webkit-appearance: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to `inherit` in Safari.
*/

::-webkit-file-upload-button {
  -webkit-appearance: button;
  /* 1 */
  font: inherit;
  /* 2 */
}

/*
Add the correct display in Chrome and Safari.
*/

summary {
  display: list-item;
}

/*
Removes the default spacing and border for appropriate elements.
*/

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
Reset default styling for dialogs.
*/

dialog {
  padding: 0;
}

/*
Prevent resizing textareas horizontally by default.
*/

textarea {
  resize: vertical;
}

/*
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2. Set the default placeholder color to the user's configured gray 400 color.
*/

input::-moz-placeholder, textarea::-moz-placeholder {
  opacity: 1;
  /* 1 */
  color: #9ca3af;
  /* 2 */
}

input::placeholder,
textarea::placeholder {
  opacity: 1;
  /* 1 */
  color: #9ca3af;
  /* 2 */
}

/*
Set the default cursor for buttons.
*/

button,
[role="button"] {
  cursor: pointer;
}

/*
Make sure disabled buttons don't get the pointer cursor.
*/

:disabled {
  cursor: default;
}

/*
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
   This can trigger a poorly considered lint error in some tools but is included by design.
*/

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  /* 1 */
  vertical-align: middle;
  /* 2 */
}

/*
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
*/

img,
video {
  max-width: 100%;
  height: auto;
}

/* Make elements with the HTML hidden attribute stay hidden by default */

[hidden] {
  display: none;
}

*, ::before, ::after {
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
}

::backdrop {
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
}

.static {
  position: static;
}

.hidden {
  display: none;
}

.transform {
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.filter {
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

@font-face {
  font-family: "JetBrains Mono";

  src: url("/asset?u=https%3A%2F%2Funwrap.rs%2Ffonts%2FJetBrainsMono-latin.woff2") format("woff2");

  font-weight: 100 800;

  font-style: normal;

  font-display: swap;
}

:root {
  --bg: #0d0a10;
  --bg-glow: #200826;
  --text: #f0e8f4;
  --muted: #a091a8;
  --faint: #2e1a36;
  --accent: #dd68ff;
  --column: 56rem;
  --gutter: 1.25rem;
  /* 16 JetBrains Mono advances at 1rem */
  --name-col: 9.6rem;
  color-scheme: dark;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, var(--bg-glow), transparent 70%) no-repeat;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "calt" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* One column for every page. Clipping here also keeps the 3D particles
   from inflating the scrollable area (Firefox projects near-camera glyphs). */

/*
 * Thorny vines down both side margins, on every page. Screens only, and
 * only where each margin is wide enough to hold one clear of the text.
 * The tile repeats without a seam (drawn by ~/Pictures/skull_roses/site_tile.py).
 */

@media screen and (min-width: 80rem) {
  body {
    position: relative;
    isolation: isolate;
  }

  body::before,
    body::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: -1;
    width: calc((100% - var(--column)) / 2);
    background-repeat: repeat-y;
    background-position: center top 2rem;
    background-size: 170px auto;
    pointer-events: none;
  }

  body::before {
    left: 0;
    background-image: url("/asset?u=https%3A%2F%2Funwrap.rs%2Fvine-left.webp");
  }

  body::after {
    right: 0;
    background-image: url("/asset?u=https%3A%2F%2Funwrap.rs%2Fvine-right.webp");
  }
}

.page {
  box-sizing: border-box;
  min-height: 100svh;
  overflow: clip;
  padding:
        clamp(3rem, 14vh, 8rem)
        max(var(--gutter), env(safe-area-inset-right), (100% - var(--column)) / 2)
        max(4rem, env(safe-area-inset-bottom))
        max(var(--gutter), env(safe-area-inset-left), (100% - var(--column)) / 2);
}

/* Intro */

/* Homepage only: the portrait sits right of the name, sentence and links. */

.intro:has(.portrait) {
  display: grid;
  grid-template-columns: 1fr auto;
  -moz-column-gap: 2rem;
       column-gap: 2rem;
}

.intro:has(.portrait) > :not(.portrait) {
  grid-column: 1;
}

.portrait {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: start;
  /* Spans the header block, from the name to the PGP line. */
  width: 11rem;
  height: 11rem;
  border: 1px solid var(--faint);
  border-radius: 12px;
  -o-object-fit: cover;
     object-fit: cover;
}

@media (max-width: 40rem) {
  .intro:has(.portrait) {
    grid-template-columns: 1fr;
  }

  .portrait {
    grid-column: 1;
    grid-row: auto;
    order: -1;
    width: 5.5rem;
    height: 5.5rem;
    margin-bottom: 1rem;
  }
}

@media print {
  .portrait {
    display: none;
  }
}

.name {
  margin: 0;
  font-size: clamp(1.625rem, 4.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.statement {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

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

.links {
  display: flex;
  flex-wrap: wrap;
  -moz-column-gap: 1.5rem;
       column-gap: 1.5rem;
  margin-top: 0.75rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-height: 44px;
}

/* Inline Bootstrap Icons: sized to the text, coloured by it. */

.icon {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
}

.pgp .icon,
.post-meta .icon {
  margin-right: 0.45em;
}

.links a,
.post-meta a,
.entries-empty a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.links a:hover,
.post-meta a:hover,
.entries-empty a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.pgp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  -moz-column-gap: 1.5rem;
       column-gap: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.pgp a {
  display: inline-flex;
  flex-wrap: wrap;
  -moz-column-gap: 1ch;
       column-gap: 1ch;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.pgp a + a {
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 0.3em;
}

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

/* Hero: `Result<T, E>` is static text; `.unwrap()` is assembled by the
   animation in a 6em x 3em field (see typing_animation/constants.rs). */

.hero {
  display: flex;
  align-items: center;
  margin: clamp(1.5rem, 6vh, 3.25rem) 0;
  font-size: clamp(1rem, calc((100vw - 2 * var(--gutter)) / 13.6), 2.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  perspective: 1000px;
}

.hero-base {
  color: var(--text);
}

.hero-static {
  color: var(--accent);
}

.hero:has(.animation-field) .hero-static {
  display: none;
}

.animation-field {
  position: relative;
  flex: none;
  width: 6em;
  height: 3em;
  transform-style: preserve-3d;
}

.connections-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0.5;
}

.animation-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-style: preserve-3d;
}

.particle {
  position: absolute;
  line-height: 1;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.particle.settled {
  text-shadow: 0 0 0.4em rgb(221 104 255 / 0.35);
}

/* Sections */

.section + .section {
  margin-top: 3rem;
}

.section-label {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

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

.entries a,
.entries .entry-static {
  display: grid;
  grid-template-columns: var(--name-col) 1fr;
  -moz-column-gap: 1.5rem;
       column-gap: 1.5rem;
  align-items: baseline;
  min-height: 44px;
  padding: 0.5rem 0;
  text-decoration: none;
}

.entry-name {
  color: var(--text);
  font-weight: 600;
  transition: color 0.15s ease;
}

.entry-desc {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.entries a:hover .entry-name {
  color: var(--accent);
}

.entries a:has(.entry-meta),
.entries .entry-static:has(.entry-meta) {
  grid-template-columns: var(--name-col) 1fr auto;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Identifiers that belong to the entry above (CVEs under a research item). */

.entry-refs {
  display: flex;
  flex-wrap: wrap;
  -moz-column-gap: 1.75rem;
       column-gap: 1.75rem;
  margin: -0.25rem 0 0.25rem;
  padding: 0 0 0 calc(var(--name-col) + 1.5rem);
  list-style: none;
  color: var(--muted);
  font-size: 0.875rem;
}

.entry-refs li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.entry-refs a,
.section-more a,
.post-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.entry-refs a:hover,
.section-more a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.section-more {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* A post title spans the name and description columns. */

.entry-title {
  grid-column: 1 / 3;
  color: var(--text);
  line-height: 1.45;
  transition: color 0.15s ease;
}

.entries a:hover .entry-title {
  color: var(--accent);
}

.entries-empty {
  color: var(--muted);
}

@media (max-width: 34rem) {
  .entries a,
    .entries a:has(.entry-meta),
    .entries .entry-static,
    .entries .entry-static:has(.entry-meta) {
    grid-template-columns: 1fr;
    row-gap: 0.125rem;
  }

  .entry-title {
    grid-column: auto;
  }

  .entry-refs {
    padding-left: 0;
  }
}

/* Writing pages (generated by sitegen) */

/* Generated pages repeat the homepage header; the name links home. */

.name a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}

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

.intro + article,
.intro + .post-title {
  margin-top: clamp(2.5rem, 8vh, 4rem);
}

.post-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.post-meta {
  margin: 0.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.post-body {
  max-width: 70ch;
  color: #ddd3e2;
  font-size: 0.9375rem;
  line-height: 1.75;
}

.post-body > * + * {
  margin-top: 1.1em;
}

.post-body h2,
.post-body h3 {
  margin-top: 2.25em;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

.post-body h2 {
  font-size: 1.25rem;
}

.post-body h3 {
  font-size: 1.0625rem;
}

.post-body a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

.post-body ul,
.post-body ol {
  padding-left: 1.5em;
}

.post-body ul {
  list-style: square;
}

.post-body ol {
  list-style: decimal;
}

.post-body code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--faint);
  font-size: 0.9em;
}

/* sitegen wraps each word of inline code in a span: wrap between words,
   never inside one (a flag must not split at its hyphen). */

.post-body :not(pre) > code > span {
  white-space: nowrap;
}

.post-body pre {
  overflow-x: auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--faint);
  border-radius: 4px;
  background: #08060a;
  line-height: 1.55;
}

.post-body pre code {
  padding: 0;
  background: none;
}

/* Syntax highlighting, rendered at build time by sitegen (syntect,
   classed spans, no script). The accent plus a few tints; every color
   passes WCAG AA on the code background. */

.post-body .hl code {
  color: #e8def0;
}

.hl .hl-comment {
  color: #958aa3;
  font-style: italic;
}

.hl .hl-keyword,
.hl .hl-storage.hl-modifier,
.hl .hl-storage.hl-type.hl-function {
  color: var(--accent);
}

.hl .hl-keyword.hl-operator,
.hl .hl-punctuation {
  color: #a99bb6;
}

/* types: primitives, std types, and names the grammar knows are types */

.hl .hl-storage.hl-type,
.hl .hl-support.hl-type,
.hl .hl-support.hl-class,
.hl .hl-entity.hl-name.hl-type {
  color: #f0b6ff;
}

/* the item being defined: fn, struct, trait, impl names */

.hl .hl-entity.hl-name {
  color: #f6ecff;
  font-weight: 700;
}

.hl .hl-support.hl-function,
.hl .hl-variable.hl-function,
.hl .hl-support.hl-macro,
.hl .hl-entity.hl-name.hl-macro {
  color: #c9a6ff;
  font-weight: 400;
}

.hl .hl-string,
.hl .hl-string .hl-punctuation {
  color: #9fdcbc;
}

.hl .hl-constant,
.hl .hl-storage.hl-modifier.hl-lifetime {
  color: #ff9ed8;
}

.hl .hl-meta.hl-annotation,
.hl .hl-meta.hl-attribute {
  color: #958aa3;
}

/* Diagrams keep their natural size (readable text) and scroll inside
   their frame on narrow screens, like code blocks. */

.post-body .diagram {
  /* As wide as the diagram (at least the text column), up to the page
       column; wider than the screen, it scrolls. */
  width: -moz-max-content;
  width: max-content;
  min-width: 100%;
  max-width: min(
        var(--column),
        calc(
            100vw - max(var(--gutter), env(safe-area-inset-left)) -
                max(var(--gutter), env(safe-area-inset-right))
        )
    );
  margin: 1.75rem 0;
  overflow-x: auto;
}

.post-body .diagram svg {
  display: block;
  margin: 0 auto;
}

.post-body .diagram:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.post-body blockquote {
  padding-left: 1rem;
  border-left: 2px solid var(--faint);
  color: var(--muted);
}

.post-body table {
  border-collapse: collapse;
  font-size: 0.875rem;
  /* wide tables scroll inside the column instead of being clipped */
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.post-body th,
.post-body td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--faint);
  text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  /* Applies live: if reduced motion is switched on after the animation
       mounted, hide it and show the static `.unwrap()` again. */

  .animation-field {
    display: none;
  }

  .hero:has(.animation-field) .hero-static {
    display: inline;
  }

  *,
    *::before,
    *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* The live Xtensa disassembler in its post (xtensa-dis, WebAssembly). */

.xtensa-demo {
  display: grid;
  gap: 0.75rem;
  margin: 1.75rem 0;
}

.xtensa-inputs {
  display: grid;
  grid-template-columns: 1fr 12rem;
  gap: 0.75rem;
}

.xtensa-inputs label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.xtensa-bytes,
.xtensa-base {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--faint);
  border-radius: 4px;
  background: #08060a;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  resize: vertical;
}

.xtensa-bytes:focus-visible,
.xtensa-base:focus-visible,
.xtensa-out:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Before the WebAssembly loads (or without it) the example is read-only. */

.xtensa-demo:not([data-live]) .xtensa-bytes,
.xtensa-demo:not([data-live]) .xtensa-base {
  color: var(--muted);
}

.post-body .xtensa-out {
  margin: 0;
}

/* Listing colors: the code-block palette, assigned by what the decoder
   printed rather than by a grammar. */

.xt-addr,
.xt-bytes {
  color: #958aa3;
}

.xt-mn {
  color: var(--accent);
}

.xt-reg {
  color: #e8def0;
}

.xt-imm {
  color: #ff9ed8;
}

.xt-target {
  color: #c9a6ff;
}

@media (max-width: 40rem) {
  .xtensa-inputs {
    grid-template-columns: 1fr;
  }
}

/* Older/newer links under a post. */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 70ch;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 44px;
  text-decoration: none;
}

.post-nav-next {
  grid-column: 2;
  text-align: right;
}

.post-nav-label {
  color: var(--muted);
  font-size: 0.8125rem;
}

.post-nav-title {
  color: var(--text);
  line-height: 1.45;
  transition: color 0.15s ease;
}

.post-nav a:hover .post-nav-title {
  color: var(--accent);
}

@media (max-width: 40rem) {
  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-next {
    grid-column: auto;
    text-align: left;
  }
}

/* The CV: longer names (roles, schools) get a wider first column. */

.cv {
  --name-col: 13rem;
  margin-top: 2rem;
}

/* Printing (the CV in particular): dark text on white, compact rows, no
   glow or screen-only links, link targets written out, rows kept whole. */

@page {
  margin: 0.5in;
}

@media print {
  :root {
    --bg: #fff;
    --bg-glow: #fff;
    --text: #111;
    --muted: #444;
    --faint: #bbb;
    --accent: #6b1f8a;
  }

  body {
    min-height: 0;
    background: none;
    font-size: 9pt;
    line-height: 1.4;
  }

  .page {
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  .pgp,
    .links svg,
    .links a[href^="/"],
    #animation-mount {
    display: none;
  }

  .links a::after {
    content: " " attr(href);
    color: var(--muted);
  }

  .links a,
    .entries a,
    .entries .entry-static,
    .entry-refs a,
    .section-more a {
    min-height: 0;
    padding: 0.1rem 0;
  }

  .post-title {
    margin-top: 1rem;
    font-size: 14pt;
  }

  .cv {
    --name-col: 11rem;
    margin-top: 0.75rem;
  }

  .section + .section {
    margin-top: 0.8rem;
  }

  .section-label {
    margin-bottom: 0.25rem;
    -moz-column-break-after: avoid;
         break-after: avoid;
  }

  .entries li {
    -moz-column-break-inside: avoid;
         break-inside: avoid;
  }

  a {
    text-decoration: none;
  }
}
