@font-face {
    font-family: "KtxPlayfair";
    src: url("../../fonts/playfair-display/playfair-display-variable.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "KtxInter";
    src: url("../../fonts/inter/inter-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --ktx-bg: #0a0a0c;
    --ktx-ink: #f3efe6;
    --ktx-mut: rgba(243, 239, 230, 0.56);
    --ktx-dim: rgba(243, 239, 230, 0.30);
    --ktx-gold: #cda45c;
    --ktx-gold-soft: rgba(205, 164, 92, 0.14);
    --ktx-line: rgba(243, 239, 230, 0.12);
    --ktx-serif: "KtxPlayfair", "Playfair Display", Georgia, serif;
    --ktx-ui: "KtxInter", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --ktx-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body.ktx-page { background: var(--ktx-bg); }

.ktx {
    background: var(--ktx-bg);
    color: var(--ktx-ink);
    font-family: var(--ktx-ui);
    overflow-x: clip;
}
.ktx ::selection { background: var(--ktx-gold); color: #0a0a0c; }
.ktx-hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
}

.ktx-wall {
    position: absolute;
    inset: -18% -6%;
    z-index: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    transform: rotate(-7deg) scale(1.18);
    transform-origin: center;
    opacity: 0.42;
    pointer-events: none;
}
.ktx-wall__col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    will-change: transform;
}
.ktx-wall__col--up { animation: ktxWallUp 64s linear infinite; }
.ktx-wall__col--down { animation: ktxWallDown 64s linear infinite; }
.ktx-wall__col--up:nth-child(3) { animation-duration: 78s; }
.ktx-wall__col--down:nth-child(2) { animation-duration: 72s; }
@keyframes ktxWallUp { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes ktxWallDown { from { transform: translateY(-50%); } to { transform: translateY(0); } }

.ktx-wall__cover {
    display: block;
    border-radius: 4px;
    overflow: hidden;
    background: #16161a;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.ktx-wall__cover img { width: 100%; height: auto; display: block; }
.ktx-hero__scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(90deg, var(--ktx-bg) 0%, rgba(10, 10, 12, 0.92) 34%, rgba(10, 10, 12, 0.55) 66%, rgba(10, 10, 12, 0.82) 100%),
        linear-gradient(180deg, rgba(10, 10, 12, 0.85) 0%, rgba(10, 10, 12, 0.25) 42%, rgba(10, 10, 12, 0.9) 100%);
}
.ktx-hero__glow {
    position: absolute;
    top: 10%;
    left: 12%;
    width: 60vw;
    height: 60vw;
    max-width: 760px;
    max-height: 760px;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle, rgba(205, 164, 92, 0.14) 0%, rgba(205, 164, 92, 0) 60%);
}

.ktx-hero__inner {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1500px;
    margin: clamp(50px, 11vh, 130px) auto 0;
    padding: 0 clamp(20px, 6vw, 90px);
}

.ktx-hero__title {
    margin: 0;
    font-family: var(--ktx-serif);
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: -0.02em;
    font-size: clamp(60px, 12vw, 200px);
}
.ktx-line { display: block; overflow: hidden; padding-bottom: 0.22em; margin-bottom: -0.22em; }
.ktx-line > span { display: block; }
.ktx-ital { font-family: var(--ktx-serif); font-style: italic; color: var(--ktx-gold); }

.ktx-hero__desc {
    margin: clamp(24px, 3vw, 38px) 0 0;
    max-width: 44ch;
    font-size: clamp(15px, 1.15vw, 18px);
    line-height: 1.6;
    color: var(--ktx-mut);
}
.ktx-shelf {
    position: relative;
    z-index: 2;
    padding: clamp(60px, 9vw, 130px) clamp(20px, 6vw, 90px);
}
.ktx-shelf__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
    gap: 24px;
    margin-bottom: clamp(34px, 5vw, 60px);
}
.ktx-shelf__title {
    margin: 0;
    font-family: "Outfit", system-ui, sans-serif;
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    font-weight: 200;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ktx-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}
.ktx-filter {
    appearance: none;
    background: transparent;
    border: 1px solid var(--ktx-line);
    color: var(--ktx-mut);
    font-family: var(--ktx-ui);
    font-size: 12px;
    letter-spacing: 0.08em;
    min-width: 0;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 99px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.ktx-filter:hover { color: var(--ktx-ink); border-color: rgba(243, 239, 230, 0.35); }
.ktx-filter.is-active { background: var(--ktx-gold); border-color: var(--ktx-gold); color: #0a0a0c; }
.ktx-books {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(24px, 3vw, 46px) clamp(18px, 2.4vw, 34px);
}
.ktx-book {
    opacity: 0;
    transform: translateY(38px);
    cursor: pointer;
    outline: none;
}
.ktx-book.is-hidden { display: none; }
.ktx-book:focus-visible .ktx-book__cover { outline: 2px solid var(--ktx-gold); outline-offset: 4px; }

.ktx-book__cover {
    position: relative;
    border-radius: 3px 6px 6px 3px;
    overflow: hidden;
    background: #15151a;
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.5);
    transition: transform 0.55s var(--ktx-ease), box-shadow 0.55s var(--ktx-ease);
    aspect-ratio: 4 / 3;
}
.ktx-book__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.7s var(--ktx-ease), filter 0.5s ease;
}
.ktx-book__spine {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 14px;
    z-index: 2;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.05) 60%, transparent);
    pointer-events: none;
}
.ktx-book__pages {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 3;
    padding: 5px 11px;
    border-radius: 99px;
    background: rgba(10, 10, 12, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ktx-ink);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.ktx-book__open {
    position: absolute;
    left: 50%; bottom: 18px;
    transform: translate(-50%, 14px);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 99px;
    background: var(--ktx-gold);
    color: #0a0a0c;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s var(--ktx-ease);
}
.ktx-book:hover .ktx-book__cover,
.ktx-book:focus-visible .ktx-book__cover {
    transform: translateY(-8px);
    box-shadow: 0 40px 70px rgba(0, 0, 0, 0.6);
}
.ktx-book:hover .ktx-book__cover img { transform: scale(1.05); filter: brightness(0.85); }
.ktx-book:hover .ktx-book__pages { opacity: 1; transform: translateY(0); }
.ktx-book:hover .ktx-book__open,
.ktx-book:focus-visible .ktx-book__open { opacity: 1; transform: translate(-50%, 0); }

.ktx-book__meta { padding: 16px 2px 0; }
.ktx-book__name {
    margin: 0;
    font-family: var(--ktx-serif);
    font-size: clamp(17px, 1.5vw, 21px);
    font-weight: 500;
    line-height: 1.15;
}
.ktx-book__cat {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ktx-dim);
}
.ktx-shelf__empty { text-align: center; color: var(--ktx-mut); padding: 40px 0; }
.ktx-reader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    background: rgba(6, 6, 8, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    font-family: var(--ktx-ui);
    color: var(--ktx-ink);
}
.ktx-reader.is-open { opacity: 1; visibility: visible; }

.ktx-reader__bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(16px, 4vw, 40px);
    border-bottom: 1px solid var(--ktx-line);
    background: rgba(6, 6, 8, 0.98);
    flex-shrink: 0;
}
.ktx-reader__id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ktx-reader__name { font-family: var(--ktx-serif); font-size: clamp(18px, 2.2vw, 26px); font-weight: 500; color: var(--ktx-ink); }
.ktx-reader__cat { font-size: 12px; line-height: 1.4; letter-spacing: 0.02em; text-transform: none; color: var(--ktx-gold); }
.ktx-reader__close {
    appearance: none;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px;
    padding: 0;
    border: 1px solid var(--ktx-line);
    border-radius: 50%;
    background: transparent;
    color: var(--ktx-ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.25s ease, background 0.25s ease;
}
.ktx-reader__close::before,
.ktx-reader__close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}
.ktx-reader__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.ktx-reader__close:hover { border-color: var(--ktx-gold); background: var(--ktx-gold-soft); }

.ktx-reader__stage {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 40px);
    min-height: 0;
    padding: clamp(14px, 3vh, 34px) clamp(16px, 4vw, 40px);
    overflow: hidden;
}
.ktx-reader__page {
    flex: 1;
    min-width: 0;
    height: 100%;
    margin: 0;
    max-width: min(1300px, 84vw);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ktx-reader__page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.7);
    transition: opacity 0.28s ease, transform 0.4s var(--ktx-ease);
}
.ktx-reader__page.is-turning img { opacity: 0; transform: translateX(var(--dir, 0)) scale(0.985); }

.ktx-reader__nav {
    appearance: none;
    display: flex; align-items: center; justify-content: center;
    width: 54px; height: 54px;
    padding: 0;
    border: 1px solid var(--ktx-line);
    border-radius: 50%;
    background: rgba(20, 20, 24, 0.6);
    color: var(--ktx-ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.25s ease, background 0.25s ease, opacity 0.25s ease;
}
.ktx-reader__nav:hover { border-color: var(--ktx-gold); background: var(--ktx-gold-soft); }
.ktx-reader__nav:disabled { opacity: 0.25; cursor: default; }

.ktx-reader__filmstrip {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 10px;
    padding: 14px clamp(16px, 4vw, 40px);
    overflow-x: auto;
    border-top: 1px solid var(--ktx-line);
    background: rgba(6, 6, 8, 0.98);
    flex-shrink: 0;
    scrollbar-width: thin;
}
.ktx-thumb {
    flex-shrink: 0;
    width: 66px;
    height: 48px;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.45;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: opacity 0.25s ease, outline-color 0.25s ease;
    padding: 0;
    border: none;
    background: #15151a;
}
.ktx-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ktx-thumb:hover { opacity: 0.85; }
.ktx-thumb.is-active { opacity: 1; outline-color: var(--ktx-gold); }
@media (max-width: 1100px) {
    .ktx-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ktx-books { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
    .ktx-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ktx-filter { min-height: 42px; padding-inline: 10px; letter-spacing: 0.04em; }
    .ktx-books { grid-template-columns: repeat(2, 1fr); }
    .ktx-wall { grid-template-columns: repeat(3, 1fr); opacity: 0.3; }
    .ktx-reader__nav { width: 46px; height: 46px; }
    .ktx-reader__filmstrip { display: none; }
}
@media (max-width: 430px) {
    .ktx-filters { grid-template-columns: 1fr; }
    .ktx-books { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .ktx-wall__col--up,
    .ktx-wall__col--down { animation: none !important; }
    .ktx-book { opacity: 1 !important; transform: none !important; }
    .ktx-reader__page img { transition: opacity 0.2s ease; }
}
.ktx-hero__title,
.ktx-hero__title * {
    font-family: "Outfit", system-ui, sans-serif;
    font-style: normal;
    font-weight: 500;
    letter-spacing: -0.03em;
    text-transform: none;
}

.ktx-hero__title {
    font-size: clamp(3.4rem, 7.2vw, 7rem);
    line-height: 1;
    max-width: none;
}
