/* ====================================================================
   Design tokens
   Subject: a community bulletin board — the kind of cork board at a
   coffee shop or community center where local orgs pin flyers for their
   events. Cards read as pinned paper, not app cards.
   ==================================================================== */
:root {
  /* paper + ink */
  --paper: #f6efe2;
  --paper-card: #fffbf2;
  --ink: #221d18;
  --ink-soft: #6b6256;
  --line: #ddd2bb;

  /* category accents — six named hues, reused thematically across
     categories rather than one unique color per category, so the board
     stays calm and the color-coding still means something at a glance */
  --hue-pride: #e2492f;     /* Pride & Festivals */
  --hue-warm: #e8a33d;      /* Social & Game Nights, Fundraisers */
  --hue-teal: #2f8f7a;      /* Sports & Recreation, Support & Wellness */
  --hue-violet: #6b5ca5;    /* Youth & Family, Arts & Drag */
  --hue-indigo: #44456b;    /* Advocacy & Action, Meetings, Faith & Community */
  --hue-neutral: #8b8378;   /* Awareness Days, Other */

  --font-display: 'Archivo Black', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Space Mono', monospace;

  --radius: 3px;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  /* Paper + dot texture lives on html so body::before (the flag) can sit
     between the two without body's background painting over it. */
  background: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(34,29,24,0.06) 1px, transparent 0);
  background-size: 22px 22px;
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: var(--hue-indigo); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--hue-pride);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- masthead ---------- */
.masthead {
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
}
.masthead-inner { max-width: 720px; margin: 0 auto; }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.wordmark {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  margin: 0;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---------- toolbar ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

/* Flag starts at the masthead border. --masthead-h is set by app.js.
   Visual center is positioned at masthead_height + half the viewport height
   so the flag's top edge aligns with the black border line. */
body::before {
  content: '';
  position: fixed;
  top: calc(var(--masthead-h, 180px) + 50vh);
  left: 50%;
  width: 100vh;
  height: min(100vw, 1080px);
  transform: translate(-50%, -50%) rotate(90deg);
  background-image: url('/progress-pride-flag.jpg');
  background-size: cover;
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;           /* chips wrap to additional rows — no scrolling */
  gap: 0.5rem;
  flex: 1 1 100%;
}
.chip {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border: 1.5px solid var(--ink);
  background: var(--paper-card);
  color: #000;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active { background: var(--ink); color: var(--paper-card); }

/* Mobile category select — hidden on desktop */
.category-select-label { display: none; }
.category-select {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.45rem 0.8rem;
  background: var(--paper-card);
  color: var(--ink);
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23221d18' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}

.search {
  flex: 0 0 auto;
  margin-left: auto;
}
.search input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  min-width: 220px;
  background: var(--paper-card);
  color: #000;
}

.status-line {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

/* ---------- board + flyer cards ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem 1.5rem;
}

.flyer {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent, var(--hue-neutral));
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem;
  box-shadow: 0 6px 14px -8px rgba(34,29,24,0.35);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.15s ease;
}
.flyer:hover { transform: rotate(var(--tilt, 0deg)) translateY(-2px); }

.flyer::before {
  /* the pin */
  content: '';
  position: absolute;
  top: -7px;
  left: 1.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent, var(--hue-neutral));
  box-shadow: 0 2px 3px rgba(0,0,0,0.35);
}

.flyer-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}
.flyer-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.flyer-meta {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.flyer-desc {
  font-size: 0.92rem;
  margin: 0 0 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.flyer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.flyer-category {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent, var(--hue-neutral));
}
.flyer-source { color: var(--ink-soft); text-decoration: none; }
.flyer-source:hover { text-decoration: underline; }

.board-empty {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  padding: 3rem 1rem;
  text-align: center;
  grid-column: 1 / -1;
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--paper);
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .flyer { transform: none; transition: none; }
  .flyer:hover { transform: none; }
}

@media (max-width: 600px) {
  /* Swap chip row for the compact select on small screens */
  .filters { display: none; }
  .category-select-label { display: block; flex: 1 1 100%; }

  .search input { min-width: 0; width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .search { margin-left: 0; }
}
