/* lp0fire.dev — one stylesheet, no build step. */

/* Fonts: IBM Plex (SIL OFL 1.1, see fonts/LICENSE.txt), self-hosted. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: dark light;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #100d0b;
  --surface: #17120f;
  --surface-2: #221b16;
  --line: #2f2620;
  --text: #ede5da;
  --muted: #a09284;
  --accent: #ff7a1a;
  --link: #ff9a4a;
  --glow: rgb(255 98 26 / 0.13);
  --fire: linear-gradient(100deg, #ffc23d, #ff7a1a 50%, #f0322a);

  /* The terminal stays dark in both schemes: it is a screen, not paper. */
  --term-bg: #0b0908;
  --term-line: #2a211b;
  --term-text: #ddd3c7;
  --term-dim: #8a7c70;

  --wrap: 48rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5efe4;
    --surface: #fffbf5;
    --surface-2: #f1e9dc;
    --line: #e1d5c3;
    --text: #1e1814;
    --muted: #6b5f54;
    --accent: #e0590e;
    --link: #b5420a;
    --glow: rgb(255 140 40 / 0.16);
    --fire: linear-gradient(100deg, #f29100, #e0590e 50%, #c8251f);
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  font: 400 1.0625rem/1.7 var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(ellipse 60rem 22rem at 50% -4rem, var(--glow), transparent 70%) no-repeat,
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* A thin strip of fire along the top edge. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 10;
  background: repeating-linear-gradient(90deg, #ffc23d 0, #ff7a1a 25vw, #f0322a 50vw, #ff7a1a 75vw, #ffc23d 100vw);
  animation: burn 9s linear infinite;
}

::selection {
  background: var(--accent);
  color: #120c08;
}

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

a {
  color: var(--link);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #120c08;
  font: 600 0.875rem var(--font-mono);
  text-decoration: none;
  z-index: 20;
}

.skip:focus {
  top: 1rem;
}

.fire {
  background: var(--fire);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font: 600 1.05rem/1 var(--font-mono);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  transition: transform 0.3s ease;
}

.brand:hover img {
  transform: scale(1.08) rotate(-4deg);
}

.brand-tld {
  color: var(--muted);
  font-weight: 400;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font: 400 0.9rem/1 var(--font-mono);
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.4rem;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
}

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

/* ---------- Home ---------- */

.hero {
  padding-block: clamp(3rem, 9vw, 5.5rem) 3.5rem;
}

.hero h1 {
  margin: 0 0 1.25rem;
  font: 600 clamp(2.1rem, 4.6vw + 0.6rem, 3.4rem)/1.08 var(--font-mono);
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 33rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.terminal {
  margin: 2.75rem 0 0;
  padding: 1.1rem 1.35rem;
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-line);
  border-radius: 10px;
  font: 400 0.875rem/1.8 var(--font-mono);
  overflow-x: auto;
  box-shadow: 0 28px 70px -38px rgb(255 80 20 / 0.55);
}

.terminal .prompt,
.terminal .ts {
  color: var(--term-dim);
}

.terminal .hot {
  color: #ffb45e;
  text-shadow:
    0 0 6px rgb(255 110 30 / 0.75),
    0 0 18px rgb(255 60 20 / 0.45);
  animation: flicker 4s infinite;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: var(--accent);
  animation: blink 1.1s step-end infinite;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font: 400 0.8rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

.post-list li + li {
  border-top: 1px solid var(--line);
}

.post-link {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: 0.35rem 1.5rem;
  align-items: baseline;
  padding: 1.35rem 0;
  color: inherit;
  text-decoration: none;
}

.post-link time {
  color: var(--muted);
  font: 400 0.85rem/1 var(--font-mono);
}

.post-link-title {
  font: 600 1.35rem/1.3 var(--font-mono);
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}

.post-link-excerpt {
  grid-column: 2;
  color: var(--muted);
}

.post-link-arrow {
  grid-column: 3;
  grid-row: 1;
  color: var(--accent);
  font-family: var(--font-mono);
  opacity: 0;
  transform: translateX(-0.4rem);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.post-link:hover .post-link-title {
  color: var(--link);
}

.post-link:hover .post-link-arrow,
.post-link:focus-visible .post-link-arrow {
  opacity: 1;
  transform: none;
}

/* ---------- Post ---------- */

/* Continuous-form printer paper: tractor-feed holes behind a perforation. */
.sheet {
  position: relative;
  margin-block: 3rem 1rem;
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1.25rem, 6vw, 3rem) 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (min-width: 50rem) {
  .wrap--post {
    /* Give the reading column half the viewport, plus the paper margins and borders. */
    --wrap: max(48rem, calc(50vw + 11rem + 2px));
  }

  .sheet {
    padding-inline: 5.5rem;
  }

  .sheet::before,
  .sheet::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.25rem;
    background: radial-gradient(circle, var(--bg) 0 0.3rem, var(--line) 0.32rem 0.38rem, transparent 0.42rem) 50% 0 / 100% 1.5rem;
    background-repeat: no-repeat round;
  }

  .sheet::before {
    left: 0;
    border-right: 1px dashed var(--line);
  }

  .sheet::after {
    right: 0;
    border-left: 1px dashed var(--line);
  }
}

.post-meta {
  margin: 0 0 1rem;
  color: var(--muted);
  font: 400 0.85rem/1.4 var(--font-mono);
}

.post-meta time::before {
  content: "[ ";
  content: "[ " / "";
  color: var(--accent);
}

.post-meta time::after {
  content: " ]";
  content: " ]" / "";
  color: var(--accent);
}

.post-title {
  margin: 0 0 2.25rem;
  font: 600 clamp(2rem, 4vw + 0.75rem, 3rem)/1.1 var(--font-mono);
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line);
  font: 400 0.9rem/1.4 var(--font-mono);
}

.post-footer a {
  color: var(--muted);
  text-decoration: none;
}

.post-footer a:hover {
  color: var(--link);
}

.post-footer--author {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 1rem 0.5rem;
}

.post-author {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.5em;
  max-width: 100%;
  margin: 0 0 0 auto;
  color: var(--muted);
  text-align: left;
}

.post-author strong {
  color: var(--text);
  font-weight: 600;
}

.post-author-role {
  display: block;
  font-size: 0.75rem;
  font-style: italic;
  line-height: 1.4;
}

/* ---------- Prose: everything a post body may contain ---------- */

.prose {
  font-size: 1.0625rem;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose dl,
.prose table,
.prose figure {
  margin: 0 0 1.3em;
}

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.prose h2 {
  margin: 2.25em 0 0.65em;
  font-size: 1.45rem;
  line-height: 1.3;
}

.prose h2::before {
  content: "## ";
  content: "## " / "";
  color: var(--accent);
  letter-spacing: 0.04em;
}

.prose h3 {
  margin: 1.9em 0 0.5em;
  font-size: 1.15rem;
  line-height: 1.35;
}

.prose h4 {
  margin: 1.6em 0 0.4em;
  font-size: 1rem;
}

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  transition: text-decoration-color 0.15s ease;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose strong {
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose li::marker {
  color: var(--accent);
}

.prose ul > li::marker {
  content: "› ";
  font-family: var(--font-mono);
}

.prose code {
  padding: 0.1em 0.35em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.86em;
}

.prose pre {
  margin: 1.6em 0;
  padding: 1rem 1.25rem;
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 4;
}

.prose pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: inherit;
  color: inherit;
}

.code-block {
  position: relative;
  margin: 1.6em 0;
}

.prose .code-block pre {
  margin: 0;
  padding-right: 4.5rem;
}

.copy-code-button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: var(--term-bg);
  color: var(--term-text);
  cursor: pointer;
}

.copy-code-button:hover,
.copy-code-button:focus-visible,
.copy-code-button[data-copied] {
  color: var(--accent);
}

.copy-code-status {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  right: 0;
  max-width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--term-line);
  border-radius: 5px;
  background: var(--term-bg);
  color: var(--term-text);
  font: 400 0.75rem/1.4 var(--font-mono);
  text-align: right;
  pointer-events: none;
}

.copy-code-status:empty {
  display: none;
}

.prose kbd {
  padding: 0.05em 0.4em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 0.85em;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 0.15em 0 0.15em 1.25em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose hr {
  margin: 2.75em 0;
  height: 1px;
  border: 0;
  background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 10px);
  opacity: 0.5;
}

.prose img,
.prose video {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.prose figcaption {
  margin-top: 0.6em;
  color: var(--muted);
  font: 400 0.8rem/1.5 var(--font-mono);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  font: 600 0.8rem/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 4rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 400 0.8rem/1.6 var(--font-mono);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
}

.site-footer a:hover {
  color: var(--link);
}

.site-footer code {
  color: var(--text);
}

/* ---------- Small screens ---------- */

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

  .post-link-excerpt {
    grid-column: 1;
  }

  .post-link-arrow {
    display: none;
  }

  .terminal {
    font-size: 0.78rem;
    white-space: pre-wrap;
  }

  .terminal .ts {
    display: none;
  }
}

/* ---------- Motion ---------- */

@keyframes burn {
  to {
    background-position: 100vw 0;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes flicker {
  0%, 41%, 43%, 77%, 80%, 100% {
    opacity: 1;
  }
  42% {
    opacity: 0.7;
  }
  78% {
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Print: a blog named after a printer error should print well ---------- */

@media print {
  :root {
    --text: #000;
    --muted: #444;
    --line: #bbb;
    --link: #000;
    --accent: #000;
    --surface: #fff;
    --surface-2: #f2f2f2;
    --term-bg: #fff;
    --term-text: #000;
    --term-line: #bbb;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .wrap {
    width: auto;
    min-height: 0;
  }

  .site-footer {
    margin-top: 2rem;
  }

  body::before,
  .skip,
  .site-nav,
  .terminal,
  .post-footer,
  .copy-code-button,
  .copy-code-status {
    display: none;
  }

  .sheet {
    margin: 1.5rem 0 0;
    padding: 0;
    border: 0;
  }

  .sheet::before,
  .sheet::after {
    display: none;
  }

  .fire {
    background: none;
    color: inherit;
  }

  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--muted);
  }

  .prose pre {
    white-space: pre-wrap;
    break-inside: avoid;
  }

  .prose .code-block pre {
    padding-right: 1.25rem;
  }
}
