:root {
  --bg: #f3ede5;
  --paper: rgba(255, 252, 247, 0.86);
  --card: rgba(255, 252, 247, 0.95);
  --ink: #191714;
  --muted: #6d675f;
  --line: rgba(25, 23, 20, 0.1);
  --line-strong: rgba(25, 23, 20, 0.18);
  --accent: #1f352b;
  --accent-soft: #edf3ef;
  --accent-warm: #ae7d5d;
  --accent-rose: #b68273;
  --shadow-soft: 0 20px 48px rgba(31, 26, 20, 0.05);
  --shadow-card: 0 18px 38px rgba(34, 28, 21, 0.045);
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(174, 125, 93, 0.14), transparent 18%),
    radial-gradient(circle at bottom right, rgba(31, 53, 43, 0.08), transparent 26%),
    linear-gradient(180deg, #f7f1ea 0%, #ede6dd 100%);
}

a {
  color: inherit;
}

button,
textarea {
  font: inherit;
}

.max-app {
  width: min(1280px, calc(100% - 1.4rem));
  margin: 0 auto;
  padding: 0.85rem 0 2.2rem;
}

.max-hero,
.max-comments-shell,
.max-post-card {
  background: var(--paper);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.max-hero {
  padding: 1.2rem;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
}

.max-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 53, 43, 0.06), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent 55%);
  pointer-events: none;
}

.max-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1rem;
}

.max-hero-main {
  min-width: 0;
}

.max-hero-note {
  align-self: stretch;
  border-radius: 24px;
  border: 1px solid rgba(25, 23, 20, 0.09);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.62), rgba(247, 241, 235, 0.82));
  padding: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.max-hero-note h2 {
  margin: 0.5rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.05;
}

.max-note-list {
  margin: 0.95rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.7rem;
}

.max-note-list li {
  position: relative;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.55;
}

.max-note-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: var(--accent-warm);
}

.max-note-footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(25, 23, 20, 0.08);
}

.max-note-footer span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.max-note-footer strong {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
}

.max-brandline {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.max-brandmark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1f352b 0%, #6e8f7f 100%);
  color: #fbf8f3;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.84rem;
  flex-shrink: 0;
}

.max-brandcopy {
  min-width: 0;
}

.max-brandsub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.max-live-pill {
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(174, 125, 93, 0.22);
  background: rgba(174, 125, 93, 0.08);
  color: var(--accent-warm);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.66rem;
}

.max-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.max-hero h1,
.max-section-head h2,
.max-post-card h3,
.max-comment-card h4 {
  font-family: var(--font-display);
  font-weight: 400;
}

.max-hero h1 {
  margin: 0.85rem 0 0;
  font-size: clamp(1.8rem, 6vw, 4rem);
  line-height: 0.95;
  max-width: 11ch;
  text-wrap: balance;
}

.max-lead {
  margin: 0.9rem 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1rem;
}

.max-hero-actions,
.max-comment-actions,
.max-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.max-hero-actions {
  margin-top: 1rem;
}

.max-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.max-stat-card {
  padding: 0.75rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
}

.max-stat-card strong,
.max-thread-banner strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.05rem, 3vw, 1.5rem);
}

.max-stat-card span {
  display: block;
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.max-btn,
.max-inline-action {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.max-btn:hover,
.max-inline-action:hover {
  transform: translateY(-1px);
}

.max-btn {
  min-height: 44px;
  padding: 0.6rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  border-radius: 999px;
}

.max-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8f5ef;
}

.max-btn-secondary {
  background: rgba(255, 255, 255, 0.38);
}

.max-inline-action {
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
}

.max-meta,
.max-comments-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.max-meta {
  margin-top: 1rem;
}

.max-meta span,
.max-comments-meta {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.max-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.thread-focused .max-hero {
  display: none;
}

.thread-focused .max-layout {
  grid-template-columns: 1fr;
  margin-top: 0.7rem;
}

.thread-focused .max-app {
  width: min(920px, calc(100% - 1rem));
  padding-top: 0.35rem;
}

.thread-focused .max-layout > div:first-child {
  display: none;
}

.thread-focused .max-comments-shell {
  max-width: 860px;
  margin: 0 auto;
  position: static;
  padding: 1rem;
}

.thread-focused .max-comments-shell > .max-section-head,
.thread-focused .max-comments-lead,
.thread-focused .max-comments-rail {
  display: none;
}

.max-section-head h2 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1;
}

.max-posts {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.max-post-card {
  border-radius: 24px;
  padding: 1rem;
  transition: transform 180ms ease, border-color 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  box-shadow: var(--shadow-card);
}

.max-post-card.is-active {
  border-color: rgba(31, 53, 43, 0.26);
  box-shadow: 0 18px 34px rgba(31, 53, 43, 0.08);
}

.max-post-card--strength {
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(240, 247, 243, 0.92));
}

.max-post-card--premium {
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.96), rgba(248, 239, 232, 0.96));
}

.max-post-card--home,
.max-post-card--lifestyle {
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(249, 244, 239, 0.96));
}

.max-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  gap: 1rem;
  align-items: start;
}

.max-post-copy {
  min-width: 0;
}

.thread-open .max-post-card:not(.is-active) {
  opacity: 0.76;
}

.max-post-media {
  position: relative;
  min-height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(31, 53, 43, 0.1), rgba(174, 125, 93, 0.18));
  min-height: 210px;
}

.max-post-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.max-post-media-fallback {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  color: var(--accent);
}

.max-post-media-fallback strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 0.9;
}

.max-post-media-label {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.max-post-thread-chip {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  background: rgba(20, 18, 16, 0.58);
  color: #f8f3ec;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.max-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.max-post-meta span {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.max-post-count {
  background: var(--accent-soft);
  color: var(--accent) !important;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
}

.max-post-card h3 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.02;
}

.max-post-card p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.max-post-actions {
  margin-top: 1rem;
}

.max-comments-shell {
  border-radius: 28px;
  padding: 1.2rem;
  position: sticky;
  top: 0.8rem;
  align-self: start;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(249, 244, 237, 0.92));
}

.max-thread-focus-head {
  display: none;
  margin-bottom: 0.95rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(25, 23, 20, 0.08);
}

.max-thread-focus-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.max-thread-focus-head h3 {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 0.95;
}

.max-thread-focus-lead {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.thread-focused .max-thread-focus-head {
  display: block;
}

.max-comments-lead,
.max-comments-empty {
  color: var(--muted);
  line-height: 1.6;
}

.max-comments-rail {
  margin-top: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(25, 23, 20, 0.08);
  background: rgba(255, 255, 255, 0.52);
  padding: 0.48rem 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.max-comments-rail-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--accent-warm);
  box-shadow: 0 0 0 0.28rem rgba(174, 125, 93, 0.12);
}

.max-empty-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(25, 23, 20, 0.08);
  background: rgba(255, 255, 255, 0.44);
}

.max-empty-label {
  display: inline-block;
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  background: rgba(31, 53, 43, 0.08);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.max-empty-card p {
  margin: 0.8rem 0 0;
}

.max-empty-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.max-comments-panel {
  margin-top: 1rem;
}

.max-thread-banner {
  margin-bottom: 0.8rem;
  padding: 0.78rem 0.9rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 53, 43, 0.12);
  background: linear-gradient(135deg, rgba(31, 53, 43, 0.08) 0%, rgba(174, 125, 93, 0.08) 100%);
}

.max-thread-label {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.max-comments-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.max-comment-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(31, 26, 20, 0.03);
}

.max-comment-card.is-error {
  border-color: rgba(126, 60, 52, 0.22);
  background: rgba(255, 246, 242, 0.9);
}

.max-comment-card.is-loading {
  border-style: dashed;
}

.max-comment-card h4 {
  margin: 0;
  font-size: 1.2rem;
}

.max-comment-note {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.max-comment-form[data-readonly="true"] textarea {
  background: rgba(255, 255, 255, 0.55);
}

.max-comment-form[data-readonly="true"] input {
  background: rgba(255, 255, 255, 0.55);
}

.max-btn:disabled,
textarea:disabled {
  opacity: 0.7;
  cursor: progress;
}

.max-comment-card p {
  margin: 0.7rem 0 0;
  color: #4e4842;
  line-height: 1.68;
}

.max-comment-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
}

.max-comment-row span {
  color: var(--muted);
  font-size: 0.74rem;
}

.max-comment-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.max-comment-avatar {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(31, 53, 43, 0.95), rgba(174, 125, 93, 0.72));
  color: #faf6f0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.max-comment-author-copy {
  min-width: 0;
}

.max-comment-author-copy h4 {
  font-size: 1.08rem;
}

.max-comment-author-copy span {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.max-comment-form {
  margin-top: 1rem;
}

.max-comment-author-group {
  margin-bottom: 0.85rem;
}

.max-comment-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.max-comment-form input,
.max-comment-form textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.9rem 1rem;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.max-comment-form textarea {
  resize: vertical;
  min-height: 120px;
}

.max-comment-actions {
  margin-top: 0.8rem;
}

@media (max-width: 980px) {
  .max-hero-grid,
  .max-post-layout,
  .max-layout {
    grid-template-columns: 1fr;
  }

  .max-comments-shell {
    position: static;
    order: -1;
  }

  .max-hero-stats {
    grid-template-columns: 1fr;
  }

  .max-post-media {
    min-height: 180px;
  }
}

@media (max-width: 720px) {
  .max-app {
    width: min(100%, calc(100% - 1rem));
    padding-top: 0.55rem;
  }

  .max-hero,
  .max-comments-shell,
  .max-post-card {
    border-radius: 24px;
  }

  .max-brandline {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .max-live-pill {
    margin-left: 0;
  }

  .max-btn {
    flex: 1 1 100%;
    text-align: center;
  }

  .max-hero-note {
    padding: 0.9rem;
  }

  .max-hero h1 {
    max-width: 10ch;
  }

  .max-comment-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .max-comment-author {
    width: 100%;
  }

  .max-comment-actions .max-btn {
    flex: 1 1 100%;
  }
}
