/* Copied from theme/sections/journal-entry.liquid by tools/sync_from_theme.py. Don't edit here. */
  .journal-entry {
    display: block;
    padding-inline: var(--page-margin, 16px);
    /* Stickers can hang off the paper; clip sideways so phones don't scroll horizontally */
    overflow-x: clip;
  }

  .journal-entry__article {
    /* One ruled line. Every text row is exactly this tall. */
    --line: 1.875rem;
    /* Colors sampled from the photos in references/paper, white-balanced */
    --rule-color: #9dbbe0;
    --margin-color: #e0607e;
    --paper-color: #fbfaf6;
    --margin-x: 14%;
    --right-margin-color: #e0607e33;
    /* The text column's side padding, as a share of the paper's width. journal-wrap reads these too. */
    --pad-start: 17cqi;
    --pad-end: 16cqi;

    max-width: 42rem;
    margin-inline: auto;
    color: #24242a;
  }

  .journal-entry__date {
    display: block;
    margin-block-end: 1.25rem;
    text-align: center;
    font-size: 1.125rem;
  }

  .journal-entry__date sup {
    font-size: 0.6em;
  }

  .journal-entry__paper {
    position: relative;
    /* Stickers and text wrapping measure in % of the paper's width (cqi units) */
    container-type: inline-size;
    /* Row 1 is the title band, row 2 the ruled part */
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: calc(var(--line) * 30);
  }

  /* The sheet spans both rows and passes them down (subgrid), so the rules can start under the title */
  .journal-entry__shadow,
  .journal-entry__surface {
    grid-area: 1 / 1 / 3 / 2;
    display: grid;
    grid-template-rows: subgrid;
  }

  /* The shadow sits on a wrapper so it follows the torn edge (a mask clips its own element's shadow) */
  .journal-entry__shadow {
    filter: drop-shadow(0 1px 1px rgb(40 35 20 / 0.12)) drop-shadow(0 10px 24px rgb(40 35 20 / 0.1));
  }

  .journal-entry__surface {
    background-color: var(--paper-color);
    background-image:
      /* Paper grain: fine fibers plus faint uneven mottling */
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .42 0 0 0 0 .35 .16 0 0 0 -.04'/%3E%3C/filter%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .47 0 0 0 0 .4 .1 0 0 0 -.03'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23m)'/%3E%3Crect width='300' height='300' filter='url(%23f)'/%3E%3C/svg%3E"),
      /* Red margin line on the left (slightly soft, like printed ink), faint one on the right */
      linear-gradient(to right, transparent calc(var(--margin-x) - 0.5px), var(--margin-color) var(--margin-x), var(--margin-color) calc(var(--margin-x) + 1px), transparent calc(var(--margin-x) + 1.5px)),
      linear-gradient(to right, transparent 86%, var(--right-margin-color) 86%, var(--right-margin-color) calc(86% + 1px), transparent calc(86% + 1px)),
      /* Light falls a little unevenly across a real sheet */
      radial-gradient(ellipse at 30% 0%, #ffffff 0%, transparent 70%),
      linear-gradient(to bottom, transparent 70%, #efece3 100%);
    /* Torn left edge, where the sheet came off a spiral notebook */
    mask:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='160'%3E%3Cpath d='M14 0 L3.6 0 L4.2 4 L1.6 7 L1.8 15 L1.5 23 L2.7 31 L4.5 34 L2.9 37 L4.4 45 L2 53 L6 57 L8.6 65 L5.7 73 L8.8 76 L5.5 79 L3.3 83 L5.3 87 L3.5 95 L1.8 99 L6.1 107 L1.8 112 L5.5 115 L2.6 123 L4.4 131 L4.7 136 L3.9 142 L7.4 146 L1.7 150 L5.2 155 L3.6 160 L14 160Z'/%3E%3C/svg%3E")
        0 0 / 14px 160px repeat-y,
      linear-gradient(#000 0 0) 14px 0 / calc(100% - 14px) 100% no-repeat;
  }

  .journal-entry__rules {
    grid-row: 2;
    /* A 1px rule under every row with soft edges, like printed ink, nudged up to sit just under the text's baseline */
    background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line) - 1.5px), var(--rule-color) calc(var(--line) - 1px), var(--rule-color) calc(var(--line) - 0.5px), transparent var(--line));
    background-position-y: calc(var(--line) * -0.15);
  }

  .journal-entry__title {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--line) * 3);
    margin: 0;
    padding-inline: 16% 16%;
    text-align: center;
    font-size: 1.75rem;
    line-height: var(--line);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    text-wrap: balance;
    grid-area: 1 / 1;
    /* Above stickers that sit behind the text */
    position: relative;
    z-index: 1;
  }

  .journal-entry__body {
    position: relative;
    grid-area: 2 / 1;
    padding-inline: var(--pad-start) var(--pad-end);
    padding-block-end: calc(var(--line) * 4);
    font-size: 1.125rem;
    line-height: var(--line);
    overflow-wrap: anywhere;
  }

  /* The text sits between the two sticker layers */
  .journal-entry__text {
    position: relative;
    z-index: 1;
  }

  /* Keep everything on the rules: same line height, gaps of whole lines */
  /* !important: the blog editor writes inline margins on photos, which would push text off the rules */
  .journal-entry__text * {
    margin-block: 0 !important;
    line-height: var(--line);
  }

  .journal-entry__text :is(sup, sub) {
    line-height: 0;
  }

  .journal-entry__text > * + * {
    margin-block-start: var(--line) !important;
  }

  .journal-entry__text :is(h1, h2, h3, h4, h5, h6) {
    font-size: 1.35em;
    font-weight: 600;
  }

  .journal-entry__text :is(ul, ol) {
    padding-inline-start: 1.25em;
  }

  .journal-entry__text blockquote {
    padding-inline-start: 1em;
    border-inline-start: 2px solid var(--rule-color);
  }

  /* Photos sit on the paper and cover the rules; the script pads them to whole lines */
  .journal-entry__text :is(img, video, iframe) {
    display: block;
    box-sizing: content-box;
    max-width: 100%;
    height: auto;
  }

  .journal-entry__text img {
    width: auto;
  }

  .journal-entry__text iframe {
    aspect-ratio: 16 / 9;
    width: 100%;
  }

  .journal-entry__text a {
    color: currentcolor;
    text-decoration-color: currentcolor;
  }

  @container paper-view (max-width: 749px) {
    .journal-entry__article {
      --margin-x: 8%;
      --right-margin-color: transparent;
      --pad-start: 11cqi;
      --pad-end: 5cqi;
    }

    .journal-entry__title {
      padding-inline: 11% 5%;
      font-size: 1.5rem;
    }
  }

/* Copied from theme/snippets/journal-stickers.liquid by tools/sync_from_theme.py. Don't edit here. */
  .journal-stickers {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .journal-stickers--behind {
    z-index: 0;
  }

  .journal-stickers--front {
    z-index: 2;
  }

  .journal-stickers--phone {
    display: none;
  }

  .journal-sticker {
    position: absolute;
    inset-inline-start: calc(var(--x) * 1%);
    inset-block-start: calc(var(--y) * var(--line));
    width: calc(var(--w) * 1%);
    aspect-ratio: var(--ratio);
    transform: translate(-50%, -50%) rotate(calc(var(--r) * 1deg));
  }

  .journal-sticker[href] {
    pointer-events: auto;
  }

  .journal-sticker img {
    display: block;
    width: 100%;
    height: 100%;
  }

  @container paper-view (max-width: 749px) {
    .journal-stickers--desktop {
      display: none;
    }

    .journal-stickers--phone {
      display: block;
    }
  }

/* Copied from theme/snippets/journal-wrap.liquid by tools/sync_from_theme.py. Don't edit here. */
  /* Invisible: only its shape matters, the text flows around it */
  .journal-wrap {
    /* Never wider than the text column */
    max-width: 100%;
    pointer-events: none;
  }

  .journal-wrap--left {
    float: left;
  }

  .journal-wrap--right {
    float: right;
  }

  .journal-wrap--phone {
    display: none;
  }

  @container paper-view (max-width: 749px) {
    .journal-wrap--desktop {
      display: none;
    }

    .journal-wrap--phone {
      display: block;
    }
  }

