/* WordPress-only additions to the static design (main.css).
   Content edited in WordPress has to look right in every case: block editor photos, items without a
   picture, empty lists, paging, form messages. */

/* ---------------------------------------------------------------- Admin bar (logged in) */

/* The home page header floats over the hero from 860px; keep it below the admin bar */
@media (min-width: 860px) {
  .admin-bar:not(.page) .site-head { top: 32px; }
}

/* ---------------------------------------------------------------- Empty lists */

.empty-note { font-size: 14.5px; color: var(--ink-2); }
.board .empty-note { padding: 18px 0 8px; text-align: center; color: rgba(243, 240, 230, 0.85); }

/* ---------------------------------------------------------------- Board and harvest table without a drawing */

/* A vegetable with no chalk drawing yet: its name, price and note sit in the middle of the row */
.veg > .no-art { display: flex; flex-direction: column; justify-content: center; min-height: 96px; }
@media (min-width: 860px) { .veg > .no-art { min-height: 116px; } }
/* Names in the harvest table stay in one column even without a drawing */
.cal-name.no-art::before { content: ""; flex: none; width: 32px; }
@media (min-width: 860px) { .cal-name.no-art::before { width: 46px; } }

.news a { text-decoration: underline; text-decoration-color: var(--shu); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.news a:hover { background: linear-gradient(transparent 62%, var(--marker) 62%); }

/* ---------------------------------------------------------------- Diary items without a photo */

.diary.no-photo { grid-template-columns: 1fr; }
.diary-list .noimg { width: 56px; height: 42px; box-sizing: border-box; background: var(--washi); border: 2px solid #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.n-top.no-photo, .n-grid a.no-photo { grid-template-columns: 1fr; }

/* ---------------------------------------------------------------- Paging (archives) */

/* "← 新しい…" on the left, "前の… →" on the right */
.pager { justify-content: space-between; gap: 16px; }
.pager .tag:only-child:not(.tag-back) { margin-left: auto; }
.tag-back::after { content: "←"; order: -1; }
a.tag-back:hover { transform: rotate(0deg) translateX(-2px); }

/* ---------------------------------------------------------------- Diary text from the block editor */

/* Photos get the same taped look as the static diary pages:
   a gallery is the pair of photos side by side, a single image block stands alone. */
.post-body > .wp-block-image,
.post-body > .wp-block-gallery { margin: 30px 4px 32px; }
.post-body > .wp-block-image { position: relative; display: block; background: #FFFFFF; padding: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); transform: rotate(-1deg); }
.post-body > .wp-block-image::before,
body .post-body > .wp-block-gallery figure.wp-block-image:not(#naorai)::before {
  content: ""; position: absolute; z-index: 1; inset: -7px auto auto 50%; width: 44px; height: 13px; max-height: none; margin-left: -22px;
  background: var(--tape); transform: rotate(-4deg); -webkit-backdrop-filter: none; backdrop-filter: none;
  -webkit-mask-image: none; mask-image: none; }
.post-body > .wp-block-image img { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: cover; }
.post-body > .wp-block-image.alignleft,
.post-body > .wp-block-image.alignright { width: 46%; margin-block: 8px 20px; }
.post-body > .wp-block-image.alignleft { float: left; margin-right: 24px; }
.post-body > .wp-block-image.alignright { float: right; margin-left: 24px; }

body .post-body > .wp-block-gallery.has-nested-images { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
body .post-body > .wp-block-gallery.has-nested-images figure.wp-block-image:not(#naorai) {
  display: block; position: relative; box-sizing: content-box; width: auto; max-width: none; margin: 0; padding: 4px;
  background: #FFFFFF; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); transform: rotate(-1.5deg); }
body .post-body > .wp-block-gallery.has-nested-images figure.wp-block-image:not(#naorai):nth-child(even) { transform: rotate(1.2deg); margin-top: 14px; }
body .post-body > .wp-block-gallery.has-nested-images figure.wp-block-image:not(#naorai) img {
  display: block; width: 100%; height: auto; flex: none; object-fit: cover; }
body .post-body > .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#naorai) img { aspect-ratio: 3 / 4; }
/* A gallery with one photo behaves like a single photo */
body .post-body > .wp-block-gallery.has-nested-images:has(> figure:only-child) { grid-template-columns: 1fr; }
body .post-body > .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:only-child:not(#naorai) img { aspect-ratio: 4 / 3; }

/* Captions: small notes under the photo, inside its white frame */
.post-body figcaption,
body .post-body > .wp-block-gallery.has-nested-images figure.wp-block-image:not(#naorai) figcaption {
  position: static; max-height: none; overflow: visible; margin: 0; padding: 6px 2px 2px; background: none; color: var(--ink-2);
  text-shadow: none; font-size: 13px; line-height: 1.6; text-align: center; }
.post-body > .wp-block-gallery > figcaption { grid-column: 1 / -1; background: none; }

/* Other text blocks, kept plain */
.post-body > h2, .post-body > h3 { margin-top: 1.8em; font-family: var(--hand); font-weight: 400; font-feature-settings: "palt"; line-height: 1.5; }
.post-body > h2 { font-size: 22px; }
.post-body > h3 { font-size: 19px; }
.post-body > ul, .post-body > ol { margin: 1.1em 0 0; padding-left: 1.6em; font-size: 15.5px; line-height: 2; }
.post-body > ul { list-style: disc; }
.post-body > blockquote { margin: 1.4em 0 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--kraft); color: var(--ink-2); }
.post-body > hr, .post-body > .wp-block-separator { margin: 2em auto; border: 0; border-top: 1px dashed var(--dash); }
.post-body::after { content: ""; display: block; clear: both; }
@media (min-width: 860px) {
  .post-body > .wp-block-image,
  .post-body > .wp-block-gallery { margin: 36px 0 38px; }
  body .post-body > .wp-block-gallery.has-nested-images { gap: 28px; }
  .post-body > ul, .post-body > ol { font-size: 16.5px; }
}

/* ---------------------------------------------------------------- Shops from WordPress (home page) */

/* A shop with a photo but no illustration: the taped photo alone */
.shop-photo { margin: 0; aspect-ratio: 4 / 3; }
.also .shop-photo { transform: rotate(-1.5deg); }
/* Neighboring cards lean the other way */
.shops > :nth-child(2) > figure { transform: rotate(1.2deg); }
.shops > :nth-child(3) > figure { transform: rotate(-0.8deg); }
/* A shop without a picture: its name and introduction take the whole card */
.also.no-photo { display: block; }
/* With 0 or 2 shops the call for new shops is a full row: text on the left, the tag on the right */
.shops > .wanted.wide { grid-column: 1 / -1; }
@media (min-width: 860px) {
  .also.wanted.wide { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; align-items: center; padding: 18px 24px; }
  .also.wanted.wide::after { content: none; }
  .wanted.wide b, .wanted.wide p { grid-column: 1; }
  .wanted.wide .tag { grid-column: 2; grid-row: 1 / span 2; margin: 0; float: none; }
}

/* ---------------------------------------------------------------- 畑の野菜を使っているお店 (/shops/) */

/* The longest page title: one line on phones, and if it still wraps, the marker follows each line */
.post-type-archive-naorai_shop .p-h { display: block; }
.post-type-archive-naorai_shop .p-h span { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (max-width: 859px) { .post-type-archive-naorai_shop .p-h { font-size: 26px; } }
.shop-list { display: grid; gap: 36px; }
/* A sheet like the home page's shop cards, the taped picture on top */
.shop-item { display: grid; gap: 20px; align-content: start; padding: 22px 18px 20px; scroll-margin-top: 20px;
  background: var(--sheet); border-radius: 6px 16px 5px 14px / 14px 5px 16px 6px; }
.shop-item > figure { margin: 0 4px; transform: rotate(-1.2deg); }
.shop-item:nth-child(even) > figure { transform: rotate(1deg); }
.shop-item .shop-name { margin-bottom: 6px; }
/* Coming from a link to one shop, its name gets the heading marker */
.shop-item:target .shop-name { background: linear-gradient(transparent 62%, var(--marker) 62%); }
.shop-area { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; padding: 1px 12px 1px 8px; border-radius: 999px;
  background: rgba(79, 125, 58, 0.1); color: var(--leaf); font-size: 13.5px; line-height: 1.8; }
.shop-area svg, .shop-memo svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--leaf); stroke-width: 1.8;
  stroke-linejoin: round; stroke-linecap: round; }
.shop-memo { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--dash);
  font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.shop-memo svg { margin-top: 0.25em; }
.shop-item .more { justify-content: flex-start; margin-top: 16px; }
/* The call for new shops: a full row under the shops, or the last cell of the grid with the farmer drawing */
.shop-list > .shop-cta:not(.is-slot) { grid-column: 1 / -1; }
.sec > .shop-cta { margin-top: 24px; }
.shop-cta.is-slot .wanted { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; height: 100%; box-sizing: border-box; padding: 28px 26px; }
.shop-cta.is-slot .wanted::after { content: none; }
.shop-cta.is-slot .tag { align-self: flex-end; margin-top: 14px; float: none; }
.cta-art { width: 84px; height: auto; margin: 0 0 12px; transform: rotate(-3deg); }
@media (min-width: 700px) {
  .shop-list:not(.is-single) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 44px 36px; }
  /* One shop: a wide card, picture on the left and the details on the right */
  .is-single .shop-item:not(.no-photo) { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 44px; align-items: center; padding: 30px 32px; }
}
@media (min-width: 860px) {
  .shop-item { padding: 26px 26px 24px; }
  .cta-art { width: 104px; }
}

/* ---------------------------------------------------------------- Contact form messages */

.form-msg { margin: 0 0 24px; padding: 10px 14px; border-left: 3px solid var(--shu); background: rgba(184, 69, 47, 0.06);
  font-size: 15px; line-height: 1.8; }
.form-msg.is-ok { margin: 0; border-left-color: var(--leaf); background: rgba(79, 125, 58, 0.08); }
.form [aria-invalid="true"] { border-bottom-color: var(--shu); }
.form textarea[aria-invalid="true"] { box-shadow: inset 0 -1.5px 0 var(--shu); }
/* The honeypot field is for bots only */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- 404 */

/* The page is short: the footer color continues below it instead of a strip of paper */
html:has(> body.error404) { background: var(--foot); }
.nf { display: grid; justify-items: center; gap: 18px; padding-block: 60px 40px; text-align: center; }
.nf img { width: 120px; height: auto; }
.nf .p-h { font-size: 24px; }
@media (min-width: 860px) { .nf .p-h { font-size: 30px; } }

/* ---------------------------------------------------------------- WordPress helpers */

.screen-reader-text { border: 0; clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
  width: 1px; word-wrap: normal !important; }
.screen-reader-text:focus { clip-path: none; height: auto; width: auto; z-index: 100000; display: block; padding: 12px 20px;
  background: var(--sheet); color: var(--ink); }
.aligncenter { margin-inline: auto; }
