:root {
  --bg: #FAF5EE;
  --bg-warm: #F3E9DC;
  --card: #FFFDF9;
  --card-soft: #FBF7F1;
  --border: #E6DACB;
  --border-strong: #D6C4AE;
  --ink: #2C221B;
  --ink-soft: #635347;
  --ink-muted: #8B7869;
  --accent: #B85D3B;
  --accent-hover: #9C4B2D;
  --accent-soft: #F9EBE4;
  --sage: #4F6F52;
  --sage-soft: #EAF2EB;
  --ochre: #C48A34;
  --ochre-soft: #FBF3E2;
  --danger: #B23A3A;
  --danger-soft: #FCECEC;
  --shadow-sm: 0 2px 10px rgba(68, 43, 24, 0.05);
  --shadow-md: 0 10px 28px rgba(68, 43, 24, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 90% -10%, rgba(196, 138, 52, 0.10), transparent 65%),
    radial-gradient(700px 420px at -10% 10%, rgba(184, 93, 59, 0.08), transparent 65%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, .serif {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 0;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 245, 238, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
  white-space: nowrap;
}

.version-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-warm);
  color: var(--ink);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.avatar-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFDF9;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Main layout ---------- */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.auth-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 36px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand img {
  width: 62px;
  height: 62px;
  margin-bottom: 12px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.auth-brand h1 {
  font-size: 1.65rem;
  margin-bottom: 4px;
}

.auth-brand p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

/* ---------- Cards & Hero ---------- */
.hero {
  background: linear-gradient(145deg, #FFFDF9 0%, #F7EDE0 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 93, 59, 0.11) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sage);
  background: var(--sage-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(1.55rem, 3.8vw, 2.25rem);
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 62ch;
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 16px;
}

.card-warm {
  background: var(--card-soft);
  border-color: var(--border-strong);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 1.35rem;
  margin: 0;
}

.muted {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.soft {
  color: var(--ink-soft);
}

/* ---------- Areas Grid ---------- */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.area-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.area-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.area-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.area-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.area-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--bg-warm);
  padding: 3px 10px;
  border-radius: 999px;
}

.area-card h3 {
  font-size: 1.15rem;
  margin: 4px 0 0;
}

.area-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------- Posts & Comments ---------- */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.post-card + .post-card {
  margin-top: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.area-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.8rem;
}

.area-pill:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.post-title {
  font-size: 1.28rem;
  margin: 0 0 8px;
}

.post-body {
  white-space: pre-line;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.post-image {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 12px 0 14px;
}

.post-link-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--ochre-soft);
  border: 1px solid rgba(196, 138, 52, 0.28);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  word-break: break-word;
}

.post-link-box:hover {
  background: #F6E6C6;
  text-decoration: none;
}

.comments-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.comment-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 3px;
}

.comment-head strong {
  color: var(--ink);
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.comment-form input {
  flex: 1;
}

/* ---------- Forms & Buttons ---------- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 93, 59, 0.14);
}

input[readonly] {
  background: var(--bg);
  color: var(--ink-soft);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 36px;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.08s, border-color 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #FFFDF9;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #FFFDF9;
}

.btn-soft {
  background: var(--bg-warm);
  color: var(--ink);
  border-color: var(--border);
}

.btn-soft:hover {
  background: #EADCCB;
  color: var(--ink);
}

.btn-sage {
  background: var(--sage);
  color: #FFFDF9;
}

.btn-sage:hover {
  background: #3F5B42;
  color: #FFFDF9;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-warm);
  color: var(--ink);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(178, 58, 58, 0.22);
}

.btn-danger-soft:hover {
  background: #F8DADA;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

/* ---------- Alerts & Badges ---------- */
.alert {
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.94rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert-ok {
  background: var(--sage-soft);
  color: #2B452E;
  border-color: rgba(79, 111, 82, 0.25);
}

.alert-err {
  background: var(--danger-soft);
  color: #7F2323;
  border-color: rgba(178, 58, 58, 0.25);
}

.alert-warm {
  background: var(--ochre-soft);
  color: #5E4012;
  border-color: rgba(196, 138, 52, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-sage { background: var(--sage-soft); color: var(--sage); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-warm { background: var(--ochre-soft); color: #8A5D19; }
.badge-muted { background: var(--bg-warm); color: var(--ink-muted); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Guests & Invite Cards ---------- */
.invite-ready {
  background: linear-gradient(145deg, #FFFDF9 0%, #F9EBE4 100%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.invite-url-box {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.invite-url-box input {
  flex: 1 1 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
}

.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.person-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.person-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.person-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.person-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quote-box {
  background: var(--bg);
  border-left: 3.5px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  margin: 14px 0;
  font-style: italic;
  color: var(--ink-soft);
}

details.foldable {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

details.foldable summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.foldable summary::-webkit-details-marker {
  display: none;
}

details.foldable[open] summary {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #FFFDF9;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Mobile Bottom Navigation ---------- */
.mobile-nav {
  display: none;
}

.site-footer {
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.84rem;
  padding: 20px 16px 32px;
}

@media (max-width: 720px) {
  .desktop-nav {
    display: none;
  }

  .topbar-inner {
    padding: 10px 14px;
  }

  .container {
    padding: 18px 14px 104px;
  }

  .hero {
    padding: 22px 18px;
  }

  .card, .post-card {
    padding: 18px 16px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .comment-form {
    flex-direction: column;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 253, 249, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 4px;
  }

  .mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 12px;
    color: var(--ink-muted);
    font-size: 0.74rem;
    font-weight: 600;
    min-height: 48px;
  }

  .mobile-nav a .m-ico {
    font-size: 1.2rem;
    line-height: 1.1;
  }

  .mobile-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .site-footer {
    padding-bottom: 96px;
  }
}
