/* Postcards from Paco: the Pensar blog. Builds on pensar.css (its tokens, header, footer and
   launch states). The pages are written by scripts/blog.mjs. Unlike the rest of the site, the
   blog has a dark mode: people read long posts at night. */

@font-face {
  font-family: "Patrick Hand";
  src: url("/pensar/fonts/PatrickHand-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

.blog {
  --hand: "Patrick Hand", "Bradley Hand", "Segoe Print", cursive;
  --measure: 680px;
  --postcard: 960px;
  color-scheme: light;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}

@media (prefers-color-scheme: dark) {
  .blog {
    --paper: #151A24;
    --surf: #1E2431;
    --ink: #EEE7D8;
    --ink-2: #DAD3C4;
    --muted: #BAC2CE;
    --meta: #A7AFBC;
    --line: #343C4C;
    --clay: #E2683F;
    --clay-dark: #F7A684;
    --clay-text: #F2906A;
    --clay-on-ink: #C0431C;
    --sage: #74C6AC;
    --sand: #352D20;
    --sand-line: #5C4B2F;
    --on-ink: #151A24;
    --on-ink-muted: #454E5C;
    color-scheme: dark;
  }
  .blog .brand img, .blog .postcard img, .blog .shot img { filter: brightness(0.94); }
}

.blog .site-header, .blog .site-footer { max-width: var(--measure); }
.blog-index .site-header, .blog-index .site-footer { max-width: var(--wide); }

/* ---------- Reading progress: Paco flies along the top as you read ---------- */

.progress { display: none; }
@supports (animation-timeline: scroll()) {
  .progress {
    display: block;
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 20;
    pointer-events: none;
  }
  .progress-fill {
    height: 100%;
    background: var(--clay);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: blog-fill linear both;
    animation-timeline: scroll(root block);
  }
  .progress-paco {
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    animation: blog-fly linear both;
    animation-timeline: scroll(root block);
  }
}
@keyframes blog-fill { to { transform: scaleX(1); } }
@keyframes blog-fly {
  from { transform: translateX(-4px) rotate(-8deg); opacity: 0; }
  3% { opacity: 1; }
  50% { transform: translateX(calc(50vw - 15px)) rotate(4deg); }
  to { transform: translateX(calc(100vw - 34px)) rotate(-8deg); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-paco { display: none; }
}

/* ---------- A post ---------- */

.post { max-width: var(--measure); margin: 0 auto; padding: 12px 0 8px; }

.scheduled {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--sand);
  border: 1px dashed var(--sand-line);
  font: 600 15px/1.4 var(--sans);
}

.crumbs { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 15px; color: var(--meta); margin: 0 0 18px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 10px 0; }
.crumbs a:hover { color: var(--clay-text); text-decoration: underline; }
.crumbs span { padding: 10px 0; }

.kicker {
  margin: 0 0 12px;
  font: 600 13px/1.3 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clay-text);
}

.post h1 {
  font-size: clamp(34px, 7.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.dek { margin: 18px 0 0; font: 400 20px/1.5 var(--sans); color: var(--muted); max-width: 34em; }

.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--meta);
}
.byline img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sand);
  padding: 3px;
  flex: none;
}
.byline a { color: var(--ink); font-weight: 600; }

/* The hero is a postcard: a white border, the picture, a postmark in the corner. */
.postcard {
  position: relative;
  width: min(var(--postcard), calc(100vw - 32px));
  margin: 32px 0 0 50%;
  translate: -50% 0;
  padding: 10px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(27, 34, 48, 0.06), 0 26px 50px -30px rgba(27, 34, 48, 0.45);
}
.postcard img { display: block; width: 100%; height: auto; border-radius: 2px; }
.postcard figcaption { margin: 10px 4px 2px; font-size: 14px; color: var(--meta); }
.postmark {
  position: absolute;
  top: -18px;
  right: 18px;
  width: 92px;
  height: 92px;
  display: grid;
  place-content: center;
  gap: 2px;
  border-radius: 50%;
  border: 3px solid var(--clay);
  box-shadow: inset 0 0 0 4px var(--surf), inset 0 0 0 5px var(--clay);
  background: var(--surf);
  color: var(--clay-text);
  font: 600 11px/1.1 var(--sans);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  rotate: 12deg;
}
@media (max-width: 599px) {
  /* On a phone the postmark sits at the bottom corner, clear of Paco's speech bubble. */
  .postmark { width: 68px; height: 68px; top: auto; bottom: -14px; right: 10px; font-size: 9px; box-shadow: inset 0 0 0 3px var(--surf), inset 0 0 0 4px var(--clay); }
}

.post-toc {
  margin: 36px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surf);
}
.post-toc summary {
  cursor: pointer;
  padding: 12px 16px;
  min-height: 44px;
  font: 600 16px/1.4 var(--sans);
}
.post-toc ol { margin: 0; padding: 0 16px 14px 36px; font-size: 16px; }
.post-toc li { padding: 2px 0; }
.post-toc a { color: var(--ink-2); display: inline-block; padding: 4px 0; }

/* ---------- The text ---------- */

.prose { margin-top: 36px; font: 400 19px/1.7 var(--serif); color: var(--ink); }
@media (min-width: 720px) { .prose { font-size: 20px; } }
.prose > p:first-child { font-size: 1.12em; line-height: 1.6; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0 0 0.4em; }
.prose li::marker { color: var(--clay-text); }
.prose h2 { font-size: clamp(26px, 5vw, 32px); margin: 2.1em 0 0.55em; scroll-margin-top: 24px; }
.prose h3 { font-size: 22px; margin: 1.6em 0 0.4em; scroll-margin-top: 24px; }
.prose strong { font-weight: 600; }
.prose a { text-decoration-thickness: 1px; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--clay);
  color: var(--ink-2);
  font-style: italic;
}
.prose code { font: 0.88em/1 ui-monospace, "SF Mono", Menlo, monospace; background: var(--surf); padding: 2px 5px; border-radius: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* A Spanish phrase with its meaning beside it: "la cuenta (the bill)". */
.say i { font-style: italic; font-weight: 600; color: var(--clay-text); }
.say .mean { font-family: var(--sans); font-size: 0.8em; color: var(--meta); }

.shot { margin: 1.8em 0; }
.shot img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 76vh;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.shot figcaption { margin: 10px auto 0; max-width: 34em; text-align: center; font: 400 15px/1.45 var(--sans); color: var(--meta); }
.shots { display: flex; gap: 14px; justify-content: center; margin: 1.8em 0; }
.shots .shot { flex: 1 1 0; min-width: 0; margin: 0; }
.shots .shot img { max-height: 62vh; }

.table-wrap { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; min-width: 520px; font: 400 16px/1.45 var(--sans); }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surf); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }

/* Paco's note in the margin, in his handwriting. Beside the text on a wide screen. */
.note {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: start;
  margin: 1.6em 0;
  padding: 14px 16px;
  background: var(--sand);
  border-radius: 4px 14px 14px 14px;
  rotate: -0.6deg;
}
.note img { width: 48px; height: 48px; }
.note-text { font: 400 22px/1.35 var(--hand); color: var(--ink-2); }
.note-text p { margin: 0 0 0.4em; }
.note-text p:last-child { margin: 0; }
@media (min-width: 1240px) {
  .note {
    float: right;
    clear: right;
    width: 240px;
    margin: 0.2em -280px 1em 0;
    grid-template-columns: 1fr;
    rotate: 1.2deg;
  }
  .note img { width: 44px; height: 44px; }
}

.workshop {
  margin: 2.4em 0 1.4em;
  padding: 20px 22px 18px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sage);
  border-radius: 4px var(--radius) var(--radius) 4px;
  font: 400 17px/1.6 var(--sans);
}
.workshop-title {
  margin: 0 0 8px;
  font: 600 13px/1.3 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
}
.workshop p { margin: 0 0 0.8em; }
.workshop .workshop-sign { margin: 0; font: 400 21px/1.2 var(--hand); color: var(--muted); }

.faq { margin-top: 2.4em; }
.faq h2 { margin-bottom: 0.4em; }
/* The questions and their chevron are the landing page's (.faq in pensar.css). */
.faq summary { font-size: 19px; }
.faq details > div { font-size: 18px; color: var(--ink-2); }
.faq details > div p:last-child { margin-bottom: 0; }

.made {
  clear: both;
  margin: 2.6em 0 0;
  padding: 16px 0 0;
  border-top: 1px dashed var(--line);
  font-size: 15px;
  line-height: 1.5;
  color: var(--meta);
}
.made strong { color: var(--muted); }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 18px 0 0; font-size: 15px; color: var(--meta); }
.share span { margin-right: 4px; }
.share a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surf);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
}
.share a:hover { border-color: var(--clay); color: var(--clay-text); }

/* ---------- After the post ---------- */

.cta {
  max-width: var(--measure);
  margin: 48px auto 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 24px;
  align-items: center;
  padding: 24px;
  border-radius: 14px;
  background: var(--surf);
  border: 1px solid var(--line);
}
.cta img { width: 96px; height: auto; }
.cta h2 { font-size: 25px; }
.cta p { margin: 10px 0 0; color: var(--muted); }
.cta .get { margin-top: 16px; }
.cta p.soon { margin: 0; color: var(--on-ink); }
@media (min-width: 600px) {
  .cta { grid-template-columns: 120px 1fr; }
  .cta img { width: 120px; }
}
.blog-index .cta { max-width: var(--wide); }

.more {
  max-width: var(--measure);
  margin: -20px auto 56px;
  display: grid;
  gap: 12px;
}
@media (min-width: 600px) { .more { grid-template-columns: 1fr 1fr; } }
.more a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font: 600 18px/1.35 var(--serif);
}
.more a:hover { border-color: var(--clay); }
.more span { display: block; margin-bottom: 4px; font: 600 12px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--clay-text); }

/* ---------- The index: Paco's postcards on a table ---------- */

.blog-hero {
  max-width: var(--wide);
  margin: 0 auto;
  display: grid;
  gap: 24px;
  align-items: center;
  padding: 16px 0 40px;
}
.blog-hero h1 { font-size: clamp(42px, 10vw, 68px); line-height: 1.02; letter-spacing: -0.02em; }
.blog-hero .lede { margin-top: 18px; }
.blog-hero img { width: min(260px, 60vw); height: auto; justify-self: center; }
@media (min-width: 760px) {
  .blog-hero { grid-template-columns: 1fr 300px; }
  .blog-hero img { width: 280px; }
}

.postcards { max-width: var(--wide); margin: 0 auto; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
.card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 18px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 18px 36px -30px rgba(27, 34, 48, 0.5);
  transition: translate 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card a:hover { translate: 0 -3px; box-shadow: 0 24px 40px -28px rgba(27, 34, 48, 0.55); }
@media (prefers-reduced-motion: reduce) { .card a { transition: none; } .card a:hover { translate: none; } }
.card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
.card picture { display: block; }
/* On a phone, cards show the hero's phone layout, cropped from the top: bubble and screen. */
@media (max-width: 600px) { .card img { aspect-ratio: 4 / 3; object-position: top; } }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 8px 0; }
.card-kicker { font: 600 12px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--clay-text); }
.card-title { font: 600 24px/1.2 var(--serif); }
.card-dek { color: var(--muted); font-size: 16px; line-height: 1.5; }
.card-meta { font-size: 14px; color: var(--meta); }
.card.is-scheduled a { border-style: dashed; }
/* The newest postcard lies across the table: picture beside the words on a wide screen. */
@media (min-width: 760px) {
  .cards > .card:first-child { grid-column: 1 / -1; }
  .cards > .card:first-child a { flex-direction: row; align-items: center; gap: 12px; }
  .cards > .card:first-child img { width: 56%; flex: none; }
  .cards > .card:first-child .card-body { padding: 8px 20px; }
  .cards > .card:first-child .card-title { font-size: 32px; }
}
.empty { font: 400 22px/1.4 var(--hand); color: var(--muted); }

/* A sound you can play: the caption says what you'll hear, the player sits under it. */
.sound { margin: 1.2em 0; padding: 14px 16px; background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius); }
.sound figcaption { margin: 0 0 10px; font: 600 16px/1.4 var(--sans); color: var(--ink-2); }
.sound audio { display: block; width: 100%; height: 44px; }
.sounds { display: grid; gap: 12px; margin: 1.4em 0; }
@media (min-width: 640px) { .sounds { grid-template-columns: 1fr 1fr; } .sounds .sound { margin: 0; } }
.postcard picture { display: block; }
@media (max-width: 600px) { .postcard img { aspect-ratio: 4 / 5; object-fit: cover; } }
