/* Public site. Direction: the CYSSA blocks, applied with restraint.
   Neutral cool paper so the covers (loud, mixed colour) carry the page; brand blue for action; one full-bleed blue
   band; deep blue for the close. The isometric idea shows up in exactly four places: the lattice texture behind
   heads, the 30-degree cuts on bands, the stepped hero shelf, and the hard plate-shadow under every cover. */

:root { --gutter: clamp(20px, 4vw, 40px); --cut: clamp(28px, 5vw, 64px); }
.wrap { width: min(100% - 2 * var(--gutter), 1160px); margin-inline: auto; }

/* ---------- Top strip + header ---------- */
.topbar { background: var(--deep-2); color: var(--on-deep-soft); font-size: 0.8125rem; }
.topbar__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s5); }
.topbar a { display: inline-flex; align-items: center; min-height: 36px; color: var(--on-deep); text-decoration: none; font-variant-numeric: tabular-nums; }
.topbar a:hover { text-decoration: underline; }
.topbar__tag { display: none; align-self: center; }
@media (min-width: 700px) { .topbar__tag { display: block; } }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-block: var(--s3); }
.brand { display: block; border-radius: var(--r-s); }
.brand img { height: 44px; width: auto; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--hit);
  padding: 0 var(--s4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-m);
  background: var(--sheet);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 650;
  cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition-property: transform, opacity;
  transition-duration: 160ms;
  transition-timing-function: var(--ease);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.site-header[data-open] .nav-toggle__bars { background: transparent; }
.site-header[data-open] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.site-header[data-open] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Mobile: the menu is a full-width panel under the bar */
.site-nav { display: none; width: 100%; padding-bottom: var(--s4); }
.site-header[data-open] .site-nav { display: block; }
.site-nav ul { display: grid; }
.site-nav li:not(.site-nav__cta) { border-top: 1px solid var(--rule-soft); }
.site-nav a:not(.btn) {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 var(--s2);
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-nav a[aria-current="page"]:not(.btn) { color: var(--brand); }
.site-nav__cta { padding-top: var(--s3); }
.site-nav__cta .btn { width: 100%; min-height: 48px; }

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; width: auto; padding: 0; }
  .site-nav ul { display: flex; align-items: center; gap: var(--s1); }
  .site-nav li:not(.site-nav__cta) { border-top: 0; }
  .site-nav a:not(.btn) {
    position: relative;
    min-height: 44px;
    padding: 0 var(--s4);
    font-size: 0.9375rem;
    font-weight: 550;
    letter-spacing: 0;
    color: var(--ink-2);
    transition: color 140ms var(--ease);
  }
  /* The active page gets a teal plate edge under it */
  .site-nav a:not(.btn)::after {
    content: "";
    position: absolute;
    left: var(--s4);
    right: var(--s4);
    bottom: 4px;
    height: 3px;
    background: var(--teal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 200ms var(--ease);
  }
  .site-nav a[aria-current="page"]:not(.btn) { color: var(--ink); font-weight: 650; }
  .site-nav a[aria-current="page"]:not(.btn)::after { transform: scaleX(1); }
  .site-nav__cta { padding: 0 0 0 var(--s3); }
  .site-nav__cta .btn { width: auto; min-height: 40px; padding: 0 var(--s5); }
}
@media (min-width: 820px) and (hover: hover) {
  .site-nav a:not(.btn):hover { color: var(--ink); }
  .site-nav a:not(.btn):hover::after { transform: scaleX(1); }
}
.site-nav .btn[aria-current="page"] { background: var(--brand-deep); }

/* ---------- Hero: copy on lattice paper, the stepped shelf on the right ---------- */
.hero { position: relative; isolation: isolate; overflow-x: clip; background: var(--paper); }
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--lattice) 0 0 / 52px 60px;
  -webkit-mask-image: linear-gradient(100deg, transparent 25%, #000 85%);
  mask-image: linear-gradient(100deg, transparent 25%, #000 85%);
}
.hero__grid { display: grid; }
.hero__copy { padding-block: var(--s8) var(--s6); }
.hero h1 {
  font-size: clamp(2.75rem, 1.4rem + 4.6vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 750;
  color: var(--ink);
  max-width: 12ch;
}
.lede { margin-top: var(--s5); font-size: 1.1875rem; line-height: 1.55; color: var(--ink-2); max-width: 44ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

.hero__stage { padding-block: var(--s6) var(--s8); }
/* Three books climbing like steps: each one a plate higher than the last */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: var(--s5); width: min(100%, 560px); margin-inline: auto; padding-right: 5px; }
.steps__book:nth-child(2) { margin-bottom: var(--s6); }
.steps__book:nth-child(3) { margin-bottom: calc(var(--s6) * 2); }
.steps__book a { display: block; border-radius: 2px; }
@media (hover: hover) {
  .steps__book a:hover .cover { transform: translate(-3px, -3px); box-shadow: 0 0 0 1px rgba(12, 34, 48, 0.12), 8px 8px 0 var(--teal); }
}
@media (min-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--s8); align-items: center; }
  .hero__copy { padding-block: var(--s9); }
  .hero__stage { padding-block: var(--s9); }
  .steps { gap: var(--s6); width: 100%; }
  .steps__book:nth-child(2) { margin-bottom: var(--s7); }
  .steps__book:nth-child(3) { margin-bottom: calc(var(--s7) * 2); }
}

/* One staged entrance on load: copy chunks and books rise 90ms apart. */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero .lede, .hero__actions, .steps__book { animation: rise 360ms var(--ease) both; }
  .hero .lede { animation-delay: 90ms; }
  .hero__actions { animation-delay: 180ms; }
  .steps__book:nth-child(1) { animation-delay: 220ms; }
  .steps__book:nth-child(2) { animation-delay: 310ms; }
  .steps__book:nth-child(3) { animation-delay: 400ms; }
}
@media (prefers-reduced-motion: reduce) {
  .hero h1, .hero .lede, .hero__actions, .steps__book { animation: fade 200ms ease-out both; }
}

/* ---------- Facts band ---------- */
.facts-band { background: var(--sheet); border-block: 1px solid var(--rule); }
.facts-band__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 0; }
.facts-band__list > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--s1); padding: var(--s5) var(--s3); }
.facts-band__list > div + div { border-left: 1px solid var(--rule); }
.facts-band dt { color: var(--ink-3); font-size: 0.8125rem; line-height: 1.3; }
.facts-band dd { margin: 0; font-size: clamp(1.875rem, 1.2rem + 2.6vw, 3rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
@media (min-width: 700px) {
  .facts-band__list > div { flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: var(--s3); padding: var(--s6) var(--s5); }
  .facts-band__list > div:first-child { padding-left: 0; }
  .facts-band dt { font-size: 0.9375rem; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--s8); }
.section--sheet { background: var(--sheet); }
.section--tight { padding-block: var(--s7) var(--s8); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s5); margin-bottom: var(--s6); }
.section__link { font-size: 0.9375rem; font-weight: 650; }
h2 { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.625rem); color: var(--ink); }

/* Page heads (catalogue, about, contact, errors): lattice fading in from the right */
.page-head { position: relative; isolation: isolate; overflow: clip; padding-block: var(--s7); background: var(--paper); border-bottom: 1px solid var(--rule); }
.page-head::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--lattice) 0 0 / 52px 60px;
  -webkit-mask-image: linear-gradient(100deg, transparent 40%, #000 95%);
  mask-image: linear-gradient(100deg, transparent 40%, #000 95%);
}
.page-head h1 { font-size: clamp(2.375rem, 1.4rem + 3.6vw, 4rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 750; max-width: 18ch; color: var(--ink); }
.page-head .lede { max-width: 56ch; }
.page-head__count { margin-top: var(--s3); color: var(--ink-2); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

/* ---------- Bands: a 30-degree cut on the top edge, drawn as a triangle in the band's own colour ---------- */
.band { position: relative; }
.band::before {
  content: "";
  position: absolute;
  inset: calc(var(--cut) * -1 + 1px) 0 auto 0; /* overlaps the previous section's bottom padding */
  height: var(--cut);
  background: inherit;
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
.band--brand { background: var(--brand); color: #fff; }
.band--deep { background: var(--deep); color: var(--on-deep); }
.band h2, .band h3 { color: inherit; }
.band :where(a, button):focus-visible { box-shadow: 0 0 0 2px var(--brand), 0 0 0 4px var(--aqua); }
.band--deep :where(a, button):focus-visible { box-shadow: 0 0 0 2px var(--deep), 0 0 0 4px var(--aqua); }
.btn--aqua { background: var(--aqua); color: var(--deep); }
@media (hover: hover) {
  .btn--aqua:hover { background: var(--aqua-deep); color: var(--deep); }
}

.split { display: grid; gap: var(--s7); padding-block: var(--s8) var(--s9); }
.split__intro { display: grid; gap: var(--s4); justify-items: start; align-content: start; }
.split__intro p { color: #d9ebf4; font-size: 1.125rem; max-width: 34ch; }
.split__intro h2 { font-size: clamp(2.25rem, 1.4rem + 3.2vw, 3.75rem); line-height: 1; letter-spacing: -0.04em; font-weight: 750; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s9); }
  .split__intro { position: sticky; top: var(--s9); align-self: start; }
}

/* ---------- Services: one row per service, ruled; numbered inside bands ---------- */
.services { border-bottom: 1px solid var(--rule); counter-reset: svc; }
.service { display: grid; gap: var(--s2); padding-block: var(--s5); border-top: 1px solid var(--rule); }
.service h3 { font-size: 1.3125rem; letter-spacing: -0.02em; }
.service p { color: var(--ink-2); max-width: 62ch; }
@media (min-width: 760px) {
  .prose-grid .service { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s6); }
}
.band .services, .band .service { border-color: rgba(255, 255, 255, 0.28); }
.band .service { counter-increment: svc; grid-template-columns: 3.25rem 1fr; column-gap: var(--s4); }
.band .service::before { content: counter(svc, decimal-leading-zero); grid-row: 1 / 3; font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.04em; color: var(--aqua-deep); font-variant-numeric: tabular-nums; padding-top: 0.3em; }
.band .service h3, .band .service p { grid-column: 2; }
.band .service p { color: #d9ebf4; }
.prose-grid > h2 { margin-top: var(--s8); margin-bottom: var(--s5); font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); }
.prose-grid > h2:first-child { margin-top: 0; }
.plain-list { display: grid; gap: var(--s3); max-width: 62ch; padding-left: var(--s5); list-style: square; color: var(--ink-2); }
.plain-list li::marker { color: var(--teal); }

.cta__inner { display: grid; gap: var(--s3); justify-items: start; padding-block: var(--s8) var(--s9); }
.cta h2 { max-width: 20ch; font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 750; }
.cta p { color: var(--on-deep-soft); font-size: 1.0625rem; max-width: 46ch; margin-bottom: var(--s3); }

/* ---------- Book grid ---------- */
.books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s7) var(--s5); }
@media (min-width: 700px) { .books { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s8) var(--s6); } }
@media (min-width: 1000px) { .books { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.book-item a { display: block; padding-right: 5px; color: inherit; text-decoration: none; border-radius: var(--r-s); }
.book-item h2, .book-item h3 {
  margin-top: var(--s5);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-item__authors { margin-top: var(--s2); color: var(--ink-3); font-size: 0.875rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-item__date { margin-top: var(--s1); color: var(--ink-4); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .book-item a:hover h2, .book-item a:hover h3 { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
  .book-item a:hover .cover { transform: translate(-3px, -3px); box-shadow: 0 0 0 1px rgba(12, 34, 48, 0.12), 8px 8px 0 var(--teal); }
}
.empty { padding-block: var(--s6); color: var(--ink-2); display: grid; gap: var(--s2); max-width: 52ch; }

/* ---------- Search + pager ---------- */
.search { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); max-width: 680px; }
.search .input { flex: 1 1 240px; width: auto; min-height: 52px; background: var(--sheet); border-radius: var(--r-m); font-size: 1.0625rem; }
.search .btn { min-height: 52px; }
.pager { margin-top: var(--s8); }

/* ---------- Book page ---------- */
.book-detail { display: grid; gap: var(--s6); padding-block: var(--s6) var(--s9); }
.book-detail__cover { width: min(100%, 380px); }
.stage { position: relative; isolation: isolate; padding: var(--s6); background: var(--brand-wash); border: 1px solid var(--brand-line); border-radius: var(--r-l); overflow: clip; }
.stage::before { content: ""; position: absolute; z-index: -1; inset: 0; background: var(--lattice) 0 0 / 52px 60px; }
.stage .cover { box-shadow: 0 0 0 1px rgba(12, 34, 48, 0.12), 8px 8px 0 var(--plate-deep); margin: 0 8px 8px 0; }
.crumbs { font-size: 0.875rem; margin-bottom: var(--s3); }
.book-detail h1 { font-size: clamp(1.875rem, 1.2rem + 2.6vw, 3rem); line-height: 1.06; letter-spacing: -0.035em; font-weight: 750; color: var(--ink); }
.byline { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s4); font-family: var(--font-serif); font-size: 1.1875rem; color: var(--ink-2); }
.synopsis { margin-top: var(--s6); display: grid; gap: var(--s4); max-width: 64ch; font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.7; color: var(--ink-2); }
.facts { display: grid; gap: var(--s3); margin: var(--s6) 0 0; padding-top: var(--s5); border-top: 1px solid var(--rule); max-width: 64ch; font-size: 0.9375rem; }
.facts > div { display: grid; grid-template-columns: 7rem 1fr; gap: var(--s3); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.book-detail__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s6); }
.btn__meta { font-weight: 400; opacity: 0.85; }
@media (min-width: 800px) {
  .book-detail { grid-template-columns: minmax(240px, 380px) minmax(0, 1fr); gap: var(--s8); align-items: start; padding-top: var(--s7); }
  .book-detail__cover { position: sticky; top: calc(var(--s9) - var(--s2)); }
}

/* ---------- Contact ---------- */
.contact-list { display: grid; border-top: 1px solid var(--rule); max-width: 760px; }
.contact-list li { border-bottom: 1px solid var(--rule); }
.contact-list a { display: grid; gap: var(--s1); padding-block: var(--s5); text-decoration: none; color: var(--ink); transition: padding-left 200ms var(--ease); }
.contact-list__label { color: var(--ink-3); font-size: 0.875rem; font-weight: 550; }
.contact-list__value { font-size: clamp(1.375rem, 1rem + 1.6vw, 2rem); font-weight: 650; letter-spacing: -0.025em; overflow-wrap: anywhere; }
@media (hover: hover) {
  .contact-list a:hover { padding-left: var(--s3); }
  .contact-list a:hover .contact-list__value { color: var(--brand); }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--deep-2); color: var(--on-deep-soft); }
.site-footer__grid { display: grid; gap: var(--s6); padding-block: var(--s8) var(--s6); }
.site-footer__logo { height: 48px; width: auto; }
.site-footer__note { margin-top: var(--s4); font-size: 0.9375rem; max-width: 34ch; }
.site-footer__cta { display: inline-block; margin-top: var(--s4); padding-block: var(--s1); color: var(--aqua); font-weight: 650; font-size: 0.9375rem; text-decoration-thickness: 1px; }
.site-footer ul { display: grid; align-content: start; gap: var(--s1); }
.site-footer a { display: inline-block; padding-block: var(--s1); color: var(--on-deep-soft); font-size: 0.9375rem; text-decoration: none; }
.site-footer address { display: grid; align-content: start; gap: var(--s1); font-style: normal; }
.site-footer :where(a):focus-visible { box-shadow: 0 0 0 2px var(--deep-2), 0 0 0 4px var(--aqua); }
@media (hover: hover) {
  .site-footer a:hover { color: var(--on-deep); text-decoration: underline; }
  .site-footer a.site-footer__cta:hover { color: var(--aqua-deep); }
}
.site-footer__legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-block: var(--s4) var(--s6); border-top: 1px solid var(--deep-line); font-size: 0.8125rem; }
.site-footer a.site-footer__admin { font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 0.2em; }
@media (min-width: 760px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
