/*
Theme Name: Shōkai 紹介
Theme URI: https://vtubes.tokyo/
Author: Saguya
Description: Video grid theme for vtubes.tokyo: top navigation with centered logo, search and filter bar, infinite scroll, every card links straight to YouTube / niconico.
Version: 1.51
Requires PHP: 8.0
Text Domain: shokai
*/
@font-face { font-family: 'OsFontNew'; src: url('fonts/osfontnew.woff2') format('woff2'); font-weight: normal; font-style: normal; font-display: swap; }
:root { --bg-color: #f8f9fa; --sidebar-width: 260px; --card-bg: #ffffff; --text-main: #1a1a1a; --text-muted: #555555; --accent: #3b82f6; --radius: 16px; --shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05); --logo-height: 140px; --single-width: 850px; }
* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: 'OsFontNew', sans-serif; font-weight: 500; background: var(--bg-color); color: var(--text-main); min-height: 100vh; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
img { max-width: 100%; height: auto; display: block; }

/* Top header: menu left | logo | menu right */
/* Above the search bar (Kensaku uses z-index 9999), so the dropdown menus are not covered */
.site-header { background: var(--bg-color); border-bottom: 1px solid rgba(0,0,0,0.05); position: relative; z-index: 10000; }
.site-header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 30px; padding: 18px 40px; }
.site-header .logo-area { margin: 0; }
.site-header .custom-logo-link img { max-height: 110px; }
.top-nav .top-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.top-nav-left .top-menu { justify-content: flex-end; }
.top-nav-right .top-menu { justify-content: flex-start; }
.top-nav li { position: relative; }
.top-nav a { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-radius: 12px; color: var(--text-muted); font-size: 15px; font-weight: 700; white-space: nowrap; }
.top-nav a:hover, .top-nav .current-menu-item > a { background: #fff; color: var(--text-main); box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.top-nav .menu-item-has-children > a::after { content: '\25BE'; font-size: 11px; opacity: 0.6; }
.top-nav .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; list-style: none; margin: 6px 0 0; padding: 8px; background: #fff; border: 0; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.10); z-index: 1100; }
.top-nav .sub-menu::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.top-nav-right .sub-menu { left: auto; right: 0; }
.top-nav li:hover > .sub-menu, .top-nav li:focus-within > .sub-menu { display: block; }
.top-nav .sub-menu a { box-shadow: none; }
.top-nav .sub-menu a:hover { background: var(--bg-color); box-shadow: none; }

/* Bar between header and grid: search, filter (Firuta) and other sidebar widgets */
.top-toolbar { padding: 32px 40px 0; }
.top-toolbar-inner { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.top-toolbar .widget { margin: 0; flex: 0 1 460px; min-width: 0; }
/* Widget wrappers (paragraphs from text/shortcode widgets) must not shift the controls */
.top-toolbar .widget p, .top-toolbar .widget > div, .top-toolbar .firuta-mount { margin: 0; padding: 0; width: 100%; }
.top-toolbar .widget br, .top-toolbar .widget p:empty { display: none; }

/* Search (Kensaku): always a full, open search field instead of the small magnifier pill */
.top-toolbar .kensaku-wrapper { display: block; width: 100%; margin: 0; }
.top-toolbar .kensaku-form { margin: 0; }
.top-toolbar .kensaku-input-group, .top-toolbar .kensaku-input-group:hover, .top-toolbar .kensaku-input-group:focus-within { width: 100%; height: 48px; background: #fff; border: 1px solid rgba(0,0,0,0.07); border-radius: 16px; box-shadow: var(--shadow); cursor: text; }
.top-toolbar .kensaku-input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59,130,246,0.12); }
.top-toolbar .kensaku-field { opacity: 1; transform: none; pointer-events: auto; font-family: inherit; font-size: 15px; font-weight: 600; padding: 0 56px 0 20px !important; }
.top-toolbar .kensaku-btn { width: 50px; color: var(--text-muted); }
.top-toolbar .kensaku-btn svg { width: 18px; height: 18px; }

/* Filter (Firuta): a real button next to the search field, the panel opens as a dropdown */
.top-toolbar .widget:has(.firuta-mount) { flex: 0 0 auto; position: relative; }
.top-toolbar .widget:has(.firuta-mount) .firuta-mount { width: auto; }
.top-toolbar .firuta { container-type: normal; margin: 0; }
.top-toolbar .firuta-head { flex-wrap: nowrap; }
.top-toolbar .firuta--nav .firuta-toggle { width: auto; height: 48px; padding: 0 22px; border-radius: 16px; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(0,0,0,0.07); color: var(--text-main); }
.top-toolbar .firuta-summary { display: none; }
.top-toolbar .firuta-reset { height: 48px; border-radius: 16px; padding: 0 16px; }
.top-toolbar .firuta-panel { position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 10px); width: min(880px, calc(100vw - 80px)); margin: 0; z-index: 1200; box-shadow: 0 24px 60px rgba(0,0,0,0.16); }
.top-toolbar .firuta-go { grid-column: 1 / -1; justify-self: start; margin: 0; }
.top-toolbar .widget-title, .top-toolbar .widgettitle { display: none; }
.top-toolbar .widget ul { list-style: none; padding: 0; margin: 0; }
.top-toolbar .firuta--nav .firuta-toggle { width: auto; }
.top-toolbar input[type="search"] { font: inherit; font-size: 15px; width: 100%; height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.08); background: #fff; box-shadow: var(--shadow); outline: none; }
.top-toolbar input[type="search"]:focus { border-color: var(--accent); }

/* Sidebar: only the mobile drawer now */
.sidebar { display: none; }
.sidebar { width: var(--sidebar-width); background: var(--bg-color); padding: 40px 20px; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 1000; border-right: 1px solid rgba(0,0,0,0.03); text-align: center; transition: transform 0.3s; }
.logo-area { margin-bottom: 30px; display: flex; justify-content: center; }
.custom-logo-link img { max-height: var(--logo-height); width: auto; }
.sidebar .widget { margin-bottom: 25px; text-align: left; }
.sidebar .widget-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: #999; margin-bottom: 12px; padding-left: 10px; }

/* Menu */
.widget_nav_menu ul { list-style: none; padding: 0; margin: 0; }
.widget_nav_menu li { margin-bottom: 4px; position: relative; }
.widget_nav_menu a { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 12px; color: var(--text-muted); font-size: 15px; font-weight: 700; }
.widget_nav_menu a:hover { background: #fff; color: var(--text-main); box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.menu-toggle-icon { font-size: 10px; cursor: pointer; padding: 8px 12px; opacity: 0.6; border-left: 1px solid rgba(0,0,0,0.05); margin-left: 5px; }
.menu-item-has-children.open > a .menu-toggle-icon { transform: rotate(180deg); color: var(--accent); }
.sub-menu { display: none; padding-left: 15px; margin-top: 5px; border-left: 2px solid rgba(0,0,0,0.05); }

/* Layout */
.main-content-w { width: 100%; }
.main-content-m { padding: 40px; width: 100%; }
.content-grid { display: grid; gap: 30px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1800px) { .content-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1400px) { .content-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Cards */
.post-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,0.8); transition: 0.3s; position: relative; }
.post-card:hover { transform: translateY(-5px); }
.card-thumb-link { display: block; width: 100%; aspect-ratio: 16/9; background-color: #eee; overflow: hidden; position: relative; }
.card-thumb-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 16px; font-weight: 800; margin: 0 0 10px 0; color: var(--text-main); }
.card-meta { margin-top: auto; font-size: 13px; font-weight: 600; color: #777; display: flex; justify-content: space-between; }
.tag-badge { background: var(--accent); color: #fff !important; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 800; text-decoration: none !important; transition: 0.2s; display: inline-block; }
.tag-badge:hover { background: #1d4ed8; transform: translateY(-1px); }

/* Buttons */
.admin-edit-btn { display: inline-block; background: #e11d48; color: #fff !important; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 10px; border-radius: 6px; text-decoration: none; margin-left: 15px; transition: 0.2s; }
.admin-edit-btn:hover { background: #be123c; transform: translateY(-2px); }
.grid-edit-btn { position: absolute; top: 10px; right: 10px; background: #e11d48; color: white !important; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; z-index: 20; box-shadow: 0 2px 8px rgba(0,0,0,0.2); transition: 0.2s; }
.grid-edit-btn:hover { transform: scale(1.1); background: #be123c; }
.scroll-to-top { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: #fff; border: none; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.2); z-index: 999; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; opacity: 0; visibility: hidden; transition: all 0.3s ease; transform: translateY(20px); }
.scroll-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-to-top:hover { background: #1d4ed8; transform: translateY(-5px); }

/* Single Post */
.single-post-container { max-width: var(--single-width); margin: 0 auto; background: var(--card-bg); padding: 50px 60px; border-radius: var(--radius); box-shadow: var(--shadow); }
.single-header { margin-bottom: 40px; text-align: center; border-bottom: 1px solid #f0f0f0; padding-bottom: 30px; }
.single-title { font-size: 30px; font-weight: 800; text-align: center; margin-bottom: 15px; color: #000; }
.single-meta { display: flex; justify-content: center; align-items: center; gap: 25px; font-size: 14px; font-weight: 600; color: #666; }
.single-content { font-size: 18px; line-height: 1.8; color: #222; }
.single-content iframe { width: 100%; aspect-ratio: 16/9; border-radius: 12px; margin-bottom: 30px; }
.single-content a { color: var(--accent); font-weight: 700; text-decoration: underline; }

/* Page & 404 */
.page-container { width: 100%; background: var(--card-bg); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.page-content { width: 100%; }
.page .page-title, .page .entry-title, .page h1.title { display: none !important; }

/* 404 Specific Styles */
.error-404-container { text-align: center; padding: 60px 40px; display: flex; flex-direction: column; align-items: center; }
.error-image img { max-width: 100%; height: auto; border-radius: 12px; margin-bottom: 30px; }
.error-title { font-size: 32px; font-weight: 900; margin-bottom: 15px; color: #000; }
.error-text { font-size: 18px; color: var(--text-muted); margin-bottom: 30px; }
.error-btn { background: var(--accent); color: #fff !important; padding: 12px 30px; border-radius: 50px; font-weight: 700; text-decoration: none !important; transition: 0.2s; }
.error-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

/* Mobile */
.mobile-top-bar { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 60px; background: #fff; z-index: 2000; align-items: center; padding: 0 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); justify-content: space-between; }
.mobile-toggle-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-main); }
.mobile-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 900; }
.mobile-backdrop.open { display: block; }
@media (max-width: 900px) {
    .mobile-top-bar { display: flex; }
    .site-header { display: none; }
    body { padding-top: 60px; }
    .top-toolbar { padding: 20px 20px 0; }
    .top-toolbar .widget { flex: 1 1 100%; }
    .top-toolbar .widget:has(.firuta-mount) { flex: 1 1 100%; }
    .top-toolbar .firuta--nav .firuta-toggle { width: 100%; justify-content: center; }
    .top-toolbar .firuta-panel { position: static; transform: none; width: auto; margin-top: 10px; }
    .top-toolbar .widget:has(.firuta-mount) .firuta-mount { width: 100%; }
    .sidebar { display: block; transform: translateX(-100%); width: 280px; text-align: left; }
    .sidebar.open { transform: translateX(0); }
    .main-content-w { width: 100%; }
    .main-content-m { padding: 20px; }
    .content-grid { grid-template-columns: 1fr; }
    .single-post-container { padding: 30px 20px; }
    .page-container { padding: 20px; }
    .scroll-to-top { bottom: 20px; right: 20px; width: 45px; height: 45px; font-size: 20px; }
}
/* High Performance Rendering */
.post-card {
    content-visibility: auto;
    contain-intrinsic-size: 1px 350px; /* Geschätzte Breite/Höhe */
}

/* --- MOBILE PERFORMANCE BOOSTER --- */

/* 1. CLS Fix: Platzhalter für Bilder reservieren bevor sie laden */
.card-thumb-link img {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* 2. Hardware-Beschleunigung für das Menü */
.mobile-backdrop {
    will-change: opacity;
    transition: opacity 0.2s ease-out;
}
.sidebar {
    will-change: transform;
    /* Transformation statt display:none für 60fps Animationen */
}

/* 3. Mobile Layout Optimierung */
@media (max-width: 768px) {
    /* Schriftgröße anpassen für Lesbarkeit (Google Readability) */
    body {
        font-size: 16px; 
    }
    
    /* Grid Stabilisierung */
    .content-grid {
        display: grid;
        grid-template-columns: 1fr; /* Einspaltig auf Mobile erzwingen */
        gap: 20px;
    }

    /* Klickflächen vergrößern (Tap Targets) */
    .mobile-toggle-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Verhindert horizontales Wackeln */
    .main-content-w {
        overflow-x: hidden; 
        width: 100%;
    }
	
	/* Fix für abgeschnittene Kanjis im Widget-Menü */
.widget_nav_menu a {
    display: block !important;
    position: relative;
}

.widget_nav_menu a .menu-toggle-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border-left: none;
    margin-left: 0;
}
}