/*
 * Flat retro terminal theme, dark only. Loaded after actiontext.css, which still styles the
 * Trix editor and attachments; the overrides for both live at the bottom of this file.
 */

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/ibm-plex-mono-400-c9c3574e.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/ibm-plex-mono-700-1ec1315e.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #121212;
  --bg-raised: #1c1c1f;
  --fg: #f4f1fa;
  --fg-dim: #aeaac0;
  --fg-faint: #615e74;
  --purple: #b48cff;
  --green: #7ee787;
  --red: #ff6b6b;
  --line: #2c2b33;
  --glow-text: 0 0 8px rgba(244, 241, 250, 0.059);
  --glow-purple: 0 0 3px rgba(180, 140, 255, 0.31), 0 0 10px rgba(180, 140, 255, 0.17), 0 0 24px rgba(180, 140, 255, 0.07);
  --glow-folder: 0 0 3px rgba(180, 140, 255, 0.124), 0 0 10px rgba(180, 140, 255, 0.068), 0 0 24px rgba(180, 140, 255, 0.028);
  --glow-green: 0 0 3px rgba(126, 231, 135, 0.3), 0 0 10px rgba(126, 231, 135, 0.16), 0 0 24px rgba(126, 231, 135, 0.07);
  --font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* actiontext.css is themed through these names; map them onto the tokens above */
  --color-bg--main: var(--bg);
  --color-bg--surface: var(--bg);
  --color-bg--secondary: var(--bg-raised);
  --color-bg--overlay: var(--bg-raised);
  --color-border: var(--line);
  --color-border--light: var(--line);
  --color-border--medium: var(--fg-faint);
  --color-border--heavy: var(--purple);
  --color-txt: var(--fg);
  --color-txt--subtle: var(--fg-dim);
  --color-txt--very-subtle: var(--fg-faint);
  --color-shadow: rgba(0, 0, 0, 0.5);
  --color-shadow--dark: rgba(0, 0, 0, 0.7);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  text-shadow: var(--glow-text);
}

main {
  max-width: 84ch;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

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

a {
  color: var(--purple);
  text-decoration: none;
}

a:hover {
  color: var(--fg);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

h1,
h2,
p,
ul {
  margin: 0;
}

hr {
  height: 0;
  margin: 1.75rem 0;
  border: 0;
  border-top: 1px dashed var(--line);
}

/* Navigation */

.topnav {
  margin-bottom: 1.5rem;
  color: var(--fg-faint);
}

.topnav span {
  margin: 0 0.5ch;
}

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

/* Glow follows the color: purple things glow purple, green things glow green */
a,
.accent,
.shell__ps1,
.entry__title,
.post__title,
.screen-title,
.btn,
.trix-content h1,
.gem--edge,
.gem--light,
.gem--mid,
.gem--dark {
  text-shadow: var(--glow-purple);
}

.entry__date,
.post__date,
.notice__tag,
.boot__hint,
.trix-content em {
  text-shadow: var(--glow-green);
}

.gem--spark {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.7), 0 0 18px rgba(180, 140, 255, 0.39);
}

trix-editor,
trix-toolbar,
.input {
  text-shadow: none;
}

/* Command prompts */

.prompt {
  margin: 1.5rem 0 0.5rem;
}

.prompt__tag {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 3px;
  background: rgba(180, 140, 255, 0.12);
  overflow-wrap: anywhere;
}

/* Flash */

.notice {
  margin-bottom: 1rem;
  color: var(--fg-dim);
  font-size: 13px;
}

.notice__tag {
  color: var(--green);
  font-weight: 700;
}

/* Post list */

.entry__link {
  display: block;
  margin: 0 -0.75rem;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--fg);
}

.entry__link:hover {
  border-left-color: var(--green);
  background: var(--bg-raised);
  text-decoration: none;
}

.entry__date {
  display: block;
  color: var(--green);
  font-size: 13px;
}

.entry__title {
  color: var(--purple);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.entry__link:hover .entry__title {
  text-decoration: underline;
}

.entry__excerpt {
  display: block;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}

.more {
  margin-top: 1rem;
}

/* Single post */

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

.post__date {
  color: var(--green);
  font-size: 13px;
}

.post__title {
  color: var(--purple);
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.post__title::before {
  content: "# ";
  color: var(--fg-faint);
}

/* Interactive shell */

.shell {
  min-height: 70vh;
  padding-bottom: 0.6rem;
  cursor: text;
}

.shell__output {
  overflow-wrap: anywhere;
}

.shell__banner:empty {
  display: none;
}

.shell__line,
.shell__text {
  min-height: 1.65em;
  white-space: pre-wrap;
}

.shell__text {
  margin-bottom: 0.5rem;
  color: var(--fg-dim);
}

.shell__tag {
  width: fit-content;
  max-width: 100%;
  margin: 1rem 0 0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 3px;
  background: rgba(180, 140, 255, 0.12);
  white-space: pre-wrap;
}

.shell__columns {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
}

.shell__dir {
  text-shadow: var(--glow-folder);
  color: var(--purple);
  font-weight: 700;
}

.shell__prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1ch;
  margin-top: 0.5rem;
}

.shell__ps1 {
  flex: none;
  color: var(--purple);
}

.shell__input {
  flex: 1 1 16ch;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  caret-color: var(--green);
  font: inherit;
}

.shell__input::placeholder {
  color: var(--fg-faint);
}

/* Boot banner */

.boot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 3ch;
  margin-bottom: 1rem;
}

.boot__art {
  margin: 0;
  color: var(--purple);
  font: inherit;
  /* 36 columns at 0.6em each; shrink on narrow screens instead of overflowing */
  font-size: min(15px, calc((100vw - 2rem) / 22));
  line-height: 1.15;
  user-select: none;
}

/* Edges outline the facets; the fill characters get darker away from the light at the top left */
.gem--edge {
  color: var(--purple);
}

.gem--light {
  color: #dccbff;
}

.gem--mid {
  color: #9569e0;
}

.gem--dark {
  color: #5d3f96;
}

.gem--spark {
  color: #ffffff;
  font-weight: 700;
}

.boot__info {
  max-width: 36ch;
}

.boot__identity a {
  color: var(--fg);
  font-weight: 700;
}

.boot__identity a:hover {
  color: var(--purple);
}

.boot__hint {
  margin-top: 0.5rem;
  color: var(--green);
}

.boot__handle {
  font-size: 1.15rem;
  font-weight: 700;
}

.boot__handle a:hover {
  text-decoration: none;
}

.boot__handle a:hover span {
  color: var(--fg);
}

.boot__rule {
  color: var(--fg-faint);
}

.boot__links {
  margin-bottom: 0.5rem;
}

.boot__description {
  color: var(--fg-dim);
}

/* Buttons and forms */

.btn {
  display: inline-block;
  padding: 0.2rem 1.25ch;
  border: 1px solid var(--purple);
  border-radius: 0;
  background: transparent;
  color: var(--purple);
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background: var(--purple);
  color: var(--bg);
  text-decoration: none;
}

.screen-title {
  margin: 0.5rem 0 1.25rem;
  color: var(--purple);
  font-size: 1.4rem;
}

.screen-title::before {
  content: "# ";
  color: var(--fg-faint);
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--fg-dim);
  font-size: 13px;
}

.field label::after {
  content: ":";
}

.input {
  width: 100%;
  padding: 0.5rem 1.25ch;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  caret-color: var(--green);
}

.input:focus {
  border-color: var(--green);
  outline: none;
}

.actions {
  margin-top: 2rem;
  text-align: center;
}

.errors {
  margin-bottom: 1.25rem;
  padding: 0.5rem 1.5ch;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 13px;
}

.errors ul {
  padding-left: 3ch;
}

.errors__title {
  font-weight: 700;
}

.footnav {
  margin-top: 2rem;
  color: var(--fg-faint);
  font-size: 13px;
}

.permalink {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Rendered post content (Action Text) */

.trix-content {
  color: var(--fg);
  font-size: 15px;
  line-height: 1.7;
  }

.trix-content > * + * {
  margin-top: 0.4rem;
}

.trix-content > h1,
.trix-content > pre,
.trix-content > blockquote,
.trix-content > ul,
.trix-content > ol {
  margin-top: 1rem;
}

.trix-content h1 {
  margin-top: 1.75rem;
  color: var(--purple);
  font-size: 1.25em;
  line-height: 1.3;
}

.trix-content h1::before {
  content: "## ";
  color: var(--fg-faint);
}

.trix-content strong {
  color: var(--fg);
  font-weight: 700;
}

.trix-content em {
  color: var(--green);
}

.trix-content blockquote {
  border: 0;
  border-left: 2px solid var(--green);
  margin-left: 0;
  padding-left: 1.5ch;
  color: var(--fg-dim);
}

.trix-content ul,
.trix-content ol {
  padding-left: 3ch;
}

.trix-content li {
  margin-left: 0;
}

.trix-content ul > li::marker {
  color: var(--green);
  content: "* ";
}

.trix-content ol > li::marker {
  color: var(--green);
}

.trix-content pre,
.trix-content code {
  font-family: var(--font);
  background: var(--bg);
  color: var(--green);
}

.trix-content pre {
  display: block;
  padding: 0.75rem 1.5ch;
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 13px;
  line-height: 1.5;
}

.trix-content code {
  padding: 0.1em 0.5ch;
}

.trix-content pre code {
  padding: 0;
}

.trix-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.trix-content .attachment--preview .attachment__caption {
  color: var(--fg-faint);
  font-size: 12px;
}

.trix-content .attachment--file {
  color: var(--fg);
  border-color: var(--line);
  border-radius: 0;
}

/* Trix editor (admin) */

trix-editor,
trix-toolbar .trix-button-group {
  border-color: var(--line);
  border-radius: 0;
}

trix-editor {
  min-height: 16em;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  caret-color: var(--green);
}

trix-editor:focus {
  border-color: var(--green);
}

trix-toolbar .trix-button {
  border-color: var(--line);
  background: transparent;
}

trix-toolbar .trix-button.trix-active {
  background: var(--purple);
}

trix-toolbar .trix-button--icon::before {
  filter: invert(1);
}

trix-toolbar .trix-button--icon.trix-active::before {
  filter: none;
}

trix-toolbar .trix-dialog {
  border-top-color: var(--purple);
  border-radius: 0;
  background: var(--bg-raised);
  box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.5);
}

trix-toolbar .trix-input--dialog {
  border-color: var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
}

trix-toolbar .trix-button--dialog {
  color: var(--fg);
}

@media (pointer: coarse) {
  .shell__input,
  .input {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }
}
