/* The Orange Ribbon design system.
   Blue and orange from the logo, warm neutrals, soft depth, calm motion.
   Accessibility first: large targets, strong contrast, visible focus, no flashing. */

:root {
  --navy: #0c407c;
  --blue: #14609f;           /* links, primary actions: 7:1 on white */
  --blue-hover: #0f4f85;
  --blue-soft: #eaf3fb;
  --sky: #45beeb;
  --orange: #f08a1c;         /* accents and decoration */
  --orange-ink: #a64b05;     /* orange for text: 5.9:1 on white */
  --orange-soft: #fff1df;

  --bg: #fbf9f4;
  --surface: #ffffff;
  --surface-2: #f6f3ec;
  --ink: #17212b;
  --muted: #566270;
  --border: #e9e3d6;
  --border-strong: #d8d0bf;
  --focus: #b4540a;
  --danger: #b3261e;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 40, 70, 0.06);
  --shadow: 0 1px 2px rgba(15, 40, 70, 0.05), 0 6px 20px rgba(15, 40, 70, 0.07);
  --shadow-lg: 0 2px 4px rgba(15, 40, 70, 0.05), 0 18px 44px rgba(15, 40, 70, 0.12);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ease: 140ms ease;

  color-scheme: only light; /* the site is always light, whatever the device's dark mode says */
}

* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }

.container { max-width: 66rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 34rem; margin: 2.5rem auto; }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.75rem 1rem; border-radius: var(--radius-sm); z-index: 50; box-shadow: var(--shadow); }
.skip-link:focus { left: 0.5rem; }
[hidden] { display: none !important; }

a { color: var(--blue); text-underline-offset: 4px; text-decoration-thickness: 1px; transition: color var(--ease); }
a:hover { color: var(--blue-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--navy); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.15rem; margin: 1.75rem 0 0.5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 0.9rem; }
h3 { font-size: 1.12rem; }
p { margin: 0.75rem 0; }
.muted { color: var(--muted); font-size: 0.88rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.74rem; font-weight: 700; color: var(--orange-ink); }
.section-title { margin-top: 3rem; }
.empty { padding: 1.75rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ---------- Header ---------- */
.site-header { background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.site-header::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--navy), var(--sky) 55%, var(--orange)); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.6rem; }
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--navy); }
.brand:hover { color: var(--navy); }
.brand-mark { width: 3rem; height: 3rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; }
.brand-tag { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.search { display: flex; gap: 0.4rem; margin-left: auto; }
.account { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; align-items: center; }
.account a:not(.button) { padding: 0.4rem 0.1rem; font-weight: 500; }
.chip { background: var(--blue-soft); padding: 0.3rem 0.95rem !important; border-radius: 999px; text-decoration: none; font-weight: 600 !important; }
.inline { display: inline; margin: 0; }

.main-nav { border-top: 1px solid var(--border); }
.nav-list { display: flex; flex-wrap: wrap; gap: 0.15rem 0.35rem; list-style: none; margin: 0 auto; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.nav-list a { display: inline-block; padding: 0.45rem 0.95rem; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--ink); font-size: 0.95rem; transition: background var(--ease), color var(--ease); }
.nav-list a:hover { background: var(--blue-soft); color: var(--blue); }
.nav-list a[aria-current="page"], .nav-list a[aria-current="page"]:hover { background: var(--blue); color: #fff; box-shadow: inset 0 -3px 0 var(--orange); }

/* ---------- Controls ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; padding: 0.75rem 1rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:hover, textarea:hover, select:hover { border-color: var(--sky); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 35%, transparent); }
.search input { width: 12rem; border-radius: 999px; padding-left: 1.1rem; }
textarea { min-height: 11rem; resize: vertical; line-height: 1.6; }
select { width: auto; padding-right: 2rem; border-radius: 999px; }
input[type="file"] { width: 100%; font: inherit; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.75rem; padding: 0.55rem 1.4rem; font: inherit; font-weight: 600; line-height: 1.3;
  color: #fff; background: linear-gradient(180deg, #1a6fb5, var(--blue)); border: 1.5px solid var(--blue); border-radius: 999px;
  text-decoration: none; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 40, 70, 0.2), 0 4px 12px rgba(20, 96, 159, 0.22);
  transition: filter var(--ease), box-shadow var(--ease), background var(--ease);
}
button:hover, .button:hover { filter: brightness(1.07); color: #fff; box-shadow: 0 1px 2px rgba(15, 40, 70, 0.2), 0 6px 18px rgba(20, 96, 159, 0.3); }
button:active, .button:active { filter: brightness(0.96); }
button.secondary, .button.secondary { color: var(--blue); background: transparent; box-shadow: none; border-color: var(--border-strong); }
button.secondary:hover, .button.secondary:hover { background: var(--blue-soft); color: var(--blue-hover); border-color: var(--blue); filter: none; box-shadow: none; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.link-button { min-height: auto; padding: 0.4rem 0.1rem; color: var(--blue); background: none; border: 0; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; box-shadow: none; border-radius: 6px; }
.link-button:hover { background: none; box-shadow: none; filter: none; color: var(--blue-hover); }
label { display: block; font-weight: 600; margin: 1.25rem 0 0.4rem; font-size: 0.95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.86rem; }
.checkbox { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 400; }
.checkbox input { width: 1.4rem; height: 1.4rem; margin-top: 0.15rem; flex: none; accent-color: var(--blue); }

/* Form surfaces */
form[action="/register"], form[action="/login"], form[action$="/new"], form[action$="/edit"], form[action$="/report"] {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 1.6rem 1.4rem; box-shadow: var(--shadow); max-width: 42rem;
}
form.bio-form, form.role-form, form.profile-action, form.member-search, form.plain { background: none; border: 0; box-shadow: none; padding: 0; max-width: none; }
form.plain { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.5rem; margin: 1rem 0; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
blockquote.card { margin-left: 0; margin-right: 0; }
.flash { display: flex; gap: 0.7rem; align-items: center; background: var(--orange-soft); border: 1px solid color-mix(in srgb, var(--orange) 55%, transparent); border-radius: var(--radius-sm); padding: 0.8rem 1.2rem; margin: 1.25rem 0 0; box-shadow: var(--shadow-sm); }
.flash::before { content: ""; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--orange); }
.errors { background: #fdeceb; color: #5c0f0a; border: 1px solid #e6a29c; border-radius: var(--radius-sm); padding: 0.6rem 1.2rem; margin: 1rem 0; }
.errors ul { margin: 0; padding-left: 1.2rem; }
.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; padding: 0.08rem 0.6rem; border-radius: 999px; background: var(--orange-soft); color: var(--orange-ink); border: 1px solid color-mix(in srgb, var(--orange) 60%, transparent); vertical-align: middle; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: center; margin: 1.75rem 0 0.75rem; padding: 2.75rem; border-radius: 32px; background:
    radial-gradient(60% 80% at 100% 0%, color-mix(in srgb, var(--orange) 14%, transparent), transparent 70%),
    radial-gradient(70% 90% at 0% 100%, color-mix(in srgb, var(--sky) 20%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.hero h1 { margin-top: 0.5rem; font-size: 2.8rem; line-height: 1.1; }
.hero-logo { width: 100%; max-width: 19rem; height: auto; justify-self: center; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.4rem 0; }
.trust { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; list-style: none; margin: 1.25rem 0 0; padding: 0; color: var(--muted); font-size: 0.9rem; }
.trust li { display: flex; align-items: center; gap: 0.45rem; }
.trust svg { width: 1.1rem; height: 1.1rem; stroke: var(--orange-ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.welcome-back { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; margin: 1.75rem 0 0.5rem; padding: 1.75rem 2rem; border-radius: var(--radius); background: radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--orange) 12%, transparent), transparent 70%), var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.welcome-back h1 { margin: 0.2rem 0; }
.welcome-back .lede { margin: 0; }

/* ---------- Categories ---------- */
.category-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 1.1rem; }
.category-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem 1.15rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.15rem; transition: border-color var(--ease), box-shadow var(--ease); }
.category-card:hover { border-color: var(--sky); box-shadow: var(--shadow-lg); }
.category-card:focus-within { border-color: var(--blue); }
.cat-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.8rem; height: 2.8rem; border-radius: 14px; background: var(--blue-soft); color: var(--blue); margin-bottom: 0.6rem; }
.accent-1 .cat-icon { background: var(--orange-soft); color: var(--orange-ink); }
.accent-2 .cat-icon { background: color-mix(in srgb, var(--navy) 12%, var(--surface)); color: var(--navy); }
.cat-icon svg { width: 1.45rem; height: 1.45rem; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.category-card h3 { margin: 0; font-size: 1.15rem; }
.category-card h3 a { text-decoration: none; color: inherit; }
.category-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.category-card p { margin: 0.25rem 0 0.7rem; color: var(--muted); font-size: 0.95rem; flex: 1; }

/* ---------- Thread rows ---------- */
.thread-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.thread-row { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.95rem 1.25rem; box-shadow: var(--shadow-sm); transition: border-color var(--ease), box-shadow var(--ease); }
.thread-row:hover { border-color: var(--sky); box-shadow: var(--shadow); }
.thread-main { flex: 1; min-width: 0; }
.thread-row a.title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; text-decoration: none; color: var(--navy); overflow-wrap: anywhere; }
.thread-row a.title:hover { color: var(--blue); text-decoration: underline; }
.thread-main .muted { margin-top: 0.1rem; }
.reply-pill { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 3.4rem; padding: 0.3rem 0.6rem; border-radius: 12px; background: var(--surface-2); line-height: 1.15; }
.reply-pill strong { font-size: 1.05rem; color: var(--ink); }
.reply-pill small { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Avatars ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; font-weight: 700; color: #fff; background: var(--blue); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); }
.av-0 { background: #14609f; }
.av-1 { background: #c4620c; }
.av-2 { background: #0c407c; }
.av-3 { background: #2c7a6b; }
.av-4 { background: #7a4a9e; }
.avatar-xl { width: 5.2rem; height: 5.2rem; font-size: 2.1rem; font-family: var(--serif); box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, 0.3); }

/* ---------- Posts ---------- */
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 1.1rem 0; box-shadow: var(--shadow); overflow: hidden; }
.post-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; justify-content: space-between; align-items: center; padding: 0.75rem 1.4rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.post-author { display: flex; align-items: center; gap: 0.6rem; }
.post-body { padding: 0.5rem 1.4rem; overflow-wrap: anywhere; font-size: 1.02rem; }
.post-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; padding: 0 1.4rem 0.9rem; font-size: 0.9rem; }
.post-actions a { color: var(--muted); }
.post-actions a:hover { color: var(--blue); }
.post.hidden .post-body { color: var(--muted); font-style: italic; }
.pagination { display: flex; gap: 1.25rem; align-items: center; margin: 1.5rem 0; }

/* ---------- Members and profiles ---------- */
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.member-list li { display: flex; gap: 0.95rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1.25rem; box-shadow: var(--shadow-sm); transition: border-color var(--ease), box-shadow var(--ease); }
.member-list li:hover { border-color: var(--sky); box-shadow: var(--shadow); }
.member-search { display: flex; gap: 0.6rem; margin: 1rem 0; flex-wrap: nowrap; }
.member-search input { flex: 1; border-radius: 999px; }
.profile-header { display: flex; flex-wrap: wrap; align-items: center; gap: 1.4rem; margin: 1.75rem 0 0.5rem; padding: 1.75rem; border-radius: var(--radius); background: radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--orange) 12%, transparent), transparent 70%), var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.profile-id { flex: 1; min-width: 12rem; }
.profile-id h1 { margin: 0; font-size: 1.9rem; }
.profile-id p { margin: 0.25rem 0; }
.stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; list-style: none; margin: 0.6rem 0 0; padding: 0; color: var(--muted); font-size: 0.95rem; }
.stats strong { color: var(--ink); font-size: 1.1rem; }
.profile-action { margin: 0; }
.bio-form textarea { min-height: 8rem; }
.danger-zone summary { cursor: pointer; font-weight: 600; color: var(--danger); }
.role-form { margin: 0 0 0.75rem; }
.inline-label { margin: 0; }

/* Gold verified seal */
.verified { display: inline-flex; vertical-align: -0.22em; margin-left: 0.45em; line-height: 1; }
.verified svg { width: 1.15em; height: 1.15em; display: block; filter: drop-shadow(0 1px 1px rgba(120, 80, 0, 0.35)); }
h1 .verified svg { width: 0.8em; height: 0.8em; }

/* ---------- Photos ---------- */
.photo-fields { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); margin: 1.25rem 0 0.5rem; padding: 0.5rem 1rem 0.75rem; background: var(--surface-2); }
.photo-fields legend { font-weight: 600; padding: 0 0.4rem; }
.photo-fields input[type="file"] { padding: 0.6rem 0; }
.photo-grid { list-style: none; margin: 0; padding: 0.25rem 1.4rem 1rem; display: flex; flex-wrap: wrap; gap: 0.9rem; }
.photo-grid li { display: flex; flex-direction: column; gap: 0.15rem; }
.photo-grid img { display: block; width: 11rem; height: 11rem; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--blue-soft); }

/* ---------- Auth pages ---------- */
.auth-shell { max-width: 30rem; margin: 2rem auto 0; text-align: center; }
.auth-shell form { text-align: left; max-width: none; }
.auth-mark { width: 4.5rem; height: 4.5rem; }
.auth-shell h1 { margin-top: 1rem; }

/* ---------- Footer ---------- */
.crisis { background: var(--orange-soft); border-left: 5px solid var(--orange); border-radius: var(--radius-sm); padding: 0.9rem 1.2rem; }
.site-footer { margin-top: 5rem; padding: 3rem 0 3.5rem; background: linear-gradient(180deg, var(--navy), #082d58); color: #e6eef7; }
.site-footer a { color: #ffc98b; }
.site-footer a:hover { color: #ffe0b8; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 2.5rem; font-size: 0.92rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { padding: 0.22rem 0; }
.footer-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; margin: 0.6rem 0 0; }
.footer-heading { font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.74rem; color: #ffc98b; margin: 0 0 0.6rem; }
.site-footer .crisis { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius-sm); align-self: start; }
.site-footer button.secondary { color: #fff; border-color: rgba(255, 255, 255, 0.5); margin-top: 0.75rem; }
.site-footer button.secondary:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; padding: 1.75rem; gap: 1.5rem; }
  .hero-logo { max-width: 13rem; order: -1; }
  .hero h1 { font-size: 2.2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
}
@media (max-width: 40rem) {
  html { font-size: 106.25%; }
  h1 { font-size: 1.85rem; }
  .search { margin-left: 0; width: 100%; }
  .search input { flex: 1; width: auto; min-width: 0; }
  .brand-tag { display: none; }
  .nav-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-list a { white-space: nowrap; }
  form[action="/register"], form[action="/login"], form[action$="/new"], form[action$="/edit"], form[action$="/report"] { padding: 0.25rem 1rem 1rem; }
  .thread-row { padding: 0.8rem 1rem; gap: 0.75rem; }
  .welcome-back, .profile-header { padding: 1.25rem; }
  .post-meta, .post-body, .post-actions { padding-left: 1rem; padding-right: 1rem; }
}

/* Profile in the top-right corner */
.account { margin-left: auto; flex-wrap: nowrap; gap: 0.75rem; }
.search { margin-left: auto; }
.search + .account { margin-left: 0; }
.profile-corner { display: flex; align-items: center; gap: 0.55rem; padding: 0.22rem 0.9rem 0.22rem 0.22rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink); font-weight: 600; transition: border-color var(--ease), box-shadow var(--ease); }
.profile-corner:hover { color: var(--ink); border-color: var(--sky); box-shadow: var(--shadow); }
.profile-corner .avatar { width: 2.3rem; height: 2.3rem; }
.account-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 40rem) { .search + .account { margin-left: auto; } .account-name { max-width: 6rem; } }

/* Full-width header so the profile sits in the true top-right corner */
.site-header .container { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }

/* Footer base line */
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 2.25rem; padding-top: 1.1rem; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.82rem; color: rgba(230, 238, 247, 0.75); }
.site-version { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* Likes, reposts, mentions */
.post-react { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.15rem 1.4rem 0.75rem; }
.react-btn { min-height: 2.25rem; padding: 0.25rem 0.9rem; font-size: 0.9rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; box-shadow: none; }
.react-btn svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.react-btn strong { color: var(--ink); }
.react-btn:hover { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); filter: none; box-shadow: none; }
.react-btn.on { color: var(--orange-ink); background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 60%, transparent); }
.react-btn.on svg { fill: currentColor; }
.react-static { color: var(--muted); font-size: 0.9rem; }
a.mention { font-weight: 600; text-decoration: none; background: var(--blue-soft); padding: 0.05rem 0.4rem; border-radius: 6px; }
.repost-list { list-style: none; margin: 0; padding: 0; }
.repost-from { margin: 0.2rem 0; }
.repost-quote { margin: 0.4rem 0 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 4px solid var(--sky); color: var(--muted); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.avatar-editor { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
img.avatar { object-fit: cover; background: var(--blue-soft); }

/* Notifications */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; }
.page-head h1 { margin-right: auto; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; color: var(--ink); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.bell svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell:hover { color: var(--blue); border-color: var(--sky); }
.bell-badge { position: absolute; top: -0.3rem; right: -0.3rem; min-width: 1.3rem; height: 1.3rem; padding: 0 0.3rem; border-radius: 999px; background: var(--orange); color: #1f1300; font-size: 0.72rem; font-weight: 800; line-height: 1.3rem; text-align: center; border: 2px solid var(--surface); }
.notification-list { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.7rem; }
.notification { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.9rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.notification.is-new { border-color: color-mix(in srgb, var(--orange) 55%, transparent); background: color-mix(in srgb, var(--orange-soft) 55%, var(--surface)); }
.notification-body p { margin: 0.1rem 0; }
.notification-quote { font-style: italic; }
.prefs-form .card { margin: 1rem 0; }
.switch-row { display: flex; gap: 0.9rem; align-items: flex-start; font-weight: 400; margin: 0; }
.switch-row input { width: 1.5rem; height: 1.5rem; flex: none; margin-top: 0.2rem; accent-color: var(--blue); }
.check-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.check-list label { margin: 0; }
.who { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Bot trap: hidden from people, visible to naive form-filling bots */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* About page */
.about { max-width: 42rem; padding-top: 1.5rem; }
.about .eyebrow { font-size: 1.1rem; }
.about p { font-size: 1.08rem; }
.about .lede { color: var(--ink); font-size: 1.2rem; }
.signature { margin-top: 1.5rem; font-family: var(--serif); font-size: 1.25rem !important; }

/* ---------- Mobile and installed-app polish ---------- */
html { -webkit-tap-highlight-color: color-mix(in srgb, var(--sky) 25%, transparent); }
body { overflow-x: clip; }
a, button, summary, label, input, select, textarea { touch-action: manipulation; }
p, li, h1, h2, h3, dd, blockquote { overflow-wrap: break-word; }

/* Keep content clear of notches, rounded corners and the home bar (viewport-fit=cover) */
.container { padding-left: max(1.25rem, env(safe-area-inset-left)); padding-right: max(1.25rem, env(safe-area-inset-right)); }
.site-header .container { padding-left: max(1.5rem, env(safe-area-inset-left)); padding-right: max(1.5rem, env(safe-area-inset-right)); }
.site-header { padding-top: env(safe-area-inset-top); }
.site-footer { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); }

/* Photos fill the row on narrow screens instead of leaving gaps */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); }
.photo-grid img { width: 100%; height: auto; aspect-ratio: 1; }

/* Touch screens: every control at least 44px tall */
@media (pointer: coarse) {
  .nav-list a { min-height: 2.75rem; display: inline-flex; align-items: center; }
  .link-button { min-height: 2.75rem; }
  .account a:not(.button) { min-height: 2.75rem; display: inline-flex; align-items: center; }
  .react-btn { min-height: 2.75rem; }
  .post-actions a { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .bell { width: 2.75rem; height: 2.75rem; }
  .pagination a { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .footer-grid li a { display: inline-block; padding: 0.35rem 0; }
}

@media (max-width: 40rem) {
  /* Row 1: logo and profile. Row 2: search. Row 3: scrolling menu. */
  .header-inner { gap: 0.5rem 0.75rem; }
  .brand { flex: 1; min-width: 0; }
  .brand-name { font-size: 1.15rem; }
  .brand-mark { width: 2.6rem; height: 2.6rem; }
  .account { order: 2; margin-left: auto; }
  .search { order: 3; }
  .search + .account { margin-left: auto; }

  /* The menu scrolls sideways: snap to items and fade the edge so it is clear there is more */
  .main-nav { position: relative; }
  .nav-list { scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; padding-right: 2.5rem; }
  .nav-list li { scroll-snap-align: start; flex: none; }
  .main-nav::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 2.5rem; pointer-events: none; background: linear-gradient(90deg, transparent, var(--surface)); }

  .hero { border-radius: 22px; margin-top: 1rem; }
  .actions .button, .actions button { flex: 1 1 100%; }
  .card { padding: 1rem 1.1rem; }
  .profile-header { gap: 1rem; }
  .pagination { flex-wrap: wrap; }
  .footer-base { flex-direction: column; }
}

/* Very small phones: avatar only, no name next to it */
@media (max-width: 26rem) {
  .account-name { display: none; }
  .profile-corner { padding: 0.22rem; }
  .brand-name { font-size: 1.05rem; }
  .thread-row { flex-wrap: wrap; }
  .reply-pill { flex-direction: row; gap: 0.4rem; }
}

/* Landscape phones: keep the header compact */
@media (max-height: 30rem) and (orientation: landscape) {
  .hero { padding: 1.25rem 1.75rem; }
  h1 { margin-top: 1rem; }
}

/* Installed as an app: there is no browser bar, so use the whole screen sensibly */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ---------- Phone header ---------- */
/* "New post" lives in the header on wide screens and at the start of the menu on phones, so the
   header row only has to fit the logo, the bell and the profile. */
.nav-new { display: none; }
@media (max-width: 40rem) {
  .site-header .container { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .container { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .header-inner { flex-wrap: wrap; }
  .brand { min-width: 0; flex: 1 1 0; gap: 0.6rem; }
  .brand-text { min-width: 0; }
  .brand-name { font-size: 1.05rem; line-height: 1.15; overflow-wrap: normal; }
  .account { flex: none; gap: 0.5rem; }
  .account-new { display: none; }
  .nav-new { display: block; }
}
/* Logged-out visitors: keep "Log in" and "Join us" on one row beside the logo */
@media (max-width: 26rem) {
  .account a:not(.button):not(.bell):not(.profile-corner) { padding-left: 0; padding-right: 0; }
  .account .button { padding-left: 1rem; padding-right: 1rem; }
  .brand-mark { width: 2.4rem; height: 2.4rem; }
}
@media (max-width: 40rem) {
  .nav-list { scroll-padding-left: 1rem; }
}
@media (max-width: 26rem) {
  .search { gap: 0.3rem; }
  .search button { padding-left: 0.9rem; padding-right: 0.9rem; }
  .search input { padding-left: 0.9rem; padding-right: 0.5rem; text-overflow: ellipsis; }
}

/* Privacy Policy and Terms of Use */
.legal { max-width: 44rem; }
.legal h2 { font-size: 1.25rem; margin: 2.2rem 0 0.6rem; }
.legal p, .legal li { font-size: 1.04rem; }
.legal li { margin: 0.45rem 0; }
.legal .lede { color: var(--ink); }

/* Help bubble, bottom right of every page */
.help { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 40; }
.help summary { list-style: none; display: flex; align-items: center; justify-content: center; width: 3.4rem; height: 3.4rem; border-radius: 50%; cursor: pointer; color: #fff; background: linear-gradient(180deg, #1a6fb5, var(--blue)); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(15, 40, 70, 0.25), 0 8px 22px rgba(15, 40, 70, 0.3); font-family: var(--serif); font-size: 1.7rem; font-weight: 700; line-height: 1; }
.help summary::-webkit-details-marker { display: none; }
.help summary::marker { content: ""; }
.help summary:hover { filter: brightness(1.08); }
.help[open] summary { background: var(--navy); }
.help-panel { position: absolute; right: 0; bottom: 4.3rem; width: min(22rem, calc(100vw - 2rem)); max-height: calc(100vh - 7rem); overflow-y: auto; padding: 1.1rem 1.3rem 1.2rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.help-panel h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.help-panel p { margin: 0.55rem 0; font-size: 0.97rem; }
.help-contact { font-weight: 600; overflow-wrap: anywhere; }
.help-crisis { padding-top: 0.7rem; border-top: 1px solid var(--border); font-size: 0.9rem !important; }
@media print { .help { display: none; } }
/* keep the last lines of a page clear of the bubble */
.site-footer { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
