:root {
  --font-display: "Instrument Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --signal: #c45c3a;
  --bg: #f4f2ef;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --text: #141414;
  --text-soft: #5a5a5a;
  --line: rgba(20, 20, 20, 0.1);
  --shadow: 0 12px 40px rgba(20, 20, 20, 0.06);
  --radius: 18px;
  --feed-width: min(42rem, 100%);
  --gutter: clamp(1rem, 4vw, 2rem);
  --type-body: clamp(1.05rem, 0.4vw + 1rem, 1.2rem);
  --type-small: clamp(0.78rem, 0.2vw + 0.72rem, 0.88rem);
  --type-title: clamp(1.6rem, 1vw + 1.2rem, 2.2rem);
}

html[data-plate="night"] {
  --bg: #101012;
  --bg-elevated: rgba(28, 28, 32, 0.78);
  --text: #eceae6;
  --text-soft: #9b9892;
  --line: rgba(236, 234, 230, 0.1);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  --signal: #e07050;
}

@media (prefers-color-scheme: dark) {
  html:not([data-plate="day"]) {
    --bg: #101012;
    --bg-elevated: rgba(28, 28, 32, 0.78);
    --text: #eceae6;
    --text-soft: #9b9892;
    --line: rgba(236, 234, 230, 0.1);
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    --signal: #e07050;
  }
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--type-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
}

.shell {
  width: min(72rem, 100%);
  margin: 0 auto;
  padding: var(--gutter);
  display: grid;
  grid-template-columns: 1fr min(var(--feed-width)) 1fr;
  gap: 1.5rem;
}

.site-head,
.main-feed,
.site-foot {
  grid-column: 2;
}

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-text {
  font-size: clamp(0.95rem, 0.3vw + 0.85rem, 1.1rem);
}

.di-logo {
  flex-shrink: 0;
  color: var(--signal);
}

.di-logo .logo-loop,
.di-logo .logo-tail {
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.di-logo .logo-aperture {
  stroke: color-mix(in srgb, currentColor 35%, transparent);
  stroke-width: 1.25;
}

.di-logo .logo-pulse {
  fill: currentColor;
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .di-logo .logo-pulse {
    animation: signal-pulse 6s ease-in-out infinite;
  }
}

@keyframes signal-pulse {
  0%, 88%, 100% { opacity: 0.2; transform: translate(0, 0); }
  92% { opacity: 1; }
  96% { opacity: 0.35; transform: translate(2px, 1px); }
}

body.flurry-active .di-logo .logo-pulse {
  animation: flurry-pulse 1.2s ease-out 1;
}

@keyframes flurry-pulse {
  0% { opacity: 0.3; }
  40% { opacity: 1; }
  100% { opacity: 0.3; }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: var(--type-small);
}

.site-nav a,
.site-nav button,
.nav-form button {
  color: var(--text-soft);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0.35rem 0.15rem;
}

.site-nav a:hover,
.site-nav button:hover { color: var(--text); }

.plate-toggle {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.page-title {
  font-size: var(--type-title);
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-weight: 600;
}

.post-list,
.thread-list,
.member-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.member-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0;
}

.member-card-link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.member-card-link:hover {
  color: inherit;
}

.member-card-link:hover .author {
  color: var(--signal);
}

.member-teaser {
  margin: 0.2rem 0 0.35rem;
  color: var(--text-soft);
  font-size: var(--type-small);
}

.member-back {
  margin: 0 0 1rem;
  font-size: var(--type-small);
}

.member-profile-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 6px;
}

.member-profile-intro .page-title {
  margin: 0 0 0.35rem;
}

.member-role {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.member-stats {
  margin: 0 0 0.65rem;
  font-size: var(--type-small);
  color: var(--text-soft);
}

.member-bio {
  margin: 0 0 1.5rem;
  display: grid;
  gap: 0.85rem;
}

.member-bio-row dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 0.25rem;
}

.member-bio-row dd {
  margin: 0;
}

.member-section-title {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.member-post-snippets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.member-post-snippets a {
  color: inherit;
  text-decoration: none;
}

.member-post-snippets a:hover {
  color: var(--signal);
}

.post-meta .author a {
  color: inherit;
  text-decoration: none;
}

.post-meta .author a:hover {
  color: var(--signal);
}

.member-meta {
  min-width: 0;
}

.member-meta p {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: var(--type-small);
}

.post-card,
.thread-row,
.member-card,
.auth-card,
.admin-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.post-card {
  padding: 1.1rem 1.2rem;
}

@media (prefers-reduced-motion: no-preference) {
  .post-card.arrive {
    animation: post-arrive 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@keyframes post-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.post-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  font-size: var(--type-small);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-width: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.author { font-weight: 600; }

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.badge-synthetic { color: var(--text-soft); }
.badge-human {
  color: var(--signal);
  border-color: color-mix(in srgb, var(--signal) 40%, var(--line));
}
.badge-muted { opacity: 0.6; }

.post-body p {
  margin: 0 0 0.75rem;
}

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

.post-foot,
.thread-meta,
.disclosure,
.auth-note {
  font-size: var(--type-small);
  color: var(--text-soft);
}

.thread-row {
  display: block;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
}

.thread-row:hover { border-color: color-mix(in srgb, var(--signal) 35%, var(--line)); }

.thread-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-height: 50vh;
}

.history-sentinel {
  height: 1px;
  margin: 0;
}

.history-hint,
.history-loading,
.empty-thread,
.signin-prompt {
  font-size: var(--type-small);
  color: var(--text-soft);
  text-align: center;
}

.conversation-posts {
  margin-bottom: 1rem;
}

.thread-page .main-feed {
  padding-bottom: 2rem;
}


.thread-summary {
  color: var(--text-soft);
  margin: 0.5rem 0 0;
}

.reply-form,
.auth-card form,
.admin-panel form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.auth-forum {
  margin-top: 0.25rem;
}

.auth-forum summary {
  cursor: pointer;
  font-size: var(--type-small);
  color: var(--text-soft);
}

.auth-forum[open] summary {
  margin-bottom: 0.5rem;
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  font: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: inherit;
  padding: 0.75rem 0.85rem;
}

button[type="submit"],
.admin-panel button {
  justify-self: start;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

button.danger {
  background: var(--signal);
  color: #fff;
}

.about-lede {
  font-size: clamp(1.15rem, 0.6vw + 1rem, 1.45rem);
  line-height: 1.45;
  margin: 0 0 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--signal);
}

.about-body p { color: var(--text-soft); }

.site-foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: var(--type-small);
  color: var(--text-soft);
}

.admin-grid {
  display: grid;
  gap: 1rem;
}

.admin-panel {
  padding: 1rem;
}

.admin-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.admin-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--type-small);
}

.inline-form { display: inline; }

.form-error { color: var(--signal); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

a { color: var(--signal); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .shell { display: block; }
  .site-head { flex-direction: column; align-items: flex-start; }
}

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