/* LoveNewHope — the flyer pole.
   Everything on the page is something you could staple, tape, or tear off a
   wooden pole: paper carries all the text, the wood carries none. See DESIGN.md. */

:root {
  /* the pole */
  --wood: #6c4a2e;
  --wood-light: #7c5838;
  --wood-dark: #553821;

  /* paper and ink */
  --paper: #fbfaf6;
  --ink: #1d1b19;
  --ink-soft: #4a4540;
  --marker: #1f4aa0;        /* ballpoint/marker blue for handwriting */
  --note: #ffe45c;          /* the yellow notice */
  --index: #eef4fb;         /* index card */
  --index-rule: #b9cfe8;
  --index-red: #e4574f;

  /* the current event, taken from its flyer. Change these per event. */
  --event: #e8701a;         /* big fills and the wordmark */
  --event-ink: #b4520c;     /* the event color as text on paper (AA) */
  --event-deep: #3b2415;

  --shadow: 0 1px 2px rgba(20, 10, 2, 0.35), 0 10px 22px -6px rgba(20, 10, 2, 0.55);
  --shadow-lift: 0 2px 3px rgba(20, 10, 2, 0.3), 0 18px 30px -8px rgba(20, 10, 2, 0.6);

  --hand: "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  --type: "Archivo", "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--type);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--wood);
  /* weathered grain (an SVG noise texture) over a rounded-pole shading; no text ever sits on this */
  background-image:
    url("/assets/textures/wood-grain.svg"),
    linear-gradient(90deg, var(--wood-dark), var(--wood) 14%, var(--wood-light) 40%, var(--wood) 66%, var(--wood-light) 86%, var(--wood-dark));
  background-size: 520px 520px, 100% 100%;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 3px; }

.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;
}

/* ---------- attachments ---------- */

/* Staples: two on anything .stapled, one (off-center, askew) on .stapled.one */
.stapled { position: relative; }
.stapled::before,
.stapled::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 24px;
  height: 9px;
  background: url("/assets/textures/staple.svg") center / 100% 100% no-repeat;
  z-index: 4;
}
.stapled::before { left: 12px; transform: rotate(-11deg); }
.stapled::after { right: 13px; transform: rotate(7deg); }
.stapled.one::after { display: none; }
.stapled.one::before { left: 23%; transform: rotate(-16deg); }

/* Masking tape: across the top edge of anything .taped */
.taped { position: relative; }
.taped::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 88px;
  height: 25px;
  margin-left: -44px;
  background: url("/assets/textures/masking-tape.svg") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(20, 10, 2, 0.22));
  transform: rotate(-3deg);
  z-index: 4;
}

/* A strip of tape with marker on it: the pole's section headings */
.tape-label {
  display: inline-block;
  margin: 0;
  padding: 0.4rem 1.1rem 0.25rem;
  background: url("/assets/textures/masking-tape.svg") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(20, 10, 2, 0.3));
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(1.2rem, 4.6vw, 1.5rem);
  line-height: 1.2;
  color: var(--ink);
  transform: rotate(-1.5deg);
}

/* ---------- the pole ---------- */

.pole {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "flyer" "details" "why" "year" "snaps" "who";
  row-gap: 1.6rem;
}
/* Papers overlap like a real pole: later ones are stapled over the edges of earlier ones.
   Overlaps land only in padding, never on text or tabs. */
.details { position: relative; z-index: 1; }
.why { position: relative; z-index: 2; margin: -2.6rem 0 0 1.6rem; }
.year { position: relative; z-index: 3; margin-top: -1.2rem; }
.who { position: relative; z-index: 0; margin-top: -0.9rem; padding-top: 1.7rem; }

/* main only groups the content; its children sit on the pole's grid */
.board { display: contents; }

/* header strip */
.masthead {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.7rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: rotate(-0.8deg);
}
.wordmark {
  margin: 0;
  font-family: var(--type);
  font-weight: 900;
  font-stretch: 88%;
  font-size: clamp(1.45rem, 6.4vw, 1.95rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.wordmark span { color: var(--event); }
.lang {
  font-family: var(--hand);
  font-size: 1.05rem;
  color: var(--marker);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.5rem 0.1rem;
}
.lang:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* the flyer and its tear-off tabs */
.flyer {
  grid-area: flyer;
  margin: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: rotate(1.1deg);
}
.flyer img { width: 100%; }

/* A neighbor's handwritten translation, taped over the flyer's QR code (Spanish page).
   It covers the QR code, which only links back to this page, and leaves the projector beam clear. */
.slip {
  position: absolute;
  top: 40.5%;
  right: -0.6rem;
  z-index: 3;
  margin: 0;
  padding: 0.75rem 0.85rem 0.6rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-family: var(--hand);
  font-size: clamp(0.8rem, 3.3vw, 1.02rem);
  white-space: nowrap;
  line-height: 1.2;
  color: var(--ink);
  transform: rotate(3.5deg);
}
.slip strong { font-weight: 400; color: var(--event-ink); font-size: 1.2em; }
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 2px dashed #a19b93;   /* the perforation */
  background: var(--paper);
}
.tab {
  display: grid;
  place-items: center;
  min-height: 4.25rem;
  padding: 0.85rem 0.4rem 1rem;
  font-family: var(--hand);
  font-size: clamp(0.98rem, 3.9vw, 1.12rem);
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 0;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.tab + .tab { box-shadow: inset 1px 0 0 rgba(40, 30, 20, 0.35); }   /* scissor cuts between tabs */
.tab:hover { transform: translateY(5px) rotate(-2.5deg); box-shadow: 0 6px 8px -2px rgba(20, 10, 2, 0.45); position: relative; z-index: 2; }
.tab + .tab:hover { box-shadow: 0 6px 8px -2px rgba(20, 10, 2, 0.45); }
.tab:active { transform: translateY(9px) rotate(-4deg); }
.tab[data-state="done"] { color: var(--marker); }

/* the details, on an index card, as real text */
.details {
  grid-area: details;
  padding: 1.1rem 1.25rem 1.3rem;
  background: var(--index);
  box-shadow: var(--shadow);
  transform: rotate(-0.6deg);
}
/* the heading sits above the card's red rule, however many lines it wraps to */
.details h2 {
  margin: 0 -1.25rem;
  padding: 0 1.25rem 0.55rem;
  border-bottom: 2px solid var(--index-red);
  font-weight: 900;
  font-stretch: 90%;
  font-size: clamp(1.4rem, 5.6vw, 1.75rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
/* Below the red rule, every line of type sits on one of the card's blue rules:
   the rules repeat every 1.9rem and every line is exactly 1.9rem tall. */
.ruled {
  --rule: 1.9rem;
  margin-top: 0.35rem;
  background: repeating-linear-gradient(transparent 0 calc(var(--rule) - 1px), var(--index-rule) calc(var(--rule) - 1px) var(--rule));
  line-height: var(--rule);
}
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 4.6rem 1fr; align-items: baseline; gap: 0 0.5rem; }
.facts dt { font-family: var(--hand); font-size: 0.95rem; color: var(--marker); }
.facts dd { margin: 0; font-weight: 700; font-size: 1.08rem; }
.facts .free strong {
  display: inline-block;
  padding: 0 0.45rem;
  margin-right: 0.35rem;
  line-height: 1.5;
  background: var(--event);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.details .also { margin: 0; color: var(--ink-soft); max-width: 36ch; }

/* the yellow notice: why */
.why {
  grid-area: why;
  padding: 1.5rem 1.3rem 1.3rem;
  background: var(--note);
  box-shadow: var(--shadow);
  transform: rotate(-1.6deg);
}
.why h2 { margin: 0; font-family: var(--hand); font-weight: 400; font-size: 1.1rem; color: var(--ink-soft); }
.why p { margin: 0.35rem 0 0; font-family: var(--hand); font-size: clamp(1.3rem, 5.4vw, 1.6rem); line-height: 1.3; }
.why p + p { font-size: 1.1rem; margin-top: 0.8rem; }

/* every year */
.year { grid-area: year; }
.notices {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: grid;
}
.notice + .notice { margin-top: -0.55rem; }
.notice { position: relative; padding-top: 1.35rem; }
.notice:nth-child(2) { z-index: 1; }
.notice:nth-child(3) { z-index: 2; }
.notice {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.25rem 0.9rem;
  align-items: baseline;
  padding: 1.05rem 1.1rem 0.95rem;
  box-shadow: var(--shadow);
}
.notice:nth-child(1) { background: #fff3b8; transform: rotate(-1deg); margin-right: 1.2rem; }
.notice:nth-child(2) { background: var(--paper); transform: rotate(0.8deg); margin-left: 1.4rem; }
.notice:nth-child(3) { background: #e3f1e4; transform: rotate(-0.5deg); margin-right: 0.6rem; }
.notice .month { font-family: var(--hand); font-size: 1.2rem; line-height: 1.1; }
.notice h3 { margin: 0; font-size: 1.08rem; font-weight: 800; line-height: 1.25; }
.notice p { grid-column: 2; margin: 0; font-size: 0.95rem; color: var(--ink-soft); }
.notice.next .month { color: var(--event-deep); }
.notice.next .month span {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.1rem 0.45rem;
  border: 2px solid var(--event-ink);
  border-radius: 50% 45% 55% 48%;
  font-size: 0.95rem;
  color: var(--event-ink);
  transform: rotate(-6deg);
}

/* snapshots */
.snaps { grid-area: snaps; }
.prints {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 0.6rem;
}
.prints li + li { margin-top: -0.35rem; }   /* laps the paper below the caption, never the caption */
.prints li:nth-child(2) { margin-top: 0; }
.prints li { position: relative; }
.prints .print { padding-top: 0.85rem; }
.prints li:nth-child(even) { z-index: 1; }
.print {
  margin: 0;
  padding: 0.45rem 0.45rem 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.print img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.print.tall img { aspect-ratio: 3 / 4; }
.print figcaption { padding: 0.45rem 0.1rem 0.9rem; font-family: var(--hand); font-size: 0.95rem; line-height: 1.2; }
.print figcaption span { display: block; margin-top: 0.2rem; font-family: var(--type); font-size: 0.8rem; color: var(--ink-soft); }
.prints li:nth-child(1) { grid-column: 1 / -1; transform: rotate(-1.2deg); }
.prints li:nth-child(2) { transform: rotate(1.8deg); }
.prints li:nth-child(3) { transform: rotate(-2deg) translateY(0.8rem); }
.prints li:nth-child(4) { grid-column: 1 / -1; transform: rotate(0.9deg); }
.prints li:nth-child(5) { transform: rotate(-1.4deg); }
.prints li:nth-child(6) { transform: rotate(2.2deg) translateY(0.6rem); }

/* who's behind this: a business card */
.who {
  grid-area: who;
  justify-self: start;
  max-width: 26rem;
  padding: 1.2rem 1.25rem 1.1rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: rotate(0.7deg);
}
.who h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.who p { margin: 0.45rem 0 0; font-size: 0.98rem; color: var(--ink-soft); }
.who a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.who a:hover { color: var(--marker); }
.who address { margin-top: 0.8rem; font-style: normal; font-size: 0.9rem; font-weight: 700; color: var(--ink); }

/* ---------- wider screens: a board, not a pole ---------- */

@media (min-width: 880px) {
  .pole {
    max-width: 70rem;
    padding: 2.5rem 2rem 4rem;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas:
      "head head"
      "flyer details"
      "flyer why"
      "flyer year"
      "snaps snaps"
      "who who";
    column-gap: 3.5rem;
    row-gap: 2.5rem;
    align-items: start;
  }
  .masthead { justify-self: start; min-width: 28rem; }
  .prints { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.1rem; align-items: start; }
  .prints li + li, .prints li:nth-child(2) { margin-top: 0; }
  .prints li:nth-child(n+3) { margin-top: -0.35rem; }
  /* rows: packed house (2) + supplies; bounce castle + dusk crowd (2); obstacle + Whoville (2) */
  .prints li:nth-child(1), .prints li:nth-child(4), .prints li:nth-child(6) { grid-column: span 2; }
  .who { justify-self: start; width: calc((100% - 2.2rem) / 3); margin: -0.9rem 0 0 0.6rem; padding-top: 1.7rem; }
}

/* ---------- the one moment: the flyer goes up ---------- */

@media (prefers-reduced-motion: no-preference) {
  .flyer { animation: pin-up 700ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .flyer.stapled::before, .flyer.stapled::after { animation: staple 160ms 520ms ease-out both; }
  @keyframes pin-up {
    from { transform: translateY(-18px) rotate(-2.5deg) scale(1.03); box-shadow: var(--shadow-lift); }
    to { transform: rotate(1.1deg); }
  }
  @keyframes staple {
    from { opacity: 0; transform: scale(1.8) rotate(0deg); }
  }
}
