/*
Theme Name: Morishita Yui Custom (Original)
Theme URI: http://example.com/my-custom-theme
Author: Antigravity
Author URI: http://example.com
Description: An original custom theme inspired by classic aesthetics.
Version: 2.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: my-custom-theme
*/

/* =========================================
   1. Reset & Basics
   ========================================= */
body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: #f9f9f9;
    margin: 0;
    padding: 0;
    font-weight: 400;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Noto Serif JP', serif;
    color: #222;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.4;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    font-weight: 700;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

a {
    color: #444;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #d4a373;
}

.site {
    background-color: #fff;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* =========================================
   2. Header Base
   ========================================= */
#header {
    width: 100%;
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.95);
    position: relative;
    transition: none;
}

/* Sticky Header State */
#header.is-sticky-active {
    position: fixed;
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#header-content {
    /* Base flex container */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
}

.site-title {
    font-size: 2rem;
    font-weight: normal;
    margin: 0;
}

/* =========================================
   3. Navigation & Menu (Desktop vs Mobile)
   ========================================= */

#header-menu ul.menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

#header-menu ul.menu li {
    position: relative;
}

#header-menu ul.menu li a {
    display: block;
    text-decoration: none;
    transition: color 0.3s;
}

/* Hamburger Icon (Base - Default Hidden) */
.icon-spaced-menu {
    display: none;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 10px;
    font-size: 28px;
    line-height: 1;
    color: #333;
    z-index: 10005;
    /* Always on top of menu content */
    position: relative;
}

.icon-spaced-menu::before {
    content: '\2261';
}

.icon-spaced-menu span {
    display: none;
}


/* --- DESKTOP VIEW (min-width: 769px) --- */
@media (min-width: 769px) {

    /* Explicitly hide mobile toggle on desktop */
    .icon-spaced-menu {
        display: none !important;
    }

    /* Force Desktop Menu Visibility */
    #header-menu-content {
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
        /* Vertically center items */
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        background: transparent !important;
        box-shadow: none !important;
        height: 100% !important;
        /* Match container height for centering */
        width: auto !important;
        margin: 0;
        padding: 0;
    }

    /* Horizontal Menu */
    #header-menu ul.menu {
        display: flex;
        flex-direction: row;
        gap: 25px;
        gap: 25px;
        align-items: stretch;
        /* Stretch items to full header height */
        height: 100%;
        /* Ensure menu spans height for alignment */
    }

    #header-menu ul.menu li {
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        /* Center text vertically within the full-height LI */
        height: 100%;
    }

    #header-menu ul.menu li a {
        font-family: 'Noto Sans JP', sans-serif;
        font-weight: 500;
        font-size: 0.95rem;
        color: #333;
        padding: 0;
        /* Remove padding entirely to rely on flex centering */
        margin: 0 12px;
        /* Horizontal spacing only */
        line-height: normal;
        /* Normal line height */
        position: relative;
        text-decoration: none;
        /* Ensure no default underline */
    }

    #header-menu ul.menu li a:hover {
        color: #0073aa;
    }

    /* Underline Animation - Fix Bottom Position */
    #header-menu ul.menu li a::after {
        content: '';
        position: absolute;
        width: 0;
        height: 2px;
        bottom: -5px;
        /* Push completely below text */
        left: 0;
        background-color: #0073aa;
        transition: width 0.3s;
    }

    #header-menu ul.menu li a:hover::after {
        width: 100%;
    }

    /* Dropdown Sub-menus */
    #header-menu .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        min-width: 200px;
        z-index: 10000;
        display: none;
        flex-direction: column;
    }

    #header-menu li:hover>.sub-menu {
        display: block;
    }

    #header-menu .sub-menu li {
        display: block;
        height: auto;
    }

    #header-menu .sub-menu li a {
        line-height: 1.5;
        padding: 10px 20px;
        margin: 0;
        display: block;
    }

    #header-menu .sub-menu li a:hover {
        background-color: #f5f5f5;
    }

    #header-menu .sub-menu li a::after {
        display: none;
        /* No underline in submenu */
    }

    /* Search Icon */
    .menu-search-item {
        margin-left: 20px;
        position: relative;
        display: flex;
        align-items: center;
        height: 100%;
    }

    .search-icon-toggle {
        display: block;
        cursor: pointer;
        line-height: 1;
        display: flex;
        /* Flex center for icon */
        align-items: center;
    }

    .search-form-dropdown {
        display: none;
        position: absolute;
        top: 150%;
        right: 0;
        width: 300px;
        background: #fff;
        padding: 15px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border: 1px solid #eee;
        z-index: 10001;
    }

    .menu-search-item:hover .search-form-dropdown {
        display: block;
    }
}

/* --- MOBILE VIEW (max-width: 768px) --- */
@media (max-width: 768px) {

    body,
    html,
    #wrapper {
        overflow-x: hidden;
    }

    #header-content {
        padding: 10px 20px;
        position: relative;
        /* Anchor */
    }

    /* Hamburger Visible */
    .icon-spaced-menu {
        display: block !important;
        order: 2;
        /* Right */
        margin-left: auto;
    }

    /* Logo Balanced Centering */
    #header-logo {
        flex: 1;
        text-align: center;
        /* Counter-balance hamburger to verify true center */
        margin-right: 0;
        padding-left: 0;
        /* Reset */
        margin-left: 20px;
        /* Slight offset to balance icon if needed */
        display: flex;
        justify-content: center;
    }

    #header-logo img {
        height: 60px !important;
        max-height: 80px !important;
        width: auto !important;
    }

    /* Drawer Container (Mobile Menu Body) */
    body #header-menu-content {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        /* FORCE WHITE BACKGROUND */
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #eee;
        padding: 0;
        /* Removing padding to let items fill width */
        margin: 0;
        z-index: 9998;
    }

    /* Show Drawer when Toggled (High Specificity) */
    body #header-menu.toggled #header-menu-content {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Mobile Vertical Menu List */
    #header-menu ul.menu {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin: 0;
        padding: 0;
        background-color: #fff;
    }

    #header-menu ul.menu li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        text-align: center;
        margin: 0;
        padding: 0;
        display: block;
        /* Ensure visibility */
    }

    #header-menu ul.menu li a {
        padding: 15px 20px;
        font-size: 16px;
        font-weight: 500;
        color: #333 !important;
        display: block;
        background-color: #fff;
        /* Ensure generic white background */
        text-decoration: none;
    }



    /* Mobile Sub-menus (Hidden by default, Toggled via JS) */
    .menu-item-has-children>.sub-menu,
    .page_item_has_children>.children {
        display: none;
        background-color: #f5f5f5;
        /* Slightly darker for contrast */
        padding-left: 0;
    }

    .menu-item-has-children.submenu-toggled>.sub-menu,
    .page_item_has_children.submenu-toggled>.children {
        display: block;
        /* Show when toggled */
        animation: mobileSubMenuFade 0.3s ease;
    }

    @keyframes mobileSubMenuFade {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Chevron Indicator */
    .menu-item-has-children>a::after,
    .page_item_has_children>a::after {
        content: '\25BC';
        /* Down Arrow */
        font-size: 10px;
        float: right;
        margin-right: 10px;
        transition: transform 0.3s;
    }

    .menu-item-has-children.submenu-toggled>a::after,
    .page_item_has_children.submenu-toggled>a::after {
        transform: rotate(180deg);
    }

    /* Hide Desktop-only Elements */
    .search-icon-toggle {
        display: none !important;
    }

    /* Mobile Search Form */
    .menu-search-item {
        display: block !important;
        width: 100%;
        padding: 20px;
        text-align: center;
        box-sizing: border-box;
        background-color: #fafafa;
        /* Distinct background for search area */
        border-bottom: 1px solid #eee;
    }

    .search-form-dropdown {
        display: block !important;
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 10px;
        background: #fff;
    }
}

/* Hide Search Submit Button (Global) */
.search-form-dropdown .search-submit {
    display: none;
}


/* =========================================
   4. Slider Section
   ========================================= */
.slider-section {
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {

    /* Mobile Slider Fixes */
    .slider-section,
    .rslides_container,
    .rslides,
    .rslides li {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .slider-section .rslides img {
        width: 100% !important;
        height: auto !important;
        float: none !important;
        display: block !important;
    }

    .rslides {
        max-height: none !important;
    }
}


/* =========================================
   5. Content Sections (Welcome, News, Etc)
   ========================================= */
.front-page-content-wrapper {
    display: flex;
    gap: 40px;
    padding: 40px;
    /* Restored Grid Padding */
    margin-top: 0;
}

@media (max-width: 768px) {
    .front-page-content-wrapper {
        flex-direction: column;
        padding: 20px;
    }
}

.front-page-main {
    flex: 3;
    min-width: 0;
}

.front-page-sidebar {
    flex: 1;
    min-width: 0;
}

.front-page-sidebar #secondary {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Welcome Section */
.home-section.intro {
    text-align: center;
    margin-bottom: 60px;
}

.home-section.intro h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    font-family: 'Noto Serif JP', serif;
}

.home-section.intro p {
    font-size: 0.9rem;
    color: #666;
    display: inline-block;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

/* News List */
.section-news {
    margin-bottom: 60px;
}

.news-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    /* Reset */
}

.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid #eee;
}

.news-item {
    display: flex;
    align-items: baseline;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.news-item:hover {
    background-color: #fafafa;
}

.news-date {
    font-family: 'Lato', sans-serif;
    color: #888;
    margin-right: 20px;
    font-size: 0.9rem;
    min-width: 80px;
}

.news-title {
    font-weight: 500;
}

/* Grid Posts */
.posts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4%;
}

.grid-item {
    width: 48%;
    margin-bottom: 40px;
}

.post-thumbnail {
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 16 / 9;
    background-color: #f0f0f0;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.grid-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.entry-title {
    font-size: 1.4rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.entry-summary {
    font-size: 1.0rem;
    color: #666;
}

@media (max-width: 768px) {
    .grid-item {
        width: 100%;
    }
}

/* =========================================
   6. Single Post & Footer
   ========================================= */
.entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Video Spacing */
.entry-content iframe,
.entry-content .wp-block-embed {
    margin-top: 40px;
    margin-bottom: 40px;
    width: 100% !important;
}

/* Footer Tags */
.entry-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.cat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cat-links a {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f5f5f5;
    color: #555;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
}

.cat-links a:hover {
    background-color: #dedede;
}

/* Comments */
#comments {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #ddd;
    background-color: #fafafa;
    padding-left: 20px;
    padding-right: 20px;
}

.comment-metadata,
.comment-metadata a {
    font-size: 0.8rem !important;
    color: #999 !important;
}

.comment-body {
    background: #fff;
    padding: 20px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

/* Footer */
.site-footer {
    padding: 40px;
    text-align: center;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #888;
    background-color: #fbfbfb;
}