/* 
 * mind_habits.css
 * 『自分を整える、心の習慣』カテゴリー用
 * (標準レイアウトを尊重し、一覧性と品格を両立)
 */

@import url('https://fonts.googleapis.com/css2?family=Kaisei+Opti:wght@400;700&family=Noto+Serif+JP:wght@300;600&family=Outfit:wght@600&display=swap');

:root {
    --mind-gold: #b59550;
    --mind-gold-light: #d4c197;
    --mind-cream: #fdfcf9;
    --mind-text: #1a252f;
    --mind-text-light: #64748b;
    --mind-border: rgba(181, 149, 80, 0.2);
    --mind-accent: #10b981;
    --mind-accent-blue: #3b82f6;
}

/* -------------------------------------------
   「今日のヒント」セクション
   ------------------------------------------- */
.recommend-section {
    max-width: 900px;
    margin: 0 auto 4rem;
    padding: 0;
}

.recommend-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--mind-border);
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.recommend-content {
    flex: 1;
}

.recommend-content h3 {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.5rem;
    color: var(--mind-text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.recommend-content p {
    color: var(--mind-text-light);
    font-size: 1rem;
    margin: 0;
}

.btn-premium {
    background: linear-gradient(135deg, var(--mind-gold-light) 0%, var(--mind-gold) 100%);
    color: white;
    border: none;
    padding: 1.1rem 2.2rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 20px rgba(181, 149, 80, 0.2);
    white-space: nowrap;
}

.btn-premium:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(181, 149, 80, 0.3);
}

/* ハイライト用 */
.magazine-item.recommended-highlight {
    border-color: var(--mind-accent) !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2) !important;
    background: #fff !important;
}

.recommend-badge {
    position: absolute;
    top: -15px;
    right: 15px;
    background: var(--mind-accent);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
    z-index: 10;
    animation: badge-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* -------------------------------------------
   ハブ・ヘッダー (一覧性を重視)
   ------------------------------------------- */
.mind-content-header {
    padding: 6rem 2rem;
    margin-bottom: 5rem;
    background: white;
    text-align: center;
    border-radius: 60px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.mind-content-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(238, 242, 255, 0.9), transparent 70%),
                radial-gradient(circle at bottom left, rgba(255, 251, 235, 0.9), transparent 70%);
    z-index: 0;
}

.mind-content-header h1 {
    position: relative;
    z-index: 1;
    font-family: 'Kaisei Opti', serif;
    font-size: clamp(2rem, 8vw, 2.8rem);
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--mind-text) 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


.hero-subtitle {
    position: relative;
    z-index: 1;
    font-family: 'Noto Serif JP', serif;
    font-size: 1.1rem;
    color: var(--mind-text-light);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;
}


/* -------------------------------------------
   記事グリッド・リスト (一覧性の向上)
   ------------------------------------------- */
.magazine-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.magazine-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(181, 149, 80, 0.1);
    padding: 2.5rem;
    text-decoration: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 30px;
    height: 100%;
}

.magazine-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 45px rgba(181, 149, 80, 0.12);
    border-color: var(--mind-gold);
}


.item-visual {
    width: 60px;
    height: 60px;
    background: var(--mind-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.item-visual i {
    font-size: 1.5rem;
    color: var(--mind-gold);
}

.magazine-item:hover .item-visual {
    background: var(--mind-gold);
}

.magazine-item:hover .item-visual i {
    color: #fff;
}

/* 深呼吸するように膨らむアニメーション (Breathing Effect) */
.magazine-item {
    transform: scale(1);
    transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.magazine-item:hover {
    transform: scale(1.03) translateY(-5px); /* ゆったりと膨らむ */
    box-shadow: 
        0 20px 50px rgba(181, 149, 80, 0.15),
        0 0 20px rgba(181, 149, 80, 0.05);
    border-color: var(--mind-gold);
}

/* 背景キャンバスのスタイル */
#mind-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
}

.item-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    color: var(--mind-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    display: block;
}

.magazine-item h3 {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.35rem;
    color: var(--mind-text);
    margin-bottom: 2rem;
}

/* =========================================
   Video Theater Container (Unified Design)
   ========================================= */
.hero-inner {
    position: relative;
    z-index: 1;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.video-theater-container.hero-video-mode {
    width: 280px;
    max-width: 90%;
    aspect-ratio: 16 / 9;
    height: auto;
    margin: 0 auto 1.5rem;
    padding: 0;
    border-radius: 20px;
    background: #000;
    /* Stronger shadow for 3D feel */
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    border: 5px solid #fff;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 10;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: translateZ(40px); /* Most prominent element */
}

.video-theater-container.hero-video-mode.is-playing {
    width: 100%;
    max-width: 900px;
    border-radius: 20px;
}

.video-frame {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.video-theater-container.hero-video-mode .video-frame {
    padding-top: 0;
}

.video-theater-container.hero-video-mode.is-playing .video-frame {
    padding-top: 56.25%;
}

.video-frame video {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.video-overlay, .video-replay-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 20; transition: all 0.4s ease;
    text-align: center;
}

.video-overlay {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(0px);
}

.video-theater-container.hero-video-mode:hover .video-overlay {
    background: rgba(255, 255, 255, 0.2);
}

.video-replay-overlay {
    background: rgba(0, 0, 0, 0.7);
    opacity: 0; visibility: hidden;
    backdrop-filter: blur(8px);
    color: #fff;
}

.video-theater-container.is-playing .video-overlay { opacity: 0; visibility: hidden; }
.video-theater-container.is-finished .video-replay-overlay { opacity: 1; visibility: visible; }

.play-circle {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #ff0000, #cc0000); /* YouTube Red Gradient */
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.video-theater-container.hero-video-mode.is-playing .play-circle {
    width: 80px; height: 80px;
}

.play-circle i { color: white; font-size: 1.5rem; transform: translateX(2px); } /* Visual balancing of triangle */
.play-text {
    color: #cc0000; margin-top: 1rem; font-weight: 800; font-size: 0.75rem;
    letter-spacing: 0.15em; text-transform: uppercase;
    text-align: center; width: 100%; display: block;
    text-shadow: none;
}

.play-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.video-theater-container.is-playing .play-text { display: none; }

/* Progress Bar */
.video-controls-ui {
    position: absolute; bottom: 0; left: 0; width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    opacity: 0; transition: opacity 0.3s;
    display: flex; align-items: center; gap: 1rem; z-index: 30;
}

.video-theater-container.is-playing:hover .video-controls-ui { opacity: 1; }

.progress-bar-container {
    flex: 1; height: 6px; background: rgba(255,255,255,0.3);
    border-radius: 3px; cursor: pointer; overflow: hidden;
}

.progress-bar-fill { height: 100%; background: #ff0000; width: 0%; border-radius: 3px; box-shadow: 0 0 10px rgba(255, 0, 0, 0.4); }
.time-display { color: #fff; font-size: 0.8rem; font-weight: 700; min-width: 80px; text-align: right; }

.magazine-item p {
    font-size: 0.95rem;
    color: var(--mind-text-light);
    line-height: 1.6;
    margin: 0;
}

/* -------------------------------------------
   アニメーション補助
   ------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 600px) {
    .magazine-list {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Layout Override for 3-Column
   ========================================= */
@media (min-width: 920px) {
    .layout-container {
        display: grid;
        grid-template-columns: 240px 1fr; 
        gap: 3rem;
        padding: 4rem 2% 8rem 2%; 
        max-width: none;
        width: 100%;
        margin: 0;
    }

    .sidebar {
        grid-column: 1;
        width: 100% !important;
        order: 1; 
        grid-row: 1 / span 2; 
    }

    .main-content {
        grid-column: 2;
        width: 100% !important;
        margin: 0 auto;
        order: 2; 
    }

    .sidebar-discovery {
        grid-column: 2; 
        width: 100%;
        position: relative; 
        top: 0;
        margin-top: 4rem;
        display: block !important;
        order: 3; 
    }
}

@media (min-width: 1200px) {
    .layout-container {
        grid-template-columns: 240px 1fr 320px; 
        gap: 4rem;
    }

    .sidebar-discovery {
        grid-column: 3; 
        position: sticky;
        top: calc(var(--nav-height) + 3rem);
        margin-top: 0;
    }
}

@media (min-width: 1400px) {
    .layout-container {
        grid-template-columns: 260px 1fr 380px;
        gap: 8rem;
        padding-left: 5%;
        padding-right: 5%;
    }
    .main-content { max-width: 1000px; }
}

@media (max-width: 919px) {
    .sidebar-discovery {
        display: block !important;
        width: 100%;
        order: 3; 
        margin-top: 4rem;
        position: relative;
        top: 0;
        animation: fadeInUp 0.8s ease-out both;
    }

    .layout-container {
        display: flex;
        flex-direction: column;
        padding-left: 5%;
        padding-right: 5%;
    }

    .main-content { 
        order: 1; 
        max-width: 100% !important;
        width: 100% !important;
    }
    .sidebar { 
        order: 2; 
        margin-top: 3rem; 
        width: 100% !important;
    }
}

/* =========================================
   Discovery Sidebar
   ========================================= */ 
.sidebar-discovery .sidebar-widget {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    padding: 1.5rem;
}

.discovery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #e0f2fe;
}

.discovery-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discovery-header h3 i {
    color: #3b82f6;
}

.btn-shuffle {
    background: #eff6ff;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.1);
}

.btn-shuffle:hover {
    background: #3b82f6;
    color: white;
    transform: rotate(180deg);
}

/* Flap Card (3D Flip Animation System) */
.discovery-cards {
    perspective: 1000px;
}

.discovery-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #f1f5f9;
    text-decoration: none;
    display: block;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    color: inherit;
    
    /* Animation Base */
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.discovery-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #3b82f6;
    z-index: 10;
}

/* Shuffle Animation (managed by container class) */
.discovery-cards.shuffling .discovery-card {
    animation: flipVert 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* pulse/Auto-Flap State (managed by single card class) */
.discovery-card.flipping {
    animation: flipVert 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes flipVert {
    0% { transform: rotateX(0deg); opacity: 1; }
    45% { transform: rotateX(-90deg); opacity: 0.5; }
    55% { transform: rotateX(90deg); opacity: 0.5; }
    100% { transform: rotateX(0deg); opacity: 1; }
}

.discovery-card .card-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: #3b82f6;
    background: #eff6ff;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    display: inline-block;
}

.discovery-card .card-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.discovery-card .card-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
