/*
Theme Name: Biblunio Editorial
Author: Biblunio
Description: An editorial bookstore and reading blog with a built-in book catalog.
Version: 1.1.0
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: biblunio-editorial
*/
:root {
  --ink: #10152e;
  --red: #c82735;
  --lavender: #eeebf8;
  --line: #d6cce8;
  --paper: #fff;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper) url('assets/paper-background.webp') center top / 100% auto repeat-y; font: 1.06rem/1.55 var(--sans); overflow-wrap: break-word; }
h1, h2, h3, summary { font-family: var(--serif); line-height: 1.07; margin: 0 0 .55em; }
h1 { font-size: clamp(2.5rem, 5vw, 5rem); }
h2 { font-size: clamp(2rem, 3.8vw, 3.8rem); letter-spacing: -.045em; }
h3, summary { font-size: clamp(1.25rem, 2vw, 1.85rem); letter-spacing: -.025em; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid #7152a7; outline-offset: 4px; }
img { max-width: 100%; height: auto; vertical-align: middle; }
p { margin: 0 0 1em; }
input, textarea, button, select { font: inherit; max-width: 100%; }
button, summary { cursor: pointer; }
.wrap { width: min(95%, 1450px); margin-inline: auto; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { z-index: 10; top: .5rem; left: .5rem; width: auto; height: auto; padding: .7rem; clip-path: none; background: white; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { width: min(95%, 1450px); margin: auto; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { position: relative; font: 700 clamp(2.2rem, 4vw, 3.5rem)/1 var(--serif); letter-spacing: -.065em; text-decoration: none; }
.brand::after { content: ''; position: absolute; width: 56%; left: 25%; bottom: -.24em; border-top: .08em solid #ff453e; border-radius: 50%; height: .14em; transform: rotate(-3deg); }
.menu, .genres ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; }
.menu { gap: .55rem clamp(.8rem, 2.2vw, 2.2rem); font: 700 clamp(1rem, 1.5vw, 1.4rem)/1.4 var(--serif); }
.menu a, .genres a, h3 a { text-decoration: none; }
.menu [aria-current] { color: var(--red); text-decoration: underline; }
.menu .sub-menu { list-style: none; padding-inline-start: .65rem; font-size: .85em; }
.biblunio-search { display: flex; align-items: center; border-radius: 2rem; background: var(--lavender); padding: .25rem .5rem .25rem .8rem; gap: .25rem; width: min(26%, 370px); }
.biblunio-search input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: .35rem .15rem; }
.biblunio-search input::placeholder { color: #49445b; }
.biblunio-search button { border: 0; border-radius: 2rem; background: white; color: var(--ink); padding: .3rem .55rem; font-size: .85rem; }
.hero { display: grid; align-items: center; position: relative; isolation: isolate; overflow: hidden; min-height: clamp(350px, 34vw, 620px); background: #eeebf8; }
.hero-copy { z-index: 1; padding: clamp(2rem, 4.4vw, 5rem) clamp(1rem, 5.5vw, 6.5rem); }
.hero h1 { font-size: clamp(3rem, 7.1vw, 7.8rem); line-height: .91; letter-spacing: -.075em; margin: 0 0 .12em; }
.hero p { font: clamp(1.1rem, 2.35vw, 2rem)/1.35 var(--serif); }
.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 69% 50%; }
.hero::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, #f7f2ffed 0%, #f7f2ffda 24%, #f7f2ff82 44%, transparent 68%); }
.button { display: inline-block; padding: .55em 1.15em; border-radius: .55rem; background: var(--red); color: white; text-decoration: none; font-weight: 700; }
.hero-button { font-size: clamp(1.02rem, 1.8vw, 1.6rem); }
.genres { padding-block: .75rem; border-bottom: 1px solid var(--line); }
.genres ul { justify-content: center; gap: .55rem 0; }
.genres li { padding-inline: clamp(.65rem, 3vw, 3rem); font: 700 clamp(1rem, 1.8vw, 1.45rem)/1.3 var(--serif); }
.genres li + li { border-inline-start: 2px solid var(--line); }
.editorial { display: grid; grid-template-columns: 3fr 2fr; gap: clamp(1.5rem, 3vw, 3.5rem); padding-block: 1.6rem 3.5rem; }
.books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.book-card { text-align: center; }
.book-card h3 { margin: .55rem 0; }
.book-card small { display: block; margin-top: .55rem; }
.from-blog { border-inline-start: 1px solid var(--line); padding-inline-start: clamp(1.5rem, 3vw, 3.5rem); }
.story-card { display: grid; grid-template-columns: minmax(85px, .95fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.3rem; align-items: start; }
.story-card img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; }
.story-card p { font: 1.04rem/1.4 var(--serif); }
.more { font-weight: 650; }
.inner { padding-block: 2.5rem 4rem; min-height: 45vh; }
.post-list, .reading { max-width: 800px; margin-inline: auto; }
.archive-books { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.reading .entry-image { margin-bottom: 1.4rem; }
.prose { font-family: var(--serif); font-size: 1.2rem; }
.prose h2, .prose h3 { margin-top: 1.2em; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { padding: .4em; border: 1px solid var(--line); }
.prose pre, .wp-block-table { overflow: auto; }
.alignleft { float: inline-start; margin-inline-end: 1rem; }
.alignright { float: inline-end; margin-inline-start: 1rem; }
.aligncenter { display: block; margin-inline: auto; }
.comments, .navigation { margin-block: 2rem; }
.site-footer { background: var(--ink); color: white; padding-block: 2rem; }
.site-footer a:hover { color: #f8c7c9; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.footer-grid h2 { font-size: 1.45rem; letter-spacing: 0; }
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; padding-block: .8rem; gap: 1rem; }
  .biblunio-search { width: min(100%, 380px); }
  .editorial { grid-template-columns: 1fr; }
  .from-blog { border-inline-start: 0; border-top: 1px solid var(--line); padding: 1.4rem 0 0; }
  .from-blog .story-card { max-width: 580px; }
}
@media (max-width: 580px) {
  .header-inner { justify-content: center; }
  .menu { justify-content: center; }
  .hero-copy { padding-inline: 5%; }
  .genres li + li { border: 0; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* Navigation and reading controls */
.biblunio-menu-toggle,
.biblunio-secondary {
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--lavender);
  color: var(--ink);
  font-weight: 650;
}
.biblunio-menu-toggle:hover,
.biblunio-secondary:hover { background: white; border-color: var(--ink); }
#biblunio-primary-nav[hidden],
.biblunio-menu-toggle[hidden],
.biblunio-secondary[hidden],
.biblunio-back-top[hidden] { display: none; }
.genres a { display: inline-block; padding-block: .3rem; }
.genres [aria-current="page"] { color: var(--red); text-decoration: underline; }
.inner > .genres { margin-bottom: 1.75rem; }
.entry-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-block: 1.3rem; }
.entry-actions:empty { display: none; }
.biblunio-copy-status { font-size: .9rem; }
.biblunio-reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
  z-index: 20;
}
.admin-bar .biblunio-reading-progress { top: 32px; }
.biblunio-back-top {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
  z-index: 10;
  padding: .55em .85em;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-size: .92rem;
  box-shadow: 0 3px 14px #10152e25;
}
@media (max-width: 782px) {
  .admin-bar .biblunio-reading-progress { top: 46px; }
}
@media (max-width: 720px) {
  .header-inner { justify-content: space-between; }
  .header-inner .biblunio-search { width: 100%; }
  #biblunio-primary-nav { flex-basis: 100%; }
  #biblunio-primary-nav .menu { justify-content: flex-start; gap: .45rem 1rem; }
  #biblunio-primary-nav a { display: inline-block; padding-block: .25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .story-card img, .button { transition: transform 180ms ease, background-color 180ms ease; }
  .story-card:hover img, .story-card:focus-within img { transform: scale(1.02); }
}

/* Display controls and cover mockups */
:root { --beam: #e955a7; --book-edge: #142749; }
:root[data-palette="violet"] { --red: #6940a0; --lavender: #efe6fb; --line: #d5bfee; --beam: #9a54f1; }
:root[data-palette="teal"] { --red: #006b62; --lavender: #e1f3ed; --line: #a6d5ce; --beam: #16b7ac; }
.button:hover { background: var(--red); color: white; filter: brightness(.83); }
.appearance-controls { display: flex; justify-content: flex-end; gap: .5rem; padding-block: 0 .55rem; }
.appearance-controls[hidden], .book-rotate[hidden], .pointer-beam[hidden] { display: none; }
.appearance-controls button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: .26rem .7rem;
  font-size: .79rem;
}
.appearance-controls button:hover,
.appearance-controls [aria-pressed="true"] { background: var(--lavender); border-color: var(--red); }
.book-display { display: grid; justify-items: center; gap: .35rem; padding: .7rem .15rem; min-width: 0; }
.book-stage {
  --depth: clamp(9px, 1.15vw, 19px);
  display: block;
  position: relative;
  perspective: 800px;
  width: min(92%, 240px);
  aspect-ratio: 2 / 3;
  text-decoration: none;
}
.book-stage::before {
  content: '';
  position: absolute;
  inset: 90% -6% -4% 5%;
  background: radial-gradient(ellipse, #17163578 5%, transparent 70%);
  filter: blur(7px);
  transform: skewX(-20deg);
  pointer-events: none;
}
.book-object {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--pitch, 1deg)) rotateY(var(--turn, -18deg));
}
.book-front, .book-spine, .book-pages {
  position: absolute;
  display: block;
}
.book-front {
  inset: 0;
  border-radius: 3px 6px 6px 3px;
  background: var(--book-edge);
  transform: translateZ(calc(var(--depth) / 2));
  box-shadow: 6px 8px 19px #10152e40;
  overflow: hidden;
}
.book-front img { width: 100%; height: 100%; object-fit: contain; }
.book-front::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #0004, #fff2 3%, transparent 9%, transparent 96%, #0003);
}
.book-spine, .book-pages { width: var(--depth); top: 0; bottom: 0; }
.book-spine {
  left: 0;
  background: linear-gradient(90deg, #142749, #314569 57%, #142749);
  transform-origin: left;
  transform: translateZ(calc(var(--depth) / 2)) rotateY(90deg);
}
.book-pages {
  right: 0;
  top: 3px;
  bottom: 3px;
  background: repeating-linear-gradient(90deg, #c7baa9 0 1px, #f6efdf 1px 3px);
  transform-origin: right;
  transform: translateZ(calc(var(--depth) / 2)) rotateY(-90deg);
}
.book-fallback { display: grid; place-items: center; height: 100%; padding: .55rem; color: white; text-align: center; font: 700 clamp(.95rem, 2.5vw, 1.7rem)/1.15 var(--serif); }
.book-display.is-turned .book-object { --turn: 34deg; --pitch: -3deg; }
.book-rotate { font-size: .82rem; min-height: 2rem; padding: .25rem .6rem; }
.reading > .book-display { justify-items: start; margin-bottom: 1rem; }
.reading > .book-display .book-stage { width: min(87%, 285px); }
.reading > .book-display .book-rotate { margin-left: .4rem; }
.pointer-beam {
  position: fixed;
  z-index: 4;
  left: 0;
  top: 0;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--beam), transparent 59%);
  opacity: .1;
}
@media (max-width: 720px) {
  .hero { min-height: clamp(420px, 90vw, 570px); align-items: end; }
  .hero-photo { object-position: 71% 50%; }
  .hero::after { background: linear-gradient(0deg, #f7f2fff9 0%, #f7f2ffed 21%, #f7f2ff91 41%, transparent 70%); }
  .hero-copy { padding: 1.25rem 5% 1.8rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .book-object { transition: transform 240ms ease; }
  [data-motion="on"] .hero-photo { transform: translate(var(--hero-x, 0px), var(--hero-y, 0px)) scale(1.045); transition: transform 420ms ease-out; }
  [data-motion="off"] .book-object, [data-motion="off"] .story-card img { transition: none; }
  [data-motion="off"] .story-card:hover img, [data-motion="off"] .story-card:focus-within img { transform: none; }
}
.pointer-beam::after {
  content: '';
  position: absolute;
  inset: calc(50% - 1px) 26%;
  background: linear-gradient(90deg, transparent, var(--beam), transparent);
  transform: rotate(-24deg);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  [data-motion="on"] .book-display:not(.is-turned) .book-stage:hover .book-object,
  [data-motion="on"] .book-display:not(.is-turned) .book-stage:focus-visible .book-object { --turn: 12deg; --pitch: -2deg; }
}
