:root {
    --primary: #00509d;    /* 背景・ボタン用のロイヤルブルー */
    --text-dark: #002147;  /* 学校名・メニュー用の元の濃いネイビー */
    --accent: #c0392b;     /* アクセントレッド */
    --gold: #d4af37;       /* ゴールド */
    --bg-slate: #f8fafc; 
    --bg-pearl: #fffefb;
    --transition: all 0.3s ease;
}

/* Base Style - 基本文字色は元の濃いグレー (#333) */
body { font-family: 'Inter', 'Segoe UI', sans-serif; margin: 0; padding: 0; color: #333; line-height: 1.6; background: #fff; overflow-x: hidden; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
a { text-decoration: none; color: inherit; transition: var(--transition); }

/* Top Bar */
.top-bar { background-color: var(--primary); color: #fff; padding: 10px 0; font-size: 0.85rem; z-index: 1100; position: relative; }
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-info a { color: #fff !important; font-weight: 600; margin-right: 25px; display: inline-flex; align-items: center; }
.top-info i { color: var(--gold); margin-right: 8px; }

/* SNSアイコンの分離 (15pxの隙間を確保) */
.top-right-group { display: flex; align-items: center; gap: 20px; }
.top-social { display: flex; align-items: center; gap: 15px !important; } 
.top-social a { color: #fff; font-size: 1.1rem; display: inline-block; line-height: 1; }

.search-box-inline { display: flex; align-items: center; background: rgba(255,255,255,0.2); border-radius: 20px; padding: 2px 15px; border: 1px solid rgba(255,255,255,0.25); }
.search-box-inline input { background: transparent; border: none; color: #fff; padding: 5px; outline: none; width: 140px; font-size: 0.8rem; }
.search-box-inline button { background: transparent; border: none; color: var(--gold); cursor: pointer; }
.portal-link { color: var(--gold) !important; font-weight: 800; border-left: 2px solid rgba(255,255,255,0.2); padding-left: 15px; margin-left: 5px; }

/* Header - 2-Line Text Stack & Original Dark Color */
.site-header { background: #fff; border-bottom: 1px solid #f1f5f9; padding: 15px 0; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.header-container { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.logo-brand { display: flex; align-items: center; gap: 20px; text-decoration: none; flex-shrink: 0; }
.logo-img { height: 85px; width: auto; max-width: 280px; object-fit: contain; border-radius: 8px; }

.logo-text-group { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
/* 学校名は元の濃いネイビーに固定 */
.logo-title { color: var(--text-dark); font-size: 2.4rem; font-weight: 900; line-height: 1.1; margin: 0; letter-spacing: -1px; display: block; }
.logo-motto { font-size: 0.9rem; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; margin-top: 5px; font-weight: 700; display: block; }

/* メインメニューも元の濃いネイビーに固定 (1.05rem) */
#mainNav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 25px; }
#mainNav a { font-weight: 800; text-transform: uppercase; font-size: 1.05rem; color: var(--text-dark); }
#mainNav a:hover { color: var(--primary); }

/* Stats Banner Overlay */
.stats-banner-wrapper { position: relative; z-index: 20; margin-top: -60px; }
.stats-banner { background: var(--primary); color: #fff; padding: 50px 0; border-radius: 15px; display: flex; justify-content: space-around; width: 95%; max-width: 1150px; margin: 0 auto; box-shadow: 0 30px 60px rgba(0,80,157,0.25); text-align: center; }
.stat-item h3 { font-size: 2.8rem; color: var(--gold); margin: 0; font-weight: 900; }

/* Section Themes */
.section-padding { padding: 100px 0; }
.bg-white { background: #ffffff; }
.bg-slate { background: var(--bg-slate); }
.bg-pearl { background: var(--bg-pearl); }
.bg-primary { background: var(--primary); color: #fff; }

/* Grid & Cards */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }

.reveal { opacity: 0; transform: translateY(40px); transition: 1s cubic-bezier(0.165, 0.84, 0.44, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

.card { background: #fff; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #f1f5f9; transition: var(--transition); height: 100%; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.08); }
.card img { width: 100%; height: 220px; object-fit: cover; }
.card-content { padding: 30px; flex-grow: 1; }

.activity-card { padding: 25px; text-align: center; background: #fff; border-radius: 12px; border: 1px solid #f1f5f9; transition: var(--transition); }
.activity-card:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.activity-card i { font-size: 2.2rem; margin-bottom: 12px; color: var(--gold); }
.activity-card:hover i { color: #fff; }

.leader-card { background: #fff; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #f1f5f9; text-align: center; }
.leader-img { width: 100%; height: 350px; object-fit: cover; }

/* Footer - 元の色 (#001022) を完全維持 */
.site-footer { background: #001022; color: #fff; padding: 80px 0 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
.footer-h3 { color: var(--gold); margin-bottom: 25px; font-size: 1.2rem; border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 5px; }

/* Dropdown Menu Styles (Fixed Priority) */
#mainNav ul .dropdown { position: relative; display: flex; align-items: center; }
#mainNav ul .dropdown-menu { display: none !important; position: absolute; top: 100%; left: 0; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.1); list-style: none; padding: 10px 0; margin: 0; min-width: 180px; z-index: 1000; border-radius: 8px; border: 1px solid #f1f5f9; flex-direction: column; gap: 0; }
#mainNav ul .dropdown:hover .dropdown-menu { display: flex !important; }
#mainNav ul .dropdown-menu li { display: block; margin: 0; width: 100%; }
#mainNav ul .dropdown-menu a { display: flex !important; align-items: center; gap: 10px; padding: 12px 20px !important; color: var(--text-dark) !important; font-size: 0.95rem !important; text-transform: none !important; font-weight: 600 !important; border-left: none !important; width: 100%; box-sizing: border-box; }
#mainNav ul .dropdown-menu a:hover { background: #f8fafc !important; color: var(--primary) !important; }

/* Enhanced Top SNS Icons */
.top-social a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    text-decoration: none;
}
.top-social a:hover {
    background: var(--gold) !important;
    color: #000 !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border-color: var(--gold);
}

/* =========================================
   Mega Menu Styles (Image + Links)
   ========================================= */
#mainNav ul li.mega-dropdown { position: relative; }
#mainNav ul li.mega-dropdown .mega-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: -100px; /* 親メニューに対して少し左にずらしてバランスを取る */
    width: 550px;
    background: #fff;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    padding: 15px;
    z-index: 1000;
}
#mainNav ul li.mega-dropdown:hover .mega-menu { display: block !important; }
#mainNav ul li.mega-dropdown .mega-menu-content { display: flex; gap: 20px; }
#mainNav ul li.mega-dropdown .mega-menu-img { width: 220px; height: 180px; border-radius: 8px; overflow: hidden; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
#mainNav ul li.mega-dropdown .mega-menu-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
#mainNav ul li.mega-dropdown:hover .mega-menu-img img { transform: scale(1.05); }
#mainNav ul li.mega-dropdown .mega-menu-links { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
#mainNav ul li.mega-dropdown .mega-menu-links a { 
    display: flex !important; 
    align-items: center; 
    gap: 12px; 
    padding: 12px 15px !important; 
    color: var(--text-dark) !important; 
    font-size: 0.95rem !important; 
    text-transform: none !important; 
    font-weight: 700 !important; 
    border-left: none !important; 
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.3s ease !important;
}
#mainNav ul li.mega-dropdown .mega-menu-links a:last-child { border-bottom: none !important; }
#mainNav ul li.mega-dropdown .mega-menu-links a:hover { background: #f8fafc; color: var(--primary) !important; padding-left: 20px !important; }

/* =========================================
   Responsive Media Queries (SEO/Mobile Optimized)
   ========================================= */
@media (max-width: 1100px) {
    .footer-grid, .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .header-container { 
        flex-direction: row !important; 
        justify-content: space-between !important; 
        align-items: center !important; 
        padding: 10px 20px;
        gap: 10px !important;
    }
    .logo-brand { gap: 10px !important; }
    .logo-img { height: 50px !important; }
    .logo-title { font-size: 1.35rem !important; }
    .logo-motto { font-size: 0.7rem !important; margin-top: 2px !important; }
    
    .section-padding { padding: 60px 0; }
    .stats-banner-wrapper { margin-top: -30px; }
    .stats-banner { 
        flex-direction: column; 
        gap: 25px; 
        padding: 30px 20px;
    }
    
    #mainNav ul li.mega-dropdown .mega-menu { position: static; width: 100%; box-shadow: none; border: none; padding: 0; }
    #mainNav ul li.mega-dropdown .mega-menu-content { flex-direction: column; gap: 10px; }
    #mainNav ul li.mega-dropdown .mega-menu-img { width: 100%; height: 150px; }
}

@media (max-width: 768px) {
    .footer-grid, .grid-4, .grid-3 { grid-template-columns: 1fr; }
    .logo-title { font-size: 1.15rem !important; }
    
    /* Show motto on mobile and keep it clean */
    .logo-motto { display: block !important; font-size: 0.65rem !important; margin-top: 2px !important; }
    
    /* Show top bar on mobile and stack it vertically to save space without clipping */
    .top-bar { display: block; padding: 8px 0; }
    .top-bar .container { flex-direction: column; gap: 8px; align-items: center; text-align: center; }
    .top-info { display: flex; flex-direction: column; gap: 6px; align-items: center; }
    .top-info a { margin-right: 0; }
    
    /* Ensure forms are fully responsive on small screens */
    form, .form-container {
        padding: 20px !important;
        box-shadow: 5px 5px 0 0 var(--accent), 0 5px 15px rgba(0,0,0,0.05) !important;
    }
}
