/* MOI design foundations. Type sizes are relative to the browser default 16px. */
:root {
  --font-caption: .8125rem; /* 13px: minimum UI text */
  --font-label: .875rem; /* 14px */
  --font-body: 1rem; /* 16px */
  --font-title: 1.25rem; /* 20px */
  --font-section: 1.5rem; /* 24px */
  --font-hero: 2rem; /* 32px */
  --text-primary: #252327;
  --text-secondary: #6f625b;
  --text-accent: #be3025;
  --action-bg: #d92d20;
  --surface: #fffdfb;
  --surface-tint: #fff0e9;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  font-size: 100%;
  --muted: var(--text-secondary);
}
body { font-size: var(--font-body); line-height: 1.7; }
h1, h2, h3 { letter-spacing: -.035em; }
.red, .text-button, .bottom-nav .nav-item.active, .post-actions .liked { color: var(--text-accent); }
.primary, .primary:hover { background: var(--action-bg); }
.chip.selected { background: var(--action-bg); }
.write-page .chip.selected { background: var(--surface-tint); color: var(--text-accent); border-color: #d57b65; }
.tag { color: var(--text-accent); }
.visibility-options input:checked + span { color: var(--text-accent); }
.text-button { min-height: 44px; white-space: normal; }
.icon-button { width: 44px; height: 44px; }
.header-spacer { width: 44px; }
.header h1 { font-size: var(--font-title); }
.home-intro h1, .auth-page h1 { font-size: var(--font-hero); }
.page-intro h2, .write-heading h2, .profile-heading h2, .admin-page h2 { font-size: var(--font-section); }
.modal h2, .detail-title h2 { font-size: var(--font-title); }
.section-title h2 { font-size: var(--font-body); }
.section-title { align-items: flex-start; flex-wrap: wrap; }
.section-title > div { flex: 1 1 210px; }
.section-title .text-button { align-self: center; }
.home-feed .section-title h2 { font-size: var(--font-body); }
.home-feed .post-body, .post-body, .detail-modal .post-body, .comment p,
.admin-body, .response-message p { font-size: var(--font-body); line-height: 1.8; }
.writing-box textarea, input:not([type=radio]):not([type=file]), #comment-form input {
  font-size: var(--font-body); line-height: 1.7;
}
.writing-box textarea { min-height: 220px; }
form > label, legend, .post-author strong, .comment strong { font-size: var(--font-label); }
.home-intro p, .page-intro p, .write-heading p, .auth-page > .muted,
.modal > .muted, .empty p { font-size: var(--font-label); line-height: 1.8; }
.quick-grid { gap: 8px; }
.quick-grid button { padding: 16px 8px; min-width: 0; }
.quick-grid strong { font-size: var(--font-label); line-height: 1.6; word-break: keep-all; }
.quick-grid small { font-size: var(--font-caption); line-height: 1.7; word-break: keep-all; }
.chip, .write-page .chip, .admin-tabs .chip { min-height: 44px; font-size: var(--font-label); }
.chip, .write-page .chip { color: var(--text-secondary); }
.chip.selected { color: #fff; }
.write-page .chip.selected { color: var(--text-accent); }
.chips { align-items: flex-start; }
.list-page > .chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.list-page > .chips > .chip { flex: 0 0 auto; white-space: nowrap; }
.detail-filter-row { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; padding-top: 8px; }
.detail-filter-row > .chip { flex: 0 0 auto; white-space: nowrap; background: #fff; border: 1px solid #e4d8d0; font-size: var(--font-caption); }
.detail-filter-row > .chip.selected { background: var(--surface-tint); color: var(--text-accent); border-color: #cf8b78; box-shadow: none; }
.detail-filter-row .chip .icon { width: 14px; height: 14px; }
.eyebrow { letter-spacing: .08em; }
legend span { display: inline-block; }
.writing-footer { gap: 8px; }
.photo-add { width: 44px; height: 44px; }
.field-help, .save-note { line-height: 1.8; }
.save-note { display: flex; align-items: flex-start; justify-content: center; gap: 5px; }
.save-note .icon { width: 15px; height: 15px; margin-top: 4px; flex-shrink: 0; }
.post-actions { gap: 14px; flex-wrap: wrap; }
.post-actions button { min-height: 44px; }
.post-more { min-width: 44px; justify-content: center; }
.post-author { min-width: 0; }
.post-author strong { overflow-wrap: anywhere; }
.tag { flex-shrink: 0; }
.bottom-nav { height: auto; min-height: 88px; gap: 2px; padding-inline: 4px; align-items: stretch; }
.nav-item { flex: 1; min-width: 0; padding-inline: 1px; min-height: 62px; }
.nav-item small { font-size: var(--font-caption); line-height: 1.4; letter-spacing: -.04em; }
.nav-write > span { margin-top: -23px; }
.app { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.response-button { min-height: 52px; font-size: var(--font-label); flex-wrap: wrap; }
.response-message strong { font-size: var(--font-label); }
.settings-card button { font-size: var(--font-body); }
.visibility-options span { min-height: 48px; font-size: var(--font-label); }
.stat-grid > div { min-width: 0; }
.admin-tabs { flex-wrap: wrap; }
#toast { font-size: var(--font-label); bottom: calc(115px + env(safe-area-inset-bottom)); }
input::placeholder, .writing-box textarea::placeholder { color: #796c63; opacity: 1; }
.floating { color: #75685f; }
.emotion-categories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.emotion-categories .chip { justify-content: center; padding: 10px 8px; }
.emotion-step { font-size: var(--font-label); font-weight: 600; margin: 4px 0 12px; }
.emotion-details { margin-top: 16px; padding: 14px; background: #faf4ee; border-radius: 14px; }
.emotion-details .chips { flex-wrap: wrap; padding-bottom: 0; }
.emotion-details .emotion-step { line-height: 1.8; }
.emotion-selection { display: flex; align-items: center; gap: 5px; font-size: var(--font-caption); color: var(--text-accent); margin-top: 10px; }
.emotion-selection .icon { width: 16px; height: 16px; }
.emotion-details .chip .icon { width: 15px; height: 15px; }
.emotion-multi-help { margin: -4px 0 12px; }
.emotion-selection { flex-wrap: wrap; overflow-wrap: anywhere; }
.emotion-selection span { color: var(--text-secondary); }
.post-top { gap: 8px; flex-wrap: wrap; }
.post-top .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.comment-heading-actions { display: flex; align-items: center; gap: 12px; }
.comment.comment-compact { align-items: center; min-height: 44px; margin-top: 8px; gap: 7px; }
.comment-compact > .avatar.small { width: 26px; height: 26px; font-size: var(--font-caption); }
.comment-compact > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.comment-compact strong { flex: 0 1 auto; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-compact strong small { display: none; }
.comment.comment-compact p { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment > [data-delete-comment] { flex-shrink: 0; min-width: 32px; }
.avatar { overflow: hidden; }
.avatar-image { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-photo-trigger { position: relative; padding: 0; display: inline-flex; border-radius: 29px; }
.photo-edit-badge { position: absolute; right: -5px; bottom: -5px; width: 30px; height: 30px; border: 3px solid var(--surface); border-radius: 50%; background: var(--action-bg); color: white; display: grid; place-items: center; }
.photo-edit-badge .icon { width: 15px; height: 15px; }
.profile-photo-options { display: grid; gap: 10px; margin-bottom: 16px; }
.admin-detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; font-size: var(--font-caption); }
.admin-detail > .muted { font-size: var(--font-caption); }
.admin-detail-body { font-size: var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 18px; line-height: 1.8; }
.admin-detail section { margin: 24px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.admin-detail section > .muted { font-size: var(--font-label); margin-top: 10px; }
.admin-report-list { list-style: none; padding: 0; }
.admin-report-list li { margin-top: 12px; }
.admin-report-list strong, .admin-report-list span { display: block; font-size: var(--font-label); }
.admin-report-list span { color: var(--text-secondary); font-size: var(--font-caption); }
.admin-detail-comment { margin-top: 16px; }
.admin-detail-comment strong { font-size: var(--font-label); }
.admin-detail-comment p { font-size: var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-detail .post-photo { object-fit: contain; max-height: 360px; background: #f1ebe6; }
/* Keep in-place interactions from changing the user's reading position. */
html { scrollbar-gutter: stable; }
/* Reduced MVP: three destinations and two admin totals. */
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-actions .text-button { white-space: nowrap; font-size: var(--font-caption); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* One persistent brand header across authentication and signed-in screens. */
:root { --app-header-height: 72px; }
html { scroll-padding-top: calc(var(--app-header-height) + env(safe-area-inset-top) + 12px); scroll-padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.app:has(> .header) { padding-top: calc(var(--app-header-height) + env(safe-area-inset-top)); }
.header {
  position: fixed; top: 0; inset-inline: 0; margin-inline: auto; transform: none;
  width: 100%; max-width: 440px;
  height: calc(var(--app-header-height) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top); z-index: 25; gap: 12px;
  background: #fffdfb; box-shadow: 0 1px 0 #25232708;
}
.header .brand { flex-shrink: 0; }
.header .brand > span { display: inline; font-size: var(--font-label); }
.header-actions { flex-shrink: 0; }
.header .icon-button { flex-shrink: 0; }
.bottom-nav { inset-inline: 0; margin-inline: auto; transform: none; }
input, textarea, button { scroll-margin-top: calc(var(--app-header-height) + env(safe-area-inset-top) + 12px); scroll-margin-bottom: 110px; }
@media (min-width: 900px) {
  .header, .bottom-nav { left: auto; right: calc((100vw - 900px) / 2); margin-inline: 0; }
}
.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.writing-footer { justify-content: flex-end; }
.home-theme .home > .secondary { margin-top: 14px; color: #f1eae6; background: #1c1715; border-color: #503026; }
#app, .modal { overflow-anchor: none; }
.auth-tabs button { border-bottom: 2px solid transparent; }
#auth-form { min-block-size: 25rem; display: flex; flex-direction: column; }
#auth-form > .primary { margin-top: auto; }
.modal-backdrop { align-items: flex-start; padding-top: max(24px, 8dvh); }
.post-photo { aspect-ratio: 16 / 10; }
@media (max-width: 359px) {
  .home-intro h1 { font-size: 1.75rem; }
  .quick-grid strong { font-size: var(--font-label); }
  .quick-grid small, .nav-item small { font-size: var(--font-caption); }
  .home-feed .section-title h2 { font-size: var(--font-body); }
  .write-page .chip { font-size: var(--font-label); }
  .visibility-options { gap: 6px; }
  .visibility-options span { padding-inline: 6px; }
}
