/* Ninety: theme layer on the Ninety foundation. CSS only. */
:root{
  --nmj-ui: var(--wp--custom--font-ui, system-ui, sans-serif);
  --nmj-display: var(--wp--custom--font-display, Georgia, serif);
  --nmj-orn: var(--wp--custom--ornament, "\2042");
  --nmj-cover-a: var(--wp--custom--cover-a, #6B2E2E);
  --nmj-cover-b: var(--wp--custom--cover-b, #2B1A18);
  --nmj-page: color-mix(in oklch, var(--nmj-brand) 3%, var(--nmj-surface));
}
.nmj-ui, .wp-block-post-date, .wp-block-post-terms, .wp-block-post-author-name, .wp-block-navigation { font-family: var(--nmj-ui); }
.is-style-kicker, .nmj-kicker { font-family: var(--nmj-ui); font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--nmj-accent-ink); }
.is-style-deck, .nmj-deck { font-family: var(--nmj-display); font-style: italic; font-size: var(--wp--preset--font-size--medium); color: var(--nmj-ink-soft); line-height: 1.35; }
.nmj-edition { font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); color: var(--nmj-ink-soft); }
.nmj-header { border-bottom: 1px solid var(--nmj-line); }
.nmj-footer { border-top: 1px solid var(--nmj-line); font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); color: var(--nmj-ink-soft); }
.nmj-footer a { color: inherit; }

/* Ornaments: each identity has its own mark */
.wp-block-separator.is-style-ornament, .wp-block-separator.is-style-scene { border: 0; background: none; height: auto; text-align: center; color: var(--nmj-accent-ink); width: 100%; max-width: none; opacity: 1; }
.wp-block-separator.is-style-ornament::before, .wp-block-separator.is-style-scene::before { content: var(--nmj-orn); letter-spacing: .3em; font-size: var(--wp--preset--font-size--medium); }
.wp-block-separator.is-style-scene::before { font-size: var(--wp--preset--font-size--base); }

/* Cover representations, all CSS on the core image block */
.wp-block-image[class*="is-style-cover-"] img { aspect-ratio: 2 / 3; object-fit: cover; border-radius: 2px 4px 4px 2px; }
.wp-block-image.is-style-cover-flat img { box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.wp-block-image.is-style-cover-standing img { box-shadow: 0 30px 30px -20px rgb(0 0 0 / .45); }
.wp-block-image.is-style-cover-book { perspective: 1200px; }
.wp-block-image.is-style-cover-book img { transform: rotateY(-22deg); box-shadow: 18px 18px 40px rgb(0 0 0 / .28), inset 6px 0 8px rgb(0 0 0 / .25); }
.wp-block-gallery.is-style-cover-stack { display: flex; flex-wrap: nowrap; }
.wp-block-gallery.is-style-cover-stack .wp-block-image { margin-left: -12%; box-shadow: -8px 8px 20px rgb(0 0 0 / .25); }
.wp-block-gallery.is-style-cover-stack .wp-block-image:first-child { margin-left: 0; }
.wp-block-gallery.is-style-series-shelf { align-items: flex-end; border-bottom: 6px solid color-mix(in oklch, var(--nmj-ink) 80%, var(--nmj-surface)); padding-bottom: 0; }
.wp-block-gallery.is-style-series-shelf img, .wp-block-gallery.is-style-cover-stack img { aspect-ratio: 2 / 3; object-fit: cover; }
@media (prefers-reduced-motion: no-preference) { .nmj-shelf .wp-block-post-featured-image, .wp-block-gallery.is-style-series-shelf .wp-block-image { transition: transform .25s; } .nmj-shelf .wp-block-post:hover .wp-block-post-featured-image, .wp-block-gallery.is-style-series-shelf .wp-block-image:hover { transform: translateY(-8px); } }

/* Placeholder cover when a book has no image: a typographic cover, never a gap */
.nmj-shelf .wp-block-post-featured-image, .nmj-book-hero .wp-block-post-featured-image { margin: 0; }
.nmj-shelf .wp-block-post-featured-image img, .nmj-book-hero .wp-block-post-featured-image img { aspect-ratio: 2 / 3; object-fit: cover; box-shadow: 0 30px 30px -20px rgb(0 0 0 / .45); }
.nmj-shelf .wp-block-post:not(:has(.wp-block-post-featured-image)) .wp-block-post-title { aspect-ratio: 2 / 3; display: flex; align-items: flex-end; padding: 1rem; background: linear-gradient(160deg, var(--nmj-cover-a), var(--nmj-cover-b)); color: #fff; font-size: var(--wp--preset--font-size--medium); }
.nmj-shelf .wp-block-post:not(:has(.wp-block-post-featured-image)) .wp-block-post-title a { color: #fff; }
.nmj-shelf .wp-block-post-template { align-items: end; border-bottom: 6px solid color-mix(in oklch, var(--nmj-ink) 80%, var(--nmj-surface)); }
.nmj-shelf .wp-block-post-title { font-size: var(--wp--preset--font-size--small); }
.nmj-shelf .wp-block-post-title a { color: var(--nmj-ink); text-decoration: none; }

/* Book hero */
.nmj-book-hero h1 { font-size: var(--wp--preset--font-size--display); margin-bottom: .2em; }
.nmj-book-hero .nmj-deck { font-size: var(--wp--preset--font-size--x-large); }
.nmj-read-sample a { font-family: var(--nmj-ui); font-weight: 600; text-decoration: none; }

/* Look Inside: cover, open book, reading. No JavaScript. */
.nmj-inside { background: var(--nmj-page); border-block: 1px solid var(--nmj-line); }
.nmj-mode { display: flex; justify-content: center; margin: 0 auto var(--wp--preset--spacing--50); width: max-content; border: 1px solid var(--nmj-line); border-radius: 999px; font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); }
.nmj-mode input { position: absolute; opacity: 0; pointer-events: none; }
.nmj-mode label { padding: .6rem 1.2rem; min-height: 44px; display: flex; align-items: center; cursor: pointer; border-radius: 999px; }
.nmj-mode input:checked + label { background: var(--nmj-ink); color: var(--nmj-surface); }
.nmj-mode input:focus-visible + label { outline: 3px solid var(--nmj-accent); outline-offset: 2px; }
.nmj-stage { position: relative; perspective: 2000px; }
.nmj-lid { position: absolute; z-index: 3; top: 0; left: 50%; width: min(42%, 330px); aspect-ratio: 2 / 3; transform-origin: left center; background: linear-gradient(160deg, var(--nmj-cover-a), var(--nmj-cover-b)); color: #fff; padding: 1.6rem; display: flex; flex-direction: column; justify-content: flex-end; font-family: var(--nmj-display); box-shadow: 0 20px 40px rgb(0 0 0 / .25); pointer-events: none; opacity: 0; }
.nmj-lid .wp-block-post-title { color: #fff; font-size: var(--wp--preset--font-size--x-large); line-height: 1.02; margin: 0; }
@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.nmj-lid { opacity: 1; animation: nmj-open linear both; animation-timeline: view(); animation-range: entry 20% cover 45%; }
		.nmj-spread { animation: nmj-reveal linear both; animation-timeline: view(); animation-range: entry 10% cover 40%; }
		@keyframes nmj-open { from { transform: rotateY(0deg); } 80% { opacity: 1; } to { transform: rotateY(-178deg); opacity: 0; } }
		@keyframes nmj-reveal { from { opacity: .25; transform: scale(.96); } to { opacity: 1; transform: none; } }
	}
}
.nmj-spread { background: var(--nmj-surface); max-width: 66rem; margin-inline: auto; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .35); display: grid; position: relative; gap: 0 !important; }
.nmj-page { padding: 3.5rem clamp(1.5rem, 4vw, 3.5rem) 3rem !important; position: relative; min-height: 34rem; }
.nmj-running { position: absolute; top: 1.4rem; left: 0; right: 0; text-align: center; font-family: var(--nmj-ui); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--nmj-ink-soft); margin: 0 !important; }
.nmj-folio { position: absolute; bottom: 1.2rem; left: 0; right: 0; text-align: center; font-family: var(--nmj-ui); font-size: .8rem; color: var(--nmj-ink-soft); margin: 0 !important; }
.nmj-opener { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.nmj-opener .is-style-kicker { margin-bottom: .6rem; }
.nmj-text p { hyphens: auto; text-align: justify; text-indent: 1.4em; margin: 0; }
.nmj-text p.nmj-running, .nmj-text p.nmj-folio { text-indent: 0; text-align: center; }
.is-style-opening { text-indent: 0 !important; }
.is-style-opening::first-letter { float: left; font-family: var(--nmj-display); font-size: 4.2em; line-height: .82; padding: .06em .08em 0 0; color: var(--nmj-accent-ink); font-weight: var(--wp--custom--heading-weight, 600); }
@media (min-width: 56rem) {
	.nmj-spread { grid-template-columns: 1fr 1fr; }
	.nmj-spread::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 40px; transform: translateX(-50%); background: linear-gradient(to right, transparent, rgb(0 0 0 / .08), transparent); pointer-events: none; }
}
.nmj-inside:has(.nmj-mode-web:checked) .nmj-spread { grid-template-columns: 1fr; max-width: 44rem; box-shadow: none; background: transparent; }
.nmj-inside:has(.nmj-mode-web:checked) .nmj-spread::after, .nmj-inside:has(.nmj-mode-web:checked) .nmj-running, .nmj-inside:has(.nmj-mode-web:checked) .nmj-folio, .nmj-inside:has(.nmj-mode-web:checked) .nmj-lid { display: none; }
.nmj-inside:has(.nmj-mode-web:checked) .nmj-opener { text-align: left; }
.nmj-inside:has(.nmj-mode-web:checked) .nmj-page { min-height: 0; padding-inline: 0 !important; }
.nmj-inside:has(.nmj-mode-web:checked) .nmj-text p { text-align: left; text-indent: 0; margin-bottom: 1em; }

/* Quotes */
.wp-block-quote.is-style-epigraph { border: 0; font-style: italic; color: var(--nmj-ink-soft); text-align: right; }
.wp-block-quote.is-style-pull { border: 0; padding: 0; font-family: var(--nmj-display); font-size: var(--wp--preset--font-size--x-large); line-height: 1.25; text-align: center; }
.wp-block-quote.is-style-praise { border: 0; padding: 0; font-family: var(--nmj-display); font-size: var(--wp--preset--font-size--medium); line-height: 1.35; }
.wp-block-quote cite { display: block; margin-top: .8rem; font-family: var(--nmj-ui); font-style: normal; font-size: var(--wp--preset--font-size--small); color: var(--nmj-ink-soft); }

/* Book anatomy and chapters */
.nmj-anatomy { border-block: 1px solid var(--nmj-line); }
.nmj-anatomy > * + * { border-left: 1px solid var(--nmj-line); }
.nmj-anatomy strong { display: block; font-family: var(--nmj-display); font-size: var(--wp--preset--font-size--xx-large); line-height: 1; }
.nmj-anatomy p { font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); color: var(--nmj-ink-soft); padding: 1.2rem 1rem; margin: 0; }
.wp-block-list.is-style-chapters { columns: 2 16rem; column-gap: 3rem; padding: 0; list-style: none; counter-reset: nmj-ch; }
.wp-block-list.is-style-chapters li { counter-increment: nmj-ch; break-inside: avoid; padding: .5rem 0; border-bottom: 1px dotted var(--nmj-line); display: flex; gap: 1rem; }
.wp-block-list.is-style-chapters li::before { content: counter(nmj-ch); font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); color: var(--nmj-accent-ink); min-width: 1.4rem; }

/* Letter, marginalia, panels */
.wp-block-group.is-style-letter { background: var(--nmj-page); padding: clamp(2rem, 5vw, 4rem); font-size: var(--wp--preset--font-size--medium); line-height: 1.55; }
.wp-block-group.is-style-marginalia { font-family: var(--nmj-ui); font-size: var(--wp--preset--font-size--small); color: var(--nmj-ink-soft); border-left: 2px solid var(--nmj-accent); padding: .2rem 0 .2rem 1rem; }
@media (min-width: 74rem) { .wp-block-post-content > .wp-block-group.is-style-marginalia { float: right; width: 14rem; margin: 0 -17rem 1rem 1rem; } }
.wp-block-group.is-style-panel { border: 1px solid var(--nmj-line); padding: var(--wp--preset--spacing--40); border-radius: var(--wp--custom--radius--base); }

/* Essays and notes */
.nmj-essay-head h1 { font-size: var(--wp--preset--font-size--xx-large); }
.nmj-note .wp-block-post-title { font-size: var(--wp--preset--font-size--large); }
.nmj-note { max-width: 34rem; margin-inline: auto; }
.nmj-world { border-top: 1px solid var(--nmj-line); }
.nmj-author-card { border-top: 1px solid var(--nmj-line); }

/* Reading group questions and press kit print cleanly */
@media print {
	.nmj-header, .nmj-footer, .nmj-mode, .nmj-lid, .wp-block-buttons { display: none !important; }
	.nmj-print-block { break-inside: avoid; }
	.nmj-reading-group h3 { break-after: avoid; }
	.nmj-press-kit img { max-width: 40% !important; }
}
