:root {
  --paper: #fbfaf6;
  --surface: #fffefa;
  --surface-2: #f1ede3;
  --ink: #24231f;
  --body: #403d36;
  --muted: #756f64;
  --line: #d8d0c2;
  --line-strong: #aaa092;
  --accent: #247458;
  --accent-soft: #e5eee8;
  --danger: #b53b2d;
  --danger-soft: #f7e8e4;
  --max-width: 1120px;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--ink);
}

button,
a {
  touch-action: manipulation;
}

h1,
h2,
h3,
p,
dl {
  margin-top: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 6vw, 72px);
  align-items: end;
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
  padding: clamp(34px, 7vw, 76px) 0 clamp(24px, 5vw, 42px);
}

.identity-name,
.identity-summary,
.meta {
  color: var(--muted);
}

.identity-name {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 6.4rem);
  font-weight: 760;
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: lowercase;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.identity-summary {
  margin-bottom: 0;
  font-size: clamp(1rem, 1.8vw, 1.14rem);
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-bottom: 4px;
}

.site-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--body);
  padding: 8px 13px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.2;
  text-decoration: none;
}

.ledger-main {
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) 0 56px;
}

.ledger-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ledger-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.55rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.feed {
  display: grid;
}

.empty-state {
  border-bottom: 1px dashed var(--line);
  padding: 28px 0;
  color: var(--muted);
}

.ledger-entry {
  display: grid;
  grid-template-columns: minmax(110px, 142px) 32px minmax(0, 1fr);
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.ledger-time {
  padding: 24px 18px 20px 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ledger-date,
.ledger-clock {
  display: block;
}

.entry-state {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry-state--boost,
.entry-state--sensitive {
  color: var(--danger);
}

.ledger-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.ledger-marker::before {
  content: "";
  width: 1px;
  min-height: 100%;
  background: var(--line);
}

.marker-dot {
  position: absolute;
  top: 30px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
}

.ledger-entry--reply .marker-dot {
  border-color: var(--accent);
}

.ledger-entry--boost .marker-dot,
.ledger-entry--sensitive .marker-dot {
  border-color: var(--danger);
}

.entry-body {
  min-width: 0;
  padding: 24px 0 22px 20px;
}

.entry-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  object-fit: cover;
  background: var(--surface-2);
}

.entry-author {
  min-width: 0;
}

.entry-author h3,
.thread-author {
  margin: 0;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 700;
}

.entry-account,
.thread-account {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.entry-note {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.9rem;
}

.content {
  color: var(--body);
  font-size: clamp(1rem, 1.45vw, 1.08rem);
  line-height: 1.66;
  overflow-wrap: anywhere;
}

.content p {
  margin: 0 0 0.85em;
}

.content p:last-child {
  margin-bottom: 0;
}

.content a {
  color: var(--accent);
}

.content a:visited {
  color: var(--muted);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 10px;
  margin-top: 16px;
}

.media-grid img,
.media-grid video {
  display: block;
  width: 100%;
  max-height: 340px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #191915;
  object-fit: cover;
}

.link-citation {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  overflow: hidden;
}

.link-citation:hover {
  border-color: var(--accent);
}

.link-citation img {
  width: 100%;
  height: 100%;
  min-height: 112px;
  object-fit: cover;
  border-right: 1px solid var(--line);
}

.link-citation__body {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.link-citation__body strong {
  color: var(--ink);
  font-size: 0.96rem;
}

.link-citation__action {
  color: var(--accent);
  font-size: 0.84rem;
}

.link-citation--no-image {
  grid-template-columns: 1fr;
}

.embed-frame {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #191915;
  overflow: hidden;
}

.embed-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--body);
  padding: 8px 13px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.2;
  text-decoration: none;
}

.button:hover:not(:disabled),
.button:focus-visible,
.site-actions a:hover,
.site-actions a:focus-visible,
a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  outline: none;
}

.button:focus-visible,
.site-actions a:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 3px rgba(36, 116, 88, 0.18);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--wide {
  min-width: min(100%, 220px);
}

.spoiler {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid var(--danger);
  border-radius: 3px;
  padding: 14px;
  color: var(--body);
  background: var(--danger-soft);
}

.spoiler strong {
  color: var(--danger);
}

.spoiler .content {
  grid-column: 1 / -1;
  padding-top: 8px;
}

.thread {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  border-left: 1px solid var(--accent);
  padding-left: 18px;
}

.thread[hidden],
[hidden] {
  display: none !important;
}

.comment {
  position: relative;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px;
  background: var(--surface);
}

.comment::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 24px;
  width: 18px;
  border-top: 1px solid var(--accent);
}

.comment header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment .avatar {
  width: 30px;
  height: 30px;
}

.thread-status {
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 3px;
  padding: 12px 14px;
}

.pagination {
  display: flex;
  justify-content: center;
  padding: 24px 0 42px;
}

@media (max-width: 760px) {
  .site-header__inner {
    display: block;
    width: min(100% - 32px, var(--max-width));
    padding: 30px 0 24px;
  }

  h1 {
    font-size: clamp(2.65rem, 13vw, 4.4rem);
  }

  .site-actions {
    justify-content: flex-start;
    margin-top: 20px;
  }

  .ledger-main {
    width: min(100% - 32px, var(--max-width));
    padding-top: 26px;
  }

  .ledger-entry {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .ledger-time {
    grid-column: 2;
    grid-row: 1;
    padding: 20px 0 0 14px;
    font-size: 0.78rem;
  }

  .ledger-marker {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .marker-dot {
    top: 25px;
  }

  .entry-body {
    grid-column: 2;
    grid-row: 2;
    padding: 12px 0 20px 14px;
  }

  .entry-header {
    align-items: flex-start;
  }

  .link-citation {
    grid-template-columns: 1fr;
  }

  .link-citation img {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .entry-actions {
    gap: 8px;
  }

  .button,
  .site-actions a {
    min-height: 44px;
  }

  .spoiler {
    grid-template-columns: 1fr;
  }

  .thread {
    padding-left: 12px;
  }

  .comment::before {
    left: -12px;
    width: 12px;
  }
}

@media (max-width: 360px) {
  .site-header__inner,
  .ledger-main {
    width: min(100% - 24px, var(--max-width));
  }

  h1 {
    font-size: 2.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
