/* =====================================================================
   THE COMMUNITY WALL
   Its own palette and type, deliberately: the wall is a pinboard sitting
   inside the site, not another dossier page. Everything is scoped under
   .cw so it cannot leak into the rest of the stylesheet.
   ===================================================================== */

.cw {
  --paper:    #f3eee3;   /* the wall itself */
  --card:     #fbf8f1;   /* a pinned card */
  --board:    #16281d;   /* the dark board behind the works */
  --brown:    #6e5136;   /* poems */
  --prose:    #e9e2d2;   /* field notes and stories */
  --band:     #e7e0d1;   /* the rules strip */
  --rule:     #d9d0bc;
  --edge:     #c9c0ac;
  --mono-ink: #6f6754;
  --soft:     #4a5f51;
  --accent:   #c0551e;
  --on-board: #7e9483;
  --nav-h:    64px;

  --f-wall: "Newsreader", Georgia, serif;
  --f-tag:  "IBM Plex Mono", ui-monospace, monospace;

  background: var(--paper);
  color: var(--board);
  font-family: var(--f-wall);
  font-weight: 400;
  /* a block formatting context, so the offline strip's top margin pushes
     it clear of the fixed nav instead of collapsing out of the page */
  display: flow-root;
}

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

/* the small uppercase labels that run through the whole wall */
.cw-tag {
  font-family: var(--f-tag);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mono-ink);
}

.cw-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding-inline: clamp(18px, 4vw, 54px);
}

/* ---------------------------------------------------------------------
   1 · HERO
   --------------------------------------------------------------------- */
.cw-hero {
  padding-top: calc(var(--nav-h) + clamp(40px, 6vw, 86px));
  padding-bottom: clamp(26px, 3vw, 44px);
}
.cw-hero__eyebrow { margin: 0 0 22px; }
.cw-hero__top {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 72px);
  align-items: flex-end;
  justify-content: space-between;
}
.cw-hero__title {
  margin: 0;
  font-size: clamp(38px, 6.2vw, 78px);
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 15ch;
  text-wrap: balance;
}
.cw-hero__title em { font-style: italic; color: var(--brown); }
.cw-hero__lead {
  margin: 0;
  max-width: 38ch;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.55;
  color: var(--soft);
}

.cw-contrib {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 44px);
  align-items: center;
  margin-top: clamp(30px, 4vw, 54px);
  padding-top: 26px;
  border-top: 1px solid var(--rule);
}
.cw-contrib__label { flex: none; font-size: 10px; letter-spacing: 0.16em; }
.cw-contrib__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  min-height: 28px;
}
.cw-contrib__one { display: flex; align-items: center; gap: 9px; }
.cw-contrib__one span:last-child { font-size: 15px; }
.cw-contrib__more { font-size: 10px; letter-spacing: 0.14em; }

.cw-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  color: #f6f1e6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-tag);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------------
   2 · STICKY FILTER BAR
   --------------------------------------------------------------------- */
.cw-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  background: rgba(243, 238, 227, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cw-bar__inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px clamp(18px, 4vw, 54px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 26px;
}
.cw-tabs { display: flex; gap: 20px; align-items: center; }
.cw-tab {
  border: none;
  background: transparent;
  font-family: var(--f-tag);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 0 6px;
  cursor: pointer;
  color: var(--mono-ink);
  border-bottom: 2px solid transparent;
  transition: color 0.16s, border-color 0.16s;
}
.cw-tab.is-active { color: var(--board); border-bottom-color: var(--accent); }

.cw-bar__sep { width: 1px; height: 20px; background: var(--rule); }

.cw-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 240px; }
.cw-chip {
  border: 1px solid var(--edge);
  background: transparent;
  color: #5a6b5e;
  font-family: var(--f-tag);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 13px;
  cursor: pointer;
  transition: all 0.16s;
}
.cw-chip:hover { border-color: var(--board); }
.cw-chip.is-active { background: var(--board); border-color: var(--board); color: var(--paper); }

.cw-bar__right { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; }
.cw-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--edge);
  background: var(--card);
  padding: 8px 12px;
  min-width: 200px;
}
.cw-search__dot { width: 7px; height: 7px; border-radius: 50%; background: #b7ae9c; flex: none; }
.cw-search input {
  border: none;
  background: transparent;
  font-family: var(--f-tag);
  font-size: 12px;
  letter-spacing: 0.04em;
  width: 100%;
  color: var(--board);
}
.cw-search input:focus { outline: none; }

/* the two headline buttons */
.cw-btn {
  border: none;
  background: var(--board);
  color: var(--paper);
  font-family: var(--f-tag);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.18s;
}
.cw-btn:hover { background: var(--accent); }
.cw-btn--ghost {
  border: 1px solid var(--board);
  background: transparent;
  color: var(--board);
  padding: 15px 26px;
}
.cw-btn--ghost:hover { background: var(--board); color: var(--paper); }
.cw-btn--quiet {
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--board);
  padding: 15px 22px;
}
.cw-btn--quiet:hover { border-color: var(--board); background: transparent; }

/* ---------------------------------------------------------------------
   3 · THE BOARD
   --------------------------------------------------------------------- */
.cw-board {
  background: var(--board);
  padding: clamp(26px, 4vw, 54px) clamp(14px, 4vw, 54px) clamp(60px, 7vw, 110px);
}
.cw-board__inner { max-width: 1500px; margin: 0 auto; }
.cw-board__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: clamp(20px, 3vw, 36px);
}
.cw-board__head .cw-tag { color: var(--on-board); }

.cw-grid { columns: 328px; column-gap: clamp(14px, 1.6vw, 24px); }

.cw-card {
  position: relative;
  width: 100%;
  display: inline-block;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin: 0 0 clamp(14px, 1.6vw, 24px);
  cursor: pointer;
  text-align: left;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--board);
  background: var(--card);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cw-card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.36); }
.cw-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cw-card--poem  { background: var(--brown); color: #f6f1e6; }
.cw-card--prose { background: var(--prose); }

.cw-card__media {
  display: block;
  width: 100%;
  background: repeating-linear-gradient(135deg, #e2dac7 0 9px, #d8ceb8 9px 18px);
}
.cw-card__media img {
  display: block;
  width: 100%;
  height: auto;
}
.cw-card__slot {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--f-tag);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6f6a5d;
  background: rgba(251, 248, 241, 0.9);
  border: 1px solid rgba(111, 106, 93, 0.28);
  padding: 6px 11px;
}
.cw-card__mediawrap { position: relative; }

/* sound posts get a real player rather than a picture of one */
.cw-sound {
  padding: 26px 22px 18px;
  background: repeating-linear-gradient(135deg, #d9dfd3 0 9px, #cdd5c6 9px 18px);
}
.cw-sound audio { width: 100%; display: block; margin-top: 14px; }

.cw-card__text { padding: 26px 24px 6px; }
.cw-card__medium {
  font-family: var(--f-tag);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 18px;
  color: var(--mono-ink);
}
.cw-card--poem .cw-card__medium { color: #d3be9e; }
.cw-card__poem {
  font-style: italic;
  font-size: 20px;
  line-height: 1.6;
  white-space: pre-line;
  color: #f6f1e6;
}
.cw-card__title {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.cw-card__excerpt { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--soft); }

.cw-card__foot { padding: 16px 18px 15px; }
.cw-card--poem .cw-card__foot,
.cw-card--prose .cw-card__foot { padding: 18px 24px 20px; }
.cw-card__foot h3 {
  margin: 0 0 12px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.cw-byline { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cw-byline__who { font-size: 14.5px; }
.cw-byline__when {
  font-family: var(--f-tag);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.62;
  margin-left: auto;
}
.cw-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(127, 127, 127, 0.22);
}
.cw-act {
  border: 1px solid #cfc6b2;
  background: transparent;
  color: #5a6b5e;
  font-family: var(--f-tag);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 8px 11px;
  cursor: pointer;
  transition: all 0.16s;
}
.cw-card--poem .cw-act { border-color: rgba(243, 238, 227, 0.3); color: rgba(243, 238, 227, 0.8); }
.cw-act.is-on { border-color: var(--accent); background: var(--accent); color: var(--card); }
.cw-act.is-on--save { border-color: #2f5240; background: #2f5240; color: var(--card); }
.cw-act--danger { border-color: #a33; color: #a33; margin-left: auto; }

.cw-empty { text-align: center; padding: 90px 20px; color: var(--on-board); }
.cw-empty__tag {
  font-family: var(--f-tag);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.cw-empty__line { font-size: 26px; font-style: italic; color: #c9d6c6; }

/* ---------------------------------------------------------------------
   4 · RULES STRIP
   --------------------------------------------------------------------- */
.cw-rules {
  background: var(--band);
  padding: clamp(40px, 5vw, 72px) clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--rule);
}
.cw-rules__inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  justify-content: space-between;
}
.cw-rules__copy { max-width: 46ch; }
.cw-rules__copy .cw-tag { margin-bottom: 16px; display: block; }
.cw-rules__copy p { margin: 0; font-size: clamp(19px, 2.1vw, 26px); line-height: 1.4; }
.cw-rules__copy em { font-style: italic; color: var(--brown); }

/* ---------------------------------------------------------------------
   5 · MODALS
   --------------------------------------------------------------------- */
@keyframes cwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cwRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cw-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 22, 16, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 3vw, 48px);
  overflow: auto;
  animation: cwFade 0.18s ease;
}
.cw-modal[hidden] { display: none; }
.cw-modal--upload { z-index: 95; }
.cw-modal__panel {
  width: min(1080px, 100%);
  background: var(--card);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
  animation: cwRise 0.24s ease;
  position: relative;
  font-family: var(--f-wall);
  color: var(--board);
}
.cw-modal--upload .cw-modal__panel { width: min(680px, 100%); padding: clamp(24px, 3vw, 42px); }
.cw-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  border: 1px solid var(--edge);
  background: rgba(251, 248, 241, 0.9);
  color: var(--board);
  font-family: var(--f-tag);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
}
.cw-modal__close:hover { background: var(--board); color: var(--paper); }

.cw-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cw-detail__left {
  min-height: clamp(300px, 46vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5ded0;
  padding: 0;
}
.cw-detail__left img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.cw-detail__left--poem  { background: var(--brown); padding: clamp(28px, 3.6vw, 54px); }
.cw-detail__left--prose { background: var(--prose); padding: clamp(28px, 3.6vw, 54px); }
.cw-detail__left--sound { background: repeating-linear-gradient(135deg, #d9dfd3 0 11px, #cdd5c6 11px 22px); padding: clamp(28px, 3.6vw, 54px); flex-direction: column; gap: 18px; }
.cw-detail__left--sound audio { width: 100%; }
.cw-detail__text { font-size: clamp(16px, 1.5vw, 19px); line-height: 1.65; color: #2c3e33; white-space: pre-line; }
.cw-detail__left--poem .cw-detail__text {
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 27px);
  line-height: 1.65;
  color: #f6f1e6;
}
.cw-detail__right { padding: clamp(24px, 3vw, 42px); }
.cw-detail__meta { font-family: var(--f-tag); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mono-ink); margin-bottom: 16px; }
.cw-detail__title {
  margin: 0 0 18px;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.cw-detail__caption { margin: 0 0 26px; font-size: 16.5px; line-height: 1.6; color: var(--soft); }
.cw-detail__by {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid #ddd5c3;
  border-bottom: 1px solid #ddd5c3;
}
.cw-detail__by-name { font-size: 16px; }
.cw-detail__by-when { font-family: var(--f-tag); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mono-ink); margin-top: 3px; }
.cw-detail__acts { display: flex; gap: 8px; flex-wrap: wrap; padding: 18px 0; }

.cw-notes { border-top: 1px solid #ddd5c3; padding-top: 22px; }
.cw-notes__label { font-family: var(--f-tag); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mono-ink); margin-bottom: 18px; }
.cw-notes__list { display: flex; flex-direction: column; gap: 18px; max-height: 260px; overflow: auto; padding-right: 6px; }
.cw-note { display: flex; gap: 11px; }
.cw-note__who { font-size: 14.5px; margin-bottom: 3px; }
.cw-note__text { font-size: 15.5px; line-height: 1.5; color: var(--soft); }
.cw-notes__form { display: flex; gap: 8px; margin-top: 22px; }
.cw-notes__form input {
  flex: 1;
  border: 1px solid var(--edge);
  background: var(--paper);
  padding: 12px 14px;
  font-family: var(--f-tag);
  font-size: 12px;
  color: var(--board);
}
.cw-notes__form button {
  border: none;
  background: var(--board);
  color: var(--paper);
  font-family: var(--f-tag);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 18px;
  cursor: pointer;
}
.cw-notes__form button:hover { background: var(--accent); }

/* ---- upload form --------------------------------------------------- */
.cw-up__eyebrow { font-family: var(--f-tag); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mono-ink); margin-bottom: 14px; }
.cw-up__title {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.cw-up__title em { font-style: italic; color: var(--brown); }
.cw-up__lead { margin: 0 0 28px; font-size: 16px; line-height: 1.55; color: var(--soft); max-width: 46ch; }
.cw-up__label {
  font-family: var(--f-tag);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mono-ink);
  margin-bottom: 10px;
}
.cw-up__kinds { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }

/* the byline comes from the signed-in account, so it is shown, not typed */
.cw-up__as {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  padding: 12px 14px;
  border: 1px solid var(--edge);
  background: var(--band);
  margin-bottom: 24px;
}
.cw-up__as img { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; }
.cw-kind {
  border: 1px solid var(--edge);
  background: transparent;
  color: #5a6b5e;
  font-family: var(--f-tag);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 15px;
  cursor: pointer;
  transition: all 0.16s;
}
.cw-kind.is-active { background: var(--brown); border-color: var(--brown); color: var(--card); }

.cw-up input[type="text"],
.cw-up textarea {
  width: 100%;
  border: 1px solid var(--edge);
  background: var(--paper);
  padding: 14px 16px;
  font-family: var(--f-wall);
  font-size: 17px;
  color: var(--board);
  margin-bottom: 24px;
}
.cw-up textarea { font-size: 16.5px; line-height: 1.55; resize: vertical; }
.cw-up input[type="text"]:focus,
.cw-up textarea:focus { outline: none; border-color: var(--brown); }
.cw-up__place { margin-bottom: 32px !important; }

.cw-drop {
  border: 1px dashed #c0b7a2;
  background: repeating-linear-gradient(135deg, #efe9dc 0 9px, #e8e1d2 9px 18px);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
  padding: 16px;
  text-align: center;
}
.cw-drop:hover { border-color: var(--brown); }
.cw-drop.is-over { border-color: var(--brown); background: rgba(110, 81, 54, 0.08); }
.cw-drop.is-set { border-style: solid; border-color: #2f5240; background: rgba(47, 82, 64, 0.08); }
.cw-drop__label { font-family: var(--f-tag); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: #6f6a5d; }
.cw-drop__preview { max-width: 100%; max-height: 220px; display: block; }
.cw-drop input[type="file"] { display: none; }

.cw-up__foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cw-up__note {
  font-family: var(--f-tag);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b0a894;
  margin-left: auto;
}
.cw-up__error {
  font-family: var(--f-tag);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 16px;
  min-height: 1em;
}

/* ---------------------------------------------------------------------
   6 · TOAST + STATUS
   --------------------------------------------------------------------- */
.cw-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 120;
  background: var(--board);
  color: var(--paper);
  font-family: var(--f-tag);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 14px 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  animation: cwRise 0.2s ease;
}
.cw-toast[hidden] { display: none; }

/* shown when the wall is running without its database. It sits above the
   hero, so it clears the fixed site nav itself and the hero drops the
   offset it would otherwise have carried. */
.cw-offline {
  margin-top: var(--nav-h);
  background: #f6ecd9;
  border-bottom: 1px solid var(--rule);
  padding: 12px clamp(18px, 4vw, 54px);
  font-family: var(--f-tag);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a5a2a;
  text-align: center;
}
.cw-offline[hidden] { display: none; }
.cw-offline:not([hidden]) + .cw-hero { padding-top: clamp(40px, 6vw, 86px); }

.cw-busy { opacity: 0.5; pointer-events: none; }

/* ---------------------------------------------------------------------
   7 · NARROW SCREENS
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .cw-bar__sep { display: none; }
  .cw-bar__right { flex: 1 1 100%; }
  .cw-search { flex: 1; }
}
@media (max-width: 640px) {
  .cw { --nav-h: 58px; }
  .cw-grid { columns: 1; }
  .cw-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .cw-chip { flex: none; }
  .cw-detail { grid-template-columns: 1fr; }
  .cw-modal { padding: 0; }
  .cw-modal__panel { min-height: 100%; }
}
