:root {
  --paper: #f7f5ef;
  --paper-deep: #efebe1;
  --card: #fffefb;
  --ink: #1e211d;
  --muted: #73766f;
  --line: #dedbd1;
  --line-dark: #c8c4b8;
  --green: #275c49;
  --green-soft: #e7efe9;
  --orange: #e46f42;
  --orange-soft: #f9e7df;
  --shadow: 0 16px 42px rgba(44, 43, 36, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 0%, rgba(228, 111, 66, 0.08), transparent 25rem),
    var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(228, 111, 66, 0.26);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(200, 196, 184, 0.7);
  background: rgba(247, 245, 239, 0.9);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: min(1080px, calc(100% - 36px));
  height: 70px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--ink);
  font: 400 2rem/1 "DM Serif Display", serif;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand span { color: var(--orange); }

.topbar-actions { display: flex; align-items: center; gap: 9px; }

.quiet-button,
.user-button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
}

.quiet-button { padding: 0 15px; background: transparent; }
.quiet-button:hover { background: var(--paper-deep); }

.user-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  background: var(--ink);
  color: white;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}

.page {
  width: min(1160px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.left-rail { position: sticky; top: 98px; align-self: start; }

.intro {
  position: relative;
  isolation: isolate;
  min-height: 540px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 48px 42px;
  overflow: hidden;
  text-align: left;
}

.hero-aura {
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid rgba(200, 196, 184, .52);
  border-radius: 42% 58% 46% 54% / 36% 42% 58% 64%;
  background: rgba(255, 254, 251, .34);
}

.hero-aura span { position: absolute; border-radius: 50%; filter: blur(2px); }
.hero-aura span:nth-child(1) { width: 116px; height: 116px; top: -38px; left: 9%; background: rgba(228, 111, 66, .1); animation: drift 9s ease-in-out infinite alternate; }
.hero-aura span:nth-child(2) { width: 116px; height: 116px; right: 9%; bottom: -38px; background: rgba(39, 92, 73, .08); animation: drift 9s ease-in-out infinite alternate-reverse; }
.hero-aura span:nth-child(3) { display: none; }

@keyframes drift { to { transform: translate(18px, 12px) scale(1.08); } }

.kicker,
.section-label {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0 0 16px;
  font: 400 clamp(4rem, 5.2vw, 5.25rem)/.9 "DM Serif Display", serif;
  letter-spacing: -0.055em;
}

.intro h1 span,
.intro h1 em { display: block; }
.intro h1 em { color: var(--green); font-style: normal; }

.hero-copy {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.6;
}

.hero-actions { display: flex; align-items: center; justify-content: flex-start; margin-top: 22px; }

.hero-cta {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: white;
  box-shadow: 0 10px 24px rgba(228, 111, 66, .2);
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(228, 111, 66, .25); }
.hero-cta span { font-size: 1.15rem; }

.hero-promises {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}
.hero-promises li { width: auto; display: inline-flex; min-height: 31px; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; border: 1px solid rgba(200, 196, 184, .72); border-radius: 999px; background: rgba(255, 254, 251, .52); color: var(--muted); font-size: .7rem; font-weight: 600; }
.hero-promises i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 68px);
  align-items: start;
}

.rail-note { margin: 15px 18px 0; color: #96988f; font-size: .71rem; line-height: 1.6; }

.composer-trigger {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 7px 24px rgba(44, 43, 36, 0.05);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.composer-trigger:hover { border-color: var(--line-dark); transform: translateY(-1px); }

.composer-avatar,
.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
  text-transform: uppercase;
}

.composer-avatar { width: 42px; height: 42px; }
.composer-trigger > span:nth-child(2) { color: var(--muted); }
.composer-trigger > strong { color: var(--green); font-size: 0.86rem; }

.feed-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 38px 0 14px;
}

.feed-heading h2 {
  margin: 0;
  font: 400 2rem/1 "DM Serif Display", serif;
}

.auth-tabs button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.feed-promise { margin: 0 0 3px; color: var(--muted); font-size: .72rem; }

.feed { display: grid; gap: 12px; }

.feed-loading,
.feed-empty {
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 35px;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.feed-loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 900ms infinite alternate;
}
.feed-loading span:nth-child(2) { animation-delay: 180ms; }
.feed-loading span:nth-child(3) { animation-delay: 360ms; }
.feed-loading p { flex-basis: 100%; margin: 6px 0 0; }

@keyframes pulse { to { opacity: .25; transform: translateY(-5px); } }

.feed-empty { flex-direction: column; }
.feed-empty strong { color: var(--ink); font: 400 1.55rem "DM Serif Display", serif; }
.feed-empty p { margin: 0; max-width: 350px; line-height: 1.55; }

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 160ms ease;
}
.post-card:hover { border-color: var(--line-dark); }

.post-main { padding: 20px 20px 15px; }

.post-meta,
.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar { width: 36px; height: 36px; flex: 0 0 auto; font-size: 0.78rem; }
.post-author, .comment-author { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.post-author strong, .comment-author strong { font-size: 0.86rem; }
.post-author span, .comment-author span { color: var(--muted); font-size: 0.72rem; }

.topic {
  margin-left: auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: #9c4728;
  font-size: 0.67rem;
  font-weight: 700;
}

.post-content {
  display: block;
  margin: 17px 0 15px;
  font-size: 1rem;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-story {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.post-story small {
  display: block;
  margin: -4px 0 15px;
  color: var(--green);
  font-size: .7rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(3px);
  transition: 160ms ease;
}

.post-story:hover small,
.post-story:focus-visible small { opacity: 1; transform: translateY(0); }

.reaction-picker { margin: 3px 0 11px; }
.reaction-picker summary {
  width: fit-content;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 700;
  list-style: none;
}
.reaction-picker summary::-webkit-details-marker { display: none; }
.reaction-picker[open] summary { border-color: #b6c9bc; background: var(--green-soft); }

.reaction-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  padding: 14px;
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  animation: reveal 140ms ease-out;
}

@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

.reaction-group > p { margin: 0 0 7px; color: #999a91; font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.reaction-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 7px;
}

.reaction-button {
  width: 100%;
  min-height: 38px;
  height: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .69rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: 150ms ease;
}

.reaction-button:hover { border-color: var(--green); color: var(--green); }
.reaction-button.is-selected { border-color: #b6c9bc; background: var(--green-soft); color: var(--green); }

.post-actions { display: flex; align-items: center; gap: 8px; }
.expiry-note { margin-left: auto; color: #98998f; font-size: .68rem; }

.text-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}
.text-action:hover { background: var(--paper); color: var(--ink); }
.text-action svg { width: 16px; height: 16px; }

.comments-panel {
  padding: 17px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fbfaf6;
}

.comment-form { display: flex; gap: 8px; margin-bottom: 18px; }
.comment-form input {
  min-width: 0;
  flex: 1;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.comment-form button,
.reply-form button {
  min-height: 42px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.comment-list { display: grid; gap: 15px; }
.comment { display: grid; grid-template-columns: 30px 1fr; gap: 9px; }
.comment .avatar { width: 30px; height: 30px; font-size: 0.68rem; }
.comment-body p { margin: 6px 0 5px; font-size: 0.88rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-body > button { padding: 0; border: 0; background: none; color: var(--green); cursor: pointer; font-size: 0.72rem; font-weight: 700; }
.replies { display: grid; gap: 12px; margin-top: 13px; padding-left: 13px; border-left: 2px solid var(--line); }
.reply-form { display: flex; gap: 7px; margin-top: 9px; }
.reply-form input { min-width: 0; flex: 1; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.reply-form button { min-height: 38px; }
.no-comments { margin: 5px 0 17px; color: var(--muted); font-size: .84rem; }

.side-stamp, .mini-brand { display: grid; place-items: center; border-radius: 11px; background: var(--green); color: white; font: 400 1.35rem "DM Serif Display", serif; }

.modal {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100dvh - 30px);
  overflow: auto;
  padding: 31px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(25, 27, 24, .55); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 14px; right: 15px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--paper); cursor: pointer; font-size: 1.5rem; line-height: 1; }
.modal-intro { padding-right: 32px; }
.mini-brand { width: 40px; height: 40px; margin-bottom: 25px; }
.modal-intro h2 { margin: 0 0 9px; font: 400 2.1rem/1.05 "DM Serif Display", serif; }
.modal-intro > p:last-child { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.modal-intro.compact { margin-bottom: 24px; }

.reader-modal {
  width: min(700px, calc(100% - 28px));
  max-height: calc(100dvh - 34px);
  padding: clamp(28px, 6vw, 62px);
  background: #fffefa;
}

.reader-story { max-width: 560px; margin: auto; }
.reader-author { display: flex; align-items: center; gap: 11px; margin: 28px 0 36px; }
.reader-author strong, .reader-author small { display: block; }
.reader-author strong { font-size: .9rem; }
.reader-author small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.reader-text { margin: 0; font: 400 clamp(1.25rem, 3vw, 1.55rem)/1.75 "DM Serif Display", serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-divider { display: flex; align-items: center; gap: 12px; margin: 42px 0 20px; color: #aaa99f; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
.reader-divider::before, .reader-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.reader-reactions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.reader-reactions .reaction-group > p { text-align: center; }
.reader-story .reaction-row { justify-content: center; }
.reader-comment { display: block; margin: 0 auto; padding: 8px 3px; border: 0; border-bottom: 1px solid var(--green); background: none; color: var(--green); cursor: pointer; font-size: .78rem; font-weight: 700; }

.auth-modal { width: min(560px, calc(100% - 28px)); }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 27px 0 20px; }
.auth-tabs button {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--muted);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.auth-tabs button:hover { border-color: var(--line-dark); transform: translateY(-1px); }
.auth-tabs strong { font-size: .8rem; }
.auth-tabs small { font-size: .65rem; font-weight: 500; }
.auth-tabs button[data-auth-tab="guest"].is-active { border-color: rgba(39, 92, 73, .42); background: var(--green-soft); color: var(--green); }
.auth-tabs button[data-auth-tab="register"] { border-color: rgba(228, 111, 66, .3); }
.auth-tabs button[data-auth-tab="register"].is-active { border-color: var(--orange); background: var(--orange-soft); color: #9c4728; }
.auth-tabs button[data-auth-tab="login"].is-active { border-color: var(--green); background: var(--green); color: white; }

.auth-form, .post-form { display: grid; }
.auth-form[hidden] { display: none; }
.auth-form label, .post-form label { margin: 14px 0 7px; font-size: .78rem; font-weight: 700; }
.auth-form input, .post-form textarea, .post-form select {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}
.auth-form input, .post-form select { min-height: 48px; padding: 0 13px; }
.post-form textarea { min-height: 170px; padding: 13px; line-height: 1.55; resize: vertical; }
.field-note { margin: 8px 0 4px; color: var(--muted); font-size: .72rem; }
.story-note { line-height: 1.45; }
.primary-button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--green); color: white; cursor: pointer; font-weight: 700; }
.primary-button:hover { background: #1f4b3b; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.auth-form > .primary-button { margin-top: 20px; }
.auth-form[data-mode="register"] > .primary-button { background: var(--orange); }
.auth-form[data-mode="register"] > .primary-button:hover { background: #cb5d35; }
.form-message { min-height: 18px; margin: 12px 0 0; color: #a44228; font-size: .78rem; line-height: 1.4; }
.form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; }
.form-footer > span { color: var(--muted); font-size: .72rem; }
.honey { position: fixed !important; left: -100vw !important; opacity: 0 !important; }

.profile-popover {
  position: fixed;
  z-index: 35;
  top: 63px;
  right: max(18px, calc((100vw - 1080px) / 2));
  width: 235px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.profile-head { display: flex; align-items: center; gap: 10px; padding: 5px 4px 13px; }
.profile-head > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; }
.profile-head strong, .profile-head small { display: block; }
.profile-head strong { font-size: .86rem; }
.profile-head small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.profile-popover > button { width: 100%; min-height: 38px; border: 0; border-radius: 10px; background: var(--paper); cursor: pointer; color: #9c4728; font-weight: 700; }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 30px);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: .8rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .page { padding-top: 28px; }
  .layout { grid-template-columns: 1fr; }
  .left-rail { position: static; }
  .intro { min-height: 350px; margin-bottom: 0; padding: 34px 36px 38px; text-align: center; align-items: center; }
  .intro h1 span, .intro h1 em { display: inline; }
  .hero-copy { margin: 0 auto; }
  .hero-actions, .hero-promises { justify-content: center; }
  .rail-note { display: none; }
}

@media (max-width: 580px) {
  .topbar-inner, .page { width: min(100% - 24px, 1080px); }
  .topbar-inner { height: 62px; }
  .quiet-button { display: none; }
  .page { padding: 24px 0 55px; }
  .intro { min-height: 390px; margin-bottom: 0; padding: 34px 18px 40px; }
  .intro h1 { font-size: clamp(3.25rem, 15vw, 4.2rem); }
  .intro h1 span, .intro h1 em { display: block; }
  .hero-copy { max-width: 340px; font-size: .96rem; }
  .hero-actions { margin-top: 20px; }
  .hero-promises { width: 100%; gap: 6px; margin-top: 18px; }
  .hero-promises li { width: auto; min-width: 0; flex: 1 1 0; padding: 0 5px; }
  .hero-aura { inset: 5px -16px 0; }
  .layout { gap: 30px; }
  .composer-trigger { grid-template-columns: 39px 1fr; min-height: 70px; }
  .composer-avatar { width: 39px; height: 39px; }
  .composer-trigger > strong { display: none; }
  .feed-heading { margin-top: 31px; }
  .post-main { padding: 17px 16px 13px; }
  .topic { display: none; }
  .post-content { font-size: .95rem; }
  .post-story small { display: none; }
  .reaction-menu, .reader-reactions { grid-template-columns: 1fr; }
  .reaction-row { gap: 6px; }
  .reaction-button { min-height: 42px; padding: 6px 7px; font-size: .64rem; }
  .expiry-note { font-size: .62rem; }
  .comments-panel { padding: 15px 15px 18px; }
  .comment-form { display: grid; }
  .comment-form button { min-height: 40px; }
  .modal { padding: 25px 20px; border-radius: 19px; }
  .reader-modal { padding: 35px 22px; }
  .reader-text { font-size: 1.22rem; line-height: 1.68; }
  .modal-intro h2 { font-size: 1.9rem; }
  .form-footer .primary-button { min-height: 44px; }
}

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