/* ===== GLOBAL RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0a0a0a;
    color: #e8e8e8;
    font-family: 'Inter', -apple-system, 'Helvetica Neue', 'PingFang SC', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    background: linear-gradient(180deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0) 100%);
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f0f0f0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 400;
    color: #888;
    letter-spacing: 0.5px;
    transition: color 0.25s ease;
    position: relative;
}

.nav-links a.active,
.nav-links a:hover {
    color: #f0f0f0;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #e63946;
    border-radius: 50%;
}

.lang-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #333;
    color: #aaa;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    border-color: #e63946;
    color: #e63946;
}

/* ===== VIEW TRANSITIONS ===== */
.view {
    position: fixed;
    inset: 0;
    padding-top: 80px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.77, 0, 0.175, 1), visibility 0s 0.5s;
    will-change: transform, opacity;
    z-index: 1;
}

.view.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.77, 0, 0.175, 1), visibility 0s 0s;
}

/* Home → Detail: slide in from right */
.view.enter-right {
    transform: translateX(100%);
}
.view.enter-right.active {
    transform: translateX(0);
}

/* Detail → Home: slide in from left */
.view.enter-left {
    transform: translateX(-100%);
}
.view.enter-left.active {
    transform: translateX(0);
}

/* Initial state */
#home-view {
    transform: translateX(0);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== HOME VIEW ===== */
#home-view {
    grid-template-columns: 1fr 1.4fr;
    gap: 60px;
    padding: 100px 60px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

#home-view.active {
    display: grid;
}

/* LEFT COLUMN */
.home-left {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-top: 40px;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 1.5px;
    color: #666;
    text-transform: uppercase;
}

.meta-dot {
    color: #333;
}

.home-title {
    margin-top: 0;
}

.display-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(4rem, 8vw, 7rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -2px;
    color: #f5f5f5;
    margin-bottom: 24px;
}

.title-sub {
    display: flex;
    align-items: center;
    gap: 16px;
}

.title-bar {
    width: 36px;
    height: 3px;
    background: #e63946;
}

.title-sub span {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.1rem;
    color: #ccc;
    letter-spacing: 2px;
}

/* Chapter Index (bottom left vertical list) */
.chapter-index {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 24px;
    border-top: 1px solid #1a1a1a;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.chapter-index::-webkit-scrollbar {
    width: 4px;
}

.chapter-index::-webkit-scrollbar-track {
    background: transparent;
}

.chapter-index::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.chapter-index::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.index-item {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    padding: 6px 0;
    transition: all 0.3s ease;
}

.index-item:hover .index-num,
.index-item:hover .index-name,
.index-item:hover .index-date {
    color: #f0f0f0;
}

.index-num {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    color: #555;
    font-weight: 700;
    min-width: 28px;
    transition: color 0.3s ease;
}

.index-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #888;
    letter-spacing: 0.8px;
    transition: color 0.3s ease;
    flex: 1;
}

.index-date {
    font-size: 0.7rem;
    color: #555;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    font-family: 'Playfair Display', serif;
    font-style: italic;
}

/* RIGHT COLUMN */
.home-right {
    padding-top: 40px;
    display: flex;
    flex-direction: column;
}

.browse-label {
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: #555;
    text-transform: uppercase;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid #1a1a1a;
    align-self: flex-end;
}

.chapter-grid {
    display: flex;
    flex-direction: column;
    gap: 36px;
    flex: 1;
}

/* Chapter Card (right side with photos) */
.chapter-card {
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateX(100vw);
    animation: cardReveal 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateX(100vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.index-item {
    opacity: 0;
    transform: translateX(-100vw);
    animation: indexReveal 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes indexReveal {
    from {
        opacity: 0;
        transform: translateX(-100vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chapter-card:hover .cc-number {
    color: #e63946;
}

.chapter-card:hover .cc-photo {
    transform: scale(1.02);
}

.cc-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 14px;
}

.cc-number {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 900;
    color: #f0f0f0;
    line-height: 1;
    letter-spacing: -1px;
    transition: color 0.3s ease;
}

.chapter-card:first-child .cc-number {
    color: #e63946;
}

.cc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cc-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #e8e8e8;
    letter-spacing: 1px;
}

.cc-region {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: #666;
    text-transform: uppercase;
}

.cc-date {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #888;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    margin-top: 4px;
}

.cc-photos {
    display: grid;
    gap: 8px;
}

.cc-photo {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 4px;
    transition: transform 0.4s ease;
    background: #1a1a1a;
}

.cc-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: brightness(0.85);
    background: #0a0a0a;
    transition: filter 0.4s ease;
}

.chapter-card:hover .cc-photo img {
    filter: brightness(1);
}

/* ===== DETAIL VIEW ===== */
#detail-view {
    padding-top: 0;
}

#detail-view.active {
    display: block;
}

.detail-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    min-height: calc(100vh - 60px);
}

/* LEFT COLUMN */
.detail-left {
    padding: 100px 50px 80px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

/* Detail view staggered animations */
.detail-left .back-link,
.detail-left .chapter-tag,
.detail-left .chapter-date,
.detail-left .chapter-title,
.detail-left .chapter-jp,
.detail-left .chapter-tags,
.detail-left .detail-thumbs,
.detail-left .detail-bottom {
    opacity: 0;
    transform: translateY(24px);
    animation: detailReveal 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes detailReveal {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Right hero slide-in from screen right edge */
.detail-right {
    opacity: 0;
    transform: translateX(100vw);
    animation: heroSlideIn 1s cubic-bezier(0.23, 1, 0.32, 1) 0.3s forwards;
}

@keyframes heroSlideIn {
    from {
        opacity: 0;
        transform: translateX(100vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes thumbReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-link {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: #666;
    text-transform: uppercase;
    transition: color 0.25s ease;
    display: inline-block;
    margin-bottom: 30px;
}

.back-link:hover {
    color: #e63946;
}

.chapter-info {
    margin-bottom: 30px;
}

.chapter-tag {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: #555;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.chapter-date {
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    font-style: italic;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.chapter-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    color: #f5f5f5;
    position: relative;
    padding-bottom: 16px;
}

.chapter-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 4px;
    background: #3b82f6;
}

.chapter-jp {
    font-family: 'Noto Serif JP', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ddd;
    letter-spacing: 4px;
    margin-top: 16px;
}

.chapter-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    font-size: 0.8rem;
    color: #777;
    letter-spacing: 1px;
}

.chapter-tags span:nth-child(even) {
    color: #e63946;
}

/* Thumbnail strip */
.detail-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 30px 0;
    max-width: 380px;
}

.thumb-item {
    aspect-ratio: 3/2;
    border-radius: 3px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    background: #1a1a1a;
    transition: all 0.25s ease;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.7);
    transition: filter 0.25s ease;
    background: #0a0a0a;
}

.thumb-item:hover img,
.thumb-item.active img {
    filter: brightness(1);
}

.thumb-item.active {
    outline: 2px solid #e63946;
    outline-offset: 2px;
}

.thumb-num {
    position: absolute;
    bottom: 4px;
    left: 6px;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Bottom bar */
.detail-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid #1a1a1a;
    margin-top: 20px;
}

.next-chapter {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #e8e8e8;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color 0.25s ease;
}

.next-chapter:hover {
    color: #e63946;
}

.page-indicator {
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 2px;
}

.chapter-loc {
    font-size: 0.7rem;
    color: #555;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* RIGHT COLUMN (Hero) */
.detail-right {
    position: relative;
    overflow: hidden;
    background: #111;
}

.detail-hero {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    min-height: calc(100vh - 60px);
    background: #0a0a0a;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    #home-view {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 100px 40px 60px;
    }

    .home-left {
        min-height: auto;
        gap: 30px;
    }

    .chapter-index {
        flex-direction: row;
        flex-wrap: wrap;
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .index-item {
        width: 50%;
        min-width: 200px;
    }

    .detail-container {
        grid-template-columns: 1fr;
    }

    .detail-left {
        padding: 100px 40px 40px;
    }

    .detail-right {
        min-height: 50vh;
    }

    .detail-hero {
        min-height: 50vh;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 16px 20px;
    }

    #home-view {
        padding: 90px 20px 40px;
        gap: 30px;
    }

    .display-title {
        font-size: clamp(3rem, 12vw, 4.5rem);
    }

    .cc-photos {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .meta-row {
        font-size: 0.65rem;
        gap: 8px;
        flex-wrap: wrap;
    }

    .detail-left {
        padding: 90px 20px 30px;
    }

    .chapter-title {
        font-size: 3rem;
    }

    .chapter-jp {
        font-size: 1.8rem;
    }

    .detail-thumbs {
        grid-template-columns: repeat(5, 1fr);
    }

    .chapter-index {
        gap: 16px;
    }

    .index-item {
        width: 100%;
    }

    .cc-number {
        font-size: 2rem;
    }

    .cc-name {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .cc-photos {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .nav-links {
        gap: 20px;
    }

    .detail-thumbs {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== LIGHTBOX ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: lbFade 0.3s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes lbFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lb-image {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.lb-caption {
    margin-top: 20px;
    color: #aaa;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: 'Playfair Display', serif;
    font-style: italic;
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.lb-close:hover {
    color: #e63946;
}

.lb-prev,
.lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.lb-prev:hover,
.lb-next:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}

.lb-prev {
    left: 30px;
}

.lb-next {
    right: 30px;
}