/* 
  HITEC - Modern CSS Variables & Reset
*/
:root {
    --primary-color: #0056b3;
    --primary-light: #00b4d8;
    --secondary-color: #0a192f;
    --accent-color: #e63946;
    --text-color: #333333;
    --text-light: #f8f9fa;
    --bg-light: #f4f6f9;
    --bg-white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --transition-speed: 0.3s;
    --font-main: 'Noto Sans JP', 'Inter', sans-serif;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
}

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

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    background-color: var(--bg-white);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed) ease;
}

ul {
    list-style: none;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
}

/* Layout Utilities */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-padding {
    padding: 100px 0;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    z-index: -1;
    transition: opacity 0.4s ease;
    opacity: 0;
}

.btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 180, 216, 0.6);
    color: #fff;
}
.btn-primary:hover::before { opacity: 1; }

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--text-light);
}

.btn-outline:hover {
    background: var(--text-light);
    color: var(--primary-color);
    transform: translateY(-5px);
}

.btn-outline-dark {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}
.btn-outline-dark:hover {
    background: var(--primary-color);
    color: var(--text-light);
    transform: translateY(-5px);
}

/* Header & Navigation */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95); /* 全ページで白背景に統一 */
    backdrop-filter: blur(10px);
    transition: all var(--transition-speed) ease;
    padding: 12px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 15px; /* モックアップに合わせた間隔 */
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon-bg {
    height: 48px; /* 白背景に合わせた適正サイズ */
    width: 240px; 
    background-image: url('../assets/images/hitec-logo-transparent.png'); /* Pythonで白背景を完全透過させた特製PNG */
    background-size: contain; /* はみ出さずに全体を表示 */
    background-position: left center;
    background-color: transparent; /* 完全な透明背景 */
    background-repeat: no-repeat;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
    transition: all 0.3s ease;
}

.logo-text {
    font-size: 2.2rem;
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
    font-style: normal;
    color: #333333;
    letter-spacing: 2px;
    display: flex;
    align-items: flex-end; /* 株式会社とHITECの下端を揃える */
    line-height: 0.85; /* 余白調整 */
    padding-bottom: 2px;
}

.logo-text small {
    font-size: 0.9rem;
    font-weight: 700;
    font-style: normal;
    margin-right: 10px; /* 株式会社 と HITEC の間 */
    letter-spacing: 1px;
    padding-bottom: 4px;
}

.nav-list {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: #333333;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding-bottom: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover, 
.nav-link.active {
    color: var(--primary-color);
}
.hamburger span {
    background: #333333;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--primary-light);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

/* ====== トップページ専用 透明ヘッダー ====== */
.header.header-transparent {
    background: transparent;
    padding: 20px 0;
    box-shadow: none;
    backdrop-filter: none;
}
.header.header-transparent .logo-icon-bg {
    height: 58px;
    width: 290px;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
}
.header.header-transparent .logo-text {
    font-size: 2.8rem;
    color: #ffffff;
    text-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.header.header-transparent .logo-text small {
    font-size: 1.1rem;
    color: #ffffff;
}
.header.header-transparent .nav-link {
    color: rgba(255, 255, 255, 0.9);
}
.header.header-transparent .nav-link:hover,
.header.header-transparent .nav-link.active {
    color: #fff;
}
.header.header-transparent .hamburger span {
    background: #ffffff;
}

/* トップページ：スクロール後（白背景に戻る） */
.header.header-transparent.scrolled {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}
.header.header-transparent.scrolled .logo-icon-bg {
    height: 48px;
    width: 240px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.header.header-transparent.scrolled .logo-text {
    font-size: 2.2rem;
    color: #333333;
    text-shadow: none;
}
.header.header-transparent.scrolled .logo-text small {
    font-size: 0.9rem;
    color: #333333;
}
.header.header-transparent.scrolled .nav-link {
    color: #333333;
}
.header.header-transparent.scrolled .nav-link:hover,
.header.header-transparent.scrolled .nav-link.active {
    color: var(--primary-color);
}
.header.header-transparent.scrolled .hamburger span {
    background: #333333;
}

.recruit-link {
    background: rgba(255,255,255,0.1);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
}
.recruit-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}
.recruit-link::after { display: none; }

/* Hero Section */
.hero {
    height: 100vh; /* パノラマ風をやめ、全画面表示に戻して社屋と空の両方を確実に写す */
    min-height: 600px;
    position: relative;
    display: flex;
    align-items: flex-start; /* 中央揃えをやめ、上部の「空のエリア」にテキストを配置する */
    padding-top: 26vh; /* 背景画像が下へスライドしたのに合わせて、文字もギリギリ木に掛からない絶妙な位置まで追従して下げる */
    justify-content: flex-start;
    padding-left: 10%;
}

.video-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden;
    z-index: -2;
    background: var(--secondary-color);
}

.hero-video {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center;
}

.video-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* 重く暗い黒のグラデーションを極限まで薄く短くし、空の青さと建物の明るさを強調してさらなる清潔感を出す */
    background: linear-gradient(to right, rgba(10, 25, 47, 0.2) 0%, rgba(10, 25, 47, 0) 50%);
    z-index: -1;
}

.hero-content {
    color: var(--text-light);
    max-width: 750px;
    z-index: 2;
}

.hero-title {
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 2px 5px rgba(0,0,0,0.4);
}

.hero-title .highlight {
    /* 新しい写真の「暗い木々」と水色が同化して見づらくなる現象を避けるため、
       最も視認性が高くクリーンな「純白」に統一し、確実な読みやすさを確保 */
    color: #ffffff; 
    background: none;
    -webkit-text-fill-color: initial;
    /* 背景が複雑でも文字がハッキリ浮かび上がるように、しっかりとした黒い影を引き続き適用 */
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), 0 2px 5px rgba(0, 0, 0, 0.6);
}

.hero-subtitle {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 3rem;
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.5);
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.hero-buttons .btn-primary {
    line-height: 1.4;
    padding: 12px 35px;
}
.hero-buttons .btn-primary small {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.9;
}

/* Sections Common */
.section-header {
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 60px; height: 3px;
    background: var(--primary-light);
}
.section-subtitle {
    font-size: 1rem;
    color: #666;
    letter-spacing: 1px;
}

/* Business Grid */
.bg-light { background-color: var(--bg-light); }

.business-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.card {
    background: #fff;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(0, 180, 216, 0.2);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}
.card-desc {
    color: #555;
    font-size: 0.95rem;
}

/* About Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.about-heading {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}
.text-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary-color);
    font-weight: 700;
    border-bottom: 1px solid transparent;
}
.text-link:hover {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

/* Recruit CTA */
.recruit-cta {
    position: relative;
    padding: 120px 0;
    overflow: hidden;
    background: var(--secondary-color);
}

.recruit-cta-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Pattern over dark bg */
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.5;
}

.text-white { color: #fff; }
.cta-title {
    font-size: 3rem;
    margin-bottom: 20px;
}
.cta-desc {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 40px;
    opacity: 0.9;
}

.benefits-preview {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.benefit-item {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Footer */
.footer {
    background: #050d1a;
    color: #a0aabf;
    padding: 80px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-logo {
    height: 40px;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.footer-info p { margin-bottom: 10px; font-size: 0.95rem; }

.footer-links h4 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.footer-links ul li {
    margin-bottom: 12px;
}

.footer-links a:hover {
    color: var(--primary-light);
}

/* Instagram Footer Link */
.footer-ig-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-ig-link:hover {
    transform: translateY(-5px);
}

.footer-ig-icon {
    width: 140px;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.footer-ig-link:hover .footer-ig-icon {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.footer-ig-text {
    display: none;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    font-size: 0.85rem;
}

/* --- Cinematic Hero Animations --- */
.cinematic-hero .hero-bg-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}
.cinematic-hero .sunny-layer { opacity: 1; }
.cinematic-hero .cloudy-layer {
    z-index: 1;
    animation: clearClouds 2.5s ease-in-out forwards;
    animation-delay: 2.0s; /* 最初は曇り。2秒後（文字が出た後）に晴れ始める */
}

@keyframes clearClouds {
    0% { opacity: 1; filter: brightness(1) saturate(1); }
    100% { opacity: 0; filter: brightness(1.2) saturate(1.2); }
}

/* Staggered Text Animations */
.anim-seq-1, .anim-seq-2, .anim-seq-3, .anim-seq-4 {
    display: inline-block;
    opacity: 0;
    animation: cinFadeInUp 1.2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.anim-seq-1 { animation-delay: 0.5s; } /* 「未来を照らす、」が最初に出る */
.anim-seq-2 { animation-delay: 3.5s; } /* 空が晴れ渡った瞬間に「街を創る。」が出る */
.anim-seq-3 { animation-delay: 4.8s; } /* その後サブタイトルが続く */
.anim-seq-4 { animation-delay: 5.3s; } /* 最後にボタンが出る */

@keyframes cinFadeInUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Hide mobile menu toggle on desktop */
.menu-toggle {
    display: none;
}

/* Animations CSS classes for JS intersection observer */
.fade-in { opacity: 0; transition: opacity 0.8s ease; }
.fade-in.appear { opacity: 1; }

.fade-in-up { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.fade-in-up.appear { opacity: 1; transform: translateY(0); }

.fade-in-left { opacity: 0; transform: translateX(-40px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.fade-in-left.appear { opacity: 1; transform: translateX(0); }

.fade-in-right { opacity: 0; transform: translateX(40px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.fade-in-right.appear { opacity: 1; transform: translateX(0); }


/* Responsive */
@media (max-width: 900px) {
    .business-grid { grid-template-columns: 1fr; }
    .hero-title { font-size: 3rem; }
    .footer-grid { grid-template-columns: 1fr; }
    
    /* Mobile Navigation */
    .nav-list {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 80px; /* Adjust based on header height */
        left: 0;
        width: 100%;
        background-color: #ffffff;
        padding: 20px 0;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        transform: translateY(-150%);
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
        opacity: 0;
        visibility: hidden;
        z-index: 999;
    }
    
    .nav-list.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-list li {
        width: 100%;
        text-align: center;
        margin: 10px 0;
    }
    
    .nav-list li a {
        display: block;
        padding: 10px 0;
        font-size: 1.1rem;
        color: var(--primary-color) !important;
    }

    /* Mobile Menu Toggle Button */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 21px;
        cursor: pointer;
        z-index: 1001; /* Above mobile menu */
    }

    .menu-toggle .bar {
        display: block;
        height: 3px;
        width: 100%;
        background-color: var(--primary-color);
        border-radius: 3px;
        transition: all 0.3s ease;
    }

    /* Transform toggle into X when active */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
}

/* News Layout with Sidebar */
.news-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}
@media (max-width: 900px) {
    .news-layout {
        grid-template-columns: 1fr;
    }
}
.news-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    background: #fff;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.news-sidebar-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
    color: var(--secondary-color);
}
.news-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.news-sidebar-list::-webkit-scrollbar {
    width: 6px;
}
.news-sidebar-list::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}
.news-sidebar-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
}
.news-sidebar-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.news-sidebar-list a {
    color: #444;
    font-size: 0.95rem;
    text-decoration: none;
    display: block;
    line-height: 1.5;
    transition: color 0.3s ease;
    font-weight: 500;
}
.news-sidebar-list a:hover {
    color: var(--primary-color);
}
.news-sidebar-date {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}

/* Manga Section Layout (Apple-style Interaction) */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 40px;
    padding-bottom: 40px;
}

.manga-panel {
    position: relative;
    border: 4px solid #fff;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    align-self: start;
}

.manga-panel img {
    width: 100%;
    height: auto;
    display: block;
}

/* Panel sizes */
.p1 { grid-column: span 2; }
.p2 { grid-column: span 1; }
.p3 { grid-column: span 1; }
.p4 { grid-column: span 2; margin-top: 30px; border-color: var(--primary-color); }
.p5 { grid-column: span 1; }
.p6 { grid-column: span 1; }
.p7 { grid-column: span 2; }
.p8 { grid-column: span 2; border-color: #ff5722; margin-top: 20px; }

.nav-list a.active::after {
    width: 100%;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
}

.lang-btn {
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 2px 5px;
}

.lang-btn:hover {
    color: var(--primary-color);
}

.lang-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.lang-sep {
    color: #ccc;
    font-weight: 300;
}

/* Placeholder for AI Images */
.manga-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; left: 0;
}
.manga-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.manga-status {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    font-weight: bold;
}

/* Speech Bubbles */
.comic-bubble {
    --bubble-translate: translate(0, 0);
    position: absolute;
    background: #fff;
    border: 3px solid #333;
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: 2px 4px 0 rgba(0,0,0,0.2);
    z-index: 10;
    max-width: 80%;
    
    /* Animation initial state */
    opacity: 0;
    transform: var(--bubble-translate) scale(0.3);
    transition: opacity 0.4s ease-out, transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.comic-bubble p {
    font-family: "M PLUS Rounded 1c", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #333;
    line-height: 1.4;
    margin: 0;
}

/* Scroll-triggered bubble pop */
.fade-in-up.appear .comic-bubble,
.fade-in-left.appear .comic-bubble,
.fade-in-right.appear .comic-bubble,
.fade-in-shake.appear .comic-bubble,
.fade-in-glow.appear .comic-bubble,
.fade-in-burst.appear .comic-bubble {
    opacity: 1;
    transform: var(--bubble-translate) scale(1);
}

/* Bubble Positions */
.b-top-left { top: 20px; left: 20px; }
.b-top-right { top: 20px; right: 20px; }
.b-bottom-left { bottom: 20px; left: 20px; }
.b-bottom-right { bottom: 20px; right: 20px; }

.b-center-large { 
    --bubble-translate: translate(-50%, -50%);
    top: 50%; left: 50%; 
    padding: 25px 40px; 
}
.b-bottom-center { 
    --bubble-translate: translateX(-50%);
    bottom: 30px; left: 50%; 
    text-align: center; 
}

/* Speech Bubble Tails */
.comic-bubble::after {
    content: '';
    position: absolute;
    border: 15px solid transparent;
}
.b-top-left::after { top: 100%; left: 30px; border-top-color: #333; border-bottom: 0; margin-top: 3px; }
.b-top-right::after { top: 100%; right: 30px; border-top-color: #333; border-bottom: 0; margin-top: 3px; }
.b-bottom-left::after { bottom: 100%; left: 30px; border-bottom-color: #333; border-top: 0; margin-bottom: 3px; }
.b-bottom-right::after { bottom: 100%; right: 30px; border-bottom-color: #333; border-top: 0; margin-bottom: 3px; }

    /* Delays for intersection observer to make them pop out sequentially */
.delay-1 { transition-delay: 0.3s; }
.delay-2 { transition-delay: 0.4s; }
.delay-3 { transition-delay: 0.5s; }
.delay-4 { transition-delay: 0.3s; }
.delay-5 { transition-delay: 0.4s; }
.delay-6 { transition-delay: 0.5s; }
.delay-7 { transition-delay: 0.3s; }
.delay-8 { transition-delay: 0.6s; }

/* =========================================
   Manga WOW Gimmicks (Parallax, Glow, Shake)
   ========================================= */

/* 1. Narrative Color Bloom */
.manga-panel.manga-gray img {
    filter: grayscale(100%) contrast(110%);
    transition: filter 1.2s ease-out;
}
.manga-panel.manga-gray.bloom img, 
.manga-panel.manga-gray:hover img {
    filter: grayscale(0%) contrast(100%);
}

/* 2. 3D Parallax Hover (Removed due to motion sickness) */

/* 3. Comic Action Effects */
/* Panel 4: HITEC Discovery Glow */
.fade-in-glow {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: opacity 0.6s ease-out;
}
.fade-in-glow.appear {
    opacity: 1;
    animation: hitec-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, hitec-glow 2s infinite alternate 0.6s;
    z-index: 5;
}
@keyframes hitec-pop {
    0% { transform: scale(0.9); border-color: var(--primary-color); }
    50% { transform: scale(1.03); border-color: #ffb700; box-shadow: 0 0 60px rgba(255,183,0,0.8); }
    100% { transform: scale(1.02); border-color: #ff9800; }
}
@keyframes hitec-glow {
    from { box-shadow: 0 0 20px rgba(255,152,0,0.4), 0 10px 30px rgba(0,0,0,0.5); border-color: #ffb700; }
    to { box-shadow: 0 0 60px rgba(255,152,0,1), 0 10px 40px rgba(0,0,0,0.6); border-color: #ffeb3b; }
}

/* Panel 5: Shock Shake */
.fade-in-shake {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fade-in-shake.appear {
    opacity: 1;
    animation: manga-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    animation-delay: 0.1s;
    transition: opacity 0.6s ease-out !important;
}
@keyframes manga-shake {
  10%, 90% { transform: translate3d(-5px, 0, 0) scale(1.02); }
  20%, 80% { transform: translate3d(5px, 0, 0) scale(1.02); }
  30%, 50%, 70% { transform: translate3d(-15px, -10px, 0) scale(1.05); }
  40%, 60% { transform: translate3d(15px, 10px, 0) scale(1.05); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* Panel 8: Radiant Burst */
.fade-in-burst {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: opacity 0.6s ease-out;
}
.fade-in-burst.appear {
    opacity: 1;
    animation: p8-success-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, p8-pulse 1.5s infinite alternate 0.8s;
    z-index: 5;
}
@keyframes p8-success-pop {
    0% { transform: scale(0.9); }
    50% { transform: scale(1.05) translateY(-10px); }
    100% { transform: scale(1.03) translateY(-5px); }
}
@keyframes p8-pulse {
    from {
        box-shadow: 
            0 0 0 0 rgba(255, 87, 34, 0.7),
            0 0 40px rgba(255, 193, 7, 0.5),
            0 15px 35px rgba(0,0,0,0.4);
        border-color: #ff5722;
    }
    to {
        box-shadow: 
            0 0 0 25px rgba(255, 87, 34, 0),
            0 0 100px rgba(255, 193, 7, 1),
            0 25px 50px rgba(0,0,0,0.5);
        border-color: #ffeb3b;
    }
}

/* Daily Perks Showcase */
.perks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}
.perk-card {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.perk-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.perk-img-wrap {
    width: 100%;
    height: 250px;
    overflow: hidden;
}
.perk-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}
.perk-card:hover .perk-img {
    transform: scale(1.08);
}
.perk-info {
    padding: 25px;
    text-align: center;
}
.perk-info h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 800;
}
.perk-info p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
}

@media (max-width: 768px) {
    .manga-grid { grid-template-columns: 1fr; gap: 10px; }
    .p1, .p2, .p3, .p4, .p5, .p6, .p7, .p8 { grid-column: span 1; }
    /* Redesign Comic Bubbles for Mobile: Stack them BELOW the images */
    .manga-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .manga-panel img {
        border: 4px solid #ebdcb7;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
        margin-bottom: 12px;
    }

    .comic-bubble {
        position: relative !important;
        top: auto !important; 
        left: auto !important; 
        right: auto !important; 
        bottom: auto !important;
        transform: scale(0.6) !important; /* Initial collapsed state for animation */
        max-width: 95%;
        margin: 0 auto 15px; /* Add margin below bubble */
        padding: 10px 16px;
        border-width: 2px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    
    .comic-bubble p { 
        font-size: 0.95rem; 
        line-height: 1.4; 
        text-align: center; 
    }
    
    /* Animation active state must use the new relative scaling */
    .fade-in-up.appear .comic-bubble,
    .fade-in-left.appear .comic-bubble,
    .fade-in-right.appear .comic-bubble,
    .fade-in-shake.appear .comic-bubble,
    .fade-in-glow.appear .comic-bubble,
    .fade-in-burst.appear .comic-bubble {
        transform: scale(1) !important;
    }
    
    /* Hide the pointing tails as they are no longer accurate below the image */
    .comic-bubble::after { 
        display: none !important; 
    }
}
