/* xhelo web: monochrome, dithered. One accent (ultramarine), used for focus, links in running text and "live" marks. */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --mute: #555555;
  --faint: #8a8a8a;
  --line: #000000;
  --hair: #d2d2d2;
  --wash: #f2f2f2;
  --dot: rgba(0, 0, 0, .2);
  --acc: #1f34ff;
  --on-acc: #ffffff;
  --ok: #000000;
  --bad: #000000;
  --mark-filter: none;

  --display: "Pixelify Sans", "Courier New", ui-monospace, monospace;
  --text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gut: max(16px, 4vw);
  --max: 72rem;
  --step: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --fg: #ffffff; --mute: #b0b0b0; --faint: #7a7a7a; --line: #ffffff; --hair: #333333;
    --wash: #111111; --dot: rgba(255, 255, 255, .24); --acc: #8b97ff; --on-acc: #000000; --mark-filter: invert(1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --fg: #ffffff; --mute: #b0b0b0; --faint: #7a7a7a; --line: #ffffff; --hair: #333333;
  --wash: #111111; --dot: rgba(255, 255, 255, .24); --acc: #8b97ff; --on-acc: #000000; --mark-filter: invert(1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--text);
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 1em; max-width: 68ch; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; line-height: 1.15; }
h1 { font: 500 clamp(2.3rem, 7vw, 4.6rem)/1 var(--display); letter-spacing: -.01em; }
h2 { font: 500 clamp(1.5rem, 3.4vw, 2.1rem)/1.1 var(--display); }
h3 { font-size: 1.1rem; }
ul, ol { padding-left: 1.2em; }
code, pre, kbd { font-family: var(--code); font-size: .88em; }
code { background: var(--wash); padding: .1em .35em; border: 1px solid var(--hair); overflow-wrap: anywhere; }
pre { background: var(--wash); border: 1px solid var(--line); padding: 14px 16px; overflow-x: auto; margin: 0 0 1.2em; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; overflow-wrap: normal; }
hr { border: 0; height: 1px; background: var(--hair); margin: 2rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
th { font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; max-width: 100%; }

:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.mute { color: var(--mute); }
.small { font-size: .875rem; }
.mono { font-family: var(--code); font-size: .85em; }
.nowrap { white-space: nowrap; }

/* dither textures */
.dots { background: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.4px) 0 0 / 6px 6px; }
.dither-rule {
  height: 10px; margin: 0;
  background: radial-gradient(circle at 1px 1px, var(--fg) 1px, transparent 1.4px) 0 0 / 4px 4px;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.15) 100%);
  mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.15) 100%);
}
.dither-fill {
  background:
    conic-gradient(var(--hair) 25%, transparent 0 50%, var(--hair) 0 75%, transparent 0) 0 0 / 8px 8px;
}

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; padding-block: 6px; }
.brand { font: 500 1.6rem/1 var(--display); text-decoration: none; letter-spacing: .01em; margin-right: auto; display: inline-flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 14px; height: 14px; background: var(--fg); box-shadow: 4px 4px 0 var(--acc); }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; align-items: center; }
.nav a { text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--fg); }
.nav a[aria-current="page"] { border-bottom-color: var(--acc); font-weight: 600; }
.subnav { border-bottom: 1px solid var(--hair); background: var(--wash); }
.subnav .wrap { display: flex; gap: 4px 18px; flex-wrap: wrap; padding-block: 8px; font-size: .92rem; }
.subnav a { text-decoration: none; padding: 2px 0; border-bottom: 2px solid transparent; }
.subnav a[aria-current="page"] { border-bottom-color: var(--acc); font-weight: 600; }
.subnav a:hover { border-bottom-color: var(--fg); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--fg); width: 34px; height: 34px; cursor: pointer; font: 500 .9rem var(--display); }
.icon-btn:hover { background: var(--fg); color: var(--bg); }
form.inline { display: inline; margin: 0; }

footer.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 2rem; font-size: .9rem; color: var(--mute); }
footer.foot .wrap { display: flex; gap: 12px 28px; flex-wrap: wrap; justify-content: space-between; }
footer.foot nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }

/* buttons + fields */
.btn {
  font: 600 .95rem/1 var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; min-height: 44px; border: 2px solid var(--line); background: var(--bg); color: var(--fg);
  cursor: pointer; text-decoration: none; box-shadow: 3px 3px 0 var(--fg); transition: transform .06s, box-shadow .06s;
}
.btn:hover { text-decoration: none; transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--fg); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--fg); }
.btn.primary { background: var(--fg); color: var(--bg); box-shadow: 3px 3px 0 var(--acc); }
.btn.primary:hover { box-shadow: 2px 2px 0 var(--acc); }
.btn.small { padding: 7px 11px; min-height: 34px; font-size: .85rem; box-shadow: 2px 2px 0 var(--fg); }
.btn.danger { border-style: dashed; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--fg); text-decoration: underline; cursor: pointer; text-underline-offset: 3px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 2px solid var(--line); padding: 10px 12px; min-height: 44px; border-radius: 0;
}
textarea { min-height: 88px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--acc); outline-offset: 0; }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--mute); margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--fg); margin: 0; }

/* chips + notices */
.chip { display: inline-block; font-size: .78rem; line-height: 1; padding: 5px 8px; border: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
.chip.solid { background: var(--fg); color: var(--bg); }
.chip.dash { border-style: dashed; }
.chip.acc { border-color: var(--acc); color: var(--acc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.notice { border: 2px solid var(--line); padding: 12px 14px; margin: 0 0 1.2rem; background: var(--bg); }
.notice.warn { border-style: dashed; background: var(--wash); }
.notice.key { border-color: var(--acc); }
.notice strong:first-child { display: block; margin-bottom: 2px; }

/* hero */
.hero { position: relative; border-bottom: 1px solid var(--line); }
.hero .wrap { display: block; padding-block: clamp(2rem, 6vw, 4.5rem) 0; }
.hero .art { margin-top: clamp(1rem, 3vw, 2.5rem); }
.hero h1 { margin-bottom: .35em; max-width: 15ch; }
.hero .lede { font-size: 1.15rem; color: var(--mute); max-width: 34rem; }
.hero .mark { filter: var(--mark-filter); width: 100%; max-width: 1155px; height: auto; margin-inline: auto; }
.hero .dotfield { position: absolute; inset: 0; z-index: -1; -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); }
.hero .cta { margin-top: 1.6rem; }

.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2.5rem); }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols > div { border-top: 2px solid var(--line); padding-top: 12px; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl > li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0 18px; position: relative; padding-bottom: 22px; }
.tl .when { text-align: right; padding-top: 10px; }
.tl .when b { display: block; font: 500 1.25rem/1 var(--display); }
.tl .when span { font-size: .8rem; color: var(--mute); }
.tl > li::before { /* the rail: dotted */
  content: ""; position: absolute; left: 92px; top: 0; bottom: 0; width: 18px; margin-left: 0;
  background: radial-gradient(circle at 50% 50%, var(--fg) 1.2px, transparent 1.6px) 50% 0 / 6px 6px repeat-y;
}
.tl > li::after { content: ""; position: absolute; left: 92px; top: 14px; width: 18px; height: 10px; }
.tl > li .node { position: absolute; left: calc(92px + 5px); top: 12px; width: 8px; height: 8px; background: var(--fg); box-shadow: 0 0 0 4px var(--bg); }
.tl > li.gap .node { background: var(--bg); border: 2px solid var(--fg); width: 10px; height: 10px; left: calc(92px + 4px); }
.tl .card-mini { margin-left: 18px; }
.tl > li > .item { margin-left: 18px; grid-column: 2; }
.tl .item { border: 1px solid var(--line); background: var(--bg); display: grid; grid-template-columns: 120px minmax(0, 1fr); }
.tl .item .thumb { border-right: 1px solid var(--line); }
.tl .item .body { padding: 12px 14px; min-width: 0; }
.tl .gapbox { margin-left: 18px; border: 2px dashed var(--fg); padding: 10px 14px; background: var(--wash); font-size: .92rem; }
.thumb { aspect-ratio: 3 / 4; overflow: hidden; background-color: var(--wash); position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb.empty { display: grid; place-items: center; font-size: .8rem; color: var(--mute); }

/* library */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.searchbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.ecard { border: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.ecard:hover, .ecard:focus-within { box-shadow: 4px 4px 0 var(--fg); transform: translate(-1px, -1px); }
.ecard .thumb { border-bottom: 1px solid var(--line); aspect-ratio: 4 / 5; }
.ecard .meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ecard .who { font-size: .85rem; color: var(--mute); display: flex; justify-content: space-between; gap: 8px; }
.ecard .who a { font-weight: 600; color: var(--fg); }
.ecard h3 { font-size: 1rem; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.ecard h3 a { text-decoration: none; }
.ecard h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.ecard { position: relative; }
.ecard .who a { position: relative; z-index: 1; }
.ecard p { margin: 0; font-size: .88rem; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more { grid-column: 1 / -1; text-align: center; padding: 10px 0; }
.count { font-size: .9rem; color: var(--mute); margin: 18px 0 12px; }
.htmx-request .count::after { content: " updating"; }
#results { transition: opacity .12s; }
#results.htmx-request { opacity: .55; }

.empty { border: 2px dashed var(--line); padding: 28px; text-align: center; color: var(--mute); }

/* email page */
.email-head { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(1rem, 3vw, 2.5rem); align-items: start; }
.viewer { border: 1px solid var(--line); background: var(--wash); }
.viewer .bar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.seg { display: inline-flex; border: 2px solid var(--line); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { margin: 0; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: .85rem; border-right: 1px solid var(--line); }
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label { background: var(--fg); color: var(--bg); }
.seg input:focus-visible + label { outline: 3px solid var(--acc); outline-offset: 2px; }
.viewer .stage { padding: 14px; display: flex; justify-content: center; }
.viewer .pane { display: none; width: 100%; }
.viewer:has(#t-shot:checked) .pane.shot, .viewer:has(#t-html:checked) .pane.html, .viewer:has(#t-text:checked) .pane.text { display: block; }
.viewer .shot img { margin-inline: auto; border: 1px solid var(--line); background: #fff; }
.viewer:has(#d-mobile:checked) .shot img { max-width: 375px; }
.viewer:has(#d-mobile:checked) iframe { max-width: 390px; }
.viewer:has(#t-text:checked) .size, .viewer:has(#t-html:checked) .size { visibility: visible; }
.viewer iframe { display: block; width: 100%; height: 760px; border: 1px solid var(--line); background: #fff; margin-inline: auto; }
.viewer .text pre { white-space: pre-wrap; background: var(--bg); max-height: 760px; overflow: auto; }
.side dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.side dt { color: var(--mute); }
.side dd { margin: 0; overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 16px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* docs */
.prose { max-width: 50rem; }
.prose h2 { margin-top: 2.2em; padding-top: .4em; border-top: 1px solid var(--line); }
.prose h3 { margin-top: 1.8em; }
.prose table { display: block; overflow-x: auto; }
.prose pre { position: relative; }
.copy { position: absolute; top: 6px; right: 6px; }

/* mock journey on landing */
.mock { border: 2px solid var(--line); background: var(--bg); padding: clamp(14px, 3vw, 28px); position: relative; }
.mock-tag { position: absolute; right: -2px; top: -14px; background: var(--fg); color: var(--bg); font-size: .75rem; padding: 3px 8px; }

.quiet-table td, .quiet-table th { font-size: .92rem; }
.price { font: 500 clamp(2.2rem, 5vw, 3.2rem)/1 var(--display); }
.plan { border: 2px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; background: var(--bg); }
.plan.soon { border-style: dashed; }
.plan .tag { position: absolute; top: -12px; left: 16px; background: var(--fg); color: var(--bg); font-size: .75rem; padding: 3px 8px; }
.plan ul { margin: 0; padding-left: 1.1em; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }

.login-box { max-width: 28rem; }
.tabs-code { display: grid; gap: 18px; }
.tabs-code h3 { margin-bottom: 6px; }

.err-code { font: 500 clamp(4rem, 14vw, 8rem)/1 var(--display); }

/* admin */
.stat { border: 1px solid var(--line); padding: 12px 14px; }
.stat b { display: block; font: 500 1.8rem/1.1 var(--display); }
.stat.alert { border: 2px solid var(--fg); background: var(--wash); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.panel { border: 1px solid var(--line); margin-bottom: 22px; }
.panel > header { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--wash); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel > header h2 { font: 600 1.05rem var(--text); margin: 0; }
.panel .inner { padding: 14px; }
.state-on { font-weight: 700; }
.iframe-raw { width: 100%; height: 520px; border: 2px solid var(--line); background: #fff; }

@media (max-width: 860px) {
  .hero .mark { image-rendering: pixelated; }
  .cols, .cols.two { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .email-head { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 560px) {
  .tl > li { grid-template-columns: 56px minmax(0, 1fr); }
  .tl > li::before { left: 56px; }
  .tl > li .node { left: calc(56px + 5px); }
  .tl > li.gap .node { left: calc(56px + 4px); }
  .tl .when b { font-size: 1rem; }
  .tl .item { grid-template-columns: 84px minmax(0, 1fr); }
  .searchbar { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .viewer iframe { height: 560px; }
  .top .wrap { gap: 8px; }
  .nav { gap: 2px 12px; }
  .mock-tag { right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print { .top, .subnav, footer { display: none; } }

/* the one moving thing: the mark is drawn in line by line, once */
@keyframes scan { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.hero .mark { animation: scan 1.4s steps(28, end) 1 both; }

.viewer .shot .img-mobile { display: none; }
.viewer:has(#d-mobile:checked) .shot .img-mobile { display: block; }
.viewer:has(#d-mobile:checked) .shot .img-desktop { display: none; }
.viewer .shot .only { display: block; }

.viewer:has(#d-mobile:checked) .shot .img-desktop.keep { display: block; }

.tabs-code > div, .cols > div, .plans > *, .grid > * { min-width: 0; }
pre { max-width: 100%; }
.tl .body { overflow-wrap: anywhere; }
.tl > li > * { min-width: 0; }
.chips .chip { white-space: normal; max-width: 100%; line-height: 1.25; }
.tl .item .thumb { aspect-ratio: auto; min-height: 100%; }
.stat b { font-family: var(--text); font-weight: 600; }

/* merge placeholders ({{first_name}}) shown as chips in published subjects and text */
.ph { display: inline-block; font-size: .78em; line-height: 1.2; padding: 1px 6px; margin: 0 1px; border: 1px dashed var(--fg); background: var(--bg); font-family: inherit; font-weight: 400; letter-spacing: 0; white-space: nowrap; vertical-align: .08em; }
