/* yagni.club — "Terminal" e-ink direction (canvas 2a).
   Mono everything, hairline rules, a paper sheet on a warm grey desk. */

:root {
  --canvas: #cfcbc1;
  --sheet: #f3f1e3;
  --ink: #1e2318;
  --ink-soft: #2b3123;
  --ink-2: #33302a;
  --muted: #6c7161;
  --muted-2: #4d5343;
  --rule: #b9bba7;
  --rule-strong: #1e2318;
  --edge: #9fa08d;
  --panel: #e7e5d4;
  --panel-2: #dedbc7;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pixel: Silkscreen, "IBM Plex Mono", monospace;

  --sheet-w: 1180px;
  --rail-w: 260px;
  --gap: 48px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  padding: 40px 24px 24px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 24px;
  top: 24px;
  z-index: 10;
  background: var(--ink);
  color: var(--sheet);
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

/* ---- sheet ---------------------------------------------------------- */

.sheet {
  max-width: var(--sheet-w);
  margin: 0 auto;
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: 22px;
  padding: 44px 48px 40px;
}

/* ---- masthead ------------------------------------------------------- */

.masthead {
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
  padding: 22px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.masthead-id {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wordmark {
  font-family: var(--pixel);
  font-size: clamp(30px, 5.5vw, 54px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wordmark:hover {
  text-decoration: none;
}

.tagline {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-top: 12px;
}

.nav [aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.bar {
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bar-meta {
  color: var(--muted);
}

/* ---- dither ---------------------------------------------------------- */

.dither {
  background: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%) 0 0 / 5px 5px;
}

.dither-chip {
  width: 34px;
  height: 34px;
  border: 1px solid var(--muted);
  background-size: 4px 4px;
  flex: none;
}

.dither-block {
  height: 86px;
  opacity: 0.55;
  margin-top: 8px;
}

.dither-invert {
  background-image: repeating-conic-gradient(var(--sheet) 0 25%, transparent 0 50%);
  opacity: 0.35;
}

/* ---- two-column body ------------------------------------------------- */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
  gap: var(--gap);
  padding-top: 40px;
}

.col-main {
  min-width: 0;
}

.rail {
  border-left: 1px solid var(--rule);
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  font-size: 14px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.rail p {
  margin: 0;
  line-height: 1.5;
}

.rail-label {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 7px;
}

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

.break {
  overflow-wrap: anywhere;
  font-size: 12px;
}

/* ---- home ------------------------------------------------------------ */

.lede {
  margin: 0 0 22px;
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.02em;
  max-width: 17em;
}

.status-line {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 22px;
  border-bottom: 2px solid var(--rule-strong);
}

.section-label {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 30px 0 18px;
}

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

.row {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.row-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.row-title {
  position: relative;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.25;
}

/* The static indicator. It stays the real one until cursor.js adds
   .term-cursor-live to <html>, so a visitor whose script fails still gets a
   mark. Sits where the travelling cursor will sit, on the title's first line. */
.row-title::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 0.625em;
  width: 12px;
  height: 24px;
  transform: translateY(-50%);
  background: var(--ink);
  opacity: 0;
}

.row:hover .row-title::before,
.row:focus-within .row-title::before {
  opacity: 1;
}

.term-cursor-live .row-title::before {
  display: none;
}

.row-desc {
  font-size: 14px;
  color: #5b6150;
}

.row-meta {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  white-space: nowrap;
  flex: none;
}

.more {
  display: inline-block;
  margin-top: 26px;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.empty {
  border: 1px solid var(--rule);
  padding: 20px;
  color: var(--muted-2);
}

/* ---- post ------------------------------------------------------------ */

.prose-col {
  max-width: 44em;
}

.post-title {
  margin: 0 0 18px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.byline {
  margin: 0 0 30px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
}

.prose {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.prose p {
  margin: 0 0 20px;
}

.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  margin: 44px 0 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
}

.prose h2 { font-size: 24px; }
.prose h3 { font-size: 20px; }
.prose h4 { font-size: 17px; text-transform: uppercase; letter-spacing: 0.08em; }

.prose .anchor {
  position: absolute;
  left: -1.1em;
  color: var(--rule);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor,
.prose .anchor:focus-visible {
  opacity: 1;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  overflow-wrap: anywhere;
}

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

.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 8px;
}

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

.prose blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--ink);
  color: var(--muted-2);
  font-style: italic;
}

.prose blockquote p {
  margin: 0;
}

.prose code {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1px 5px;
  font-size: 0.9em;
}

.prose mark {
  background: #ddd9a8;
  color: inherit;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 36px 0;
}

.prose figure {
  margin: 28px 0;
}

.prose figure.code {
  border: 1px solid var(--rule);
  background: var(--panel);
}

.prose figure.code figcaption {
  border-bottom: 1px solid var(--rule);
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose pre {
  margin: 0;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 2;
}

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

.prose figure.image img,
.prose .card-thumb {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.prose figure.image figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.prose figure.embed {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 16px;
  overflow-x: auto;
}

.prose figure.embed svg,
.prose figure.embed img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.prose .card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 16px;
  margin: 24px 0;
  text-decoration: none;
}

.prose .card:hover {
  border-color: var(--ink);
}

.prose .card-thumb {
  width: 108px;
  flex: none;
}

.prose .card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.prose .card-title {
  font-weight: 500;
  line-height: 1.35;
}

.prose .card-desc {
  font-size: 14px;
  color: var(--muted-2);
}

.prose .card-host {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose .aside {
  border: 1px solid var(--edge);
  background: var(--panel);
  padding: 20px 24px 4px;
  margin: 28px 0;
}

.prose .aside-label {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.prose .aside > :first-of-type {
  margin-top: 0;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 2px solid var(--rule-strong);
  margin-top: 40px;
  padding-top: 20px;
  font-size: 15px;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 20em;
}

.post-nav-next {
  text-align: right;
  margin-left: auto;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toc a {
  line-height: 1.4;
}

.progress {
  display: flex;
  gap: 3px;
}

.progress span {
  flex: 1;
  height: 12px;
  border: 1px solid var(--muted);
  background: transparent;
}

.progress span.on {
  background: var(--ink);
  border-color: var(--ink);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border: 1px solid var(--rule);
  padding: 2px 7px;
  font-size: 12px;
  color: var(--muted-2);
}

/* ---- about / subscribe ---------------------------------------------- */

.panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  padding-top: 40px;
}

.panel {
  padding: 40px 44px;
  border: 1px solid var(--edge);
  border-radius: 18px;
}

.panel-about {
  background: var(--sheet);
}

.panel-subscribe {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
  padding: 40px 36px;
}

.panel-title {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-size: 26px;
  font-weight: 400;
  text-transform: uppercase;
}

.panel-subscribe .panel-title {
  font-size: 22px;
}

.panel-rule {
  border-bottom: 2px solid var(--rule-strong);
  margin-bottom: 24px;
}

.panel-subscribe .panel-rule {
  border-bottom-color: #7f8672;
}

.about-lead {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.5;
}

.about-body {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted-2);
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subscribe-copy,
.subscribe-alt {
  font-size: 14px;
  line-height: 1.7;
  color: #b3b8a5;
}

.subscribe-copy {
  margin: 0 0 24px;
}

.subscribe-alt {
  margin: 26px 0 0;
  font-size: 13px;
  color: #8d9380;
}

.subscribe-alt a {
  color: var(--sheet);
}

.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscribe-form input {
  font: inherit;
  font-size: 14px;
  color: var(--sheet);
  background: transparent;
  border: 1px solid #7f8672;
  padding: 12px 14px;
}

.subscribe-form input::placeholder {
  color: #8d9380;
}

.subscribe-form button {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--sheet);
  padding: 12px;
  cursor: pointer;
}

.subscribe-form button:hover {
  background: transparent;
  color: var(--sheet);
}

.status {
  margin: 12px 0 0;
  font-size: 13px;
  min-height: 1.2em;
}

.status-ok { color: #b3b8a5; }
.status-err { color: #e6b8a2; }

/* ---- 404 -------------------------------------------------------------- */

.notfound {
  padding-top: 56px;
  max-width: 44em;
}

.notfound .status-line {
  margin-bottom: 24px;
}

/* ---- colophon --------------------------------------------------------- */

.colophon {
  max-width: var(--sheet-w);
  margin: 20px auto 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4a463f;
}

.colophon-sep {
  flex: 1;
  height: 1px;
  background: #b3aea3;
}

/* ---- terminal cursor -------------------------------------------------- */

/* Both layers are created lazily by cursor.js. The colour lives here and is
   read back out with getComputedStyle, so the script never hardcodes it. */

.term-smear {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
}

.term-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  background: var(--ink);
  pointer-events: none;
  visibility: hidden;
  opacity: 1;
  will-change: transform;
  /* Four iterations lands under the five seconds past which blinking content
     needs a stop control, and the last keyframe is solid so it ends on. */
  animation: term-blink 1.15s ease-in-out 4 both;
}

.term-cursor.on {
  visibility: visible;
}

/* A real cursor does not blink while it is moving. Removing this class is also
   what restarts the animation on landing. */
.term-cursor.moving {
  animation: none;
}

@keyframes term-blink {
  0%, 45% { opacity: 1; }
  60%, 90% { opacity: 0.22; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .term-cursor {
    animation: none;
    opacity: 1;
  }
}

/* ---- narrow ----------------------------------------------------------- */

@media (max-width: 900px) {
  body { padding: 16px 12px; }

  .sheet {
    padding: 28px 22px 32px;
    border-radius: 16px;
  }

  .columns,
  .panels {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding-top: 28px;
  }

  .rail {
    position: static;
    border-left: 0;
    border-top: 2px solid var(--rule-strong);
    padding-left: 0;
    padding-top: 24px;
  }

  .nav { gap: 18px; padding-top: 0; }

  .row {
    flex-wrap: wrap;
    gap: 12px 16px;
  }

  .row-meta { text-align: left; }

  .row-title::before { display: none; }

  .post-nav { flex-direction: column; }
  .post-nav-next { text-align: left; margin-left: 0; }

  .panel { padding: 28px 22px; }
}

@media print {
  body { background: #fff; padding: 0; }
  .sheet { border: 0; border-radius: 0; max-width: none; }
  .rail, .colophon, .nav, .post-nav { display: none; }
  .term-cursor, .term-smear { display: none; }
}
