/* ──────────────────────────────────────────────────────────────
   My Bear Was My Bodyguard
   Palette taken from the photos: the bear's navy knit jumper,
   his oatmeal fur, the pale-blue camo coat, army olive and the
   amber beacon on the missile launcher.
   ────────────────────────────────────────────────────────────── */

:root {
  --navy: #22305e;      /* the jumper */
  --navy-deep: #18214a;
  --ink: #1d2444;       /* body text */
  --paper: #eef1f4;     /* cool museum-floor grey */
  --white: #fbfcfd;
  --sky: #b9c8de;       /* camo coat highlight */
  --sky-soft: #dce4ef;
  --fur: #e6d5b5;       /* the bear */
  --fur-soft: #f1e8d6;
  --olive: #5a6138;
  --olive-soft: #dfe1cc;
  --amber: #f0a01e;     /* the beacon */
  --muted: #535d7a;
  --rule: rgb(34 48 94 / 0.16);

  --font-display: Rockwell, "Rockwell Nova", "Roboto Slab", "Zilla Slab", "DejaVu Serif", Georgia, serif;
  --font-body: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Noto Serif", Georgia, serif;
  --font-ui: "Avenir Next", Avenir, "Segoe UI", "Noto Sans", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.1875rem;   /* 19px body */
  --step-1: 1.4rem;
  --step-2: 1.85rem;
  --step-3: clamp(2.1rem, 4.5vw, 2.9rem);
  --step-4: clamp(2.6rem, 7vw, 5rem);

  --wrap: 72rem;
  --narrow: 44rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* the rib-knit of the jumper, used on the navy bands */
  --rib: repeating-linear-gradient(90deg, rgb(255 255 255 / 0.035) 0 5px, transparent 5px 11px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0) / 1.65 var(--font-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--amber); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--amber); color: var(--navy-deep);
  padding: 0.5rem 1rem; font: 600 1rem var(--font-ui); border-radius: 0 0 6px 6px;
}
.skip:focus { top: 0; }

/* ── Masthead ─────────────────────────────────────────────── */
.masthead { background: var(--navy) var(--rib); color: var(--white); }
.masthead__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 2rem; padding-block: 0.9rem;
}
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  font: 700 1.15rem/1.1 var(--font-display); text-decoration: none;
}
.brand img {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--fur); box-shadow: 0 0 0 2px var(--fur);
}
.masthead nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.masthead nav a {
  font: 500 1rem/1 var(--font-ui); text-decoration: none; padding-block: 0.5rem;
  display: inline-block; border-bottom: 2px solid transparent;
}
.masthead nav a:hover { border-bottom-color: var(--sky); }
.masthead nav a[aria-current="page"] { border-bottom-color: var(--amber); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block; font: 600 1rem/1.2 var(--font-ui);
  padding: 0.8rem 1.25rem; border-radius: 999px; text-decoration: none;
  background: var(--navy); color: var(--white); border: 2px solid var(--navy);
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); }
.btn--light { background: var(--fur); color: var(--navy-deep); border-color: var(--fur); }
.btn--light:hover { background: var(--white); border-color: var(--white); }
.btn--ghost { background: transparent; color: var(--white); border-color: rgb(255 255 255 / 0.45); }
.btn--ghost:hover { background: rgb(255 255 255 / 0.08); border-color: var(--white); }
.btn--plain { background: transparent; color: var(--navy); }
.btn--plain:hover { background: var(--sky-soft); border-color: var(--navy); }

/* ── Home hero: the one loud moment ───────────────────────── */
.hero { background: var(--navy) var(--rib); color: var(--white); position: relative; overflow: hidden; }
.hero__inner {
  display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: end; gap: 2rem;
  padding-top: clamp(2.5rem, 6vw, 5rem);
}
.hero__text { padding-bottom: clamp(3rem, 7vw, 6rem); }
.hero h1 { font-size: var(--step-4); line-height: 1.02; letter-spacing: -0.02em; max-width: 11ch; margin-bottom: 0.4em; }
.hero__lede { font-size: var(--step-1); line-height: 1.5; max-width: 32ch; color: var(--sky-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero__figure { margin: 0; align-self: end; }
.hero__img {
  /* the photo's cut-off edge sits exactly on the bottom of the band,
     so it reads as standing just behind it */
  width: 100%; max-width: 34rem; margin-inline: auto;
  filter: drop-shadow(-14px 0 30px rgb(10 16 40 / 0.35));
}

/* ── Sections ─────────────────────────────────────────────── */
.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section + .section { padding-top: 0; }
.section--tint { background: var(--sky-soft); }
.section__title { font-size: var(--step-2); margin-bottom: 1.25rem; }
.more { margin-top: 1.5rem; font-family: var(--font-ui); font-weight: 600; }

/* ── Post list ────────────────────────────────────────────── */
.postlist { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.postlist__item {
  display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.25rem 2rem;
  padding-block: 1.5rem; border-top: 1px solid var(--rule);
}
.postlist__item:last-child { border-bottom: 1px solid var(--rule); }
.postlist time { font: 500 var(--step--1)/1.9 var(--font-ui); color: var(--muted); }
.postlist h3 { font-size: var(--step-1); margin-bottom: 0.35em; }
.postlist h3 a { text-decoration: none; }
.postlist h3 a:hover { text-decoration: underline; text-decoration-color: var(--amber); }
.postlist p { margin-bottom: 0.5em; max-width: 60ch; }
.empty { font-style: italic; color: var(--muted); }

.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem;
  font: 500 var(--step--1)/1.4 var(--font-ui); color: var(--muted); margin: 0;
}
.pill {
  display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px;
  font: 600 0.8125rem/1.4 var(--font-ui); color: var(--navy-deep); text-decoration: none;
  background: var(--tone, var(--sky));
}
.pill:hover { box-shadow: inset 0 0 0 2px var(--navy); }

[data-tone="sky"]   { --tone: var(--sky);   --tone-soft: var(--sky-soft); }
[data-tone="fur"]   { --tone: var(--fur);   --tone-soft: var(--fur-soft); }
[data-tone="olive"] { --tone: #c9cda5;      --tone-soft: var(--olive-soft); }
[data-tone="amber"] { --tone: #f6c46f;      --tone-soft: #fbe7c4; }
[data-tone="navy"]  { --tone: #9aa6c9;      --tone-soft: #d9ddeb; }

/* ── Topics ───────────────────────────────────────────────── */
.topics {
  list-style: none; margin: 0 0 3rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem;
}
.topic { border-top: 8px solid var(--tone); padding-top: 1.25rem; }
.topic h2, .topic h3 { font-size: var(--step-1); margin-bottom: 0.4em; }
.topic h2 a, .topic h3 a { text-decoration: none; }
.topic h2 a:hover, .topic h3 a:hover { text-decoration: underline; text-decoration-color: var(--amber); }
.topic p { max-width: 34ch; }
.topic__count { font: 500 var(--step--1) var(--font-ui); color: var(--muted); }

/* ── "On the line" support band ───────────────────────────── */
.online { background: var(--fur-soft); overflow: hidden; }
.online__inner {
  display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 2.5rem;
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
.online__inner { padding-bottom: 0; }
.online__img { width: 100%; max-width: 40rem; align-self: end; }   /* sits on the band's bottom edge */
.online__text { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.online h2 { font-size: var(--step-3); max-width: 16ch; }
.online p { max-width: 38ch; }

/* ── Articles ─────────────────────────────────────────────── */
.article { padding-bottom: clamp(3rem, 6vw, 5rem); }
.article__head { padding-top: clamp(2.5rem, 6vw, 4.5rem); padding-bottom: 1.5rem; }
.article__head h1 { font-size: var(--step-3); margin-top: 0.6rem; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--muted); max-width: 36ch; }
.meta--quiet { margin-top: 1rem; }

.cover { margin: 0 0 2.5rem; }
.cover img { border-radius: 6px; width: 100%; }
.cover figcaption, .prose figcaption {
  font: 400 var(--step--1)/1.5 var(--font-ui); color: var(--muted); margin-top: 0.6rem;
}

.prose { max-width: 38rem; }
.prose > * + * { margin-top: 0; }
.prose h2 { font-size: var(--step-2); margin-top: 2.2em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.8em; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.15em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--olive); }
.prose a { color: var(--navy); text-decoration-color: var(--sky); }
.prose a:hover { text-decoration-color: var(--amber); }
.prose strong { font-weight: 700; }
.prose blockquote {
  margin: 2em 0; padding: 0 0 0 1.25em; border-left: 4px solid var(--sky);
  font-size: var(--step-1); line-height: 1.5; font-style: italic;
}
.prose hr { border: 0; height: 1.5rem; margin: 2.5rem 0;
  background: radial-gradient(circle, var(--sky) 3px, transparent 4px) center / 1.5rem 1.5rem repeat-x; }
.prose figure { margin: 2.25em 0; }
.prose figure img { border-radius: 6px; width: 100%; }
.prose code { font-size: 0.85em; background: var(--sky-soft); padding: 0.1em 0.35em; border-radius: 4px; }
.prose table { border-collapse: collapse; width: 100%; font: 400 1rem/1.5 var(--font-ui); margin-bottom: 1.5em; }
.prose th, .prose td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; }

/* the bear says */
.bear-says {
  display: grid; grid-template-columns: 56px 1fr; gap: 1rem; align-items: start;
  background: var(--fur-soft); border-radius: 14px; padding: 1.25rem 1.4rem;
  margin: 2.25em 0;
}
.bear-says img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--navy); }
.bear-says__label { font: 700 var(--step--1)/1.3 var(--font-ui); color: var(--olive); margin: 0.2rem 0 0.35rem !important; }
.bear-says p { margin-bottom: 0.6em; }
.bear-says p:last-child { margin-bottom: 0; }
.bear-says div > p:not(.bear-says__label) { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.5; }

/* series */
.series {
  border: 2px solid var(--navy); border-radius: 10px; padding: 1.1rem 1.4rem; margin: 0 0 2.5rem;
  font-family: var(--font-ui); font-size: 1rem;
}
.series__title { font-weight: 600; margin-bottom: 0.5rem; }
.series ol { margin: 0; padding-left: 1.3em; }
.series li { margin-bottom: 0.25rem; }
.series li[aria-current] { font-weight: 700; }

/* tags */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 2.5rem 0 0; }
.tags a {
  display: inline-block; font: 500 0.9rem/1.3 var(--font-ui); text-decoration: none;
  padding: 0.3rem 0.75rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--white);
}
.tags a:hover { border-color: var(--navy); }
.tags--cloud span { color: var(--muted); margin-left: 0.25rem; }

/* previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.pager a { text-decoration: none; font: 700 1.05rem/1.35 var(--font-display); }
.pager a:hover { text-decoration: underline; text-decoration-color: var(--amber); }
.pager span { display: block; font: 500 var(--step--1) var(--font-ui); color: var(--muted); margin-bottom: 0.3rem; }
.pager__next { text-align: right; }

/* plain pages with a cut-out picture */
.page__hero { margin: 0 0 1rem; }
.page__hero img { max-width: 22rem; }

/* ── Listing pages ────────────────────────────────────────── */
.listing { padding-bottom: clamp(3rem, 6vw, 5rem); }
.listing__head { padding-top: clamp(2.5rem, 6vw, 4.5rem); padding-bottom: 1.5rem; }
.listing__head h1 { font-size: var(--step-3); }
.listing[data-tone] .listing__head h1 {
  display: inline-block; box-shadow: inset 0 -0.35em 0 var(--tone);
}
.year { font-size: var(--step-1); color: var(--muted); margin: 2.5rem 0 0.75rem; }
.year:first-child { margin-top: 0; }

/* ── 404 ──────────────────────────────────────────────────── */
.lost {
  display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: 2.5rem; align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.lost h1 { font-size: var(--step-3); }
.lost .btn { margin: 0 0.5rem 0.5rem 0; }

/* ── Footer ───────────────────────────────────────────────── */
.footer { background: var(--navy-deep) var(--rib); color: var(--sky-soft); font-family: var(--font-ui); font-size: 1rem; }
.footer a { color: var(--white); }
.footer__inner {
  display: grid; grid-template-columns: 7rem 1.4fr 1fr; gap: 2rem; align-items: center;
  padding-block: 3rem 2rem;
}
.footer__bear img { width: 7rem; }
.footer__line { font: 700 var(--step-1)/1.2 var(--font-display); color: var(--white); margin-bottom: 0.4rem; }
.footer__text p:last-child { margin: 0; max-width: 40ch; }
.footer__links { display: flex; gap: 2.5rem; }
.footer__links ul { list-style: none; margin: 0; padding: 0; }
.footer__links li { margin-bottom: 0.4rem; }
.footer__small { border-top: 1px solid rgb(255 255 255 / 0.12); padding-block: 1rem 1.5rem; font-size: var(--step--1); }
.footer__small p { margin: 0; }

/* ── Small screens ────────────────────────────────────────── */
@media (max-width: 56rem) {
  .hero__inner { grid-template-columns: 1fr; gap: 0; }
  .hero__text { padding-bottom: 1rem; }
  .hero__img { max-width: 20rem; }
  .online__inner { grid-template-columns: 1fr; padding-bottom: 0; }
  .online__img { order: 2; max-width: 26rem; }
  .online__text { padding-bottom: 0; }
  .footer__inner { grid-template-columns: 5rem 1fr; }
  .footer__bear img { width: 5rem; }
  .footer__links { grid-column: 1 / -1; }
}
@media (max-width: 36rem) {
  :root { --step-0: 1.125rem; }
  .masthead__inner { justify-content: flex-start; }
  .brand span { font-size: 1.05rem; }
  .postlist__item { grid-template-columns: 1fr; gap: 0.1rem; }
  .pager { grid-template-columns: 1fr; }
  .pager__next { text-align: left; }
  .lost { grid-template-columns: 1fr; }
  .lost img { max-width: 12rem; }
  .bear-says { grid-template-columns: 1fr; }
}

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

@media print {
  .masthead nav, .footer, .pager, .skip { display: none; }
  body { background: white; font-size: 12pt; }
}
