/* YunCraft Viewer CSS - Wine Red Theme (Original Site Color Scheme) */
@import url('https://fonts.googleapis.com/css2?family=Dosis:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@300;400;500;700&family=Raleway:wght@400;500;600&display=swap');

:root {
    /* Original yun-craft.com Wine Red Palette */
    --primary-color: #b33e5c;
    --primary-hover: #af0a35;
    --primary-dark: #8b1e3f;
    --primary-light: #fdf2f4;
    --primary-border: #f3c5d0;
    
    --header-bg: #ffffff;
    --header-top-bg: #252b32;
    --footer-bg: #303841;
    
    --card-bg: #ffffff;
    --card-shadow: 0 10px 25px -5px rgba(179, 62, 92, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --text-main: #212121;
    --text-muted: #64748b;
    --border-color: #e8ecf1;
    --radius: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Raleway', 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f0f0f0;
    color: var(--text-main);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover, a:focus {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Header Navbar - White & Wine Red */
header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--primary-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    color: var(--text-main);
    width: 100%;
}

.header-ad-bar {
    background: var(--header-top-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
    width: 95%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
}

.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-title-img {
    height: 48px;
    max-width: 220px;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

.site-title-img:hover {
    transform: scale(1.02);
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
}

.header-nav a {
    color: var(--primary-dark);
    text-decoration: none;
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: block;
}

.header-nav a:hover, .header-nav a.active {
    color: #fff;
    background: var(--primary-color);
    text-decoration: none;
}

/* Multilevel Dropdown Menu */
.header-nav li.dropdown {
    position: relative;
}

.header-nav li.dropdown > a::after {
    content: " ▾";
}

.dropdown-toggle {
    display: none;
}

.header-nav .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #252b32;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.4rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.header-nav li.dropdown:hover .dropdown-menu,
.header-nav li.dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-nav .dropdown-menu li {
    width: 100%;
}

.header-nav .dropdown-menu a {
    color: #e2e8f0;
    font-size: 0.92rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0;
    white-space: nowrap;
}

.header-nav .dropdown-menu a:hover {
    background: var(--primary-color);
    color: #fff;
}

.header-search form {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
}

.header-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.85rem;
    width: 140px;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search button {
    background: transparent;
    border: none;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    header > .header-container {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .header-nav {
        order: 3;
        flex: 0 0 100%;
        min-width: 0;
    }

    .header-nav > ul {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .header-nav > ul > li:not(.dropdown) {
        flex: 1 1 auto;
    }

    .header-nav > ul > li > a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-nav li.dropdown {
        flex: 1 1 200px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        align-items: center;
        border: 1px solid var(--primary-border);
        border-radius: 6px;
    }

    .header-nav li.dropdown > a {
        min-width: 0;
        justify-content: flex-start;
        overflow-wrap: anywhere;
    }

    .header-nav li.dropdown > a::after {
        content: "";
    }

    .dropdown-toggle {
        display: inline-flex;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-left: 1px solid var(--primary-border);
        border-radius: 0 5px 5px 0;
        background: var(--primary-light);
        color: var(--primary-dark);
        font-size: 1rem;
        cursor: pointer;
    }

    .dropdown-toggle:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
    }

    .dropdown-toggle span {
        transition: transform 0.2s ease;
    }

    .dropdown.is-open .dropdown-toggle span {
        transform: rotate(180deg);
    }

    .header-nav .dropdown-menu {
        position: static;
        grid-column: 1 / -1;
        display: none;
        min-width: 0;
        width: 100%;
        padding: 0.25rem 0;
        border: 0;
        border-top: 1px solid var(--primary-border);
        border-radius: 0 0 6px 6px;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .header-nav li.dropdown.is-open > .dropdown-menu {
        display: flex;
    }

    .header-nav .dropdown-menu a {
        min-height: 44px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Layout Grid - 2 Column Fully Responsive */
.layout-container {
    width: 95%;
    max-width: 1440px;
    margin: 1.5rem auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    flex: 1;
}

@media (max-width: 1024px) {
    .layout-container {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Main Article Card */
main.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* Responsive Content Elements */
.page-body {
    width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.page-body h1 {
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.35;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--primary-border);
}

.page-body h2 {
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 0.9rem;
    padding-left: 0.75rem;
    border-left: 5px solid var(--primary-color);
}

.page-body h3 {
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.7rem;
}

.page-body h4, .page-body h5, .page-body h6 {
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    color: var(--primary-dark);
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
}

.page-body p {
    margin-bottom: 1.1rem;
    color: #334155;
    font-size: 1.02rem;
    line-height: 1.8;
}

.page-body img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 1.2rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: block;
}

.home-article-card {
    margin: 1.25rem 0;
}

.page-body .home-article-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-body .home-article-thumbnail {
    width: 170px;
    flex: 0 0 170px;
    display: flex;
    align-items: center;
}

.page-body .home-article-thumbnail img {
    width: 170px !important;
    max-width: 170px !important;
    height: auto;
    margin: 0;
}

.home-article-meta {
    min-width: 0;
}

.page-body .home-article-title {
    font-weight: 600;
}

.page-body .home-article-date {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.page-body .home-article-description {
    margin: 0.75rem 0 0;
}

.page-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
}

.page-body th, .page-body td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.page-body th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.page-body pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 1.2rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.2rem 0;
    font-size: 0.92rem;
    border: 1px solid #334155;
}

.page-body code {
    background: #f1f5f9;
    color: var(--primary-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
}

.page-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.page-body ul, .page-body ol {
    margin-bottom: 1.2rem;
    padding-left: 1.8rem;
}

.page-body li {
    margin-bottom: 0.4rem;
}

.page-body blockquote {
    border-left: 4px solid var(--primary-color);
    background: var(--primary-light);
    padding: 0.8rem 1.2rem;
    margin: 1.2rem 0;
    border-radius: 0 8px 8px 0;
    color: var(--primary-dark);
    font-style: italic;
}

/* Topics Badges - Wine Red Themed */
.topics-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.8rem 0 1.2rem;
}

.topic-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--primary-border);
}

.topic-badge:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Advertising Areas */
.ad-area-article-top, .ad-area-article-bottom {
    margin: 1.2rem 0;
    width: 100%;
}

.ad-container-inner {
    transition: border-color 0.2s ease;
}

.ad-container-inner:hover {
    border-color: var(--primary-hover) !important;
}

/* Post Navigation Pager Cards (Prev / Next) */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 640px) {
    header > .header-container {
        width: 100%;
        padding: 0.6rem 0.75rem;
    }

    .site-title-img {
        height: 40px;
        max-width: 170px;
    }

    .header-container {
        gap: 0.5rem;
    }

    .header-search form {
        padding: 0.3rem 0.55rem;
    }

    .header-search input {
        width: clamp(72px, 25vw, 130px);
    }

    .header-nav a {
        font-size: 0.98rem;
        padding: 0.5rem 0.6rem;
    }

    .layout-container {
        width: 100%;
        margin: 0.75rem auto;
        padding: 0 0.5rem;
    }

    main.article-card {
        padding: 1.1rem;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }
}

.nav-card {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.2rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-card:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(179, 62, 92, 0.12);
    text-decoration: none;
    transform: translateY(-2px);
}

.nav-card.prev {
    text-align: left;
}

.nav-card.next {
    text-align: right;
}

.nav-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.nav-card-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.4;
}

/* Child Pages / Subpage List on Heading Pages */
.child-pages-section {
    margin-top: 2.2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--primary-border);
}

.child-pages-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.child-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.child-pages-grid.category-article-cards {
    grid-template-columns: 1fr;
}

.child-page-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.child-page-card:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(179, 62, 92, 0.08);
    text-decoration: none;
    transform: translateY(-2px);
}

.child-page-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.child-page-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sidebar Styles - Wine Red Accents */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.sidebar-widget h3 {
    font-family: 'Dosis', 'Noto Sans JP', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-border);
}

.sidebar-widget ul {
    list-style: none;
    padding: 0;
}

.sidebar-widget li {
    margin-bottom: 0.6rem;
    font-size: 0.92rem;
}

.sidebar-widget a {
    color: #334155;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    max-width: 100%;
    overflow-wrap: break-word;
}

.sidebar-widget a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.widget-related {
    background: #fdf8f9;
    border-color: var(--primary-border);
}

.widget-archives {
    max-height: 350px;
    overflow-y: auto;
}

/* Footer - Original Slate / Wine Red Line */
footer {
    background: var(--footer-bg);
    border-top: 3px solid var(--primary-color);
    color: #94a3b8;
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: auto;
    width: 100%;
}

.footer-container {
    width: 95%;
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-section h4 {
    color: #fff;
    font-family: 'Dosis', sans-serif;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: var(--primary-border);
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.9;
}

.footer-section a:hover {
    color: #fff;
    text-decoration: underline;
}

.copyright {
    text-align: center;
    padding-top: 1.2rem;
    font-size: 0.85rem;
    color: #94a3b8;
}
