/*
Theme Name: Cosmos Three
Theme URI: https://cosmosinfo.jp
Author: Cosmos AI
Description: The definitive version. Bento Grid, Pink Theme, Clean Code.
Template: twentytwentyfour
Version: 3.0.0
*/

/* --- RESET & BASICS --- */
.wp-block-post-content {
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* --- LOCAL HEADER IMAGE --- */
.cosmos-main-header {
    background-image: url('assets/images/header.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    /* Ensure no WP inline style overrides this */
}

/* --- NAVIGATION TABS (Thinner) --- */
.cosmos-nav-bar {
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    height: 40px !important;
    /* Force thinner height (was 50px) */
    min-height: 40px !important;
    max-height: 40px !important;
    overflow: hidden !important;
}

.cosmos-tabs .wp-block-navigation-item {
    margin-right: 2rem;
    height: 40px !important;
    display: flex;
    align-items: center;
}

.cosmos-tabs .wp-block-navigation-item__content {
    display: flex;
    align-items: center;
    height: 100% !important;
    padding: 0 0.5rem !important;
    /* Less vertical padding */
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none !important;
    font-weight: 600;
    color: var(--wp--preset--color--cosmos-dark);
    font-size: 0.85rem;
    /* Smaller font */
    line-height: 1 !important;
}

.cosmos-tabs .wp-block-navigation-item__content:hover,
.cosmos-tabs .wp-block-navigation-item.current-menu-item .wp-block-navigation-item__content {
    border-bottom-color: var(--wp--preset--color--cosmos-pink);
    color: var(--wp--preset--color--cosmos-pink) !important;
}

/* "Past Exam" Button Style (Centered vertically) */
.cosmos-btn-nav {
    height: 100%;
    align-items: center;
    display: flex;
}

.cosmos-btn-nav .wp-block-navigation-item__content {
    background-color: var(--wp--preset--color--cosmos-dark);
    color: white !important;
    padding: 0.4rem 1.2rem !important;
    border-radius: 999px;
    border: none !important;
    font-size: 0.85rem;
    transition: transform 0.2s ease;
    height: auto;
    /* Allow button height */
}

.cosmos-btn-nav .wp-block-navigation-item__content:hover {
    background-color: var(--wp--preset--color--cosmos-pink);
    transform: translateY(-2px);
}

/* --- BENTO GRID HERO LAYOUT --- */
/* Core Grid Logic */
.cosmos-split-hero ul,
.cosmos-split-hero .wp-block-post-template {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    /* 2/3 Left, 1/3 Right */
    grid-template-rows: 1fr 1fr !important;
    /* 2 Equal Rows */
    gap: 4px !important;
    width: 100% !important;
    height: 85vh;
    /* Responsive Height */
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Base Card Style */
.cosmos-hero-card,
.cosmos-split-hero li {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
    margin: 0 !important;
}

/* Item 1 (Main): Left Column, Full Height */
.cosmos-split-hero li:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

/* Item 2: Right Top */
.cosmos-split-hero li:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

/* Item 3: Right Bottom */
.cosmos-split-hero li:nth-child(3) {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

/* Images & Zoom */
.cosmos-hero-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    /* Lower than overlay, but link will be higher? No, overlay must be click-through */
    margin: 0 !important;
}

.cosmos-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Crucial: The A tag inside featured image must cover the card */
.cosmos-hero-bg a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    /* Or absolute? */
}

.cosmos-hero-card:hover .cosmos-hero-bg img,
.cosmos-split-hero li:hover .cosmos-hero-bg img {
    transform: scale(1.05);
    /* Zoom on hover */
}

/* Text Overlay & Gradient (Thicker) */
.cosmos-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2.5rem;
    padding-bottom: 4rem;
    /* Extra space for scroll arrow if center */
    /* Much thicker gradient to ensure text readability */
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.95) 0%,
            rgba(0, 0, 0, 0.85) 40%,
            rgba(0, 0, 0, 0.4) 80%,
            transparent 100%);
    z-index: 20;
    color: white;

    /* POINTER EVENTS NONE IS CRITICAL FOR CLICK-THROUGH */
    pointer-events: none !important;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Typography */
.cosmos-hero-overlay h2 {
    margin-bottom: 0.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 1);
    /* Stronger shadow */
    font-size: 1.4rem !important;
    line-height: 1.4;
    padding-right: 1rem;

    /* Force Wrapping */
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 95%;
}

.cosmos-split-hero li:nth-child(1) .cosmos-hero-overlay h2 {
    font-size: 2.2rem !important;
    max-width: 90%;
}

/* Excerpt: ALWAYS Visible (1st line at least) */
.cosmos-hero-overlay .wp-block-post-excerpt {
    opacity: 0.95;
    font-size: 0.9rem;
    display: block !important;
    /* Force show on all */
    margin-top: 0.5rem;

    /* Limit lines */
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    /* Main post gets 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #eee;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.cosmos-split-hero li:nth-child(2) .wp-block-post-excerpt,
.cosmos-split-hero li:nth-child(3) .wp-block-post-excerpt {
    -webkit-line-clamp: 1;
    /* Side posts get 1 line */
}

/* Scroll Indicator */
.cosmos-scroll-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 2rem;
    animation: bounce 2s infinite;
    z-index: 30;
    opacity: 0.8;
    pointer-events: none;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Mobile */
@media (max-width: 900px) {

    .cosmos-split-hero ul,
    .cosmos-split-hero .wp-block-post-template {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        height: auto !important;
    }

    .cosmos-hero-card,
    .cosmos-split-hero li {
        width: 100% !important;
        height: 60vh !important;
    }

    .cosmos-split-hero li:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .cosmos-split-hero li:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    .cosmos-split-hero li:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
}

/* Navigation Badge */
.cosmos-date-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
    z-index: 20;
    backdrop-filter: blur(4px);
}