.profile-portfolio { --book-gold: #f4c370; --book-rim: #8ba6c44d; background: #080c14; }
.books-exhibition { position: relative; isolation: isolate; min-height: 100svh; padding-bottom: 35px; overflow: clip; }
.books-exhibition::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, #080c1440 0, #080c1410 35%, #080c14d9 83%, #080c14), url("../assets/profile-books-hero.jpg") center top / 100% auto no-repeat, #080c14;
}
.books-wrap { width: min(100% - clamp(32px, 6vw, 110px), 1540px); margin-inline: auto; }
.books-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .98fr);
  align-items: center;
  direction: ltr;
  padding-block: clamp(74px, 6.9vw, 115px) 14px;
  min-height: clamp(263px, 24vw, 384px);
}
.books-intro { direction: rtl; z-index: 1; padding-inline: 13px clamp(16px, 2.9vw, 42px); border-left: 1px solid #e9bd7687; }
.books-back { display: inline-flex; gap: 7px; align-items: center; min-height: 28px; color: #b8c9e2; font-size: .82rem; }
.books-back:hover { color: var(--book-gold); }
.books-eyebrow { display: flex; align-items: center; gap: 8px; margin: 3px 0; color: var(--book-gold); font-size: .81rem; }
.books-eyebrow::after { content: ""; width: 46px; height: 1px; background: linear-gradient(270deg, #f4c370ad, transparent); }
.books-intro h1 { margin: 6px 0; font-size: clamp(31px, 3.35vw, 62px); line-height: 1.13; }
.books-intro h1 span { color: var(--book-gold); }
.books-intro > p:last-of-type { margin: 8px 0 12px; color: #c7d3e5; font-size: clamp(.81rem, 1.25vw, 1rem); line-height: 1.6; }
.books-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 43px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid #dcb476a1;
  background: var(--book-gold);
  color: #19110a;
  font-size: .82rem;
  transition: background .24s, box-shadow .24s, color .24s;
}
.books-button:hover { background: #ffdaa1; box-shadow: 0 0 18px #f4c37055; }
.books-button-outline { background: #0c14228c; color: var(--book-gold); }
.books-button-outline:hover { background: var(--book-gold); color: #19110a; }
.books-hero-art { position: relative; min-height: clamp(130px, 15vw, 261px); perspective: 850px; }
.books-hero-art img {
  position: absolute;
  width: 65%;
  height: 92%;
  padding: 3px;
  object-fit: contain;
  border-radius: 5px;
  background: #152236;
  box-shadow: 0 12px 0 -4px #ced7e5, 0 22px 37px #000b, 0 0 23px #518ee84e;
}
.books-hero-art img:first-child { right: 4%; top: -1%; transform: rotateY(-18deg) rotateZ(11deg) rotateX(12deg); }
.books-hero-art img:last-child { left: 9%; top: 10%; transform: rotateY(-16deg) rotateZ(-11deg) rotateX(15deg); }
.books-selector { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-block: 10px 15px; }
.books-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(115px, 1fr); gap: 8px; overflow-x: auto; scrollbar-width: thin; padding: 5px 3px 7px; }
.books-rail a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(23px, .7fr);
  gap: 5px;
  align-items: center;
  min-height: 67px;
  padding: 6px;
  color: #d9e2f2;
  border: 1px solid var(--book-rim);
  border-radius: 8px;
  background: linear-gradient(125deg, #172333, #0b1425);
  font-size: clamp(.62rem, 1.1vw, .86rem);
  line-height: 1.4;
  transition: border-color .24s, box-shadow .24s;
}
.books-rail a:hover, .books-rail a[aria-current="true"] { border-color: var(--book-gold); box-shadow: 0 0 12px #e7b6604d; }
.books-rail img { width: 100%; max-height: 45px; object-fit: contain; transform: perspective(300px) rotateY(-16deg) rotateZ(-4deg); }
.books-arrow {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #d3ab665a;
  border-radius: 50%;
  color: var(--book-gold);
  background: #10192a;
  cursor: pointer;
  transition: background .23s, color .23s, border-color .23s;
}
.books-arrow:hover { background: var(--book-gold); color: #19110a; }
.books-arrow:disabled { opacity: .42; cursor: default; background: #10192a; color: var(--book-gold); }
.book-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, .78fr) minmax(83px, .4fr);
  direction: ltr;
  align-items: center;
  gap: clamp(13px, 2vw, 31px);
  padding: clamp(13px, 2.4vw, 34px);
  border: 1px solid var(--book-rim);
  border-radius: 14px;
  background: radial-gradient(ellipse at 24% 61%, #264773a1, transparent 60%), linear-gradient(115deg, #101b2de8, #090e18f0 70%);
  box-shadow: 0 17px 42px #000a;
}
.book-stage { min-width: 0; perspective: 1120px; }
.book-object {
  --page-ratio: 1.418;
  position: relative;
  isolation: isolate;
  display: grid;
  direction: ltr;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 650px);
  margin-inline: auto;
  padding: 3px;
  border-radius: 5px 8px 8px 5px;
  background: #19232d;
  box-shadow: 0 5px 0 -2px #b9c3cc, 0 9px 0 -4px #697583, 0 20px 28px #000b;
  transform-style: preserve-3d;
}
.book-stage .book-object { transform: rotateX(14deg) rotateY(-8deg) rotateZ(-5deg); }
.book-object[data-single] { grid-template-columns: minmax(0, 1fr); width: min(58%, 385px); }
.book-stage .book-object[data-portrait] { max-width: 510px; }
.book-stage .book-object[data-single][data-portrait] { max-width: 255px; }
.book-object:not([data-single])::after {
  content: "";
  position: absolute;
  inset: 4px calc(50% - 8px) 4px auto;
  width: 16px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(90deg, transparent, #15233952 39%, #10192799 49%, #111c296a 52%, transparent);
}
.book-face, .book-leaf { width: 100%; aspect-ratio: var(--page-ratio); object-fit: contain; background: #e9edf2; }
.book-leaf { position: absolute; inset-block-start: 3px; width: calc(50% - 3px); z-index: 3; animation: leaf-turn 580ms cubic-bezier(.43,.13,.33,.97) both; }
.book-leaf[data-edge="right"] { inset-inline-end: 3px; transform-origin: left center; --leaf-angle: -154deg; }
.book-leaf[data-edge="left"] { inset-inline-start: 3px; transform-origin: right center; --leaf-angle: 154deg; }
@keyframes leaf-turn {
  0% { transform: rotateY(0); opacity: 1; filter: brightness(1); }
  64% { opacity: .74; }
  100% { transform: rotateY(var(--leaf-angle)); opacity: 0; filter: brightness(.61); }
}
.book-controls { display: flex; direction: rtl; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.book-controls p { margin: 0; min-width: 102px; text-align: center; font-size: .78rem; color: #c4d1e6; }
.book-details { direction: rtl; min-width: 0; }
.book-details h2 { font-size: clamp(26px, 3.25vw, 52px); margin: 9px 0 5px; line-height: 1.15; }
.book-details #profile-sector { margin: 0; color: #c9d8ee; line-height: 1.55; }
.book-details #profile-count { color: #f0c987; font-size: .87rem; margin: 12px 0 15px; }
.book-thumb-list { display: grid; gap: 7px; }
.book-thumb-list button {
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--book-rim);
  border-radius: 6px;
  background: #141f30;
}
.book-thumb-list button:hover, .book-thumb-list button[aria-current="true"] { border-color: var(--book-gold); }
.book-thumb-list img { width: 100%; max-height: 73px; object-fit: contain; aspect-ratio: 1.65; }
.books-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 14px clamp(15px, 2vw, 28px); border: 1px solid var(--book-rim); border-radius: 12px; background: #101b2bd9; }
.books-footer h2 { margin: 0; font-size: clamp(21px, 2.1vw, 32px); }
.books-footer p { color: #c1cee2; margin: 4px 0 0; font-size: .87rem; }
.book-lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.book-lightbox h2 { text-align: center; margin: 0 0 10px; font-size: clamp(23px, 4vw, 46px); }
.book-lightbox-pages { width: min(100%, 1400px); min-height: 0; overflow: auto; padding: 3px 4px 16px; }
.book-lightbox .book-object { width: min(100%, calc((100dvh - 195px) * 2 * var(--page-ratio))); }
.book-lightbox .book-object[data-single] { width: min(100%, calc((100dvh - 195px) * var(--page-ratio))); }
.book-lightbox .book-face, .book-lightbox .book-leaf { width: 100%; max-height: none; }
.book-lightbox .book-leaf { width: calc(50% - 3px); }
.book-lightbox .book-controls { margin-top: 5px; }
@media (max-width: 1050px) { .books-rail { grid-auto-columns: minmax(110px, 1fr); } }
@media (max-width: 760px) {
  .books-exhibition::before { background: linear-gradient(180deg, #080c1469, #080c14 410px), url("../assets/profile-books-hero.jpg") 63% top / auto 370px no-repeat, #080c14; }
  .books-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; padding-bottom: 5px; }
  .books-hero-art { min-height: clamp(135px, 43vw, 235px); width: min(100%, 440px); margin: 4px auto 0; }
  .books-intro { border-left: 0; padding-inline: 0; }
  .books-rail { grid-auto-columns: 110px; }
  .books-selector { gap: 5px; }
  .book-showcase { grid-template-columns: minmax(0, 1fr); padding: 15px; }
  .book-stage { margin-top: 10px; }
  .book-stage .book-object { width: 96%; transform: rotateX(9deg) rotateY(-5deg) rotateZ(-3deg); }
  .book-stage .book-object[data-single] { width: min(68%, 260px); }
  .book-details { grid-row: 1; }
  .book-details #profile-count { margin-block: 7px 10px; }
  .book-thumb-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book-lightbox[open] { padding-top: 58px; }
  .book-lightbox-pages { padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { .book-leaf { display: none; } }
