/* Northborough Government News: a light newspaper look, system fonts only. */

:root {
  --paper: #fdfcf8;
  --ink: #1b1b1b;
  --muted: #5d5a54;
  --rule: #d9d4c7;
  --accent: #8a1c1c;
  --link: #1d4f91;
  --box: #f3efe4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --headline: "Charter", "Bitstream Charter", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161513;
    --ink: #ebe8e1;
    --muted: #a9a49a;
    --rule: #3a3731;
    --accent: #e38b7a;
    --link: #8fb4e8;
    --box: #211f1b;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--serif);
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem; z-index: 10; }

/* Masthead */

.masthead {
  border-bottom: 3px double var(--ink);
  padding: 1.5rem 1rem 0;
  text-align: center;
}
.site-name {
  font: 700 clamp(1.8rem, 5vw, 3rem)/1.1 var(--headline);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
  font: italic 1rem var(--serif);
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
  max-width: 70rem;
  margin: 0 auto;
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink); text-decoration: none; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-search { display: flex; gap: 0.25rem; }
.site-search input, .filters input, .filters select {
  font: inherit;
  font-family: var(--sans);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}
button {
  font: 600 0.85rem var(--sans);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--box);
  color: var(--ink);
  cursor: pointer;
}
button:hover { border-color: var(--muted); }

/* Page */

main {
  max-width: 70rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1, h2, h3, .headline { font-family: var(--headline); line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0.2rem 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--rule); }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.3rem; }
.headline a { color: var(--ink); text-decoration: none; }
.headline a:hover { color: var(--accent); }

.kicker {
  margin: 0;
  font: 600 0.75rem/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.note { color: var(--muted); font-size: 0.85rem; font-style: italic; }
.notice { background: var(--box); border-left: 3px solid var(--accent); padding: 0.75rem 1rem; }
.lede { font-size: 1.15rem; }
.more { font: 600 0.85rem var(--sans); text-decoration: none; }
.meeting-name { margin: 0 0 0.5rem; font: 600 1rem var(--sans); color: var(--muted); }

/* Home */

.about-box {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  background: var(--box);
  border-top: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.about-box p { margin: 0; max-width: 52rem; }

.lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
/* No picture yet: the story takes the width, at a readable measure. */
.lead:not(:has(.lead-image)) { grid-template-columns: minmax(0, var(--measure)); }
.lead .headline { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: 0.3rem 0 0.6rem; border: 0; padding: 0; }
.lead-image img, .player img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }

.stories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 0;
}
.story { border-left: 1px solid var(--rule); padding-left: 1rem; }
.story:first-child { border-left: 0; padding-left: 0; }
.story .headline { margin-top: 0.3rem; }
.story .lede {
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.headline-list { list-style: none; padding: 0; columns: 2 22rem; column-gap: 2rem; }
.headline-list li { break-inside: avoid; margin-bottom: 0.75rem; }
.headline-list a { font-family: var(--headline); font-weight: 700; }
.headline-list .kicker { display: block; color: var(--muted); }
.all-meetings { border-top: 1px solid var(--rule); padding-top: 1rem; }

/* Meeting */

.meeting-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(16rem, 22rem);
  gap: 2.5rem;
  justify-content: space-between;
  align-items: start;
}
.meeting { grid-column: 1; grid-row: 1; }
.meeting ul { padding-left: 1.2rem; }
.meeting li { margin-bottom: 0.4rem; }
.links a { font: 600 0.85rem var(--sans); margin-right: 1rem; }
a.t { white-space: nowrap; }
.oml h2 { color: var(--accent); }

.player-wrap { grid-column: 2; grid-row: 1; position: sticky; top: 1rem; }
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .play { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: #222; }
.player .play img { height: 100%; opacity: 0.85; }
.play-icon {
  position: absolute;
  left: 50%; top: 50%;
  width: 4rem; height: 2.8rem;
  margin: -1.4rem 0 0 -2rem;
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.75);
}
.play-icon::after {
  content: "";
  position: absolute;
  left: 1.65rem; top: 0.8rem;
  border-style: solid;
  border-width: 0.6rem 0 0.6rem 1rem;
  border-color: transparent transparent transparent #fff;
}
.play:hover .play-icon, .play:focus-visible .play-icon { background: var(--accent); }
.player-controls { display: flex; gap: 0.75rem; align-items: baseline; margin: 0.5rem 0 0; }
.player-controls .note { margin: 0; font-size: 0.75rem; }

/* Larger player: full width above the text. */
.player-large .meeting-layout { grid-template-columns: minmax(0, 1fr); }
.player-large .player-wrap { grid-column: 1; grid-row: 1; position: static; }
.player-large .meeting { grid-row: 2; max-width: var(--measure); }

/* All meetings */

.filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; font: 0.9rem var(--sans); margin-bottom: 0.5rem; }
.filters label { display: flex; flex-direction: column; gap: 0.2rem; font-weight: 600; }
.meeting-list { list-style: none; padding: 0; margin: 0; }
.meeting-list li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.meeting-list .headline { margin: 0.2rem 0; font-size: 1.2rem; }
.snippet { margin: 0.2rem 0 0; font-size: 0.95rem; color: var(--muted); }
.snippet:empty { display: none; }
mark { background: #f6e3a1; color: inherit; padding: 0 0.1em; }
@media (prefers-color-scheme: dark) { mark { background: #6b5a1e; } }

/* People */

table.people { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.people th { text-align: left; font: 600 0.75rem var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 2px solid var(--ink); padding: 0.4rem 0.5rem; }
table.people td { border-bottom: 1px solid var(--rule); padding: 0.5rem; vertical-align: top; }
.appearances { list-style: none; padding: 0; }
.appearances li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.appearances a { font-family: var(--headline); font-weight: 700; }
.stats { font: 0.9rem var(--sans); color: var(--muted); }

.about { max-width: var(--measure); }

.site-footer {
  max-width: 70rem;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font: 0.85rem/1.5 var(--sans);
}

/* Narrow screens: one column, the video full width at the top; while it
   plays, it stays there and the text scrolls under it. */

@media (max-width: 50rem) {
  .lead { grid-template-columns: minmax(0, 1fr); }
  .meeting-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .player-wrap {
    grid-column: 1; grid-row: 1;
    position: static;
    margin: 0 -1rem; padding: 0 0 0.5rem;
    background: var(--paper);
  }
  /* Pinned only while playing. */
  .video-playing .player-wrap {
    position: sticky; top: 0; z-index: 5;
    box-shadow: 0 6px 6px -6px rgba(0, 0, 0, 0.25);
  }
  .player-wrap .player { border-radius: 0; }
  .player-controls { padding: 0 1rem; }
  /* Once it's playing, the note about YouTube has done its job: more room for the text. */
  .video-started .player-controls { display: none; }
  .video-started .player-wrap { padding-bottom: 0; }
  .meeting { grid-row: 2; }
  .player-controls .size { display: none; }
  .story { border-left: 0; padding-left: 0; }
  table.people th:nth-child(2), table.people td:nth-child(2) { display: none; }
}
