/* ===========================================================================
   The Journal, as printed pages.

   Two views, one sheet: the archive (/journal/ and every shelf) and a single
   field note. Both used to sit on white with a narrow column of text and a
   third of the screen left empty; neither looked like the same shop that
   prints the front page on sand.

   Now the archive opens with the headline block and its hand drawing, then a
   grid of note cards; a note opens as a magazine spread — headline with the
   drawing at its shoulder, a wide reading column, and a rail carrying the
   contents, three related notes and the dark green invitation to the shop.

   Prefix: .ja- / .ja__  (journal, any view). Nothing here touches site.css or
   shop.css, so the rest of the site keeps its own type scale.
   ------------------------------------------------------------------------ */

/* The header sits on the same sand as the page. The nav bar is transparent and
   inherits from <body>, which is why these two rules live here rather than on
   .ja: without them the article opened with a white strip above a sand sheet
   and the fold between them read as a misfired container. */
body.ja-page,
body.pi-journal-page {
  background: #f2e9d6;
}

.ja {
  --ja-paper: #f2e9d6; /* must equal --jn-paper and .mf, the page is one sheet */
  --ja-ink: #2b3129;
  --ja-body: #4a5147;
  --ja-muted: #6d7269;
  --ja-faint: #8b8d80;
  --ja-card: #fdf9ee;
  --ja-green: #2f3f2e;
  --ja-orange: #e8753f;
  --ja-line: rgba(48, 60, 44, 0.13);
  --ja-serif: Georgia, 'Times New Roman', serif;
  --ja-hand: 'Segoe Script', 'Bradley Hand', 'Ink Free', 'Comic Sans MS', cursive;

  background: var(--ja-paper);
  color: var(--ja-ink);
  padding: clamp(22px, 2.4vw, 34px) 0 clamp(48px, 5vw, 76px);
}

/* The same column formula as .jn__inner and .mf__grid, so an article and the
   journal plate on the home page share one left edge at every width. */
.ja__wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 5vw;
}

/* --------------------------------------------------------------- breadcrumb */

.ja__crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--ja-faint);
}

.ja__crumb a {
  color: var(--ja-faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.ja__crumb a:hover {
  color: var(--ja-ink);
  border-bottom-color: var(--ja-line);
}

.ja__crumb i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

/* ------------------------------------------------------------------- hero */

.ja__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 2vw, 28px);
  margin-top: clamp(16px, 1.8vw, 26px);
}

.ja__title {
  margin: 0;
  font-family: var(--ja-serif);
  font-weight: 400;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.ja__stand {
  margin: 16px 0 0;
  max-width: 540px;
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.6;
  color: var(--ja-body);
}

.ja__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(16px, 1.8vw, 24px);
  font-size: 12px;
  color: var(--ja-muted);
}

.ja__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ja__meta svg {
  width: 15px;
  height: 15px;
  color: var(--ja-orange);
}

.ja__meta a {
  color: var(--ja-muted);
  border-bottom: 1px solid transparent;
}

.ja__meta a:hover {
  color: var(--ja-ink);
  border-bottom-color: var(--ja-line);
}

.ja__meta i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

/* The drawing sits on the floor of the text block, exactly like the plate on
   the home page: headline opens the page, the picture lands on the line where
   the body column starts. */
.ja__art {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 0 auto;
  justify-self: end;
  align-self: end;
}

/* ------------------------------------------------------------------- columns */

.ja__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(26px, 3vw, 52px);
  margin-top: clamp(24px, 2.6vw, 38px);
  align-items: start;
}

/* Cover and column share one measure. Left to the grid, the picture ran 37px
   wider than the text under it, which reads as a printing error rather than a
   design choice. */
.ja__main {
  max-width: 680px;
}

.ja__cover {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #e6dcc4;
  aspect-ratio: 16 / 9;
}

.ja__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Reading measure: the column is wide, the text still stops at a comfortable
   line length. 640px at 16.5px is ~72 characters, which is the top of the
   range a screen reader can track without a finger. */
.ja__prose {
  max-width: 680px;
  padding-top: clamp(20px, 2.2vw, 30px);
  font-size: clamp(15.5px, 1.15vw, 17px);
  line-height: 1.8;
  color: var(--ja-body);
}

.ja__prose > :first-child {
  margin-top: 0;
}

.ja__prose p {
  margin: 0 0 1.15em;
}

.ja__prose h2 {
  position: relative;
  margin: 2.1em 0 0.6em;
  padding-left: 34px;
  font-family: var(--ja-serif);
  font-weight: 400;
  font-size: clamp(23px, 2.1vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ja-ink);
  scroll-margin-top: 96px;
}

/* The orange asterisk that opens every section, drawn rather than typed: the
   glyph lands at a different weight in every fallback serif. */
.ja__prose h2::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.42em;
  width: 17px;
  height: 17px;
  background: currentColor;
  color: var(--ja-orange);
  -webkit-mask: var(--ja-asterisk) center / contain no-repeat;
  mask: var(--ja-asterisk) center / contain no-repeat;
}

/* Eight-point asterisk, same shape as the spark used across the site. */
.ja,
.ja__prose {
  --ja-asterisk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2v20M2 12h20M4.9 4.9l14.2 14.2M19.1 4.9L4.9 19.1' stroke='%23000' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.ja__prose h3 {
  margin: 1.8em 0 0.5em;
  font-family: var(--ja-serif);
  font-size: clamp(19px, 1.6vw, 22px);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ja-ink);
}

/* H1 inside body copy is the editor's choice, not ours — the article already
   has one in the header. Rendered at the page-level size it would swallow the
   screen, so in here it behaves as the top section heading: a touch larger
   than H2, same rules. */
.ja__prose h1 {
  margin: 2.1em 0 0.6em;
  font-family: var(--ja-serif);
  font-weight: 500;
  font-size: clamp(26px, 2.4vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--ja-ink);
}

/* Support ranks: H3 is already a serif subhead, so H4 drops to a sans label
   and H5 to a caps tag. Going smaller in the same serif just reads as body
   text that got bold by accident. */
.ja__prose h4 {
  margin: 1.7em 0 0.4em;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ja-ink);
}

.ja__prose h5 {
  margin: 1.5em 0 0.35em;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ja-muted, #6d7269);
}

.ja__prose a {
  color: var(--ja-ink);
  text-decoration: underline;
  text-decoration-color: var(--ja-orange);
  text-underline-offset: 3px;
}

.ja__prose ul,
.ja__prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.25em;
}

.ja__prose li {
  margin-bottom: 0.4em;
}

/* Pull-quote card. The reference prints the testimonial on sand with a pair of
   orange quote marks hanging to its left; a plain <blockquote> rule would read
   as a footnote instead. */
.ja__prose blockquote {
  position: relative;
  margin: 2em 0;
  padding: 22px 26px 20px 58px;
  background: #f7eeda;
  border: 1px solid var(--ja-line);
  border-radius: 14px;
  font-family: var(--ja-serif);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ja-ink);
}

.ja__prose blockquote::before {
  content: '\201C\201C';
  position: absolute;
  left: 20px;
  top: 16px;
  font-family: var(--ja-serif);
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--ja-orange);
}

.ja__prose blockquote p:last-child {
  margin-bottom: 0;
}

.ja__prose img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.ja__prose hr {
  margin: 2.4em 0;
  border: 0;
  height: 1px;
  background: var(--ja-line);
}

/* --------------------------------------------------------------- article foot */

.ja__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 680px;
  margin-top: clamp(28px, 3vw, 44px);
  padding-top: 20px;
  border-top: 1px solid var(--ja-line);
}

.ja__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ja-ink);
}

.ja__back svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}

.ja__back:hover svg {
  transform: translateX(-3px);
}

.ja__foot .ja__tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--ja-line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ja-muted);
  background: rgba(253, 249, 238, 0.6);
}

.ja__foot .ja__tag svg {
  width: 12px;
  height: 12px;
  color: var(--ja-orange);
}

/* ------------------------------------------------------------------------ rail */

.ja__rail {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.2vw, 28px);
  position: sticky;
  top: 24px;
}

/* Contents card */
.ja-toc {
  padding: 18px 20px 16px;
  background: var(--ja-card);
  border: 1px solid var(--ja-line);
  border-radius: 16px;
}

.ja-toc__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--ja-serif);
  font-size: 17px;
  color: var(--ja-ink);
}

.ja-toc__head svg {
  width: 16px;
  height: 16px;
  color: var(--ja-orange);
}

.ja-toc ol {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.ja-toc li {
  counter-increment: toc;
  border-top: 1px solid var(--ja-line);
}

.ja-toc li:first-child {
  border-top: 0;
}

.ja-toc a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ja-body);
  transition: color 0.15s ease;
}

.ja-toc a::before {
  content: counter(toc);
  flex: 0 0 12px;
  font-size: 11px;
  color: var(--ja-faint);
}

.ja-toc a:hover {
  color: var(--ja-ink);
  text-decoration: underline;
  text-decoration-color: var(--ja-orange);
  text-underline-offset: 3px;
}

/* Related notes */
.ja-rel__head {
  margin: 0 0 12px;
  font-family: var(--ja-serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ja-ink);
}

.ja-rel__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 8px;
  border-radius: 14px;
  transition: background 0.16s ease;
}

.ja-rel__item + .ja-rel__item {
  margin-top: 2px;
}

.ja-rel__item:hover {
  background: rgba(253, 249, 238, 0.75);
}

.ja-rel__thumb {
  flex: 0 0 76px;
  width: 76px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: #e6dcc4;
}

.ja-rel__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ja-rel__text {
  min-width: 0;
}

.ja-rel__kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ja-faint);
}

.ja-rel__title {
  display: block;
  margin-top: 4px;
  font-family: var(--ja-serif);
  font-size: 15px;
  line-height: 1.25;
  color: var(--ja-ink);
}

/* The invitation. Dark green, with the cat peering over the top edge — the
   same animal that closes the home page plate, so the two pages sign off in
   the same voice. */
.ja-cta {
  position: relative;
  display: block;
  /* The cat hangs 52px above the card, so the gap under the contents list has
     to clear it — 24px put the cat's ears through the card above. */
  margin-top: clamp(28px, 3vw, 40px);
  padding: 30px 24px 22px;
  border-radius: 18px;
  background: var(--ja-green);
  color: #f6efdc;
}

/* The cat leans over the top edge, so the card must not clip it — the round
   corners come from the background, not from overflow. */
.ja-cta__cat {
  position: absolute;
  top: -52px;
  right: 10px;
  width: 104px;
  height: auto;
  pointer-events: none;
}

.ja-cta__star {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--ja-orange);
}

.ja-cta__star svg {
  width: 100%;
  height: 100%;
}

.ja-cta__title {
  margin: 14px 0 0;
  max-width: 150px;
  font-family: var(--ja-hand);
  font-size: clamp(19px, 1.5vw, 22px);
  line-height: 1.25;
  color: #fdf8e9;
  transform: rotate(-2deg);
}

.ja-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  padding: 11px 16px;
  border-radius: 999px;
  background: #fdf8e9;
  color: var(--ja-green);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  transition: background 0.16s ease, transform 0.16s ease;
}

.ja-cta__btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.16s ease;
}

.ja-cta:hover .ja-cta__btn {
  background: #fffdf6;
}

.ja-cta:hover .ja-cta__btn svg {
  transform: translateX(3px);
}

/* ------------------------------------------------------------- listing page

   /journal/ and every shelf archive. The archive used to be a white page with
   three plain cards, which meant clicking a note dropped you onto sand and the
   two halves of the Journal read as two different sites. Same sheet, same
   header drawing, same card language.
   ------------------------------------------------------------------------ */

.ja--list {
  padding-bottom: clamp(40px, 4.5vw, 68px);
}

/* The list header needs less height than an article's: no meta row, no cover,
   so the drawing is allowed to run a little wider against the headline. */
.ja__hero--list {
  margin-top: clamp(14px, 1.6vw, 22px);
}

.ja-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.2vw, 30px);
  margin-top: clamp(26px, 3vw, 40px);
}

/* A shelf with one note should not print one lopsided column and 800px of
   nothing: the card widens into the space instead, on a 16:9 crop so it does
   not turn into a square slab. */
.ja-list[data-count='1'] {
  grid-template-columns: minmax(0, 1fr);
  max-width: 720px;
}

.ja-list[data-count='1'] .ja-card__media {
  aspect-ratio: 16 / 9;
}

.ja-list[data-count='2'] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ja-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.ja-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #e6dcc4;
}

.ja-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.ja-card:hover .ja-card__media img {
  transform: scale(1.035);
}

.ja-card__kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ja-faint);
}

.ja-card__kicker svg {
  width: 11px;
  height: 11px;
  color: var(--ja-orange);
}

.ja-card__title {
  margin: 9px 0 0;
  font-family: var(--ja-serif);
  font-weight: 400;
  font-size: clamp(21px, 1.9vw, 27px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--ja-ink);
}

.ja-card:hover .ja-card__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(44, 51, 39, 0.35);
}

.ja-card__text {
  display: block;
  margin-top: 9px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #5d6459;
}

.ja-card__more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ja-ink);
}

.ja-card__more svg {
  width: 13px;
  height: 13px;
  transition: transform 0.16s ease;
}

.ja-card:hover .ja-card__more svg {
  transform: translateX(3px);
}

.ja-list__empty {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 15px;
  color: var(--ja-muted);
}

/* The shelf chips are drawn for a white page in shop.css; on sand their hairline
   border disappears. Restate them on the sheet's own line colour. */
.ja--list .pi-catnav {
  margin-top: 30px;
  padding-top: 20px;
  border-top-color: var(--ja-line);
}

.ja--list .pi-catnav__item {
  border-color: var(--ja-line);
  color: var(--ja-muted);
  background: rgba(253, 249, 238, 0.5);
}

.ja--list .pi-catnav__item:hover {
  border-color: var(--ja-ink);
  color: var(--ja-ink);
}

.ja--list .pi-catnav__item.on {
  background: var(--ja-green);
  border-color: var(--ja-green);
  color: #f6efdc;
}

/* ------------------------------------------------------------- breakpoints */

@media (min-width: 941px) {
  /* 1240 like every other reading page (.wrap), not the 1440 of the sand
     plates: an article has no neighbouring block to line up with, and a 1340px
     measure would push the rail into the far margin. */
  .ja__hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 38%);
    align-items: end;
    gap: clamp(20px, 3vw, 48px);
  }

  .ja__cols {
    /* 360 + 44 leaves the main column at 692 against a 680 measure, so the
       gutter between text and rail lands at ~56 instead of 80 — the rail sat
       in the far margin when it was 336 wide. */
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: clamp(26px, 3vw, 44px);
  }
}

@media (max-width: 940px) {
  /* One column: the reading measure can use whatever the screen gives it, up to
     the point where the line stops being trackable. */
  .ja__main,
  .ja__foot {
    max-width: 100%;
  }

  .ja__prose {
    max-width: 760px;
  }

  .ja-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
  }

  /* Stacked under the headline the drawing needs air on both sides — flush to
     the meta row above and the cover below it read as one cramped block. */
  .ja__art {
    max-width: 340px;
    margin: 12px 0 4px auto;
  }

  .ja__rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
  }

  /* Full width made the invitation a 810px banner with everything crammed into
     the left third; it stays a card. */
  .ja-cta {
    grid-column: 1 / -1;
    max-width: 420px;
    justify-self: start;
  }

  .ja-cta__cat {
    width: 80px;
  }
}

@media (max-width: 620px) {
  .ja-list,
  .ja-list[data-count='1'],
  .ja-list[data-count='2'] {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  /* Stacked, the drawing sits right on top of the cover; give the two edges
     their own air. */
  .ja__cols {
    margin-top: 30px;
  }

  .ja__title {
    font-size: clamp(31px, 8.4vw, 42px);
  }

  .ja__art {
    max-width: 280px;
    margin: 10px auto 2px;
  }

  .ja__cover {
    border-radius: 12px;
    aspect-ratio: 4 / 3;
  }

  .ja__prose {
    font-size: 15.5px;
    line-height: 1.8;
  }

  .ja__prose h2 {
    padding-left: 28px;
  }

  .ja__prose h2::before {
    width: 14px;
    height: 14px;
  }

  .ja__prose blockquote {
    padding: 20px 18px 18px 46px;
  }

  .ja__prose blockquote::before {
    left: 14px;
    font-size: 28px;
  }

  .ja__rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .ja-cta {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ja__back svg,
  .ja-cta__btn,
  .ja-cta__btn svg {
    transition: none;
  }
}
