/* dither — "Hatch" design system.
   A quiet, chronological, ink-on-paper network. Newsreader serif for reading,
   IBM Plex Mono for machine voice, engraving/crosshatch textures, hairline
   1px rules. Pure black on paper. */

:root {
  --ink: #000;
  --paper: #fff;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --rule: 1px solid var(--ink);
  --col: 460px;
}

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

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  /* Graph-paper "desk": visible dot grid the sheet sits on. */
  background-image: radial-gradient(var(--ink) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 17px;
  line-height: 1.5;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

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

.mono { font-family: var(--mono); }
.muted { opacity: .6; }
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; opacity: .55;
}

/* ---- Shell ------------------------------------------------------------- */
/* Mobile-first: a single full-width paper column, top bar + bottom tabs.
   Desktop: a left nav rail + centre sheet + right discovery rail. */
.shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  min-height: 100vh;
}
.center {
  width: 100%;
  max-width: var(--col);
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

/* Desktop rails are hidden until there's room. */
.rail { display: none; }

/* --- Tablet/desktop: two columns (left rail + centre sheet) --- */
@media (min-width: 900px) {
  .topbar, .tabbar { display: none; }
  .center {
    border-left: var(--rule);
    border-right: var(--rule);
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.06);
  }
  .rail-left {
    display: flex;
    flex-direction: column;
    width: 236px;
    flex: none;
    align-self: stretch;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 26px 22px 22px;
  }
}

/* --- Wide desktop: add the right discovery rail --- */
@media (min-width: 1200px) {
  .rail-right {
    display: block;
    width: 320px;
    flex: none;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: 26px 22px;
  }
}

/* ---- Left nav rail ----------------------------------------------------- */
.rail-brand {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 32px; letter-spacing: 0.02em; line-height: 1;
  text-decoration: none; color: var(--ink); margin-bottom: 26px; display: inline-block;
}
.rail-brand:hover { background: none; color: var(--ink); }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px; text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-size: 20px; line-height: 1;
}
.nav-item:hover { background: var(--ink); color: var(--paper); }
.nav-item.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); }
.nav-item.active:hover { box-shadow: none; }
.nav-item svg { display: block; }
.rail-compose {
  margin-top: 16px; display: block; text-align: center; text-decoration: none;
  background: var(--ink); color: var(--paper);
  border: var(--rule); padding: 13px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
}
.rail-compose:hover { background: var(--paper); color: var(--ink); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.rail-foot .lang { border-color: var(--ink); }
.rail-foot .lang button { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.rail-foot .lang button + button { border-left: var(--rule); }
.rail-foot .lang button.active { background: var(--ink); color: var(--paper); }

/* ---- Right discovery rail --------------------------------------------- */
.rail-card {
  border: var(--rule); background: var(--paper);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.06);
}
.rail-card + .rail-card { margin-top: 20px; }
.rail-card-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; opacity: .55; padding: 14px 16px 8px;
}
.rail-search {
  display: flex; align-items: center; gap: 9px; margin: 0;
  border: var(--rule); border-radius: 4px; padding: 10px 12px;
  text-decoration: none; color: var(--ink);
  font-family: var(--mono); font-size: 11px; opacity: .8;
}
.rail-search:hover { background: var(--ink); color: var(--paper); }
.rail-card .person { padding: 12px 16px; margin: 0; }
.rail-card .person:not(:last-child) { border-bottom: var(--rule); }

/* Masthead */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: var(--rule);
  padding: 16px 24px 14px;
  text-align: center;
}
.wordmark {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 30px; letter-spacing: 0.02em; line-height: 1;
  text-decoration: none; color: var(--ink); display: inline-block;
}
.wordmark:hover { background: none; color: var(--ink); }
.lang { display: flex; gap: 0; }
.lang button {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  background: var(--paper); border: var(--rule); color: var(--ink);
  padding: 4px 8px; cursor: pointer;
}
.lang button + button { border-left: 0; }
.lang button.active { background: var(--ink); color: var(--paper); }
/* In the mobile masthead the switch floats top-right of the centred wordmark. */
.topbar .lang { position: absolute; right: 18px; top: 16px; }

.content { flex: 1; padding: 0; }
.pad { padding: 8px 24px; }

/* ---- Bottom tab bar (icons) ------------------------------------------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; background: var(--paper); border-top: var(--rule);
}
.tabbar a {
  flex: 1; display: flex; justify-content: center; align-items: center;
  padding: 13px; color: var(--ink); text-decoration: none;
}
.tabbar a:hover { background: var(--ink); color: var(--paper); }
.tabbar a:not(.active) { opacity: .4; }
.tabbar svg { display: block; }

/* ---- Feed article (2a) ------------------------------------------------- */
.feed { padding: 8px 24px; }
.post { padding: 22px 0; border-bottom: var(--rule); animation: riseIn .5s both; }
.post:last-child { border-bottom: 0; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: var(--rule); background-color: var(--paper); flex: none;
}
.avatar.lg { width: 44px; height: 44px; }
.avatar.sm { width: 30px; height: 30px; }
.name { font-size: 16px; line-height: 1.2; }
.handle { font-family: var(--mono); font-size: 10px; opacity: .6; line-height: 1.2; }

.post-media {
  border: var(--rule); border-radius: 4px; overflow: hidden;
  margin-bottom: 14px; position: relative;
}
.post-media img { width: 100%; image-rendering: pixelated; }
.post-media .hatch { height: 210px; }
.filetag {
  position: absolute; left: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 9px;
  background: var(--paper); padding: 3px 6px; border: var(--rule); border-radius: 3px;
}
.post-body { font-size: 19px; line-height: 1.5; margin: 0 0 14px; white-space: pre-wrap; word-break: break-word; }
.post-body.quote { font-size: 24px; line-height: 1.42; }
.post-body em, .post-body i { font-style: italic; }

/* link card (essay) */
.linkcard { display: block; border: var(--rule); border-radius: 4px; overflow: hidden; text-decoration: none; color: var(--ink); margin-bottom: 14px; }
.linkcard:hover { background: none; color: var(--ink); }
.linkcard .thumb { height: 110px; border-bottom: var(--rule); }
.linkcard .meta { padding: 12px 14px; }
.linkcard .meta .t { font-size: 18px; line-height: 1.2; }
.linkcard .meta .s { font-family: var(--mono); font-size: 10px; margin-top: 6px; opacity: .6; }

/* action row */
.actions { display: flex; align-items: center; gap: 20px; }
.actions .spacer { flex: 1; }
.act { display: flex; align-items: center; gap: 7px; }
.act .count { font-family: var(--mono); font-size: 12px; opacity: .75; }
.icon-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  display: flex; color: var(--ink);
}
.icon-btn:hover { opacity: .5; }

/* ---- Post detail (2b) -------------------------------------------------- */
.thread-head {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: var(--rule);
}
.thread-head a { display: flex; color: var(--ink); text-decoration: none; }
.thread-head a:hover { background: none; opacity: .5; }
.detail-post { padding: 22px 24px 20px; border-bottom: var(--rule); }
.detail-body { font-size: 21px; line-height: 1.5; margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }
.detail-sub { font-size: 18px; line-height: 1.55; margin: 0 0 18px; opacity: .85; }
.detail-time { font-family: var(--mono); font-size: 10px; opacity: .55; margin-bottom: 16px; }
.detail-actions { display: flex; align-items: center; gap: 24px; border-top: var(--rule); padding-top: 16px; }
.follow-chip {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  border: var(--rule); border-radius: 3px; padding: 4px 8px; cursor: pointer;
  background: var(--paper); color: var(--ink);
}
.follow-chip:hover, .follow-chip.on { background: var(--ink); color: var(--paper); }

.section-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; opacity: .55; padding: 16px 24px 8px;
}
.reply { padding: 14px 24px; border-bottom: var(--rule); }
.reply-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.reply-body { font-size: 17px; line-height: 1.5; margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }

.composer {
  display: flex; align-items: center; gap: 10px;
  border-top: var(--rule); background: var(--paper); padding: 12px 18px;
  position: sticky; bottom: 0;
}
.composer input {
  flex: 1; border: none; outline: none; background: none;
  font-family: var(--mono); font-size: 12px; padding: 4px 0; color: var(--ink);
}
.composer input::placeholder { opacity: .5; }
.composer .send { background: none; border: none; padding: 0; cursor: pointer; color: var(--ink); display: flex; }
.composer .send:hover { opacity: .5; }

/* ---- Explore (2c) ------------------------------------------------------ */
.explore-title { font-size: 26px; font-weight: 500; font-style: italic; margin: 0 0 12px; }
.searchbox {
  display: flex; align-items: center; gap: 9px;
  border: var(--rule); border-radius: 4px; padding: 9px 12px;
}
.searchbox input {
  flex: 1; border: none; outline: none; background: none;
  font-family: var(--mono); font-size: 11px; color: var(--ink);
}
.searchbox input::placeholder { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.chip { border: var(--rule); border-radius: 3px; padding: 5px 10px; cursor: pointer; color: var(--ink); text-decoration: none; }
.chip:hover, .chip.on { background: var(--ink); color: var(--paper); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 24px; }
.tile {
  aspect-ratio: 1; border: var(--rule); border-radius: 4px; position: relative;
  overflow: hidden; display: block; transition: transform .12s;
}
.tile:hover { transform: scale(.97); background: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.tile-tag {
  position: absolute; left: 8px; bottom: 8px;
  font-family: var(--mono); font-size: 9px;
  background: var(--paper); padding: 2px 5px; border: var(--rule); border-radius: 3px;
}
.person { display: flex; align-items: center; gap: 11px; padding-bottom: 14px; border-bottom: var(--rule); margin-bottom: 14px; }
.person:last-child { border-bottom: 0; margin-bottom: 0; }
.person .bio { font-family: var(--mono); font-size: 10px; opacity: .6; }

/* ---- Crosshatch / engraving textures ---------------------------------- */
.hatch { background-color: var(--paper); }
.hx {
  background-image:
    repeating-linear-gradient(45deg, var(--ink) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, var(--ink) 0 1px, transparent 1px 5px);
  background-color: var(--paper);
}
.hh { background-image: repeating-linear-gradient(0deg, var(--ink) 0 1px, transparent 1px 4px); background-color: var(--paper); }
.hd { background-image: repeating-linear-gradient(135deg, var(--ink) 0 1.5px, transparent 1.5px 6px); background-color: var(--paper); }
.hdot { background-image: radial-gradient(var(--ink) 42%, transparent 44%); background-size: 7px 7px; background-color: var(--paper); }
.hsolid { background: var(--ink); }

/* ---- Forms (compose / auth) ------------------------------------------- */
.form-pad { padding: 20px 24px; }
label, .label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: .7; margin-bottom: 7px;
}
input.field, textarea.field, select.field {
  width: 100%; font-family: var(--serif); font-size: 17px;
  background: var(--paper); color: var(--ink);
  border: var(--rule); border-radius: 4px; padding: 11px 12px; margin-bottom: 16px;
}
textarea.field { resize: vertical; min-height: 110px; line-height: 1.5; }
input.field:focus, textarea.field:focus, select.field:focus { outline: 1px solid var(--ink); outline-offset: 1px; }

.btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--paper); color: var(--ink); border: var(--rule); border-radius: 4px;
  padding: 12px 18px; cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--paper); color: var(--ink); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em;
  text-decoration: underline; text-underline-offset: 3px; color: var(--ink);
}
.link-btn:hover { background: var(--ink); color: var(--paper); }

/* ---- Auth -------------------------------------------------------------- */
.hero { text-align: center; padding: 44px 24px 8px; }
.hero-mark { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 64px; line-height: .9; margin: 0; }
.hero-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; opacity: .6; margin-top: 14px; }
.hero-orb {
  width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 50%;
  border: var(--rule); background-color: var(--paper);
  background-image:
    repeating-linear-gradient(45deg, var(--ink) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, var(--ink) 0 1px, transparent 1px 5px);
}

/* ---- Profile ----------------------------------------------------------- */
.profile-head { padding: 26px 24px 20px; border-bottom: var(--rule); }
.profile-name { font-size: 30px; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.profile-counts { display: flex; gap: 26px; margin-top: 16px; font-family: var(--mono); }
.profile-counts b { font-family: var(--serif); font-size: 20px; }
.profile-counts span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; opacity: .6; }

/* ---- Bits -------------------------------------------------------------- */
.error { border: var(--rule); border-radius: 4px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 12px; padding: 10px 12px; margin: 12px 0; }
.loader { padding: 60px 24px; text-align: center; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.2em; font-size: 11px; opacity: .5; }
.empty { padding: 40px 24px; text-align: center; font-style: italic; opacity: .6; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.check { display: flex; gap: 9px; align-items: center; }
.check input { width: auto; margin: 0; }
.check span { font-family: var(--mono); font-size: 12px; opacity: .8; }

@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Desktop: the mobile masthead + tab bar give way to the left nav rail.
   (Placed last so it wins over the base .topbar/.tabbar display rules.) */
@media (min-width: 900px) {
  .center > .topbar,
  .center > .tabbar { display: none; }
}

/* ---- Compose filter picker -------------------------------------------- */
.compose-preview { border: var(--rule); background: #fff; margin-top: 4px; }
.compose-preview img { width: 100%; display: block; image-rendering: pixelated; }
.filters { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.filter {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; cursor: pointer; box-shadow: none;
}
.filter img {
  width: 72px; height: 72px; object-fit: cover;
  border: var(--rule); background: #fff; image-rendering: pixelated;
}
.filter.on img { outline: 3px solid var(--ink); outline-offset: 1px; }
.filter span {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; opacity: .6;
}
.filter.on span { opacity: 1; font-weight: 600; }

/* ==== Accessibility & robustness (design-review fixes) ================== */

/* Real utility so the class works anywhere, not only via parent selectors. */
.px { image-rendering: pixelated; }

/* Long usernames / display names / bios can never scroll the page sideways. */
.name, .handle, .profile-name, .bio, .post-author { overflow-wrap: anywhere; }
.post-head > div, .reply-head > div, .profile-head .row > div { min-width: 0; }

/* Visible keyboard focus on every interactive control (incl. the borderless
   composer/search inputs, which previously had outline:none). */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible,
.composer input:focus-visible, .searchbox input:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

/* Comfortable touch targets (>= the 24px AA minimum) without moving anything:
   pad the hit area and pull it back with a negative margin. */
.icon-btn { padding: 10px; margin: -10px; }
.lang button { padding: 6px 10px; }
.follow-chip { padding: 6px 10px; }

/* Contrast: inactive nav icons and the loader were too faint. */
.tabbar a:not(.active) { opacity: .55; }
.loader { opacity: .75; }

/* Topic chips are decorative suggestions, not controls — don't invite a tap. */
.chip { cursor: default; }
.chip:hover { background: var(--paper); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); }

/* Honour "reduce motion". */
@media (prefers-reduced-motion: reduce) {
  .post { animation: none; }
  .tile { transition: none; }
  * { scroll-behavior: auto; }
}

/* Screen-reader-only text. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Sensitive-media lid rendered as a real (keyboard-operable) button. */
.reveal-btn {
  width: 100%; height: 210px; border: 0; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* --- Login footer + public info pages (About/Privacy/Roadmap/AI/Terms) --- */
.footer {
  font-family: var(--mono); font-size: 11px; text-align: center;
  padding: 22px 12px 30px; line-height: 2;
}
.footer a { color: var(--ink); text-decoration: none; opacity: .7; }
/* Match the site's invert-on-hover: flip text to white on the ink background
   (base `a:hover` sets that background) so it stays readable. */
.footer a:hover { opacity: 1; color: var(--paper); text-decoration: none; }
.footer .sep { opacity: .35; margin: 0 7px; }

.info-head { padding: 22px 24px 0; }
.wordmark-sm {
  font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: 22px; color: var(--ink); text-decoration: none;
}
.info-body { padding: 0 24px; font-family: var(--serif); font-size: 17px; line-height: 1.6; }
.info-body h1 {
  font-family: var(--serif); font-weight: 500; font-size: 30px;
  letter-spacing: -0.01em; margin: 4px 0 14px;
}
.info-body h2 { font-family: var(--serif); font-weight: 600; font-size: 20px; margin: 24px 0 6px; }
.info-body p { margin: 0 0 14px; overflow-wrap: anywhere; }
.info-body ul { margin: 0 0 14px; padding-left: 22px; }
.info-body li { margin: 0 0 7px; }
.info-body a { color: var(--ink); }
/* Blockquotes carry the "draft/notice" callout in the Markdown pages. */
.info-body blockquote {
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  border: var(--rule); padding: 7px 10px; margin: 0 0 14px; opacity: .8;
}
.info-body blockquote p { margin: 0; }
