/* =========================================================
   Li-Cha — online catalogue viewer (/catalog)
   The catalogue pages are shown as they are; the frame around them
   uses the site's graphite, galvanized greys and brand green.
   ========================================================= */
@font-face { font-family: "Ravi FaNum"; src: url("../fonts/RaviFaNum-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Ravi FaNum"; src: url("../fonts/RaviFaNum-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("../fonts/Lexend-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --ink: #1D2022; --ink-2: #24272A; --ink-3: #2E3236; --line: rgba(237,239,240,.12); --line-2: rgba(237,239,240,.22);
  --galv: #EDEFF0; --steel: #9AA3A7; --green: #009933; --green-deep: #1A7B32; --green-hi: #2DBE5A;
  --f: "Ravi FaNum", system-ui, sans-serif; --f-lat: "Lexend", "Ravi FaNum", system-ui, sans-serif;
  --bar: 64px; --foot: 76px; --ease: cubic-bezier(.2,.7,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--galv); font: 400 15px/1.8 var(--f); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 22px; height: 22px; flex: none; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; top: -100px; right: 16px; z-index: 100; background: var(--green); color: #fff; padding: .6rem 1rem; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--green-hi); outline-offset: 2px; }

body { display: grid; grid-template-rows: var(--bar) minmax(0, 1fr) var(--foot); height: 100dvh; }

/* ---------- top bar ---------- */
.cv-bar { position: relative; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem; padding: 0 1.25rem; border-bottom: 1px solid var(--line); background: rgba(29,32,34,.86); backdrop-filter: blur(12px); }
.cv-bar__logo img { display: block; height: 34px; width: auto; }
.cv-bar__title { display: flex; align-items: baseline; gap: .9rem; min-width: 0; }
.cv-bar__title h1 { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-bar__kicker { font: 400 .68rem/1 var(--f-lat); letter-spacing: .22em; color: var(--steel); padding-inline-start: .9rem; border-inline-start: 3px solid var(--green); order: -1; }
.cv-bar__tools { display: flex; align-items: center; gap: .25rem; }
.tool { display: inline-flex; align-items: center; gap: .45rem; height: 40px; padding: 0 .8rem; border-radius: 999px; color: var(--galv); text-decoration: none; font-size: .9rem; transition: background-color .2s, color .2s; }
.tool--icon { width: 40px; padding: 0; justify-content: center; }
.tool:hover, .tool[aria-pressed="true"] { background: rgba(237,239,240,.1); }
.tool[aria-pressed="true"] { color: var(--green-hi); }
.tool svg { width: 20px; height: 20px; }
.tool-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 .4rem; }

/* ---------- stage ---------- */
.stage { position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 45%, #2C3135 0%, #1D2022 62%, #151719 100%); }
.stage__lines { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: repeating-linear-gradient(90deg, transparent 0 63px, rgba(237,239,240,.035) 63px 64px), repeating-linear-gradient(0deg, transparent 0 63px, rgba(237,239,240,.035) 63px 64px);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 100%); }
.stage__book { position: relative; height: 100%; display: grid; place-items: center; padding: 22px 0 18px; min-width: 0; }
.book { position: relative; transition: transform .7s var(--ease), opacity .5s; outline: none; }
.book.is-cover-l { transform: translateX(-25%); }   /* single front page sits on the left half (RTL) */
.book.is-cover-r { transform: translateX(25%); }
.book::after { content: ""; position: absolute; inset: auto 6% -18px; height: 30px; background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.55), transparent 70%); filter: blur(6px); z-index: -1; }
.is-loading .book { opacity: 0; }

.nav-arrow { position: relative; z-index: 5; justify-self: center; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--galv); border: 1px solid var(--line-2); background: rgba(29,32,34,.6); transition: background-color .25s, border-color .25s, transform .25s, opacity .25s; }
.nav-arrow:hover { background: var(--green); border-color: var(--green); transform: scale(1.06); }
.nav-arrow:disabled { opacity: .2; pointer-events: none; }
.nav-arrow--prev { grid-column: 1; grid-row: 1; }   /* grid runs RTL: column 1 is on the right — previous on the right, next on the left */
.nav-arrow--next { grid-column: 3; grid-row: 1; }
.stage__book { grid-column: 2; grid-row: 1; }

.loader { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--steel); font-size: .9rem; transition: opacity .4s; pointer-events: none; }
.loader img { width: 54px; height: 54px; animation: spin 1.4s linear infinite; filter: brightness(0) invert(1) opacity(.7); }
body:not(.is-loading) .loader { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- pages ---------- */
.pg { background: #fff; overflow: hidden; }
.pg__in { position: absolute; inset: 0; background: #fff; }
.pg__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pg__img.is-ready { opacity: 1; }
.pg__in::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, #f2f4f5 30%, #fafbfb 50%, #f2f4f5 70%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; }
.pg__in.is-ready::before { display: none; }
@keyframes shimmer { to { background-position: -150% 0; } }
/* spine shading — the left page of a spread darkens to its right edge, the right page to its left edge */
.pg__in::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.--left .pg__in::after { background: linear-gradient(to left, rgba(0,0,0,.14), rgba(0,0,0,0) 7%); }
.--right .pg__in::after { background: linear-gradient(to right, rgba(0,0,0,.14), rgba(0,0,0,0) 7%); }
.is-portrait .pg__in::after { display: none; }

.pg__items { position: absolute; inset: 0; }
.it { position: absolute; display: block; }
.it svg, .it * { pointer-events: none; }
.it img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
button.it, a.it { cursor: pointer; border-radius: 6px; transition: transform .25s var(--ease), box-shadow .25s, filter .25s; }
button.it:hover, a.it.has-img:hover { transform: translateY(-2px); filter: drop-shadow(0 8px 14px rgba(0,60,20,.25)); }
a.it.hot:hover, a.it.hot:focus-visible { background: rgba(0,153,51,.14); box-shadow: 0 0 0 2px rgba(0,153,51,.55); }
.it--play { border-radius: 50% !important; }
.it--play:hover { transform: scale(1.12) !important; }
.it--close { display: grid; place-items: center; color: #fff; border-radius: 50%; }
.it--close svg { width: 60%; height: 60%; }
.pg__layer { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s; }
.pg__layer.is-open { opacity: 1; visibility: visible; transition: opacity .35s; }

/* ---------- footer pager ---------- */
.cv-foot { position: relative; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 1.25rem; border-top: 1px solid var(--line); background: rgba(29,32,34,.9); }
.pager { grid-column: 2; display: flex; align-items: center; gap: .35rem; direction: rtl; }
.pbtn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--galv); transition: background-color .2s; }
.pbtn:hover { background: rgba(237,239,240,.1); }
.pbtn:disabled { opacity: .25; pointer-events: none; }
.pbtn svg { width: 18px; height: 18px; }
.scrub { position: relative; width: clamp(160px, 30vw, 440px); margin: 0 .6rem; direction: rtl; }
.scrub input { width: 100%; appearance: none; background: transparent; height: 26px; cursor: pointer; direction: rtl; }
.scrub input::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to left, var(--green) var(--p, 0%), var(--line-2) var(--p, 0%)); }
.scrub input::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line-2); }
.scrub input::-moz-range-progress { height: 3px; background: var(--green); }
.scrub input::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: #fff; border: 4px solid var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.scrub input::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 4px solid var(--green); }
.scrub__tip { position: absolute; bottom: calc(100% + 10px); right: 0; transform: translateX(50%); padding: .3rem .55rem; border-radius: 6px; background: #fff; color: var(--ink); font: 600 .8rem/1 var(--f); white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none; display: grid; justify-items: center; gap: .4rem; }
.scrub__tip img { width: 74px; height: auto; display: block; border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.scrub.is-active .scrub__tip { opacity: 1; }
.goto { display: flex; align-items: center; gap: .5rem; margin-inline-start: .8rem; font-size: .88rem; color: var(--steel); }
.goto input { width: 3.6em; height: 34px; text-align: center; border: 1px solid var(--line-2); border-radius: 8px; background: rgba(237,239,240,.06); color: var(--galv); -moz-appearance: textfield; }
.goto input::-webkit-inner-spin-button { appearance: none; }
.goto b { color: var(--galv); font-weight: 600; }
.cv-foot__section { grid-column: 3; justify-self: end; margin: 0; font-size: .85rem; color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cv-foot__section b { color: var(--galv); font-weight: 600; }
.cv-foot__section i { display: inline-block; width: 4px; height: .9em; background: var(--fc, var(--green)); margin-inline-end: .5rem; vertical-align: -.1em; }

/* ---------- side panel ---------- */
.panel { position: fixed; z-index: 40; top: 0; bottom: 0; right: 0; width: min(420px, 92vw); display: grid; grid-template-rows: auto minmax(0, 1fr); background: #F4F5F6; color: var(--ink); transform: translateX(102%); transition: transform .45s var(--ease); box-shadow: -20px 0 60px rgba(0,0,0,.35); }
.panel.is-open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(10,12,13,.5); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem .9rem; border-bottom: 1px solid #D5DADC; }
.panel__tabs { display: flex; gap: .25rem; background: #E3E6E8; border-radius: 999px; padding: 4px; }
.panel__tabs button { padding: .35rem 1rem; border-radius: 999px; font-size: .9rem; color: #4C5558; }
.panel__tabs button[aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.panel__close { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.panel__close:hover { background: #E3E6E8; }
.panel__body { overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.25rem 2rem; }

.toc { list-style: none; margin: 0; padding: 0; }
.toc__group { margin-top: 1.4rem; }
.toc__group:first-child { margin-top: 0; }
.toc__group > p { margin: 0 0 .35rem; font-size: .78rem; color: #6F7A7F; display: flex; align-items: center; gap: .5rem; }
.toc__group > p::after { content: ""; flex: 1; height: 1px; background: #D5DADC; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: grid; grid-template-columns: 4px 1fr auto; gap: .8rem; align-items: center; padding: .6rem .4rem .6rem .2rem; text-decoration: none; border-radius: 8px; transition: background-color .2s; }
.toc a::before { content: ""; width: 4px; height: 1.6em; border-radius: 2px; background: var(--fc, var(--green)); }
.toc a:hover, .toc a.is-current { background: #fff; }
.toc a.is-current { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.toc__name { display: grid; line-height: 1.5; }
.toc__name b { font-weight: 600; font-size: .95rem; }
.toc__name small { color: #6F7A7F; font-size: .78rem; }
.toc__name .lat { font: 500 .95rem/1.4 var(--f-lat); letter-spacing: .02em; }
.toc__pg { font-size: .8rem; color: #6F7A7F; }

.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem .8rem; }
.thumb { display: grid; gap: .35rem; text-align: center; font-size: .78rem; color: #6F7A7F; }
.thumb__img { aspect-ratio: 584 / 825; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .25s, box-shadow .25s; }
.thumb__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover .thumb__img { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.thumb.is-current .thumb__img { box-shadow: 0 0 0 3px var(--green); }
.thumb.is-current { color: var(--green-deep); font-weight: 600; }
.thumb__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

.search { position: relative; }
.search svg { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); color: #6F7A7F; width: 20px; height: 20px; }
.search input { width: 100%; height: 48px; padding: 0 2.8rem 0 1rem; border: 1px solid #C3C9CC; border-radius: 10px; background: #fff; color: var(--ink); }
.search input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(0,153,51,.15); }
.search__meta { margin: .7rem 0 .4rem; font-size: .82rem; color: #6F7A7F; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.results a { display: grid; grid-template-columns: 52px 1fr; gap: .8rem; padding: .55rem; border-radius: 10px; text-decoration: none; transition: background-color .2s; }
.results a:hover { background: #fff; }
.results img { width: 52px; aspect-ratio: 584/825; object-fit: cover; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.15); background: #fff; }
.results b { font-weight: 600; font-size: .85rem; }
.results p { margin: .1rem 0 0; font-size: .82rem; line-height: 1.7; color: #4C5558; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.results mark { background: rgba(0,153,51,.18); color: var(--ink); border-radius: 2px; padding: 0 .1em; }

/* ---------- modal (video / form / contact) ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal__scrim { position: absolute; inset: 0; background: rgba(10,12,13,.82); backdrop-filter: blur(4px); }
.modal__box { position: relative; width: min(960px, 100%); max-height: 100%; animation: pop .35s var(--ease); }
.modal--contact .modal__box { width: min(460px, 100%); }
.modal--form .modal__box { width: min(720px, 100%); height: min(860px, 100%); }
.modal__content { width: 100%; height: 100%; }
.modal video { display: block; width: 100%; max-height: calc(100dvh - 48px); background: #000; border-radius: 10px; }
.modal iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 12px; background: #fff; }
.modal__close { position: absolute; top: -48px; left: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.12); }
.modal__close:hover { background: var(--green); }
.modal__alt { position: absolute; top: -44px; right: 0; font-size: .85rem; color: var(--galv); }
.card { position: relative; aspect-ratio: 465.47 / 570.93; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.card > img { width: 100%; height: 100%; display: block; }
.card a { position: absolute; border-radius: 6px; }
.card a:hover, .card a:focus-visible { background: rgba(0,153,51,.14); box-shadow: 0 0 0 2px rgba(0,153,51,.55); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- zoom ---------- */
.zoom { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: 56px minmax(0, 1fr); background: #111314; }
.zoom__bar { display: flex; align-items: center; gap: 1rem; padding: 0 1rem; border-bottom: 1px solid var(--line); }
.zoom__label { font-weight: 600; }
.zoom__hint { margin-inline-start: auto; color: var(--steel); font-size: .82rem; }
.zoom__view { overflow: auto; cursor: grab; overscroll-behavior: contain; }
.zoom__view.is-drag { cursor: grabbing; }
.zoom__canvas { display: flex; justify-content: center; gap: 0; padding: 24px; width: max-content; min-width: 100%; direction: rtl; }
.zoom__canvas img { display: block; height: auto; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.5); user-select: none; -webkit-user-drag: none; }

/* ---------- floating contact + toast ---------- */
.contact-fab { position: fixed; z-index: 30; left: 20px; bottom: calc(var(--foot) + 18px); display: inline-flex; align-items: center; gap: .6rem; height: 48px; padding: 0 1.2rem 0 1.05rem; border-radius: 999px; background: var(--green); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0,153,51,.35); transition: transform .25s, background-color .25s; }
.contact-fab:hover { transform: translateY(-2px); background: var(--green-deep); }
.contact-fab svg { width: 20px; height: 20px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--foot) + 20px); transform: translate(-50%, 20px); padding: .6rem 1.1rem; border-radius: 999px; background: #fff; color: var(--ink); font-size: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tool:not(.tool--icon) span { display: none; }
  .tool:not(.tool--icon) { width: 40px; padding: 0; justify-content: center; }
  .cv-foot__section { display: none; }
  .cv-foot { grid-template-columns: 1fr; }
  .pager { grid-column: 1; justify-self: center; }
}
@media (max-width: 760px) {
  :root { --bar: 56px; --foot: 64px; }
  .cv-bar { gap: .5rem; padding: 0 .6rem 0 .75rem; grid-template-columns: auto 1fr; }
  .cv-bar__title { display: none; }
  .cv-bar__logo img { height: 28px; }
  .cv-bar__tools { justify-self: end; gap: 0; }
  .tool-sep, .hide-sm { display: none; }
  .tool, .tool--icon { width: 38px; height: 38px; }
  .stage { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .nav-arrow { display: none; }
  .stage__book { padding: 12px 0 10px; }
  .scrub { width: 32vw; margin: 0 .2rem; }
  .pager .pbtn[data-act="first"], .pager .pbtn[data-act="last"] { display: none; }
  .goto { margin-inline-start: .3rem; }
  .contact-fab { left: 12px; bottom: calc(var(--foot) + 12px); width: 48px; padding: 0; justify-content: center; }
  .contact-fab span { display: none; }
  .zoom__hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
