/* Noticeboard — a magazine about ordinary days in the city.
   Identity: a civic pinboard. Deep board green, notice-paper slips,
   marker yellow reserved exclusively for "you pinned this". */

@font-face {
  font-family: 'Oswald';
  src: url('assets/oswald.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --board: #17352b;
  --board-deep: #0f241d;
  --board-line: #2d4c40;
  --paper: #faf8f3;
  --paper-edge: #e4e0d4;
  --ink: #16251f;
  --muted: #5c6b62;
  --muted-board: #9db3a6;
  --mark: #efc84a;
  --mark-deep: #c79f1c;

  --sign: 'Oswald', 'Haettenschweiler', 'Arial Narrow', sans-serif;
  --prose: 'Literata', Georgia, 'Times New Roman', serif;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.3125rem;
  --t-xl: 1.625rem;

  --rail-w: 20.5rem;
  --gap: 1.375rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--board);
  color: var(--paper);
  font-family: var(--prose);
  font-size: var(--t-base);
  line-height: 1.6;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--mark);
  color: var(--ink);
  font-family: var(--sign);
  font-size: var(--t-sm);
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.skip:focus-visible {
  outline-color: var(--ink);
}

/* ---------- focus: ink on paper, yellow on board ---------- */

:focus-visible {
  outline: 3px solid var(--mark);
  outline-offset: 2px;
}

.notice :focus-visible,
.reader :focus-visible,
.empty :focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- board shell ---------- */

.board {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  /* paints the rail's column full height even though the rail itself is sticky */
  background: linear-gradient(
    to right,
    var(--board-deep) 0 calc(var(--rail-w) - 1px),
    var(--board-line) calc(var(--rail-w) - 1px) var(--rail-w),
    var(--board) var(--rail-w)
  );
}

/* ---------- rail ---------- */

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.75rem 1.5rem 2rem;
  background: var(--board-deep);
  border-right: 1px solid var(--board-line);
}

.nameplate {
  position: relative;
  padding: 1.5rem 1.25rem 1.1rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.6);
}

/* the nameplate is the first slip pinned to the board: two pins, board-green */
.nameplate::before,
.nameplate::after {
  content: '';
  position: absolute;
  top: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--board-deep);
  box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.35);
}

.nameplate::before {
  left: 0.55rem;
}

.nameplate::after {
  right: 0.55rem;
}

.nameplate__name {
  margin: 0;
  font-family: var(--sign);
  font-weight: 600;
  font-size: clamp(2.9rem, 4.4vw, 4rem);
  line-height: 0.86;
  letter-spacing: -0.012em;
}

.nameplate__name span {
  display: block;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.nameplate__line {
  margin: 0.85rem 0 0;
  max-width: 22ch;
  font-size: var(--t-base);
  line-height: 1.45;
  color: var(--ink);
}

.nameplate__issue {
  margin: 0.4rem 0 0;
  font-family: var(--sign);
  font-weight: 400;
  font-size: var(--t-sm);
  color: var(--muted);
}

.controls {
  margin: 1.75rem 0 0;
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field__label {
  font-family: var(--sign);
  font-weight: 400;
  font-size: var(--t-sm);
  letter-spacing: 0.015em;
  color: var(--muted-board);
}

.field__input,
.field__select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-family: var(--prose);
  font-size: var(--t-base);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 2px;
}

.field__input::placeholder {
  color: #6e756d;
}

.field__select {
  font-family: var(--sign);
  font-weight: 400;
  font-size: var(--t-md);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: right 1rem center, right 0.62rem center;
  background-size: 0.38rem 0.38rem, 0.38rem 0.38rem;
  background-repeat: no-repeat;
  padding-right: 2.1rem;
}

.pinswitch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.1rem;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-family: var(--sign);
  font-weight: 400;
  font-size: var(--t-base);
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--board-line);
  border-radius: 2px;
  cursor: pointer;
}

.pinswitch__pin {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 1px solid var(--muted-board);
}

.pinswitch[aria-pressed='true'] {
  background: var(--mark);
  border-color: var(--mark);
  color: var(--ink);
}

.pinswitch[aria-pressed='true'] .pinswitch__pin {
  background: var(--ink);
  border-color: var(--ink);
}

.pinswitch:hover {
  border-color: var(--mark);
}

/* yellow-on-yellow would vanish once the switch is on */
.pinswitch[aria-pressed='true']:focus-visible {
  outline-color: var(--ink);
}

.tally {
  margin: 1.1rem 0 0;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--muted-board);
}

.tally b {
  font-weight: 400;
  color: var(--paper);
}

.rail__note {
  margin: 1.75rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--board-line);
  font-size: var(--t-xs);
  line-height: 1.55;
  color: var(--muted-board);
}

/* ---------- the wall ---------- */

.wall {
  padding: 1.75rem 2rem 3.5rem;
}

.wall__rest {
  column-count: 3;
  column-gap: var(--gap);
}

.wall__lead:not(:empty) {
  margin-bottom: var(--gap);
}

/* ---------- a notice ---------- */

.notice {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 2px;
  box-shadow: 0 7px 16px -10px rgba(0, 0, 0, 0.55);
}

.wall__rest .notice {
  break-inside: avoid;
  margin-bottom: var(--gap);
}

.notice__inner {
  padding: 1.1rem 1.15rem 1.2rem;
}

.notice__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--sign);
  font-size: var(--t-sm);
  letter-spacing: 0.015em;
}

.notice__topic {
  font-weight: 500;
  color: var(--ink);
}

.notice__mins {
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

.notice__h {
  margin: 0.5rem 0 0;
  font-family: var(--sign);
  font-weight: 500;
  font-size: var(--t-lg);
  line-height: 1.12;
  letter-spacing: -0.005em;
}

.notice__open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration-color: transparent;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 120ms linear;
}

.notice__open:hover,
.notice__open:focus-visible {
  text-decoration-color: var(--mark-deep);
}

.notice__sum {
  margin: 0.6rem 0 0;
  font-size: var(--t-base);
  line-height: 1.62;
  color: #2f3f37;
  max-width: 46ch;
}

.notice__by {
  margin: 0.75rem 0 0;
  font-size: var(--t-sm);
  font-style: italic;
  color: var(--muted);
}

/* pinned marker: the one place yellow appears on paper */
.notice__pin {
  position: absolute;
  top: -0.3rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.14rem 0.5rem 0.18rem;
  background: var(--mark);
  color: var(--ink);
  font-family: var(--sign);
  font-weight: 500;
  font-size: var(--t-xs);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.5);
}

/* only notices without a picture need to make room for the tag */
.notice--pinned:not(.notice--pic) .notice__inner {
  padding-top: 1.5rem;
}

.notice__figure {
  margin: 0;
}

.notice__figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* slips: the three- and four-minute reads */
.notice--slip .notice__h {
  font-size: var(--t-md);
}

/* the lead notice */
.notice--lead {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 14fr);
  align-items: stretch;
}

.notice--lead .notice__figure img {
  height: 100%;
  min-height: 15rem;
  aspect-ratio: auto;
  border-bottom: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.notice--lead .notice__inner {
  padding: 1.6rem 1.9rem 1.75rem;
  align-self: center;
}

.notice--lead .notice__h {
  font-size: clamp(1.75rem, 2.5vw, 2.4rem);
  line-height: 1.04;
  margin-top: 0.6rem;
}

.notice--lead .notice__sum {
  font-size: var(--t-md);
  line-height: 1.6;
  max-width: 44ch;
}

/* ---------- empty state ---------- */

.empty {
  max-width: 34rem;
  padding: 1.5rem 1.6rem 1.75rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  box-shadow: 0 7px 16px -10px rgba(0, 0, 0, 0.55);
}

.empty__head {
  margin: 0;
  font-family: var(--sign);
  font-weight: 500;
  font-size: var(--t-xl);
  line-height: 1.12;
}

.empty__body {
  margin: 0.6rem 0 1.15rem;
  max-width: 48ch;
  line-height: 1.62;
  color: #2f3f37;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  font-family: var(--sign);
  font-weight: 400;
  font-size: var(--t-base);
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn--board {
  background: var(--ink);
  color: var(--paper);
}

.btn--board:hover {
  background: var(--board);
}

.btn__pin {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 1px solid currentColor;
}

.btn--pin[aria-pressed='true'] {
  background: var(--mark);
  border-color: var(--mark-deep);
}

.btn--pin[aria-pressed='true'] .btn__pin {
  background: var(--ink);
}

.btn--pin[aria-pressed='true']:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------- reading view ---------- */

.reader {
  width: min(46rem, calc(100vw - 3rem));
  max-height: min(90vh, 58rem);
  margin: auto;
  padding: 0;
  overflow: hidden auto;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-radius: 2px;
  box-shadow: 0 2.5rem 5rem -1.5rem rgba(0, 0, 0, 0.7);
}

.reader::backdrop {
  background: rgba(8, 24, 18, 0.74);
}

.reader__bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-edge);
}

.reader__sheet {
  padding: 1.6rem 1.75rem 2.5rem;
}

.reader__topic {
  margin: 0;
  font-family: var(--sign);
  font-weight: 500;
  font-size: var(--t-sm);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.reader__title {
  margin: 0.35rem 0 0;
  max-width: 28ch;
  font-family: var(--sign);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  line-height: 1.04;
  letter-spacing: -0.008em;
}

.reader__dek {
  margin: 0.9rem 0 0;
  max-width: 48ch;
  font-size: var(--t-md);
  line-height: 1.55;
  color: #2f3f37;
}

.reader__meta {
  margin: 1.1rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--paper-edge);
  font-size: var(--t-sm);
  font-style: italic;
  color: var(--muted);
}

.reader__figure {
  margin: 1.5rem 0 0;
}

.reader__figure img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 2px;
}

.reader__figure figcaption {
  margin-top: 0.5rem;
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--muted);
}

.reader__body {
  margin-top: 1.6rem;
  max-width: 62ch;
}

.reader__body p {
  margin: 0 0 1.15rem;
  font-size: var(--t-md);
  line-height: 1.78;
}

.reader__body p:first-child::first-letter {
  float: left;
  margin: 0.34rem 0.5rem 0 0;
  font-family: var(--sign);
  font-weight: 500;
  font-size: 3.4rem;
  line-height: 0.76;
}

.reader__body p:last-child {
  margin-bottom: 0;
}

/* ---------- motion: one orchestrated pin-up on load ---------- */

@media (prefers-reduced-motion: no-preference) {
  .is-pinning .notice {
    animation: pinup 260ms cubic-bezier(0.2, 0.75, 0.3, 1) backwards;
    animation-delay: calc(var(--i, 0) * 25ms);
  }

  @keyframes pinup {
    from {
      opacity: 0;
      transform: translateY(-0.6rem) scale(0.985);
    }
  }

  .reader[open] {
    animation: lift 200ms ease-out;
  }

  @keyframes lift {
    from {
      opacity: 0;
      transform: translateY(0.75rem);
    }
  }
}

/* ---------- 1024 and below: two columns on the wall ---------- */

@media (max-width: 1180px) {
  :root {
    --rail-w: 17.5rem;
  }

  .wall__rest {
    column-count: 2;
  }

  .wall {
    padding: 1.5rem 1.5rem 3rem;
  }
}

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  .board {
    display: block;
    background: var(--board);
  }

  .rail {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 1.25rem 1.25rem 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--board-line);
  }

  .nameplate {
    padding: 1.25rem 1.1rem 1rem;
  }

  .nameplate__name {
    font-size: 2.9rem;
  }

  /* one line on a narrow screen: Oswald is condensed enough to carry it */
  .nameplate__name span {
    display: inline;
  }

  .nameplate__line {
    margin-top: 0.5rem;
    max-width: 32ch;
  }

  .controls {
    margin-top: 1.1rem;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
  }

  .field:first-of-type {
    grid-column: 1 / -1;
  }

  .pinswitch {
    align-self: end;
    margin-top: 0;
    padding: 0.62rem 0.6rem;
    font-size: var(--t-sm);
  }

  .tally {
    margin-top: 0.9rem;
  }

  .rail__note {
    margin-top: 0.9rem;
    padding-top: 0.7rem;
  }

  .wall {
    padding: 1.25rem 1.25rem 3rem;
  }

  .wall__rest {
    column-count: 1;
  }

  .notice--lead {
    grid-template-columns: minmax(0, 1fr);
  }

  /* shallower crop so the lead headline reaches the first screen */
  .notice--lead .notice__figure img {
    min-height: 0;
    aspect-ratio: 2 / 1;
    border-right: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .notice--lead .notice__inner {
    padding: 1.2rem 1.2rem 1.35rem;
  }

  .notice--lead .notice__h {
    font-size: 1.75rem;
  }

  .reader {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .reader__bar {
    padding: 0.75rem 1.1rem;
  }

  .reader__sheet {
    padding: 1.35rem 1.1rem 2.5rem;
  }

  .reader__title {
    max-width: none;
  }
}
