/*
 * Phosphor: a terminal for devlogs and technical notes.
 * Green phosphor on black, with a paper teletype for readers who prefer light pages.
 * To keep the phosphor palette for everyone, delete the light-scheme block below.
 * Token names (--ink, --paper, --accent, ...) match the other bundled themes.
 */

:root {
  color-scheme: dark light;
  --ink: #b8e8c2;
  --bright: #e2fbe7;
  --muted: #7aa386;
  --paper: #0e1210;
  --panel: #151c17;
  --line: #2e4436;
  --accent: #e6d27a;
  --content-width: 80ch;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
}

/* The teletype: black ribbon on paper. */
@media (prefers-color-scheme: light) {
  :root {
    --ink: #1d2a20;
    --bright: #0b140d;
    --muted: #556b5b;
    --paper: #f6f4ec;
    --panel: #ebe8dc;
    --line: #c9c5b4;
    --accent: #8a5a00;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 100%;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

a {
  color: var(--bright);
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

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

::selection {
  background: var(--ink);
  color: var(--paper);
}

img {
  display: block;
  height: auto;
  max-width: 100%;
}

p,
ul,
ol,
dl,
pre,
table,
blockquote,
figure {
  margin: 0 0 1.25rem;
}

.site-width {
  margin: 0 auto;
  max-width: calc(var(--content-width) + 3rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  width: 100%;
}

.visually-hidden {
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link {
  background: var(--accent);
  color: var(--paper);
  left: 1rem;
  padding: 0.25rem 1ch;
  position: absolute;
  top: -4rem;
  z-index: 1;
}

.skip-link:focus {
  top: 1rem;
}

/* Shell prompts and the cursor */

.command {
  color: var(--muted);
}

.command::before {
  color: var(--accent);
  content: "$ ";
}

.prompt {
  margin-top: 1.5rem;
}

.prompt::after {
  animation: blink 1.1s steps(1, end) infinite;
  background: var(--ink);
  content: "";
  display: inline-block;
  height: 1.15em;
  vertical-align: text-bottom;
  width: 1ch;
}

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

@media (prefers-reduced-motion: reduce) {
  .prompt::after {
    animation: none;
  }
}

/* Header */

.site-header {
  border-bottom: 1px dashed var(--line);
  margin-bottom: 2rem;
  padding: 2rem 0 0.5rem;
}

.site-name {
  font-size: 1.15rem;
  font-weight: bold;
  margin: 0;
}

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

.site-name a::before {
  color: var(--accent);
  content: "~/";
}

.site-name a:hover::before {
  color: inherit;
}

.site-description {
  color: var(--muted);
  margin: 0 0 1rem;
}

.site-description::before {
  content: "# ";
}

.site-description:empty {
  display: none;
}

.dirs .command {
  margin: 0;
}

.dirs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
  list-style: none;
  padding: 0;
}

.dirs ul:empty,
.dirs:has(ul:empty) {
  display: none;
}

.dirs a::after {
  content: "/";
}

main {
  flex: 1 0 auto;
  padding-bottom: 3rem;
}

/* Listings: ls -lt */

.listing {
  list-style: none;
  padding: 0;
}

.entry {
  column-gap: 2ch;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  padding: 0.2rem 0;
}

.entry-date {
  color: var(--muted);
  white-space: nowrap;
}

.entry-body > * {
  margin: 0;
}

.entry-title {
  font-weight: bold;
}

.tags,
.flow-list {
  display: inline-flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
}

.tags {
  color: var(--muted);
  gap: 0 1ch;
}

.tags:empty {
  display: none;
}

.tags a {
  color: var(--muted);
}

.tags a::before {
  content: "[";
}

.tags a::after {
  content: "]";
}

.entry-excerpt {
  color: var(--muted);
}

.entry-excerpt::before {
  content: "# ";
}

.entry-excerpt:empty {
  display: none;
}

.entry + .entry {
  margin-top: 0.6rem;
}

/* Posts: YAML front matter, then the Markdown body */

.front-matter {
  color: var(--muted);
}

.front-matter::before,
.front-matter::after {
  content: "---";
  display: block;
}

.front-matter div {
  display: flex;
  gap: 1ch;
}

.front-matter dt {
  color: var(--accent);
  flex: none;
}

.front-matter dt::after {
  content: ":";
}

.front-matter dd {
  color: var(--ink);
  margin: 0;
  min-width: 0;
}

.front-matter-summary:has(dd:empty),
.front-matter-list:has(ul:empty) {
  display: none;
}

/* Categories as a YAML flow sequence: [elixir, tools] */
.flow-list {
  margin: 0;
}

.flow-list::before {
  content: "[";
}

.flow-list::after {
  content: "]";
}

.flow-list li + li::before {
  content: ",\00a0";
}

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

.post-title {
  font-size: 1.3rem;
  margin-top: 0;
}

.post-title::before,
.dir-title::before {
  color: var(--muted);
}

.post-title::before {
  content: "# ";
}

.post-content h2 {
  font-size: 1.15rem;
}

.post-content h2::before {
  color: var(--muted);
  content: "## ";
}

.post-content h3::before {
  color: var(--muted);
  content: "### ";
}

.post-content h4::before {
  color: var(--muted);
  content: "#### ";
}

.post-content strong {
  color: var(--bright);
}

.post-content del {
  color: var(--muted);
}

.post-content ul {
  list-style-type: "- ";
  padding-left: 2ch;
}

.post-content ol {
  padding-left: 3ch;
}

.post-content li::marker {
  color: var(--muted);
}

.post-content li + li {
  margin-top: 0.25rem;
}

.post-content blockquote {
  color: var(--muted);
  margin-left: 0;
  margin-right: 0;
}

.post-content blockquote p {
  margin-bottom: 0.5rem;
  padding-left: 2ch;
  text-indent: -2ch;
}

.post-content blockquote p::before {
  color: var(--accent);
  content: "> ";
}

.post-content code {
  color: var(--accent);
  font-family: inherit;
  font-size: 1em;
  overflow-wrap: anywhere;
}

.post-content :not(pre) > code::before,
.post-content :not(pre) > code::after {
  color: var(--muted);
  content: "`";
}

.post-content pre {
  background: var(--panel);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  overflow-x: auto;
  padding: 1ch 2ch;
}

.post-content pre code {
  color: var(--ink);
  overflow-wrap: normal;
}

.post-content table {
  border-collapse: collapse;
  max-width: 100%;
}

.post-content th,
.post-content td {
  border: 1px solid var(--line);
  padding: 0.15rem 1ch;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  color: var(--bright);
}

.post-content hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 2rem 0;
}

.post-content img,
.figure img {
  border: 1px solid var(--line);
}

.figure figcaption {
  color: var(--muted);
  margin-top: 0.4rem;
}

.figure figcaption::before {
  color: var(--accent);
  content: "^ ";
}

/* Category pages: a directory with a README */

.dir-title {
  font-size: 1.3rem;
  margin-top: 0;
}

.dir-title::before {
  content: "~/categories/";
  font-weight: normal;
}

.dir-title::after {
  color: var(--muted);
  content: "/";
}

.category-description {
  border-left: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 1.5rem;
  padding-left: 2ch;
}

.category-description:empty {
  display: none;
}

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

/* Footer */

.site-footer {
  border-top: 1px dashed var(--line);
  color: var(--muted);
  padding: 1rem 0 2rem;
}

.site-footer p {
  margin: 0;
}

.site-footer p::before {
  content: "# ";
}

@media (max-width: 40rem) {
  html {
    font-size: 93.75%;
  }

  .entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry + .entry {
    margin-top: 1rem;
  }
}
