@font-face {
  font-family: "IBM Plex Serif";
  src: url("/fonts/IBMPlexSerif-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Serif";
  src: url("/fonts/IBMPlexSerif-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Serif";
  src: url("/fonts/IBMPlexSerif-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Ilta Mono";
  src: url("/fonts/IltaMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ilta Mono";
  src: url("/fonts/IltaMono-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #0d0d0d;
  --fg: #d8d8d8;
  --muted: #93898b;
  --accent: #e23e49;
  --line: #2a2a2a;
  --ember: #7a4828;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Ilta Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --mono-fg: #d8ced0;
  --mono-muted: #907e7f;
  --mono-accent: #e23e49;
  --mono-accent-rgb: 226 62 73;
  --presence-x: 50vw;
  --presence-y: 28vh;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 10;
  padding: 0.45rem 0.68rem;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.68rem;
  text-decoration: none;
  transform: translateY(calc(-100% - 1rem));
  transition: transform 0.15s ease;
}

.skip-link:focus {
  color: var(--fg);
  transform: translateY(0);
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% -10%, #1a0a0a 0%, transparent 54%),
    radial-gradient(ellipse at 110% 85%, rgba(122, 72, 40, 0.07) 0%, transparent 42%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.65;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(
      circle 42px at var(--presence-x) var(--presence-y),
      rgba(208, 17, 33, 0.035),
      transparent 72%
    ),
    radial-gradient(
      circle 280px at var(--presence-x) var(--presence-y),
      rgba(96, 13, 22, 0.075),
      transparent 70%
    );
  transition: opacity 0.9s ease;
}

body.presence-active::before {
  opacity: 1;
}

header, main, footer {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

body.long-form header,
body.long-form main,
body.long-form footer {
  max-width: 680px;
}

body.long-form main {
  font-size: 18px;
  line-height: 1.7;
}

header {
  margin-bottom: 2.5rem;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--mono-fg);
  font-size: 0.78rem;
  text-transform: lowercase;
}

nav .site-title {
  color: var(--mono-accent);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  text-shadow: 0 0 24px rgb(var(--mono-accent-rgb) / 0.22);
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
}

nav .site-title:hover {
  color: var(--mono-accent);
  text-shadow: 0 0 18px rgb(var(--mono-accent-rgb) / 0.68);
}

.site-mark {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px rgba(208, 17, 33, 0.16));
  transition: filter 0.45s ease;
}

.site-title:hover .site-mark {
  filter: drop-shadow(0 0 9px rgb(var(--mono-accent-rgb) / 0.48));
}

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.2rem;
}

.nav-links a {
  color: var(--mono-muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--mono-accent);
  text-shadow: 0 0 14px rgb(var(--mono-accent-rgb) / 0.42);
}

nav a[aria-current="page"] {
  color: var(--mono-fg);
}

a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.3rem;
}

main {
  flex: 1;
  min-width: 0;
  text-wrap: pretty;
}

main:focus {
  outline: none;
}

.home-sigil {
  width: 5rem;
  margin: 0 0 1.25rem -0.18rem;
  filter: drop-shadow(0 0 20px rgba(208, 17, 33, 0.16));
}

.home-sigil img {
  display: block;
  width: 100%;
  height: auto;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--accent);
  margin-bottom: 0.2rem;
  text-shadow: 0 0 45px rgba(208, 17, 33, 0.18);
}

h2 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 2rem 0 0.8rem 0;
}

p {
  margin: 0 0 0.9rem 0;
}

strong {
  font-weight: 600;
}

.lede {
  color: #eeeeec;
  font-size: 1.12rem;
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  border-bottom: none;
  transition: color 0.15s ease, text-shadow 0.45s ease;
}

a:hover {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(208, 17, 33, 0.36);
}

.tagline {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.45;
  margin-bottom: 0.6rem;
}

hr {
  border: none;
  height: 1px;
  background: var(--accent);
  width: 48px;
  margin: 0 0 2rem 0;
  box-shadow: 0 0 12px rgba(208, 17, 33, 0.35);
  transform-origin: left center;
  transition: transform 0.9s ease, box-shadow 0.9s ease;
}

.posts {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0 0;
}

.posts li {
  margin-bottom: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.posts a {
  font-size: 1.05rem;
}

.post-description {
  color: #a8a3a3;
  font-size: 0.9rem;
  line-height: 1.45;
}

.date {
  color: var(--mono-muted);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.jaw {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.2rem 1.8rem;
  margin-top: 2rem;
}

.tooth {
  border-top: 2px solid var(--accent);
  padding-top: 0.8rem;
  font-size: 0.9rem;
  line-height: 1.55;
  box-shadow: 0 -6px 18px -12px rgba(208, 17, 33, 0.5);
  transition:
    color 0.45s ease,
    transform 0.5s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.tooth:nth-child(even) {
  margin-top: 2.4rem;
}

.tooth h2,
.tooth h3 {
  font-size: 1.05rem;
  margin: 0 0 0.65rem 0;
}

.tooth p {
  margin: 0;
}

.tooth p + p {
  margin-top: 0.6rem;
}

.tooth-wide {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
}

.render {
  margin: 1.8rem 0;
}

.render img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.render figcaption {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.55rem;
}

.sound-player {
  display: block;
  width: 100%;
  margin: 1.8rem 0;
  color-scheme: dark;
  accent-color: var(--accent);
}

.book-cover {
  width: min(100%, 360px);
  margin: 1.8rem auto 2.1rem;
}

.book-cover img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(208, 17, 33, 0.34);
  box-shadow:
    0 24px 55px -34px rgba(0, 0, 0, 0.95),
    0 0 38px -24px rgba(208, 17, 33, 0.55);
}

.book-threshold {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem 0.9rem;
  border-left: 2px solid var(--accent);
  background: rgba(208, 17, 33, 0.035);
  color: #aaa3a4;
  font-size: 0.86rem;
  line-height: 1.5;
}

.book-threshold p {
  margin: 0;
}

.book-threshold p + p {
  margin-top: 0.35rem;
}

.book-threshold strong {
  color: var(--fg);
  font-weight: 400;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.6rem 0 0.8rem;
}

.book-action {
  display: inline-block;
  padding: 0.48rem 0.72rem;
  border: 1px solid var(--line);
  color: var(--mono-fg);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.68rem;
  line-height: 1.2;
  text-decoration: none;
}

.book-action:hover {
  border-color: var(--mono-accent);
  color: var(--mono-accent);
}

.book-format-note {
  color: var(--mono-muted);
  font-family: var(--sans);
  font-size: 0.66rem;
}

code,
pre,
kbd,
samp {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-feature-settings: "calt" 1, "dlig" 1;
}

code,
kbd,
samp {
  color: var(--mono-fg, #e6e2df);
  font-size: 0.84em;
}

:not(pre) > code {
  padding: 0.12em 0.32em 0.16em;
  border: 1px solid rgba(208, 17, 33, 0.22);
  border-radius: 2px;
  background: rgba(208, 17, 33, 0.055);
}

pre {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.35rem 0 1.65rem;
  padding: 0.9rem 1rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background:
    linear-gradient(110deg, rgba(208, 17, 33, 0.065), transparent 44%),
    #090909;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.025),
    0 16px 38px rgba(0, 0, 0, 0.24);
  color: var(--mono-fg, #e6e2df);
  font-size: 0.72rem;
  line-height: 1.65;
  scrollbar-color: var(--accent) #111;
  scrollbar-width: thin;
}

pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

pre code[data-lang]::before {
  content: attr(data-lang);
  display: block;
  width: max-content;
  margin-bottom: 0.48rem;
  color: var(--accent);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

pre::-webkit-scrollbar {
  height: 0.35rem;
}

pre::-webkit-scrollbar-track {
  background: #111;
}

pre::-webkit-scrollbar-thumb {
  background: var(--accent);
}

pre:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.22rem;
}

.copy-code {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  z-index: 1;
  padding: 0.2rem 0.42rem 0.24rem;
  border: 1px solid rgba(208, 17, 33, 0.42);
  border-radius: 2px;
  background: #0d0d0d;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
  cursor: pointer;
}

.copy-code:hover,
.copy-code:focus-visible,
.copy-code[data-copy-state="copied"] {
  border-color: var(--accent);
  color: var(--mono-fg, #e6e2df);
  box-shadow: 0 0 14px rgb(var(--mono-accent-rgb) / 0.24);
}

.copy-code:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.18rem;
}

.copy-code[data-copy-state="failed"] {
  color: var(--accent);
}

.code-shell {
  position: relative;
  min-width: 0;
  margin: 1.35rem 0 1.65rem;
}

.code-shell pre {
  margin: 0;
}

.pet-portrait,
.pet-hero {
  display: grid;
  place-items: center;
}

.pet-portrait {
  margin: 1.4rem 0 2rem;
}

.pet-hero {
  margin: 1.5rem 0 1.8rem;
}

.pet-portrait img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.72));
}

.pet-hero img {
  display: block;
  width: min(100%, 192px);
  height: auto;
}

.pet-portrait figcaption,
.pet-hero figcaption,
.pet-state figcaption {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.pet-portrait figcaption,
.pet-hero figcaption {
  margin-top: 0.55rem;
}

.pet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.8rem 0 2rem;
}

.pet-state {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  margin: 0;
  min-width: 0;
  padding: 0.8rem 0.5rem 0.55rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.pet-state img {
  display: block;
  width: min(100%, 192px);
  height: auto;
}

.pet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.2rem 0 1.8rem;
}

.pet-action {
  display: inline-block;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--accent);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.74rem;
  text-decoration: none;
}

.pet-action:hover,
.pet-action:focus-visible {
  background: var(--accent);
  color: var(--bg);
  text-shadow: none;
}

@media (max-width: 480px) {
  .pet-grid {
    grid-template-columns: 1fr;
  }

  .pet-portrait img {
    width: min(100%, 250px);
  }
}

.motion-ready .reading-line {
  transition: color 0.85s ease, text-shadow 0.85s ease;
}

.motion-ready .reading-line.is-near {
  color: #e5e1de;
  text-shadow: 0 0 22px rgba(208, 17, 33, 0.045);
}

.motion-ready .date.reading-line.is-near {
  color: var(--mono-fg);
}

.motion-ready hr.is-near {
  transform: scaleX(1.18);
  box-shadow: 0 0 20px rgba(208, 17, 33, 0.52);
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--mono-muted);
  transition: border-color 0.9s ease, box-shadow 0.9s ease;
}

.motion-ready footer.is-near {
  border-color: rgba(208, 17, 33, 0.38);
  box-shadow: 0 -10px 26px -24px rgba(208, 17, 33, 0.7);
}

footer p {
  margin-bottom: 0.4rem;
}

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

footer a:hover {
  color: var(--mono-accent);
}

footer .sep {
  margin: 0 0.4rem;
}

footer .status {
  font-style: italic;
}

.footer-badge {
  margin: 1rem 0 0.4rem;
}

.footer-badge-link {
  display: inline-block;
  line-height: 0;
}

.footer-badge img,
.pixel-art {
  image-rendering: pixelated;
  display: block;
}

.footer-badge-link img {
  transition: filter 0.35s ease, box-shadow 0.35s ease;
}

.footer-badge-link:focus-visible img {
  filter: brightness(1.3) saturate(1.12);
  box-shadow:
    0 0 0 1px rgba(208, 17, 33, 0.65),
    0 0 9px rgba(208, 17, 33, 0.42);
}

@media (hover: hover) and (pointer: fine) {
  h1 {
    transition: text-shadow 0.55s ease;
  }

  h1:hover {
    text-shadow: 0 0 34px rgba(208, 17, 33, 0.42);
  }

  .tooth:nth-child(odd):hover {
    color: #eeeeec;
    transform: translateX(3px);
  }

  .tooth:nth-child(even):hover {
    color: #eeeeec;
    transform: translateX(-3px);
  }

  .tooth-wide:hover {
    transform: translateY(-1px);
  }

  .footer-badge-link:hover img {
    filter: brightness(1.3) saturate(1.12);
    box-shadow:
      0 0 0 1px rgba(208, 17, 33, 0.65),
      0 0 9px rgba(208, 17, 33, 0.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    display: none;
  }

  a,
  h1,
  hr,
  .tooth,
  footer,
  .footer-badge-link img {
    transition: none;
  }

  .site-mark {
    transition: none;
  }

  .tooth:nth-child(odd):hover,
  .tooth:nth-child(even):hover,
  .tooth-wide:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem;
  }
  pre {
    padding: 0.78rem 0.72rem 0.88rem;
    font-size: 0.64rem;
  }
  nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
  }
  h1 {
    font-size: 2rem;
  }
  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 0.65rem;
  }
  .jaw {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
  .tooth:nth-child(even),
  .tooth-wide {
    margin-top: 0;
  }
}
