/* The Continental Observer — small-town Montana weekly, printed (not really) on newsprint. */

:root {
  --paper: #ecebe5;        /* newsprint: grey, not cream */
  --paper-deep: #e2e0d8;   /* boxes and photo backing */
  --ink: #1d1d1b;
  --ink-soft: #4c4b46;
  --rule: #1d1d1b;
  --hairline: #b5b2a8;
  --press-red: #a3241b;    /* the one spot color */
  --head: "Old Standard TT", "Times New Roman", serif;
  --body: "Source Serif 4", Georgia, serif;
  --page: 74rem;
  color-scheme: light;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--press-red); }
:focus-visible { outline: 2px solid var(--press-red); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* ---------- masthead ---------- */
.masthead {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.75rem 1rem 0;
  display: grid;
  grid-template-columns: 1fr minmax(0, 40rem) 1fr;
  align-items: center;
  gap: 1.25rem;
}
.flag img { width: 100%; height: auto; mix-blend-mode: multiply; } /* logo has a white background */
.ear {
  border: 1px solid var(--rule);
  padding: .6rem .75rem;
  font: 400 .8rem/1.35 var(--body);
  max-width: 13rem;
}
.ear-left { justify-self: start; }
.ear-right { justify-self: end; text-align: right; }
.ear-head {
  font: 700 .8rem/1.2 var(--head);
  font-variant-caps: all-small-caps;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: .3rem;
  margin-bottom: .35rem;
}
.folio {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 -5px 0 -4px var(--rule); /* thin rule above the thick one */
  margin-top: .75rem;
  padding: .35rem 0;
  font: 400 .85rem/1.3 var(--head);
  font-variant-caps: small-caps;
  letter-spacing: .04em;
}
.folio span:nth-child(2) { text-align: center; }
.folio span:last-child { text-align: right; font-style: italic; font-variant-caps: normal; }

/* ---------- section nav ---------- */
.sections {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1rem;
}
.sections ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: 1px solid var(--rule);
  padding: .45rem 0;
}
.sections li + li::before { content: "·"; color: var(--ink-soft); padding: 0 .6rem; }
.sections a {
  font: 400 .95rem/1.6 var(--head);
  font-variant-caps: small-caps;
  letter-spacing: .03em;
  text-decoration: none;
}
.sections a[aria-current="page"] { color: var(--press-red); text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- page ---------- */
.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.75rem 1rem 0;
}

.kicker {
  font: 700 .8rem/1.2 var(--head);
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--press-red);
  margin-bottom: .35rem;
}
.kicker a { text-decoration: none; }
.byline {
  font: 400 .85rem/1.4 var(--body);
  color: var(--ink-soft);
}
.byline strong { color: var(--ink); font-weight: 600; }

/* ---------- front page: lead + briefs ---------- */
.above-fold {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  gap: 0 2rem;
  padding-bottom: 2rem;
  border-bottom: 3px double var(--rule);
}
.lead { padding-right: 2rem; border-right: 1px solid var(--rule); }
.lead-head {
  font: 700 clamp(2.1rem, 4.6vw, 3.6rem)/1.02 var(--head);
  letter-spacing: -.01em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.lead-head a { text-decoration: none; }
.lead-head a:hover { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; }
.lead-photo { margin: 0 0 .75rem; background: var(--paper-deep); }
.lead-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; filter: grayscale(.15) contrast(1.03); }
.lead-photo figcaption, .article-photo figcaption, .article-content figcaption {
  font: italic 400 .85rem/1.4 var(--body);
  color: var(--ink-soft);
  padding: .4rem 0 0;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: .5rem;
}
.lead .byline { margin-bottom: .6rem; }
.lead-text { font-size: 1.15rem; line-height: 1.55; max-width: 40rem; }
.jump { margin-top: .6rem; font: italic 400 .95rem var(--head); }
.jump a { color: var(--press-red); }

.rail-head {
  font: 700 1.05rem/1.2 var(--head);
  font-variant-caps: all-small-caps;
  letter-spacing: .1em;
  text-align: center;
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: .35rem 0;
  margin-bottom: 1rem;
}
.brief { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--hairline); }
.brief:last-child { border-bottom: 0; margin-bottom: 0; }
.brief h3 { font: 700 1.3rem/1.15 var(--head); margin-bottom: .4rem; text-wrap: balance; }
.brief h3 a { text-decoration: none; }
.brief h3 a:hover { text-decoration: underline; }
.brief p:not(.kicker):not(.byline) { font-size: .95rem; line-height: 1.5; margin-bottom: .35rem; }

/* ---------- column stories ---------- */
.section-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.75rem 0 1.25rem;
  font: 700 1.05rem/1 var(--head);
  font-variant-caps: all-small-caps;
  letter-spacing: .1em;
}
.section-rule::before, .section-rule::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

.columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}
.story {
  padding: 0 1.5rem 1.5rem;
  border-left: 1px solid var(--hairline);
  margin-bottom: 1.5rem;
}
.columns .story:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
.columns .story:nth-child(3n) { padding-right: 0; }
.story h3 { font: 700 1.45rem/1.12 var(--head); margin-bottom: .45rem; text-wrap: balance; }
.story h3 a { text-decoration: none; }
.story h3 a:hover { text-decoration: underline; }
.story .byline { margin-bottom: .5rem; }
.story > p:last-child { font-size: .97rem; line-height: 1.55; hyphens: auto; }
.story-photo { display: block; margin-bottom: .75rem; background: var(--paper-deep); }
.story-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; filter: grayscale(.15) contrast(1.03); }

.section-front {
  text-align: center;
  border-bottom: 3px double var(--rule);
  padding-bottom: 1rem;
  margin-bottom: 1.75rem;
}
.section-front h1 { font: 700 clamp(2.2rem, 5vw, 3.4rem)/1.05 var(--head); margin-bottom: .35rem; }
.section-front p { font: italic 400 1rem var(--head); color: var(--ink-soft); }

.pagination {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding: 1rem 0;
  margin-top: .5rem;
  font: italic 400 1.05rem var(--head);
}
.pagination a:only-child { margin-left: auto; }

/* ---------- article ---------- */
.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 0 3rem;
  align-items: start;
}
.article-page { max-width: 42rem; margin: 0 auto; width: 100%; }
.article-header { text-align: center; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.article-header h1 {
  font: 700 clamp(2rem, 5vw, 3.2rem)/1.05 var(--head);
  letter-spacing: -.01em;
  margin: .2rem 0 .9rem;
  text-wrap: balance;
}
.article-header .byline time { display: block; margin-top: .15rem; }
.byline-role { font-style: italic; }
.byline-role::before { content: ", "; font-style: normal; }

.article-photo { margin: 0 0 1.5rem; background: var(--paper-deep); }
.article-photo img { width: 100%; filter: grayscale(.1) contrast(1.03); }

.article-content { font-size: 1.15rem; line-height: 1.7; hyphens: auto; }
.article-content p { margin-bottom: 1.05em; }
.article-content > p:first-of-type::first-letter {
  font: 700 3.6em/.8 var(--head);
  float: left;
  padding: .08em .1em 0 0;
}
.article-content h2, .article-content h3 { font: 700 1.5rem/1.2 var(--head); margin: 1.6em 0 .5em; }
.article-content figure { margin: 1.5rem 0; background: var(--paper-deep); }
.article-content img { width: 100%; height: auto; }
.article-content blockquote {
  margin: 1.5rem 0;
  padding: .75rem 0;
  border-top: 2px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font: italic 400 1.35rem/1.4 var(--head);
  text-align: center;
}
.article-content a { color: var(--press-red); }
.end-mark { text-align: right; font-size: .7rem; margin: -.4rem 0 1.5rem; }

.social-share {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.25rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: .6rem 0;
  font: 400 .95rem var(--head);
}
.social-share p { font-variant-caps: all-small-caps; font-weight: 700; letter-spacing: .08em; }

.rail { position: sticky; top: 1.5rem; }
.rail .brief h3 { font-size: 1.15rem; }

/* ---------- plain pages ---------- */
.page-content { max-width: 42rem; margin: 0 auto 2rem; }
.page-content h1 {
  font: 700 clamp(2rem, 5vw, 3rem)/1.05 var(--head);
  text-align: center;
  border-bottom: 3px double var(--rule);
  padding-bottom: .9rem;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
.page-content h2 { font: 700 1.4rem/1.2 var(--head); margin: 1.75rem 0 .5rem; }
.page-content p { font-size: 1.1rem; line-height: 1.7; margin-bottom: 1em; }
.page-content a { color: var(--press-red); }

/* ---------- colophon ---------- */
.colophon {
  max-width: var(--page);
  margin: 3rem auto 0;
  padding: 1.5rem 1rem 3rem;
  border-top: 3px double var(--rule);
  text-align: center;
  font: 400 .9rem/1.5 var(--body);
  color: var(--ink-soft);
}
.colophon-flag { width: min(16rem, 70%); margin: 0 auto 1rem; opacity: .85; mix-blend-mode: multiply; }
.colophon p { max-width: 38rem; margin: 0 auto .5rem; }
.disclaimer { font-style: italic; }
.colophon-links { display: flex; justify-content: center; gap: 1.5rem; font: 400 1rem var(--head); font-variant-caps: small-caps; }
.copyright { font-size: .8rem; margin-top: 1rem !important; }

/* ---------- smaller screens ---------- */
@media (max-width: 60rem) {
  .story-layout { grid-template-columns: 1fr; }
  .rail { position: static; max-width: 42rem; margin: 2.5rem auto 0; width: 100%; }
  .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns .story { border-left: 1px solid var(--hairline); padding: 0 1.25rem 1.25rem; }
  .columns .story:nth-child(3n + 1), .columns .story:nth-child(3n) { padding: 0 1.25rem 1.25rem; border-left: 1px solid var(--hairline); }
  .columns .story:nth-child(2n + 1) { border-left: 0; padding-left: 0; }
  .columns .story:nth-child(2n) { padding-right: 0; }
}

@media (max-width: 46rem) {
  .masthead { grid-template-columns: 1fr 1fr; padding-top: 1.25rem; gap: .75rem; }
  .flag { grid-column: 1 / -1; grid-row: 1; }
  .ear { max-width: none; font-size: .75rem; }
  .ear-left { justify-self: stretch; }
  .ear-right { justify-self: stretch; }
  .folio { flex-direction: column; align-items: center; gap: .1rem; text-align: center; }
  .folio span { text-align: center !important; }
  .sections ul { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sections li { white-space: nowrap; }
  .above-fold { grid-template-columns: 1fr; }
  .lead { padding-right: 0; border-right: 0; border-bottom: 1px solid var(--rule); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
  .columns { grid-template-columns: 1fr; }
  .columns .story, .columns .story:nth-child(n) { border-left: 0; padding: 0 0 1.25rem; border-bottom: 1px solid var(--hairline); }
  .article-content { font-size: 1.08rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  .sections, .social-share, .rail, .skip { display: none; }
  body { background: #fff; }
}
