/*
 Theme Name: Blackwhite Uplink
 Theme URI: https://000fff.org
 Description: Black&White essays in the Uplink terminal shell.
 Author: Thomas Petersen
 Version: 1.4.1
 Requires at least: 6.0
 Tested up to: 6.8
 Requires PHP: 7.4
 Text Domain: blackwhite-uplink
*/

:root {
  --bg: #000;
  --term: #000;
  --text: #f2f2f2;
  --dim: #6a6a6a;
  --mute: #9c9c9c;
  --line: #333;
  --accent: #f2f2f2;
  --ok: #3ecf4a;
  --inv: #000;
  --hairline: #1a1a1a;
  --field: #000;
  --scan-a: rgba(0, 0, 0, 0.28);
  --scan-b: rgba(0, 0, 0, 0.55);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #fff;
  --term: #fff;
  --text: #111;
  --dim: #6a6a6a;
  --mute: #5c5c5c;
  --line: #d0d0d0;
  --accent: #111;
  --ok: #1a7f32;
  --inv: #fff;
  --hairline: #e8e8e8;
  --field: #fff;
  --scan-a: rgba(255, 255, 255, 0.35);
  --scan-b: rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}

body {
  overflow: hidden;
}

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

a:hover,
a:focus-visible {
  color: var(--text);
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}

.skip:focus {
  left: 8px;
  z-index: 20;
  background: var(--accent);
  color: #111;
  padding: 4px 8px;
}

.crt {
  height: 100%;
  height: 100dvh;
  display: flex;
  background: var(--bg);
}

.crt::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 7;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--scan-a) 0,
      var(--scan-a) 1px,
      transparent 1px,
      transparent 2px
    ),
    radial-gradient(ellipse at center, transparent 40%, var(--scan-b) 100%);
}

.term {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--term);
}

.term-bar,
.term-keys {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
}

.term-keys {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.term-bar {
  border-bottom: 0;
}

.term-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.term-title {
  color: var(--text);
  font-weight: 500;
}

.term-crumb {
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-crumb::before {
  content: "› ";
  color: var(--dim);
}

.term-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
}

.theme-toggle {
  font: inherit;
  color: var(--dim);
  background: none;
  border: 1px solid var(--line);
  padding: 0 7px;
  cursor: pointer;
  line-height: 1.6;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.term-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 20px 20px 16px;
}

.wordmark {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  color: var(--text);
  font-size: clamp(8px, 1.6vw, 13px);
  line-height: 1.2;
  font-weight: 400;
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: pre;
}

.tagline {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 8px;
}

.lede {
  color: var(--mute);
  max-width: 64ch;
  margin-bottom: 22px;
}

.menu {
  list-style: none;
  margin: 0 0 20px;
  max-width: 92ch;
}

.essay-browser {
  max-width: 1400px;
}

.essay-menu {
  margin-bottom: 20px;
}

.essay-preview {
  display: none;
}

.essay-preview-link,
.essay-preview-title,
.essay-preview-text {
  display: block;
}

.essay-preview-link {
  color: var(--mute);
}

.essay-preview-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.essay-preview-image[hidden] {
  display: none;
}

.essay-preview-title {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 6px;
}

.essay-preview-text {
  color: var(--mute);
  font-size: 12px;
  line-height: 1.6;
}

.cmd-head {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 18px 0 8px;
}

.cmd-head::before {
  content: "— ";
  color: var(--dim);
}

.menu-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 6px;
  color: var(--mute);
  cursor: pointer;
}

.menu-item .caret {
  width: 1.2ch;
  color: transparent;
  flex: 0 0 auto;
}

.menu-item .idx {
  opacity: 0.55;
  min-width: 2.2ch;
  flex: 0 0 auto;
}

.menu-item .title {
  flex: 1 1 auto;
  min-width: 0;
}

.menu-item .when {
  color: var(--dim);
  font-size: 12px;
  flex: 0 0 auto;
}

.menu-item.is-active,
.menu-item:hover,
.menu-item:focus-within {
  color: var(--inv);
  background: var(--accent);
}

.menu-item.is-active .caret,
.menu-item:hover .caret,
.menu-item:focus-within .caret {
  color: var(--inv);
}

.menu-item.is-active .when,
.menu-item:hover .when,
.menu-item:focus-within .when {
  color: var(--inv);
}

.menu-item a {
  color: inherit;
  display: contents;
}

.go-back {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font: inherit;
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0;
  margin-bottom: 16px;
  cursor: pointer;
}

.go-back:hover,
.go-back:focus-visible {
  color: var(--text);
}

.entry {
  max-width: 72ch;
  color: var(--mute);
}

.entry h1 {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.entry-meta {
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 18px;
}

.entry .content p,
.entry .content li {
  margin-bottom: 12px;
}

.entry .content h2,
.entry .content h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  margin: 20px 0 8px;
}

.entry .content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry .content blockquote {
  border-left: 1px solid var(--line);
  padding-left: 14px;
  color: var(--mute);
  margin: 0 0 14px;
}

.entry .content img,
.entry .content figure {
  max-width: 100%;
  height: auto;
}

.entry .content ul,
.entry .content ol {
  padding-left: 1.5ch;
  margin-bottom: 14px;
}

.comments {
  max-width: 72ch;
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.comments h2 {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.comments h2::before {
  content: "— ";
  color: var(--dim);
}

.comment-list {
  list-style: none;
}

.comment-list .comment {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

.comment-meta {
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 6px;
}

.comment-author {
  color: var(--text);
}

.comment-content {
  color: var(--mute);
}

.comment-content p {
  margin-bottom: 8px;
}

.children {
  list-style: none;
  margin-left: 18px;
  margin-top: 12px;
}

.comment-respond {
  margin-top: 22px;
}

.comment-form label {
  display: block;
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  max-width: 52ch;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  font: inherit;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.comment-form .submit {
  font: inherit;
  background: var(--accent);
  color: var(--inv);
  border: 0;
  padding: 6px 12px;
  cursor: pointer;
}

.term-keys kbd {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0 5px;
  margin-right: 2px;
}

.key-link {
  color: var(--dim);
}

.key-link:hover,
.key-link:focus-visible {
  color: var(--text);
}

.term-credit {
  margin-left: auto;
  color: var(--dim);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 72ch;
  margin: 24px 0 8px;
  color: var(--dim);
}

.wp-block-library-css {
  display: none;
}

@media (min-width: 901px) {
  .essay-browser {
    display: grid;
    grid-template-columns: minmax(0, 92ch) minmax(280px, 520px);
    gap: clamp(28px, 5vw, 80px);
    align-items: start;
  }

  .essay-preview {
    display: block;
    position: sticky;
    top: 0;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .menu-item .when {
    display: none;
  }

  .wordmark {
    font-size: 7px;
  }
}
