:root {
  color-scheme: light;
  --bg: #f2f0e9;
  --paper: #f8f7f2;
  --ink: #171713;
  --muted: #6d6c64;
  --line: rgba(23, 23, 19, .18);
  --line-soft: rgba(23, 23, 19, .1);
  --accent: #ff4d17;
  --accent-2: #cf3a0d;
  --wash: #e7e4da;
  --shadow: 0 28px 70px rgba(41, 37, 28, .09);
  --radius: 2px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11110f;
  --paper: #181815;
  --ink: #f0eee6;
  --muted: #96948b;
  --line: rgba(240, 238, 230, .2);
  --line-soft: rgba(240, 238, 230, .1);
  --wash: #24241f;
  --shadow: 0 28px 70px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button, input, textarea, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: .17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 70px;
  padding: 0 3.5vw;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  width: max-content;
  color: var(--ink);
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -.07em;
  line-height: 1;
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.wordmark-dot { color: var(--accent); }

.topbar-note {
  margin: 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 24px; }
.access-note { color: var(--muted); font-size: 12px; }
.access-note strong { color: var(--ink); }
.access-note i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #55a769; }

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.icon-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; }

.landing {
  position: relative;
  display: grid;
  min-height: calc(100vh - 122px);
  padding: clamp(70px, 10vh, 120px) max(5vw, 24px) 60px;
  overflow: hidden;
}

.landing::before {
  content: ".";
  position: absolute;
  right: -3vw;
  top: -16vw;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: clamp(420px, 52vw, 850px);
  line-height: 1;
  opacity: .95;
  pointer-events: none;
}

.landing-index {
  position: absolute;
  top: 45%;
  left: 3.5vw;
  color: var(--muted);
  font: 9px/1 "Courier New", monospace;
  letter-spacing: .12em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.landing-copy, .url-form, .principles { position: relative; z-index: 2; width: min(100%, 1050px); margin-inline: auto; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font: 700 10px/1.2 "Courier New", monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.landing h1 {
  max-width: 900px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(57px, 7.4vw, 112px);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: .87;
}

.landing h1 em { color: var(--accent); font-weight: 400; }
.lead { width: min(100%, 580px); margin: 34px 0 0 auto; color: var(--muted); font-size: clamp(16px, 1.6vw, 21px); line-height: 1.5; }

.url-form { margin-top: clamp(48px, 8vh, 86px); }
.url-form > label { display: block; margin-bottom: 10px; font: 700 10px/1 "Courier New", monospace; letter-spacing: .1em; text-transform: uppercase; }

.url-control {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  min-height: 76px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.url-icon { color: var(--accent); text-align: center; }
.url-control input { min-width: 0; height: 74px; padding: 0 14px; border: 0; outline: 0; background: transparent; font-size: 18px; }
.url-control input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.url-control:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

.url-control button {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 42px;
  padding: 0 24px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
}

.url-control button:hover { background: var(--accent); color: #fff; }
.url-control button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.form-meta { display: flex; justify-content: space-between; min-height: 26px; padding-top: 8px; color: var(--muted); font: 10px/1.4 "Courier New", monospace; }
.form-error { color: var(--accent-2); }

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: clamp(70px, 10vh, 120px);
  border-top: 1px solid var(--line);
}

.principles article { min-height: 145px; padding: 22px 30px 10px 0; border-right: 1px solid var(--line); }
.principles article + article { padding-left: 30px; }
.principles article:last-child { border-right: 0; }
.principles span { color: var(--accent); font: 10px "Courier New", monospace; }
.principles h2 { margin: 20px 0 8px; font-family: Georgia, serif; font-size: 21px; font-weight: 400; }
.principles p { max-width: 260px; margin: 0; color: var(--muted); font-size: 13px; }

.thread-view {
  display: grid;
  grid-template-columns: minmax(270px, 31vw) 1fr;
  min-height: calc(100vh - 121px);
}

.source-panel { padding: 42px 3.5vw 60px; border-right: 1px solid var(--line); background: var(--wash); }
.back-link { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--accent); }

.source-card { margin-top: 54px; }
.source-domain-row { display: flex; align-items: center; gap: 12px; }
.source-mark { display: grid; width: 38px; height: 38px; place-items: center; background: var(--ink); color: var(--bg); font-family: Georgia, serif; font-size: 20px; }
.source-domain-row p, .source-domain-row strong { margin: 0; }
.source-domain-row p { color: var(--muted); font: 9px "Courier New", monospace; text-transform: uppercase; }
.source-domain-row strong { font-size: 13px; }
.source-card h1 { margin: 36px 0 14px; font-family: Georgia, serif; font-size: clamp(31px, 3.5vw, 54px); font-weight: 400; letter-spacing: -.04em; line-height: .98; overflow-wrap: anywhere; }
.source-url { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font: 11px/1.5 "Courier New", monospace; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.source-open { display: inline-flex; gap: 16px; margin-top: 28px; padding-bottom: 4px; border-bottom: 1px solid currentColor; color: var(--ink); font-size: 12px; text-decoration: none; }
.source-open:hover { color: var(--accent); }

.thread-tools { margin-top: 74px; border-top: 1px solid var(--line); }
.thread-tools .eyebrow { margin: 18px 0 8px; }
.thread-tools button { display: flex; width: 100%; justify-content: space-between; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; font-size: 12px; text-align: left; }
.thread-tools button:hover span { color: var(--accent); }
.thread-tools b { color: var(--muted); font: 10px "Courier New", monospace; }

.access-card { display: flex; align-items: center; gap: 14px; margin-top: 36px; padding: 17px; border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 60%, transparent); }
.access-card > span { color: var(--accent); font-family: Georgia, serif; font-size: 28px; }
.access-card p { margin: 0; color: var(--muted); font-size: 11px; }
.access-card strong { color: var(--ink); }

.discussion { min-width: 0; padding: 55px clamp(28px, 5vw, 76px) 80px; background: var(--paper); }
.discussion-head { display: flex; justify-content: space-between; align-items: end; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.discussion-head .eyebrow { margin-bottom: 10px; }
.discussion-head h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 58px); font-weight: 400; letter-spacing: -.04em; }
.discussion-head h2 span { color: var(--accent); font: 14px "Courier New", monospace; vertical-align: top; }
.sort-control { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 10px "Courier New", monospace; text-transform: uppercase; }
.sort-control select { padding: 8px 26px 8px 9px; border: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 10px; text-transform: none; }

.composer { display: grid; grid-template-columns: 38px 1fr; gap: 16px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.avatar { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--wash); color: var(--muted); font: 700 11px "Courier New", monospace; text-transform: uppercase; }
.composer-body { border: 1px solid var(--line); background: var(--bg); }
.identity-row { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); }
.identity-row label { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 9px "Courier New", monospace; text-transform: uppercase; }
.identity-row input { width: 170px; padding: 5px 0; border: 0; outline: 0; background: transparent; font-family: Arial, sans-serif; font-size: 12px; text-transform: none; }
.identity-row > span { color: var(--muted); font-size: 10px; }
.identity-row > span strong { color: var(--ink); }
.identity-row > span button { border: 0; background: transparent; color: var(--accent); }
.composer textarea { display: block; width: 100%; min-height: 96px; resize: vertical; padding: 16px; border: 0; outline: 0; background: transparent; font-size: 14px; line-height: 1.55; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px 9px 16px; border-top: 1px solid var(--line-soft); }
.composer-actions > span { color: var(--muted); font: 9px "Courier New", monospace; }
.composer-actions button { padding: 9px 15px; border: 0; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 700; }
.composer-actions button:hover { background: var(--accent); color: #fff; }

.notice { margin: 20px 0 0 50px; padding: 10px 14px; border-left: 2px solid var(--accent); background: var(--wash); color: var(--muted); font-size: 12px; }
.comment-list { padding-top: 14px; }
.comment { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding-top: 22px; }
.comment-rail { position: relative; display: flex; flex-direction: column; align-items: center; }
.comment-rail::after { content: ""; width: 1px; flex: 1; min-height: 18px; margin-top: 9px; background: var(--line); }
.comment > .comment-main > .comment-children:empty { display: none; }
.comment:last-child > .comment-rail::after { opacity: .4; }
.collapse-button { position: absolute; top: 48px; z-index: 1; display: grid; width: 16px; height: 16px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--muted); font: 10px/1 Arial; }
.comment.collapsed .comment-children, .comment.collapsed .comment-body, .comment.collapsed .comment-actions { display: none; }
.comment.collapsed .collapse-button { top: 10px; }
.comment-main { min-width: 0; }
.comment-main > header { display: flex; align-items: baseline; gap: 11px; }
.comment-author { font-size: 12px; }
.comment-main time { color: var(--muted); font: 9px "Courier New", monospace; }
.comment-body { margin: 8px 0 10px; font-size: 14px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 16px; }
.comment-actions button { padding: 0; border: 0; background: transparent; color: var(--muted); font: 9px "Courier New", monospace; text-transform: uppercase; }
.comment-actions button:hover { color: var(--accent); }
.comment-children { margin-left: 1px; }
.comment-children .comment { padding-top: 25px; }

.empty-thread { padding: 70px 0; text-align: center; color: var(--muted); }
.empty-thread > span { color: var(--accent); font-family: Georgia, serif; font-size: 52px; }
.empty-thread h3 { margin: 8px 0; color: var(--ink); font-family: Georgia, serif; font-size: 27px; font-weight: 400; }
.empty-thread p { max-width: 340px; margin: auto; font-size: 12px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(15, 15, 12, .58); backdrop-filter: blur(4px); }
.embed-dialog { width: min(580px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; }
.dialog-head h2 { margin: 0; font-family: Georgia, serif; font-size: 34px; font-weight: 400; }
.dialog-head button { border: 0; background: transparent; font-size: 24px; }
.embed-dialog > p { color: var(--muted); font-size: 13px; }
.embed-dialog pre { overflow-x: auto; padding: 16px; border: 1px solid var(--line); background: var(--bg); font: 11px/1.5 "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-code { width: 100%; padding: 12px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; }

footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; padding: 0 3.5vw; border-top: 1px solid var(--line); color: var(--muted); font: 9px "Courier New", monospace; letter-spacing: .08em; text-transform: uppercase; }
footer span:last-child { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-note { display: none; }
  .landing::before { right: -8vw; top: -31vw; }
  .thread-view { grid-template-columns: 1fr; }
  .source-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .source-card { margin-top: 36px; }
  .source-card h1 { max-width: 620px; }
  .thread-tools { margin-top: 42px; }
}

@media (max-width: 640px) {
  .topbar { min-height: 62px; padding-inline: 20px; }
  .access-note { display: none; }
  .landing { padding: 74px 20px 48px; }
  .landing::before { right: -26vw; top: -32vw; font-size: 500px; opacity: .75; }
  .landing h1 { font-size: clamp(50px, 16vw, 74px); }
  .lead { margin-left: 0; }
  .url-control { grid-template-columns: 38px 1fr; }
  .url-control input { font-size: 15px; }
  .url-control button { grid-column: 1 / -1; min-height: 50px; justify-content: space-between; }
  .form-meta { flex-direction: column; gap: 4px; }
  .principles { grid-template-columns: 1fr; }
  .principles article, .principles article + article { min-height: 0; padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .source-panel, .discussion { padding-inline: 20px; }
  .discussion-head { align-items: start; gap: 20px; }
  .sort-control { flex-direction: column; align-items: start; }
  .composer { grid-template-columns: 1fr; }
  .composer > .avatar { display: none; }
  .identity-row { align-items: start; flex-direction: column; padding-block: 10px; }
  .identity-row label { width: 100%; }
  .identity-row input { flex: 1; width: auto; }
  .composer-actions > span { display: none; }
  .composer-actions { justify-content: flex-end; }
  .comment { grid-template-columns: 30px 1fr; gap: 9px; }
  .comment .avatar { width: 30px; height: 30px; }
  footer { grid-template-columns: 1fr auto; padding-inline: 20px; }
  footer span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .landing-copy, .url-form, .principles { animation: reveal .65s both; }
  .url-form { animation-delay: .08s; }
  .principles { animation-delay: .16s; }
  @keyframes reveal { from { opacity: 0; transform: translateY(18px); } }
}
