/* The Catalog section and its reader. Borrows the site ink and paper. */

/* ---------- Plate on the project page ---------- */
.ec-cat { margin-top: 2.4rem; }
.ec-cat__plate {
  display: grid; grid-template-columns: minmax(0,240px) 1fr;
  gap: clamp(1.5rem,4vw,3.2rem); align-items: center;
  width: 100%; padding: clamp(1.5rem,4vw,2.8rem); text-align: left;
  background: radial-gradient(120% 140% at 12% 0%, rgba(244,241,234,.07), transparent 62%), var(--navy);
  border: 1px solid var(--line-soft); border-radius: 4px;
  transition: border-color .5s var(--ease-out), transform .5s var(--ease-out);
}
.ec-cat__plate:hover { border-color: var(--line); transform: translateY(-2px); }
.ec-cat__book { position: relative; display: block; }
.ec-cat__leaf { position: absolute; inset: 0; background: var(--paper-45); border-radius: 1px 3px 3px 1px; transition: transform .55s var(--ease-out); }
.ec-cat__leaf--2 { transform: translate(5px,4px); }
.ec-cat__leaf--3 { transform: translate(10px,8px); opacity: .5; }
.ec-cat__plate:hover .ec-cat__leaf--2 { transform: translate(8px,5px); }
.ec-cat__plate:hover .ec-cat__leaf--3 { transform: translate(16px,11px); }
.ec-cat__face { position: relative; display: block; border-radius: 1px 3px 3px 1px; overflow: hidden; box-shadow: 0 18px 40px -18px rgba(0,0,0,.85); }
.ec-cat__face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 9%); pointer-events: none; }
.ec-cat__cover { width: 100%; height: auto; }
.ec-cat__side { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.ec-cat__kicker { font-size: var(--step--1); letter-spacing: .16em; text-transform: uppercase; color: var(--paper-45); }
.ec-cat__count { font-family: var(--display); font-size: var(--step-2); line-height: 1.1; }
.ec-cat__cta { display: inline-flex; align-items: center; gap: .5rem; margin-top: .7rem; padding-bottom: .3rem; font-size: var(--step--1); letter-spacing: .04em; color: var(--blue-hi); border-bottom: 1px solid currentColor; transition: gap .4s var(--ease-out); }
.ec-cat__plate:hover .ec-cat__cta { gap: .85rem; }
@media (max-width: 640px) { .ec-cat__plate { grid-template-columns: 1fr; } .ec-cat__book { max-width: 200px; } }

/* ---------- The reader ---------- */
html.ec-fb-open, html.ec-fb-open body { overflow: hidden; }

.ec-fb {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column;
  background: radial-gradient(120% 90% at 50% 8%, #0A1F33 0%, #03111E 58%, #010A12 100%);
  opacity: 0; visibility: hidden;
  transition: opacity .5s var(--ease-soft), visibility .5s;
}
.ec-fb.is-open { opacity: 1; visibility: visible; }
.ec-fb * { -webkit-tap-highlight-color: transparent; }

/* The surface the book sits on. */
.ec-fb__stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(4.4rem, 9vh, 5.6rem) clamp(1rem, 3vw, 3.5rem) clamp(4.8rem, 10vh, 6rem);
  overflow: hidden; touch-action: none;
}
.ec-fb__zoom {
  position: relative;
  transform-origin: center center;
  transition: transform .45s var(--ease-out);
  will-change: transform;
}
.ec-fb__zoom.is-dragging { transition: none; }

/* The ground shadow. Sits under the book, not on it, so the page edges stay
   clean and the object still feels like it has weight. */
.ec-fb__book { position: relative; }
.ec-fb__book::after {
  content: ''; position: absolute; left: 4%; right: 4%; bottom: -26px; height: 42px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(0,0,0,.6), transparent 72%);
  filter: blur(9px); pointer-events: none; z-index: -1;
}

/* A page. The image fills it; the gutter shading is painted on top so it
   follows the leaf as it turns. */
.ec-fb__page { background: #F7F5F0; overflow: hidden; }
.ec-fb__page img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .5s var(--ease-soft); }
.ec-fb__page img.is-in { opacity: 1; }
.ec-fb__page .ec-fb__blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 1; filter: blur(12px); transform: scale(1.06); transition: opacity .6s var(--ease-soft); }
.ec-fb__page.is-ready .ec-fb__blur { opacity: 0; }
/* The gutter shading follows whichever side the renderer put the page on,
   so the spine is always the darker edge. */
.ec-fb__page::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(270deg, rgba(0,0,0,.20) 0%, rgba(0,0,0,.05) 3.5%, transparent 9%);
}
.ec-fb__page.--right::after { background: linear-gradient(90deg, rgba(0,0,0,.20) 0%, rgba(0,0,0,.05) 3.5%, transparent 9%); }
.ec-fb__page.--hard::after { background: none; }
.ec-fb__page--cover { background: #EDE9E1; }

/* StPageFlip paints its own soft shadows; keep its canvas above the paper. */
.stf__parent { margin: 0 auto; }
.stf__block { overflow: visible; }

/* ---------- Chrome ---------- */
.ec-fb__bar {
  position: absolute; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 1rem;
  padding: clamp(.9rem, 2vw, 1.5rem) clamp(1rem, 3vw, 2.2rem);
  transition: opacity .45s var(--ease-soft), transform .45s var(--ease-soft);
}
.ec-fb__bar--top { top: 0; justify-content: space-between; background: linear-gradient(180deg, rgba(1,10,18,.72), transparent); }
.ec-fb__bar--bottom { bottom: 0; justify-content: center; background: linear-gradient(0deg, rgba(1,10,18,.78), transparent); }
.ec-fb.is-idle .ec-fb__bar--top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.ec-fb.is-idle .ec-fb__bar--bottom { opacity: 0; transform: translateY(8px); pointer-events: none; }

.ec-fb__title { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ec-fb__title b { font-family: var(--display); font-weight: 500; font-size: var(--step-1); line-height: 1.1; }
.ec-fb__title span { font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; color: var(--paper-45); }

.ec-fb__tools { display: flex; align-items: center; gap: .35rem; }
.ec-fb__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  width: 40px; height: 40px; border-radius: 999px; color: var(--paper-70);
  transition: color .3s var(--ease-out), background-color .3s var(--ease-out);
}
.ec-fb__btn svg { width: 18px; height: 18px; }
.ec-fb__btn:hover { color: var(--paper); background: rgba(244,241,234,.09); }
.ec-fb__btn[disabled] { opacity: .28; pointer-events: none; }
.ec-fb__btn.is-on { color: var(--blue-hi); background: var(--blue-dim); }
.ec-fb__btn--wide { width: auto; padding: 0 1rem; font-size: var(--step--1); letter-spacing: .04em; }

.ec-fb__pager { display: flex; align-items: center; gap: .5rem; }
.ec-fb__count {
  display: inline-flex; align-items: baseline; gap: .35rem;
  min-width: 108px; justify-content: center;
  font-size: var(--step--1); letter-spacing: .1em; color: var(--paper-70);
}
.ec-fb__count input {
  width: 2.6em; padding: .25rem .1rem; text-align: right;
  font: inherit; color: var(--paper); background: none;
  border: 0; border-bottom: 1px solid var(--line);
}
.ec-fb__count input:focus { outline: none; border-color: var(--blue-hi); }
.ec-fb__sep { width: 1px; height: 22px; background: var(--line); margin: 0 .35rem; }

/* ---------- Thumbnails ---------- */
.ec-fb__shelf {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 1.1rem clamp(1rem,3vw,2.2rem) 1.4rem;
  background: rgba(3,17,30,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  transform: translateY(101%); transition: transform .5s var(--ease-out);
}
.ec-fb__shelf.is-open { transform: translateY(0); }
.ec-fb__shelfscroll { display: flex; gap: .7rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .3rem; }
.ec-fb__shelfscroll::-webkit-scrollbar { display: none; }
.ec-fb__tn { position: relative; flex: 0 0 auto; width: 74px; border-radius: 2px; overflow: hidden; opacity: .55; transition: opacity .35s var(--ease-out), transform .35s var(--ease-out); }
.ec-fb__tn img { width: 100%; height: auto; display: block; }
.ec-fb__tn:hover { opacity: .9; transform: translateY(-3px); }
.ec-fb__tn.is-on { opacity: 1; outline: 1px solid var(--blue-hi); outline-offset: 1px; }
.ec-fb__tn b { position: absolute; left: 0; right: 0; bottom: 0; padding: .15rem 0; font-size: 10px; font-weight: 500; text-align: center; background: rgba(3,17,30,.72); }

/* ---------- Opening ---------- */
.ec-fb__boot { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem; background: inherit; transition: opacity .6s var(--ease-soft), visibility .6s; }
.ec-fb__boot.is-done { opacity: 0; visibility: hidden; }
.ec-fb__bootcover { width: min(200px, 34vw); border-radius: 1px 3px 3px 1px; box-shadow: 0 30px 60px -24px rgba(0,0,0,.9); animation: ec-fb-breathe 3.2s var(--ease-soft) infinite; }
@keyframes ec-fb-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ec-fb__track { width: min(200px, 34vw); height: 1px; background: var(--line); overflow: hidden; }
.ec-fb__fill { display: block; height: 100%; width: 0; background: var(--blue-hi); transition: width .35s var(--ease-soft); }
.ec-fb__pct { font-size: var(--step--1); letter-spacing: .18em; color: var(--paper-45); font-variant-numeric: tabular-nums; }

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  .ec-fb__stage { padding: 3.6rem .6rem 4.4rem; }
  .ec-fb__bar { padding: .7rem .8rem; }
  .ec-fb__bar--top { gap: .5rem; }
  .ec-fb__title b { font-size: var(--step-0); }
  .ec-fb__title span { display: none; }
  .ec-fb__btn { width: 38px; height: 38px; }
  .ec-fb__hide-sm { display: none; }
  .ec-fb__count { min-width: 84px; letter-spacing: .06em; }
  .ec-fb__book::after { bottom: -16px; height: 26px; }
  .ec-fb__tn { width: 58px; }
}

/* Pointer-coarse devices get a slightly larger tap target and no hover lift. */
@media (hover: none) {
  .ec-fb__btn:hover { background: none; color: var(--paper-70); }
  .ec-fb__tn:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ec-fb, .ec-fb__bar, .ec-fb__zoom, .ec-fb__shelf, .ec-fb__page img, .ec-fb__page .ec-fb__blur { transition-duration: .01ms !important; }
  .ec-fb__bootcover { animation: none; }
}

/* The real page paints above its own blurred stand-in. */
.ec-fb__page .ec-fb__real { position: relative; z-index: 1; }
.ec-fb__page { position: relative; }
.ec-fb.is-zoomed .ec-fb__stage { cursor: grab; }
.ec-fb.is-zoomed .ec-fb__zoom.is-dragging { cursor: grabbing; }
.ec-fb__count b { font-weight: 400; color: var(--paper-45); }

/* A lone cover or back cover is nudged to the middle of the surface, the way
   a closed catalogue would actually sit in front of you. */
.ec-fb__book { transition: transform .6s var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .ec-fb__book { transition: none; } }
