/* Porch: one typeface (Bricolage Grotesque, OFL, self-hosted) and one accent (porch-light amber).
   The lamp in the masthead is lit while you are signed in and validated, and dim otherwise. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-latin-wght.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --dusk: #e8edf0;      /* page ground: early-evening sky */
  --boards: #ffffff;    /* cards */
  --ink: #1d2730;
  --muted: #56646e;
  --rail: #cfd8dd;      /* lines and thread rails */
  --amber: #f2a516;     /* the porch light; the only accent */
  --amber-ink: #1d2730; /* text on amber */
  --glow: rgba(242, 165, 22, 0.35);
  --radius: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --dusk: #121a20; --boards: #1b252d; --ink: #edf1f3; --muted: #9eabb4; --rail: #2d3a44; --glow: rgba(242, 165, 22, 0.28); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--dusk);
  color: var(--ink);
  font-family: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: var(--amber-ink); padding: 8px 14px; border-radius: 999px; z-index: 2; }
.skip:focus { left: 16px; }
a { color: inherit; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.masthead, main, .developer-panel, .footer { width: 100%; max-width: 680px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-top: 28px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 2.5rem; line-height: 1; font-weight: 800; letter-spacing: -0.04em; }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.lamp {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--rail);
  transition: background 600ms ease, box-shadow 600ms ease;
}
body[data-validation="current"] .lamp { background: var(--amber); box-shadow: 0 0 0 6px var(--glow), 0 0 36px 10px var(--glow); }
@media (prefers-reduced-motion: reduce) { .lamp { transition: none; } }

.session { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 0.95rem; }
.session p { margin: 0; color: var(--muted); }
.session p:empty { display: none; }

button, .button {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  border: 1.5px solid var(--rail); background: var(--boards); color: var(--ink);
  border-radius: 999px; padding: 7px 16px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3;
}
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.55; cursor: progress; }
.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.primary:hover { border-color: var(--ink); }
.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 10px; }
.quiet:hover { color: var(--ink); border-color: var(--rail); }

.welcome { background: var(--boards); border-radius: var(--radius); padding: 22px 22px 24px; margin: 8px 0 18px; }
.welcome h2 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; }
.welcome p { margin: 0 0 16px; color: var(--muted); }

.compose, .editor, .report-panel { background: var(--boards); border-radius: var(--radius); padding: 16px; margin: 8px 0 18px; }
.compose label, .editor label, .report-panel label { display: block; font-weight: 650; margin-bottom: 8px; }
textarea, select, input:not([type=hidden]) {
  font: inherit; color: var(--ink); background: var(--dusk); width: 100%;
  border: 1.5px solid var(--rail); border-radius: 12px; padding: 10px 12px; resize: vertical; margin-top: 6px;
}
.compose-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.editor { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--rail); border-radius: 0; background: transparent; }
/* Live code-point count beside the send button; past the limit it turns to ink and bold, never colour alone. */
.compose-actions { align-items: center; flex-wrap: wrap; }
.count { margin-right: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.count.over { color: var(--ink); font-weight: 750; text-decoration: underline wavy var(--amber); text-underline-offset: 4px; }
textarea[aria-invalid="true"] { border-color: var(--ink); }
.form-note { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--dusk); border-left: 4px solid var(--amber); font-size: 0.95rem; }
/* Publishing paused is the network's state, not the person's mistake: calm, informative, no alarm. */
.network-state { margin: 4px 0 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--boards); border: 1.5px dashed var(--amber); font-size: 0.95rem; }
.confirm { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--rail); }
.confirm p { margin: 0; }
.danger { background: var(--ink); border-color: var(--ink); color: var(--boards); }
.danger:hover { border-color: var(--amber); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 4px; }
.tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--boards); }
.tabs #refresh { margin-left: auto; }

#status { min-height: 1.5em; margin: 6px 4px 10px; color: var(--muted); font-size: 0.9rem; }
.view-state { margin: 12px 4px; color: var(--muted); }
.view-state:empty { display: none; }
#views:focus { outline: none; }

.posts { display: grid; gap: 12px; }
.post { background: var(--boards); border-radius: var(--radius); padding: 16px 18px 12px; }
.post.tappable { cursor: pointer; }
.post.tappable:hover { box-shadow: 0 0 0 1.5px var(--rail); }
.post header { margin-bottom: 4px; }
.author { display: flex; flex-direction: column; line-height: 1.25; }
.author .name { font-weight: 700; }
.author .handle { color: var(--muted); font-size: 0.9rem; }
.author-unavailable .name { color: var(--muted); font-weight: 600; font-style: italic; }
/* The author opens their profile; it reads as a name, not a pill button. */
.author-link { align-items: flex-start; text-align: left; border: 0; border-radius: 8px; background: none; padding: 2px 4px; margin: -2px -4px; font-size: inherit; font-weight: inherit; }
.author-link:hover .name { text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.relation[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber); border-radius: 6px; }

.lookup { margin: 4px 0 6px; }
.lookup label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 2px; }
.lookup-row { display: flex; gap: 8px; align-items: center; }
.lookup-row input { margin-top: 0; padding: 7px 12px; border-radius: 999px; min-width: 0; }

.profile { background: var(--boards); border-radius: var(--radius); padding: 18px 18px 14px; margin-bottom: 12px; }
.profile-title { margin: 0; font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.profile-title:focus { outline: none; }
.profile-title .handle { font-size: 1rem; font-weight: 500; letter-spacing: 0; }
.profile .note { margin-top: 8px; }
.profile .actions { margin-left: 0; }

.post .text { margin: 6px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-unavailable .text { color: var(--muted); font-style: italic; }
.meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.meta .edited { font-style: italic; }
.note { margin: 2px 0 6px; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 8px -10px 0; }

.thread-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.thread-head h2 { margin: 0; font-size: 1.25rem; font-weight: 750; }
.thread-head h2:focus { outline: none; }
.thread { gap: 8px; }
.thread .reply { border-left: 3px solid var(--rail); border-radius: 4px var(--radius) var(--radius) 4px; }
.thread .depth-0 { border-left: 3px solid var(--amber); }
.thread .depth-2 { margin-left: 16px; }
.thread .depth-3 { margin-left: 32px; }
.thread .depth-4 { margin-left: 48px; }

/* Local hide: a quiet, collapsible list, and a marker where a hidden person's post sat in a conversation. */
.hidden-people { margin: 4px 0 8px; font-size: 0.95rem; }
.hidden-people summary { cursor: pointer; color: var(--muted); width: fit-content; }
.hidden-people[open] { background: var(--boards); border-radius: var(--radius); padding: 12px 18px; }
.hidden-people p { margin: 8px 0; }
.hidden-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hidden-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.thread .hidden-note { padding: 8px 18px; margin: 0; }

.activity { background: var(--boards); border-radius: var(--radius); padding: 12px 18px; }
.activity p { margin: 0; }
.activity.unread { box-shadow: inset 4px 0 0 var(--amber); }
/* Who, inline with what they did: the name and handle sit on one line here. */
.activity-line { overflow-wrap: anywhere; }
.activity-line .author { display: inline-flex; flex-direction: row; flex-wrap: wrap; gap: 0 6px; align-items: baseline; vertical-align: baseline; }
.activity-line .author-link { margin: -2px 0; }
.activity .about { display: block; margin: 4px 0 0; color: var(--muted); font-style: italic; }
.activity .reply-text { margin: 6px 0 4px; padding: 2px 0 2px 12px; border-left: 3px solid var(--rail); white-space: pre-wrap; overflow-wrap: anywhere; }
.activity .meta { margin-top: 4px; }
.activity .note { margin-top: 6px; }
.activity .actions { margin-top: 4px; }

/* Moderators have the report: a calm receipt, dismissed with Done. */
.report-receipt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 18px; padding: 12px 16px; border-radius: var(--radius); background: var(--boards); border-left: 4px solid var(--amber); }
.report-receipt[hidden] { display: none; }
.report-receipt p { margin: 0; flex: 1 1 16rem; overflow-wrap: anywhere; }

/* The unread count beside "Activity". */
.badge { display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--amber); color: var(--amber-ink); font-size: 0.8rem; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The developer panel: collapsed by default, plain and monospaced where it names protocol values. */
.developer-panel { margin-top: 24px; font-size: 0.9rem; }
.developer { background: var(--boards); border-radius: var(--radius); padding: 10px 18px; }
.developer summary { cursor: pointer; font-weight: 700; }
.developer dl { margin: 10px 0 0; }
.developer dt { font-weight: 700; margin-top: 10px; }
.developer dd { margin: 2px 0 0; }
.developer dd p { margin: 0 0 4px; color: var(--muted); }
.developer ul { margin: 0; padding-left: 18px; }
.developer code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; overflow-wrap: anywhere; }
.developer-actions:empty { display: none; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 32px; padding-bottom: 40px; font-size: 0.9rem; color: var(--muted); }
.built-on { border: 1.5px solid var(--rail); border-radius: 999px; padding: 4px 12px; text-decoration: none; }
.built-on strong { font-weight: 750; color: var(--ink); }

@media (max-width: 480px) {
  .brand h1 { font-size: 2.1rem; }
  .post { padding: 14px 14px 10px; }
  .thread .depth-2, .thread .depth-3, .thread .depth-4 { margin-left: 10px; }
}
