body:has(dialog[open]) { overflow: hidden; }
dialog::backdrop { background: #27192aae; backdrop-filter: blur(6px); }
#artDialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 0; margin: 0; border: 0; background: #211a2c; }
.lightbox-stage { width: 100%; height: 100%; overflow: auto; }
.lightbox-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.magnified .lightbox-stage img { width: max(145vw,1200px); height: auto; }
.lightbox-tools { position: absolute; right: 16px; bottom: max(16px,env(safe-area-inset-bottom)); display: flex; gap: 7px; }
.lightbox-tools button { background: #31223de8; color: #fff4fc; border: 1px solid #ffdaef8a; padding: 8px 15px; border-radius: 20px; }


/* The portrait holds its position while the reader scrolls the cover away. */
.cover-scroll { position: relative; overflow: clip; }
.cover-scroll .hero {
    position: relative; transform: translateY(var(--hold,0px)); min-height: clamp(460px,72svh,760px);
    background: linear-gradient(110deg,var(--paper),var(--tint) 54%,var(--paper));
    border: none; border-radius: 24px 72px 24px 24px; overflow: hidden;
}
.hero-art { opacity: var(--face-opacity,1); transform: translateY(var(--drift,0px)) scale(1.035); width: 72%; object-position: 50% 42%; }
.hero-copy { z-index: 1; width: 46%; padding: 32px 0 40px 5%; }
.hero-copy :is(h1,.eyebrow) { opacity: var(--title-opacity,1); }
.hero h1 { font-size: clamp(3.8rem,6vw,6rem); letter-spacing: .045em; margin-bottom: 24px; }
.pin-dock { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
#pinLinks { display: flex; gap: 7px; flex-wrap: wrap; max-height: 130px; overflow: auto; }
#pinLinks:empty { display: none; }
#editPins,#pinLinks a,.enter-directory { border-radius: 30px; font-size: .92rem; padding: 8px 13px; text-decoration: none; }
#editPins { border: 1px dashed var(--main-color); color: var(--main-color); background: var(--surface); }
#pinLinks a { display: flex; gap: 8px; align-items: center; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
#pinLinks a:hover,#editPins:hover { background: var(--tint); }
#pinLinks i { color: var(--main-color); }
.enter-directory { position: absolute; bottom: 20px; left: 5%; padding-left: 0; color: var(--main-color); }
.enter-directory i { margin-right: 6px; }
.bookmarks { margin-right: auto; }
.bookmarks a { color: var(--muted); text-decoration: none; }
.directory { position: relative; margin-top: 0; padding: 24px 0; }
body::before {
    content: ""; position: fixed; inset: auto 0 0 auto; width: min(100%,1200px); height: min(25vh,185px); z-index: -1; pointer-events: none;
    background: url('../assets/xilian-wallpaper.jpg') center bottom / 130% auto no-repeat;
    mask-image: linear-gradient(transparent,#000); opacity: .13;
}
.results .search-box { position: static; width: 100%; margin: 15px 0 0; }
.results .waypoint { position: static; max-width: 100%; }
#pinDialog { color: var(--ink); background: var(--surface); width: min(480px,calc(100% - 28px)); max-height: 84dvh; padding: 20px; border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 24px 90px #35193942; }
#pinDialog[open] { display: flex; flex-direction: column; gap: 10px; }
#pinDialog header,.pin-row { display: flex; align-items: center; gap: 7px; }
#pinDialog header { justify-content: space-between; }
#pinDialog h2 { font-size: 1.35rem; }
#pinDialog h3,#pinDialog > label { font-size: .92rem; font-weight: 600; }
#pinOrder { max-height: 23dvh; overflow-y: auto; }
.pin-row { padding: 5px 0; border-bottom: 1px solid var(--line); cursor: grab; }
.pin-row strong { flex: 1; font-size: .91rem; overflow-wrap: anywhere; }
.pin-row i { color: var(--muted); }
.pin-row button { min-width: 34px; height: 34px; color: var(--main-color); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.pin-row button:disabled { opacity: .35; }
#pinSearch { width: 100%; padding: 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
#pinOptions { overflow-y: auto; min-height: 66px; }
#pinOptions label { display: flex; align-items: center; gap: 9px; padding: 8px 5px; border-bottom: 1px solid var(--line); cursor: pointer; }
#pinOptions label:hover { background: var(--tint); }
#pinOptions input { accent-color: var(--main-color); width: 17px; height: 17px; }
#pinOptions small { display: block; color: var(--muted); }
@media(max-width:740px) {
    .bookmarks { display: none; }
    .cover-scroll .hero { min-height: clamp(440px,75svh,690px); border-radius: 18px 36px 18px 18px; }
    .hero-art { width: 100%; height: 74%; object-position: 50% 34%; }
    .hero-copy { width: 100%; padding: 0 20px 63px; }
    .hero h1 { font-size: clamp(2.8rem,12vw,4.5rem); margin-bottom: 10px; }
    .hero-copy .eyebrow { font-size: 1.1rem; }
    .enter-directory { bottom: 8px; }
    #pinLinks { max-height: 80px; }
}
@media(prefers-reduced-motion: reduce) {
    .hero-art { transform: none; }
    .cover-scroll { padding-bottom: 0; }
}

.action-btn.pin[aria-pressed=true] { background: var(--tint); color: var(--main-color); }
@media(max-width:500px) { .site-card { padding-right: 111px; } }
@media(hover:none) and (min-width:501px) { .domain { padding-right: 87px; } }
