:root {
    --primary-color: #e60012;
    --accent-color: #fff100;
    --base-height: 442px;
}

/* Light Mode Variables */
body.light-mode {
    --text-color: #333;
    --bg-color: #fff3e0;
    --card-bg: rgba(255, 255, 255, 0.95);
    --info-zone-bg: rgba(255, 255, 255, 0.2);
    --header-bg: #fff;
    --border-color: #ddd;
    --dot-color: #e0d5c0;
    --anim-color: rgba(255, 200, 0, 0.4);
    --btn-bg: #e60012;
    --btn-text: #fff;
    --title-color: #e60012;
}

/* Dark Mode Variables */
body.dark-mode {
    --text-color: #f0f6fc;
    --bg-color: #0d1117;
    --card-bg: #21262d;
    --info-zone-bg: rgba(255, 255, 255, 0.1);
    --header-bg: #161b22;
    --border-color: #30363d;
    --dot-color: #30363d;
    --anim-color: rgba(0, 255, 255, 0.4);
    --btn-bg: #30363d;
    --btn-text: #f0f6fc;
    --title-color: #ff4d4d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif; 
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 50px;
    transition: background-color 0.5s, color 0.3s;
}

/* Background Animation Layer */
.bg-layer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; overflow: hidden;
    background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
    background-size: 30px 30px;
}

/* Dark Mode: Digital Noise */
body.dark-mode .bg-layer::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: var(--anim-color);
    box-shadow: 0 0 15px var(--anim-color);
    animation: glitch 4s infinite;
    opacity: 0;
}
@keyframes glitch {
    0%, 93% { opacity: 0; transform: translateY(0); }
    94% { opacity: 1; transform: translateY(30vh) skewX(20deg); }
    95% { opacity: 0; }
    96% { opacity: 0.8; transform: translateY(70vh) scaleY(3); }
    97% { opacity: 0; }
}

/* Light Mode: Vitamin Lightning (JS Controlled) */
body.light-mode .bg-layer::after {
    content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(90deg, transparent, #6ed7a0, transparent);
    transform: rotate(-30deg) translateX(-100%);
    opacity: 0;
    filter: blur(4px);
}
.run-lightning::after {
    animation: lightning-once 0.8s ease-in-out forwards;
}
@keyframes lightning-once {
    0% { transform: rotate(-30deg) translateX(-100%); opacity: 0; }
    20% { opacity: 0.5; }
    80% { opacity: 0.5; }
    100% { transform: rotate(-30deg) translateX(100%); opacity: 0; }
}

/* Header */
.site-header { 
    background: var(--header-bg); padding: 12px 20px; border-bottom: 1px solid var(--border-color); 
    position: sticky; top: 0; z-index: 1000; font-size: 13px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
}
.header-inner { max-width: 1220px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.header-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; transition: opacity 0.3s; }
.header-link:hover { opacity: 0.8; }
.header-text { font-weight: 800; color: var(--text-color); line-height: 1.2; }
.header-catch { color: #e60012; font-size: 10px; letter-spacing: 0.1em; }
.header-title { font-size: 15px; letter-spacing: 0.02em; }
.header-right { display: flex; align-items: center; gap: 15px; }

.mode-toggle { cursor: pointer; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: bold; background: var(--card-bg); color: var(--text-color); transition: 0.3s; }
.mode-toggle:hover { background: var(--primary-color); color: #fff; }

/* Hamburger Menu */
.menu-trigger {
    width: 30px; height: 30px; background: transparent;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    cursor: pointer; z-index: 1200;
    transition: transform 0.3s ease;
}
.menu-trigger span { display: block; width: 20px; height: 2px; background: var(--text-color); border-radius: 2px; transition: 0.3s; }
.menu-trigger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-trigger.open span:nth-child(2) { opacity: 0; }
.menu-trigger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* メニューの注目演出 */
@keyframes menu-glow {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(230,0,18,0)); }
    30% { transform: scale(1.5); filter: drop-shadow(0 0 20px rgba(230,0,18,1)); }
    60% { transform: scale(1.5); filter: drop-shadow(0 0 30px rgba(230,0,18,1)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(230,0,18,0)); }
}
.highlight-menu { animation: menu-glow 1.0s ease-in-out 3; }

/* Polycarbonate About Modal */
.about-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1100; display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.4s;
}
.about-modal {
    width: 80%; max-width: 800px; height: auto; max-height: 500px;
    background: rgba(220, 250, 245, 0.7); /* 薄緑青がかったポリカ板イメージ（明度アップ） */
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    padding: 30px 40px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; color: #333; position: relative; overflow-y: auto;
}
body.dark-mode .about-modal { color: #fff; background: rgba(50, 100, 90, 0.3); }

.about-modal h1 { font-size: 0.75rem; letter-spacing: 0.05em; opacity: 0.7; margin-bottom: 15px; }
.about-modal h2 { font-size: 1.3rem; margin-bottom: 10px; color: var(--primary-color); }
.about-modal p { font-size: 0.95rem; line-height: 1.4; margin-bottom: 5px; font-weight: 500; }
.about-modal .emphasis { font-size: 1.05rem; font-weight: bold; margin: 8px 0; display: block; line-height: 1.6; }

/* Text Markers */
.marker { background: linear-gradient(transparent 60%, rgba(57, 255, 20, 0.6) 60%); padding: 0 4px; border-radius: 4px; }
body.dark-mode .marker { background: linear-gradient(transparent 60%, rgba(57, 255, 20, 0.6) 60%); color: #fff; }

.container { max-width: 1460px; margin: auto; padding: 20px; position: relative; z-index: 1; }

/* Pillars Grid (01-04) */
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; justify-content: center; margin-bottom: 40px; }
.pillar-wrapper { display: flex; flex-direction: column; align-items: center; transition: all 0.5s ease; width: 100%; scroll-margin-top: 80px; }
.pillar-wrapper.inactive { display: none; }

.pillar-card { 
    position: relative; cursor: pointer; 
    width: 340px; height: var(--base-height);
    aspect-ratio: 1 / 1.3; 
    background: var(--card-bg); border-radius: 16px; overflow: hidden; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.1); 
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 auto;
}
.pillar-card:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.card-bg { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: all 0.6s ease; }

/* Info Zone (01-04) */
.card-info-zone {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 25%;
    background: var(--info-zone-bg);
    display: flex; align-items: center; backdrop-filter: blur(2px); z-index: 2; transition: all 0.6s ease;
}
.card-number {
    width: 35%; font-size: 2.2rem; font-weight: 900; font-style: italic;
    color: #000; 
    text-align: center; line-height: 1; letter-spacing: -2px;
    transition: all 0.6s ease;
}
body.dark-mode .card-number { color: #000; }
.card-logo-area { width: 65%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 5px 10px; }
.card-logo-area img { max-width: 100%; max-height: 80%; object-fit: contain; }

/* Detail Area (Modal 01-04) */
.details { 
    display: none; width: 85%; max-width: 1000px; margin: 30px auto; padding: 40px; 
    background: var(--card-bg); color: var(--text-color); border-radius: 20px; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.2); border: 1px solid var(--border-color);
    position: relative; z-index: 5; animation: fadeIn 0.8s;
}
.close-icon {
    position: absolute; top: 20px; right: 20px; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 50%; background: rgba(0,0,0,0.1);
    transition: 0.3s; z-index: 10;
}
.close-icon:hover { background: var(--primary-color); transform: rotate(90deg); }
.close-icon::before, .close-icon::after {
    content: ""; position: absolute; width: 20px; height: 2px; background: var(--text-color);
}
.close-icon::before { transform: rotate(45deg); }
.close-icon::after { transform: rotate(-45deg); }
.close-icon:hover::before, .close-icon:hover::after { background: #fff; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* --- Main Card Expansion (Mobile < 740px) --- */
.pillar-wrapper.active .pillar-card {
    height: 284px; /* 16:9 image (191px) + Info zone (93px) */
}
.pillar-wrapper.active .card-bg {
    height: 191px; /* Force 16:9 aspect ratio */
}
.pillar-wrapper.active .card-info-zone {
    height: 93px;
    background: var(--card-bg); /* Opaque background below image */
    backdrop-filter: none;
    display: flex;
    align-items: center; /* Center vertically for better balance */
    padding: 10px 15px;
    gap: 10px;
}
.pillar-wrapper.active .card-number {
    width: auto;
    font-size: 1.8rem;
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1;
}
.pillar-wrapper.active .card-logo-area {
    width: auto;
    flex: 1;
    padding: 0;
    display: flex;
    justify-content: center; /* Center logo in the remaining space */
}

@media (min-width: 740px) {
    .pillar-wrapper.active { grid-column: 1 / -1; }
    .pillar-wrapper.active .pillar-card {
        height: var(--base-height);
        width: 786px; /* 16:9 ratio for 442px height */
        max-width: 1000px;
    }
    /* Reset for Desktop expansion (keep existing behavior) */
    .pillar-wrapper.active .card-bg { height: 100%; }
    .pillar-wrapper.active .card-info-zone { 
        height: 25%; 
        background: var(--info-zone-bg); 
        backdrop-filter: blur(2px);
        align-items: center;
        padding: 5px 10px;
    }
    .pillar-wrapper.active .card-number { width: 35%; font-size: 2.2rem; line-height: 1; color: #000; opacity: 1; }
    .pillar-wrapper.active .card-logo-area { width: 65%; flex: none; justify-content: center; }
}

/* Projects Section (05-09) */
.fixed-section { margin: 10px auto 60px; max-width: 1100px; }
.fixed-section .section-title::after { display: none; }
.section-title { text-align: center; margin: 20px auto; color: #888; font-size: 1.4rem; position: relative; width: fit-content; display: block; letter-spacing: 0.1em; }
.section-title::after { content: ""; position: absolute; bottom: -8px; left: 0; width: 100%; height: 3px; background: #ccc; border-radius: 2px; }

.project-list { 
    display: flex; flex-wrap: wrap; gap: 25px; justify-content: center; align-items: flex-start;
    max-width: 740px; margin: 0 auto;
}
.project-item { 
    width: 340px; position: relative; display: flex; flex-direction: column; 
    background: var(--card-bg); border-radius: 16px; overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); border: 1px solid var(--border-color); 
    cursor: pointer; height: fit-content; transition: 0.3s;
}
.project-item:hover { transform: scale(1.02); }
.project-img { width: 100%; height: 191px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.project-img img { width: 100%; height: 100%; object-fit: contain; }
.project-content { padding: 20px 25px; }
.project-header { display: flex; justify-content: flex-start; align-items: flex-end; gap: 15px; }
.project-content h3 { font-size: 0.95rem; color: var(--text-color); line-height: 1.4; flex: 1; min-height: 2.8em; display: flex; align-items: flex-end; }
.card-number-small { font-size: 1.8rem; font-weight: 900; font-style: italic; color: #000; opacity: 0.8; line-height: 0.8; }
body.dark-mode .card-number-small { color: #fff; opacity: 0.2; }

.project-detail-area { 
    max-height: 0; opacity: 0; overflow: hidden; 
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
}
.project-item.open .project-detail-area { max-height: 600px; opacity: 1; margin-top: 15px; }
.project-content p { color: var(--text-color); opacity: 0.8; margin-bottom: 15px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.project-info-list { font-size: 0.8rem; opacity: 0.7; margin-bottom: 15px; list-style: none; padding-left: 0; }
.project-info-list li { margin-bottom: 4px; position: relative; padding-left: 12px; }
.project-info-list li::before { content: "・"; position: absolute; left: 0; }
.btn-detail { display: inline-block; padding: 8px 25px; background: var(--btn-bg); color: var(--btn-text); text-decoration: none; border-radius: 30px; font-weight: bold; font-size: 0.8rem; transition: 0.3s; }
.btn-detail:hover { opacity: 0.8; }

/* SNS & Video */
.sns-section, .video-section { 
    text-align: center; 
    margin: 100px auto; 
    max-width: 85%; 
    padding: 40px 20px; 
    background: rgba(255,255,255,0.05); 
    border-radius: 20px; 
    border: 1px solid var(--border-color);
}
.sns-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; margin-top: 30px; justify-items: center; }
.sns-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; color: var(--text-color); transition: 0.3s; width: 100%; max-width: 150px; text-align: center; }
.sns-card:hover { transform: translateY(-5px); }
.sns-card img { width: auto; max-width: 100%; height: 60px; object-fit: contain; border-radius: 8px; }
.sns-card span { font-size: 0.75rem; font-weight: 500; line-height: 1.3; height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.video-wrapper { max-width: 700px; margin: 30px auto; border: 8px solid #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 15px 30px rgba(0,0,0,0.15); cursor: pointer; position: relative; }
.video-wrapper img { width: 100%; display: block; }
/*
.video-wrapper::after { content: "▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 4rem; color: #fff; text-shadow: 0 0 20px rgba(0,0,0,0.5); opacity: 0.8; }
*/

.video-section {
    text-align: center;
    margin: 100px auto;
    max-width: 85%;
    padding: 40px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* Official Link & Footer */
.official-link-area { text-align: center; margin: 60px auto 20px; }
.official-logo { width: 180px; transition: 0.3s; opacity: 0.8; }
.official-logo:hover { opacity: 1; }
body.dark-mode .official-logo { filter: invert(1) brightness(2); }

footer { font-size: 12px; opacity: 0.5; text-align: center; padding: 20px 0; letter-spacing: 0.05em; }

/* --- Opening Animation --- */
#opening-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    z-index: 9999; pointer-events: none; overflow: hidden;
    display: flex; justify-content: center; align-items: center;
}
/* 扉全体を回すためのラッパー */
#door-wrapper {
    position: absolute; width: 200vw; height: 200vh;
    display: flex; justify-content: center; align-items: center;
    transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1);
    pointer-events: none;
}
.door {
    position: absolute; top: 0; width: 51%; height: 100%;
    background: #fff;
    transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1);
    pointer-events: auto;
    box-shadow: 0 0 100px rgba(0,0,0,0.1);
}
.door-left { left: 0; border-right: 1px solid #eee; }
.door-right { right: 0; border-left: 1px solid #eee; }

/* 光の演出 */
#opening-overlay::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, #fff 0%, transparent 60%);
    opacity: 0; transition: opacity 0.8s ease; z-index: 1;
    pointer-events: none;
}

/* 扉が開くアクション */
.opening-started #door-wrapper { transform: rotate(40deg); }
.opening-started .door-left { transform: translateX(-100%); }
.opening-started .door-right { transform: translateX(100%); }
.opening-started::before { opacity: 1; }

/* タイトル移動アニメーション (扉とは別階層なので回転の影響を受けない) */
#opening-title {
    position: absolute; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
    transition: all 1.2s cubic-bezier(0.7, 0, 0.3, 1);
    transform: scale(1.5);
    pointer-events: none;
}
.opening-started #opening-title {
    transform: scale(1);
}

/* コンテンツの初期状態（フェードイン待ち） */
.container { opacity: 0; transition: opacity 0.8s ease; }
.site-header { opacity: 1; } /* ヘッダー自体は表示しておく */
.header-text { opacity: 0; transition: opacity 0.8s ease; } /* タイトルのみ遅れてフェードイン */
.reveal-content .container { opacity: 1; }
.reveal-content .header-text { opacity: 1; }

/* コンテンツ登場の調整 */
.section-title { opacity: 0; transform: translateY(20px); transition: 0.8s ease; }
.revealed .section-title { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }

.pillar-wrapper { opacity: 0; transform: translateY(30px); transition: 0.8s ease; }
.project-item { opacity: 0; transform: translateY(30px); transition: 0.8s ease; }

.revealed .pillar-wrapper { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.revealed .project-item { opacity: 1; transform: translateY(0); transition-delay: 0.5s; }

/* メニューの注目演出 (DARKモードでも見えるように光を強化) */
@keyframes menu-glow {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(230,0,18,0)); }
    30% { transform: scale(1.5); filter: drop-shadow(0 0 15px #e60012) drop-shadow(0 0 30px rgba(255,255,255,0.8)); }
    60% { transform: scale(1.5); filter: drop-shadow(0 0 25px #e60012) drop-shadow(0 0 50px rgba(255,255,255,0.9)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(230,0,18,0)); }
}
.highlight-menu { animation: menu-glow 1.0s ease-in-out 3; }