:root {
  --ink: #251a1b;
  --paper: #f7f3ec;
  --paper-deep: #ece4da;
  --wine: #731f31;
  --wine-dark: #4d1321;
  --muted: #756b66;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}
button, input { font: inherit; }
button { color: inherit; }
::selection { background: rgba(115, 31, 49, 0.16); }

.session-check {
  display: grid;
  min-height: 100dvh;
  place-content: center;
  gap: 1.25rem;
  background: var(--paper);
  text-align: center;
}
.session-check p { margin: 0; color: var(--muted); font-size: .69rem; letter-spacing: .2em; text-transform: uppercase; }
.loading-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: auto;
  place-items: center;
  border: 1px solid rgba(115, 31, 49, .38);
  border-radius: 50%;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  animation: mark-pulse 1.8s ease-in-out infinite;
}

.login-shell { display: grid; min-height: 100dvh; grid-template-columns: minmax(0, .94fr) minmax(28rem, 1.06fr); background: var(--paper); }
.login-panel { position: relative; display: flex; min-height: 100dvh; padding: clamp(2rem, 5vw, 5.5rem); flex-direction: column; justify-content: space-between; }
.login-brand, .reader-brand { color: var(--wine); font-family: Georgia, "Times New Roman", serif; letter-spacing: .13em; }
.login-brand { font-size: clamp(1.15rem, 1.8vw, 1.55rem); }
.login-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.language-selector { display: inline-flex; padding: .22rem; border: 1px solid rgba(37, 26, 27, .18); background: rgba(255, 255, 255, .42); }
.language-selector button { padding: .58rem .8rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .61rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; transition: background 160ms ease, color 160ms ease; }
.language-selector button.is-active { background: var(--wine); color: #fffaf2; }
.language-selector button:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.login-content { width: min(100%, 32rem); padding: 3rem 0; }
.eyebrow { margin: 0 0 1.15rem; color: var(--wine); font-size: .68rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.login-content h1 { max-width: 8.5em; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.75rem, 5.5vw, 5.75rem); font-weight: 400; letter-spacing: -.055em; line-height: .97; }
.login-copy { max-width: 27rem; margin: 1.8rem 0 2.3rem; color: var(--muted); font-size: .98rem; line-height: 1.65; }
.password-form { width: min(100%, 27rem); }
.password-form > label { display: block; margin-bottom: .55rem; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.password-field { position: relative; }
.password-field input { width: 100%; height: 3.55rem; padding: 0 5.25rem 0 1rem; border: 1px solid rgba(37, 26, 27, .23); border-radius: 0; outline: none; background: rgba(255, 255, 255, .55); transition: border-color 160ms ease, box-shadow 160ms ease; }
.password-field input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(115, 31, 49, .08); }
.password-field input::placeholder { color: #aaa09a; }
.visibility-button { position: absolute; top: 0; right: 0; height: 100%; padding: 0 1.1rem; border: 0; background: transparent; color: var(--wine); cursor: pointer; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.form-message { min-height: 1.1rem; margin: .55rem 0 1.1rem; color: var(--muted); font-size: .75rem; }
.form-message.is-error { color: #a32235; }
.unlock-button { display: flex; width: 100%; height: 3.55rem; padding: 0 1.15rem; align-items: center; justify-content: space-between; border: 1px solid var(--wine); background: var(--wine); color: #fffaf2; cursor: pointer; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; transition: background 160ms ease, transform 160ms ease; }
.unlock-button:hover:not(:disabled) { background: var(--wine-dark); }
.unlock-button:active:not(:disabled) { transform: translateY(1px); }
.unlock-button:disabled { cursor: wait; opacity: .7; }
.privacy-note { margin: 0; color: #948984; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; }

.editorial-panel { position: relative; min-height: 100dvh; overflow: hidden; background: radial-gradient(circle at 72% 32%, rgba(255,255,255,.11) 0 1px, transparent 1.5px) 0 0 / 17px 17px, linear-gradient(135deg, #7f2638, #4e1422 71%, #321018); }
.editorial-panel::before { position: absolute; inset: 7%; border: 1px solid rgba(255, 247, 234, .22); content: ""; }
.editorial-panel::after { position: absolute; width: 38%; height: 115%; top: -7%; left: 38%; border-left: 1px solid rgba(255, 247, 234, .22); border-right: 1px solid rgba(255, 247, 234, .22); content: ""; transform: rotate(12deg); }
.editorial-monogram { position: absolute; top: 50%; left: 50%; z-index: 2; color: rgba(255, 247, 234, .93); font-family: Georgia, "Times New Roman", serif; font-size: clamp(15rem, 31vw, 38rem); font-weight: 400; line-height: .7; text-shadow: 0 24px 80px rgba(24, 4, 10, .35); transform: translate(-50%, -50%); }
.editorial-orbit { position: absolute; z-index: 1; border: 1px solid rgba(255, 247, 234, .36); border-radius: 50%; }
.editorial-orbit-one { width: 60%; aspect-ratio: 1; top: 13%; left: 4%; }
.editorial-orbit-two { width: 44%; aspect-ratio: 1; right: 1%; bottom: 7%; }
.season-label { position: absolute; right: 10%; bottom: 10%; z-index: 3; color: rgba(255, 247, 234, .82); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 3vw, 2.6rem); letter-spacing: .14em; }
.vertical-caption { position: absolute; top: 12%; right: 9%; z-index: 3; color: rgba(255, 247, 234, .68); font-size: .57rem; letter-spacing: .28em; writing-mode: vertical-rl; }

.reader-shell { display: grid; height: 100dvh; min-height: 34rem; overflow: hidden; grid-template-rows: 4.4rem minmax(0, 1fr) 5.65rem; background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.9), rgba(236,228,218,.66) 55%, rgba(217,207,197,.74)), var(--paper-deep); user-select: none; }
.reader-header { display: grid; z-index: 5; padding: 0 clamp(1rem, 3vw, 2.6rem); align-items: center; grid-template-columns: 1fr auto 1fr; border-bottom: 1px solid rgba(37, 26, 27, .12); background: rgba(247, 243, 236, .9); backdrop-filter: blur(12px); }
.reader-brand { font-size: 1rem; }
.reader-heading { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .65rem; letter-spacing: .13em; text-transform: uppercase; }
.reader-heading span:first-child { color: var(--ink); font-weight: 700; }
.header-separator { width: 1.8rem; height: 1px; background: var(--wine); }
.lock-button { display: flex; justify-self: end; align-items: center; gap: .45rem; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: .64rem; letter-spacing: .11em; text-transform: uppercase; }
.lock-button span:first-child { font-size: 1.25rem; line-height: 1; }
.reader-stage { position: relative; display: grid; min-height: 0; padding: clamp(.8rem, 2.1vh, 1.4rem) clamp(3.75rem, 7vw, 7rem); place-items: center; }
.catalogue-page { position: relative; height: 100%; aspect-ratio: 595 / 842; overflow: hidden; background: #f3f0eb; box-shadow: 0 28px 70px rgba(41, 26, 26, .17), 0 3px 10px rgba(41, 26, 26, .1); touch-action: pan-y; -webkit-touch-callout: none; }
.catalogue-page::after { position: absolute; inset: 0; border: 1px solid rgba(42, 24, 28, .11); content: ""; pointer-events: none; }
.catalogue-page img { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; transform-origin: center; transition: opacity 260ms ease, transform 160ms ease; -webkit-user-drag: none; }
.catalogue-page.is-ready img { opacity: 1; }
.catalogue-page.is-zoomed { cursor: grab; touch-action: none; }
.catalogue-page.is-zoomed:active { cursor: grabbing; }
.catalogue-page.is-zoomed img { transition: opacity 260ms ease; }
.page-loading { position: absolute; inset: 0; display: grid; place-content: center; color: #8b817b; font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; }
.private-watermark { position: absolute; right: .72rem; bottom: .62rem; padding: .23rem .34rem; border: 1px solid rgba(115, 31, 49, .28); background: rgba(247, 243, 236, .52); color: rgba(115, 31, 49, .48); font-size: clamp(.35rem, .65vh, .5rem); letter-spacing: .14em; pointer-events: none; }
.zoom-controls { position: absolute; top: clamp(.65rem, 1.6vh, 1rem); right: clamp(.75rem, 2.3vw, 2.2rem); z-index: 4; display: flex; align-items: center; border: 1px solid rgba(37, 26, 27, .2); background: rgba(247, 243, 236, .9); box-shadow: 0 8px 24px rgba(41, 26, 26, .1); backdrop-filter: blur(10px); }
.zoom-controls button { display: grid; width: 2.35rem; height: 2.35rem; padding: 0; place-items: center; border: 0; border-right: 1px solid rgba(37, 26, 27, .12); background: transparent; color: var(--ink); cursor: pointer; font-size: 1rem; }
.zoom-controls button:hover:not(:disabled) { background: var(--wine); color: #fff; }
.zoom-controls button:disabled { cursor: default; opacity: .3; }
.zoom-controls span { min-width: 3.4rem; padding: 0 .45rem; color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .06em; text-align: center; }
.zoom-controls .zoom-reset { width: 2.8rem; border-right: 0; border-left: 1px solid rgba(37, 26, 27, .12); font-size: .58rem; font-weight: 700; letter-spacing: .05em; }
.edge-navigation { position: absolute; top: 50%; display: grid; width: 3rem; height: 3rem; place-items: center; border: 1px solid rgba(37, 26, 27, .22); border-radius: 50%; background: rgba(247, 243, 236, .62); cursor: pointer; font-size: 1.2rem; transform: translateY(-50%); transition: background 160ms ease, color 160ms ease, opacity 160ms ease; }
.edge-navigation:hover:not(:disabled) { background: var(--wine); color: white; }
.edge-navigation:disabled, .mobile-page-button:disabled { cursor: default; opacity: .22; }
.edge-navigation-left { left: clamp(.75rem, 2.3vw, 2.2rem); }
.edge-navigation-right { right: clamp(.75rem, 2.3vw, 2.2rem); }
.reader-footer { display: grid; z-index: 5; padding: 0 clamp(1.2rem, 3.5vw, 3.4rem); align-items: center; grid-template-columns: 3rem minmax(0, 37rem) 3rem; justify-content: center; gap: 1rem; border-top: 1px solid rgba(37, 26, 27, .12); background: rgba(247, 243, 236, .93); backdrop-filter: blur(12px); }
.progress-control { display: grid; grid-template-columns: 6.1rem minmax(0, 1fr); align-items: center; gap: 0 1.25rem; }
.page-counter { display: flex; align-items: center; gap: .48rem; font-family: Georgia, "Times New Roman", serif; font-size: .92rem; }
.page-counter span:first-child { color: var(--wine); font-size: 1.35rem; }
.counter-rule { width: 1rem; height: 1px; background: rgba(37, 26, 27, .3); }
.progress-control input[type="range"] { width: 100%; height: 1px; margin: 0; appearance: none; outline: none; background: linear-gradient(to right, var(--wine) 0 var(--reader-progress), rgba(37, 26, 27, .2) var(--reader-progress) 100%); cursor: pointer; }
.progress-control input[type="range"]::-webkit-slider-thumb { width: .72rem; height: .72rem; appearance: none; border: 2px solid var(--paper); border-radius: 50%; background: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.progress-control input[type="range"]::-moz-range-thumb { width: .72rem; height: .72rem; border: 2px solid var(--paper); border-radius: 50%; background: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.progress-control p { grid-column: 2; margin: .62rem 0 0; color: #8c827c; font-size: .57rem; letter-spacing: .09em; text-align: center; text-transform: uppercase; }
.mobile-page-button { display: none; width: 2.65rem; height: 2.65rem; place-items: center; border: 1px solid rgba(37, 26, 27, .18); border-radius: 50%; background: transparent; cursor: pointer; }
.empty-reader { grid-template-rows: 4.4rem minmax(0, 1fr); }
.empty-catalogue { display: grid; width: min(42rem, calc(100% - 3rem)); margin: auto; place-content: center; text-align: center; }
.empty-catalogue h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 6vw, 5.5rem); font-weight: 400; letter-spacing: -.045em; line-height: 1; }
.empty-catalogue > p:last-child { max-width: 33rem; margin: 1.5rem auto 0; color: var(--muted); line-height: 1.65; }

@keyframes mark-pulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { z-index: 2; min-height: 100dvh; background: linear-gradient(90deg, rgba(247,243,236,.97), rgba(247,243,236,.89)); }
  .editorial-panel { position: fixed; inset: 0 0 0 40%; min-height: 100dvh; }
  .reader-heading span:last-child, .header-separator { display: none; }
}

@media (max-width: 640px) {
  .login-panel { padding: 1.5rem; }
  .login-content { padding: 2rem 0; }
  .login-topbar { align-items: flex-start; }
  .language-selector button { padding: .52rem .62rem; font-size: .55rem; letter-spacing: .06em; }
  .login-content h1 { max-width: 8.8em; font-size: clamp(2.65rem, 13vw, 4.4rem); }
  .editorial-panel { inset: 0 0 0 64%; opacity: .75; }
  .privacy-note { max-width: 19rem; line-height: 1.6; }
  .reader-shell { min-height: 30rem; grid-template-rows: 3.75rem minmax(0, 1fr) 5.25rem; }
  .reader-header { padding: 0 1rem; grid-template-columns: 1fr auto; }
  .reader-heading { display: none; }
  .lock-button span:last-child { display: none; }
  .reader-stage { padding: .65rem .75rem; }
  .zoom-controls { top: .85rem; right: .9rem; }
  .zoom-controls button { width: 2.1rem; height: 2.1rem; }
  .zoom-controls span { min-width: 3rem; }
  .zoom-controls .zoom-reset { display: none; }
  .catalogue-page { width: min(100%, calc((100dvh - 10.3rem) * 595 / 842)); height: auto; max-height: 100%; }
  .edge-navigation { display: none; }
  .reader-footer { padding: 0 .75rem; grid-template-columns: 2.65rem minmax(0, 1fr) 2.65rem; gap: .75rem; }
  .progress-control { grid-template-columns: 1fr; gap: .45rem; }
  .page-counter { justify-content: center; }
  .progress-control p { display: none; }
  .mobile-page-button { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
