/* =============================================================================
   FXおもしろラボ - Custom Styles
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Hero Section
   ----------------------------------------------------------------------------- */
.hero-section {
    text-align: center;
    padding: 3rem 1.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg,
            rgba(63, 81, 181, 0.08) 0%,
            rgba(3, 169, 244, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(63, 81, 181, 0.1);
}

.hero-section .xl {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

/* -----------------------------------------------------------------------------
   Article Meta
   ----------------------------------------------------------------------------- */
.article-meta {
    color: var(--md-default-fg-color--light);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

/* -----------------------------------------------------------------------------
   CTA Section
   ----------------------------------------------------------------------------- */
.cta-section {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    background: var(--md-code-bg-color);
    border-radius: 8px;
}

/* -----------------------------------------------------------------------------
   Article Footer
   ----------------------------------------------------------------------------- */
.article-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--md-default-fg-color--lightest);
}

/* -----------------------------------------------------------------------------
   Grid Cards Enhancement
   ----------------------------------------------------------------------------- */
.grid.cards>ul>li {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.grid.cards>ul>li:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Fallback for older browsers and aggressive nested targeting */
.md-typeset .grid.cards>ul>li img,
.md-typeset .grid.cards>ul>li a img,
.md-typeset .grid.cards>ul>li p img,
.md-typeset .grid.cards>ul>li span img {
    width: 100% !important;
    max-width: 100% !important;
    height: 150px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

/* -----------------------------------------------------------------------------
   Code Block Enhancements
   ----------------------------------------------------------------------------- */
.highlight code {
    font-size: 0.85rem;
    line-height: 1.6;
}

.highlight .filename {
    background: var(--md-code-bg-color);
    border-bottom: 1px solid var(--md-default-fg-color--lightest);
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
}

/* -----------------------------------------------------------------------------
   Table Enhancements
   ----------------------------------------------------------------------------- */
.md-typeset table:not([class]) {
    font-size: 0.9rem;
}

.md-typeset table:not([class]) th {
    background: var(--md-primary-fg-color);
    color: var(--md-primary-bg-color);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Dark Mode Adjustments
   ----------------------------------------------------------------------------- */
[data-md-color-scheme="slate"] .hero-section {
    background: linear-gradient(135deg,
            rgba(63, 81, 181, 0.15) 0%,
            rgba(3, 169, 244, 0.08) 100%);
    border-color: rgba(63, 81, 181, 0.2);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
    background: rgba(63, 81, 181, 0.7);
}

/* -----------------------------------------------------------------------------
   Lab-style Accents
   ----------------------------------------------------------------------------- */
.md-typeset .admonition.abstract,
.md-typeset details.abstract {
    border-color: #03a9f4;
}

.md-typeset .abstract>.admonition-title,
.md-typeset .abstract>summary {
    background-color: rgba(3, 169, 244, 0.1);
}

/* -----------------------------------------------------------------------------
   Animation
   ----------------------------------------------------------------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.md-content {
    animation: fadeIn 0.3s ease-out;
}

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */
@media screen and (max-width: 76.1875em) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-section .xl {
        font-size: 2.5rem;
    }
}

/* -----------------------------------------------------------------------------
   Mobile Table Scroll
   ----------------------------------------------------------------------------- */
@media screen and (max-width: 600px) {
    .md-typeset__scrollwrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .md-typeset table:not([class]) {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .md-typeset table:not([class]) th,
    .md-typeset table:not([class]) td {
        min-width: 100px;
        padding: 0.5rem 0.8rem;
    }
}

/* -----------------------------------------------------------------------------
   Pickup Card (Featured Article)
   ----------------------------------------------------------------------------- */
.pickup-card {
    background: linear-gradient(135deg,
            rgba(255, 152, 0, 0.1) 0%,
            rgba(255, 87, 34, 0.08) 100%);
    border: 2px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pickup-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 152, 0, 0.2);
}

.pickup-card .pickup-badge {
    display: inline-block;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.pickup-card h3 {
    margin: 0.5rem 0;
    font-size: 1.2rem;
}

.pickup-card p {
    margin: 0.5rem 0 1rem;
    color: var(--md-default-fg-color--light);
    font-size: 0.9rem;
}

[data-md-color-scheme="slate"] .pickup-card {
    background: linear-gradient(135deg,
            rgba(255, 152, 0, 0.15) 0%,
            rgba(255, 87, 34, 0.12) 100%);
    border-color: rgba(255, 152, 0, 0.4);
}

/* -----------------------------------------------------------------------------
   Skill Bar (プロフィールページ用)
   ----------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
   Skill Bar (プロフィールページ用) - CSS Grid Re-implementation
   ----------------------------------------------------------------------------- */
.skill-bar-container {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    /* Label, Bar, Comment */
    gap: 0.75rem 1rem;
    padding: 1rem;
    background: var(--md-code-bg-color);
    border-radius: 8px;
    align-items: center;
}

.skill-item {
    display: contents;
    /* 子要素を直接グリッドに参加させる */
}

.skill-label {
    /* min-width不要 (Gridで制御) */
    font-weight: 500;
    color: var(--md-default-fg-color);
}

.skill-bar-wrapper {
    /* flex-grow不要 */
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-bar {
    flex-grow: 1;
    height: 20px;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3f51b5, #2196f3);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.skill-percent {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    color: var(--md-default-fg-color);
}

.skill-comment {
    color: var(--md-default-fg-color--light);
    font-size: 0.85rem;
    white-space: nowrap;
    /* Gridにより自動的に右側の列に配置される */
}

/* ダークモード時のスキルバー */
[data-md-color-scheme="slate"] .skill-bar {
    background: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .skill-bar-fill {
    background: linear-gradient(90deg, #5c6bc0, #42a5f5);
}

/* モバイル対応 */
@media screen and (max-width: 600px) {
    .skill-bar-container {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        /* 間隔を少し広げる */
    }

    .skill-item {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    .skill-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .skill-bar-wrapper {
        width: 100%;
    }

    .skill-comment {
        display: block;
        /* モバイルでも一応表示（邪魔ならnone） */
        width: 100%;
        text-align: right;
        font-size: 0.8rem;
    }
}

/* -----------------------------------------------------------------------------
   Contact Form Styles (Formspree)
   ----------------------------------------------------------------------------- */
.contact-form {
    max-width: 600px;
    margin: 2rem 0;
    padding: 2rem;
    background: var(--md-code-bg-color);
    border-radius: 8px;
    border: 1px solid var(--md-default-fg-color--lightest);
}

.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--md-default-fg-color);
}

.contact-form .required {
    color: #e53935;
    margin-left: 0.25rem;
}

.contact-form .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--md-default-fg-color);
    background-color: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form .form-control:focus {
    outline: none;
    border-color: var(--md-primary-fg-color);
    box-shadow: 0 0 0 2px rgba(var(--md-primary-fg-color--rgb), 0.2);
}

.contact-form textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.contact-form .form-actions {
    margin-top: 2rem;
    text-align: right;
}

[data-md-color-scheme="slate"] .contact-form {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .contact-form .form-control {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .contact-form .form-control:focus {
    border-color: var(--md-primary-fg-color);
}