/*
 * MDUC Website Theme
 * Based on design-specification.md
 */

/* ==== Color Palette & Theme Variables ==== */
:root {
    /* Main Palette (Tohoku University Hospital Official) */
    --primary-orange: #F39800;
    --deep-orange: #D97C00;
    --pale-orange: #FFF4E5;
    --ui-orange: #FF9900;
    --text-gray: #333333;
    --muted-gray: #666666;
    --light-gray: #CCCCCC;
    --super-light-gray: #F5F5F5;
    --footer-gray: #E6E6E6;
    --accent-blue: #0071BC;
    --accent-blue-hover: #005B99;
    --red-alert: #E60012;
    --white: #FFFFFF;
    --black: #000000;

    /* Theme Variable Mapping */
    --highlight: var(--primary-orange);
    --highlight-contrast: var(--white);
    --highlight-inverse: var(--deep-orange);
    --sticky-menu-text-color: var(--primary-orange);
    --section-light-text-color: var(--text-gray);
    --section-light-bg-color: var(--white);
    --section-dark-bg-color: var(--super-light-gray);
}

/* ==== Base & Typography ==== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", "メイリオ", Meiryo, "游ゴシック", "Yu Gothic", "MS PGothic", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-gray);
    font-weight: 400;
    letter-spacing: 0.05em;
    background-color: var(--white);
    margin: 0;
    padding: 0;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: 0.02em;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--primary-orange);
}

h2 {
    font-size: 2rem;
    line-height: 1.3;
    margin-bottom: 1.3rem;
    color: var(--primary-orange);
}

h3 {
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 1.2rem;
    color: var(--text-gray);
}

h4 { font-size: 1.25rem; color: var(--text-gray); }
h5 { font-size: 1.125rem; color: var(--muted-gray); }
h6 { font-size: 1rem; color: var(--muted-gray); }

/* ==== Layout ==== */
main#main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    margin-left: 220px; /* Add space for expanded floating menu */
    background-color: transparent;
    position: relative;
    z-index: 1;
}

.post-holder {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
    border: 1px solid #E0E0E0;
    transition: background-color 0.8s ease-in-out, transform 0.4s ease-out;
}

.post-holder.active-section {
    /* 背景色変更の例 - 必要に応じて調整 */
    background-color: color-mix(in srgb, var(--section-light-bg-color) calc(100% - (var(--bg-intensity, 0) * 100%)), var(--pale-orange));
}

.post-holder.dark {
    background-color: var(--white);
}

.section-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--light-gray), transparent);
    margin: 2rem 0;
}

/* Header removed - replaced with hero-eyecatch section */

/* Footer */
.site-footer {
    background-color: var(--footer-gray);
    color: var(--muted-gray);
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9em;
    position: relative !important;
    z-index: 9999 !important;
}

.site-footer a {
    color: var(--accent-blue);
}

.site-footer a:hover {
    color: var(--accent-blue-hover);
}

/* ==== Components ==== */

/* Buttons */
.btn-primary, .btn-secondary {
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-orange);
    color: var(--white);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    border: 2px solid var(--primary-orange);
}

.btn-primary:hover {
    background-color: var(--deep-orange);
    border-color: var(--deep-orange);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(243, 152, 0, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-orange);
    border: 2px solid var(--primary-orange);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
}

.btn-secondary:hover {
    background-color: var(--pale-orange);
    border-color: var(--primary-orange);
}

.navigation-buttons {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Cards */
.card {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card.info { border-left: 4px solid var(--primary-orange); }
.card.important { border-left: 4px solid var(--primary-orange); background-color: var(--white); }
.card.alert { border-left: 4px solid var(--red-alert); background-color: var(--white); }

.card-title {
    margin-top: 0;
    color: var(--primary-orange);
}

/* Fixed Navigation */
.fixed-nav {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    width: 200px;
    float: left;
    margin-left: -240px; /* Adjust based on main content padding and its own width */
    z-index: 999;
}

.fn-item {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-gray);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.fn-item:hover, .fn-item.active {
    color: var(--primary-orange);
    background-color: var(--pale-orange);
    border-left: 3px solid var(--primary-orange);
}

/* MDUC Mascot */
.mduc-floating-mascot {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    animation: float 6s ease-in-out infinite;
}

.mduc-floating-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

@keyframes float {
    0% { transform: translateY(-10px); }
    50% { transform: translateY(10px); }
    100% { transform: translateY(-10px); }
}

/* FAQ Items */
.faq-item {
    background-color: var(--white);
    padding: 1em;
    margin-bottom: 1em;
    border-radius: 8px;
    border-left: 3px solid var(--ui-orange);
}

.faq-item summary {
    font-weight: bold;
    cursor: pointer;
    color: var(--primary-orange);
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 2rem auto 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--muted-gray);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8em;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.contact-form .btn-primary {
    width: 100%;
    padding: 1em 3em;
    font-size: 16px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

thead {
    background-color: var(--pale-orange);
}

th, td {
    border: 1px solid var(--light-gray);
    padding: 0.8rem;
    text-align: left;
}

/* External Link */
a.external-link:after {
    content: ' \f35d';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--deep-orange);
}

/* ==== Accessibility ==== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: var(--primary-orange);
    color: var(--white);
    padding: 1rem;
    z-index: 9999;
    transition: top 0.3s ease;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

:focus-visible {
    outline: 3px solid var(--primary-orange);
    outline-offset: 2px;
}

/* ==== Responsive Design ==== */
@media (max-width: 1280px) {
    .fixed-nav {
        display: none; /* Hide floating nav on smaller screens for simplicity */
    }
}

@media (max-width: 768px) {
    body { font-size: 15px; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }

    main#main-content {
        padding: 1rem;
        margin-left: 0; /* Remove left margin on mobile */
    }

    .post-holder {
        padding: 1.5rem;
    }

    .mduc-floating-mascot {
        left: 10px;
    }
    .mduc-floating-image {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 375px) {
    body { font-size: 16px; }
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }

    .navigation-buttons {
        flex-direction: column;
    }

    .mduc-floating-mascot {
        display: none; /* Hide on very small screens */
    }
    
    /* 相談例セクション モバイル調整 */
    .consultation-item {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .consultation-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
        margin-bottom: 1em;
    }
    
    /* 使命セクション モバイル調整 */
    .mission-grid {
        grid-template-columns: 1fr;
        gap: 1em;
    }
    
    .mission-card {
        padding: 1.5em;
    }
    
    .mission-icon {
        font-size: 2.5em;
    }
    
    /* フッター調整 */
    .footer-mduc-section {
        padding: 60px 0 30px 0;
    }
    
    .footer-mduc-image {
        width: 100px;
        height: 100px;
    }
    
    .footer-thanks {
        font-size: 1.1em;
    }
}

/* お知らせセクション */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin: 2em 0;
}

.news-item {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #F39800;
}

.news-date {
    color: #666666;
    font-size: 12px;
    background: #F5F5F5;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

.news-category {
    background: #F39800;
    color: #FFFFFF;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 8px;
    margin-left: 8px;
}

.news-title {
    font-weight: 600;
    color: #333333;
    font-size: 16px;
    margin-bottom: 8px;
}

.news-excerpt {
    color: #666666;
    font-size: 14px;
    line-height: 1.4;
}

.news-list-button {
    background: #F39800;
    color: #FFFFFF;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
}

.news-list-button:hover {
    background: #D97C00;
    transform: translateY(-1px);
}

/* 相談例セクション */
.consultation-list {
    display: flex;
    flex-direction: column;
    gap: 1em;
    overflow: hidden; /* 小カードロード前のスクロールを防ぐ */
}

.consultation-item {
    display: flex;
    align-items: center;
    gap: 1em;
    background: rgba(255, 255, 255, 0.9);
    border-left: 4px solid #F39800;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.6s ease-out;
}

.consultation-item.visible {
    transform: translateY(0);
    opacity: 1;
}

.consultation-item.visible:hover {
    transform: translate(5px, 0);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: rgba(255, 248, 240, 0.95);
}

.consultation-icon {
    font-size: 2em;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(243, 152, 0, 0.1);
    border-radius: 50%;
}

.consultation-content h4 {
    margin: 0 0 0.5em 0;
    color: #333;
    font-size: 1.1em;
}

.consultation-content p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

/* 使命セクション */
.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2em;
    margin-top: 2em;
}

.mission-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 2em;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #E0E0E0;
}

.mission-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: #F39800;
}

.mission-icon {
    font-size: 3em;
    margin-bottom: 1em;
    display: block;
}

.mission-card h3 {
    color: #F39800;
    margin: 0 0 1em 0;
    font-size: 1.3em;
}

.mission-card p {
    color: #666;
    margin: 0;
    line-height: 1.6;
}


.footer-mduc-mascot {
    position: absolute;
    bottom: 10px;
    left: -100px;
    z-index: 9999;
    animation: bounce-across 20s linear infinite;
}

.footer-mduc-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 9999;
}

@keyframes bounce-across {
    0% {
        left: -100px;
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    4% {
        bottom: 80px;
        animation-timing-function: ease-in;
    }
    8% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    12% {
        bottom: 65px;
        animation-timing-function: ease-in;
    }
    16% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    20% {
        bottom: 50px;
        animation-timing-function: ease-in;
    }
    24% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    28% {
        bottom: 40px;
        animation-timing-function: ease-in;
    }
    32% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    36% {
        bottom: 85px;
        animation-timing-function: ease-in;
    }
    40% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    44% {
        bottom: 70px;
        animation-timing-function: ease-in;
    }
    48% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    52% {
        bottom: 55px;
        animation-timing-function: ease-in;
    }
    56% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    60% {
        bottom: 45px;
        animation-timing-function: ease-in;
    }
    64% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    68% {
        bottom: 75px;
        animation-timing-function: ease-in;
    }
    72% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    76% {
        bottom: 60px;
        animation-timing-function: ease-in;
    }
    80% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    84% {
        bottom: 50px;
        animation-timing-function: ease-in;
    }
    88% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    92% {
        bottom: 40px;
        animation-timing-function: ease-in;
    }
    96% {
        bottom: 10px;
        animation-timing-function: ease-out;
    }
    100% {
        left: 100%;
        bottom: 10px;
    }
}

@keyframes flip-image {
    0% { transform: scaleX(1); }
    50% { transform: scaleX(-1); }
    100% { transform: scaleX(1); }
}

/* フッターMDUCちゃんセクション */
.footer-mduc-section {
    background: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
    padding: 30px 0 20px 0;
    text-align: center;
    position: relative !important;
    z-index: 9999 !important;
    min-height: 80px;
}

.footer-message {
    margin-top: -30px;
    font-family: 'Noto Sans JP', sans-serif;
}

.footer-thanks {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 0.5em;
    font-weight: 500;
}

.footer-center-name {
    font-size: 1em;
    color: #666;
    margin-bottom: 0;
    font-weight: 400;
}

/* Step Items for Internal Page */
.step-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5em;
    margin-bottom: 2em;
    padding: 1.5em;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border-left: 4px solid var(--primary-orange);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.step-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--primary-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1em;
    margin-top: 0.2em;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin: 0 0 0.8em 0;
    color: var(--text-gray);
    font-size: 1.2em;
    font-weight: 600;
}

.step-content p {
    margin: 0 0 1em 0;
    line-height: 1.7;
    color: var(--muted-gray);
}

.step-content ul, .step-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.step-content li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

/* Download Items for Internal Page */
.download-list {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    margin-top: 1em;
}

.download-item {
    background: rgba(255, 248, 240, 0.8);
    border: 1px solid rgba(243, 152, 0, 0.2);
    border-radius: 8px;
    padding: 1.5em;
    transition: all 0.3s ease;
}

.download-item:hover {
    background: rgba(255, 248, 240, 1);
    border-color: var(--primary-orange);
    box-shadow: 0 2px 8px rgba(243, 152, 0, 0.15);
}

.download-item h4 {
    margin: 0 0 1em 0;
    color: var(--text-gray);
    font-size: 1.1em;
}

.download-buttons {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
}

.download-buttons .btn-primary,
.download-buttons .btn-secondary {
    padding: 0.7em 1.5em;
    font-size: 0.9em;
    min-width: auto;
}

/* Details/Summary styling for Internal Page */
details {
    margin: 1em 0;
    border: 1px solid rgba(243, 152, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

summary {
    background: rgba(255, 248, 240, 0.5);
    padding: 1em;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-gray);
    user-select: none;
    transition: background-color 0.2s ease;
}

summary:hover {
    background: rgba(255, 248, 240, 0.8);
}

details[open] summary {
    background: rgba(243, 152, 0, 0.1);
    border-bottom: 1px solid rgba(243, 152, 0, 0.2);
}

details ul {
    margin: 1em;
    padding-left: 1.5em;
}

details li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mduc-floating-mascot,
    .btn-primary:hover,
    .step-item,
    .download-item {
        animation: none;
        transform: none;
        transition: none;
    }
}
