/* =============================================================================
   FXおもしろラボ - Custom Styles
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

/* -----------------------------------------------------------------------------
   Color System - Override Material theme defaults
   Maximum specificity to beat Material's built-in [data-md-color-*] selectors.
   ----------------------------------------------------------------------------- */

/* --- Light mode (default scheme) --- */
:root,
[data-md-color-scheme="default"] {
    --md-primary-fg-color: #1C2541 !important;
    --md-primary-fg-color--light: #33658A !important;
    --md-primary-fg-color--dark: #0B132B !important;
    --md-accent-fg-color: #F26419 !important;
    --md-accent-fg-color--transparent: rgba(242, 100, 25, 0.1) !important;
}

/* --- Dark mode (slate scheme) --- */
[data-md-color-scheme="slate"] {
    --md-primary-fg-color: #0B132B !important;
    --md-primary-fg-color--light: #1C2541 !important;
    --md-primary-fg-color--dark: #050A18 !important;
    --md-accent-fg-color: #F26419 !important;
    --md-accent-fg-color--transparent: rgba(242, 100, 25, 0.1) !important;
    --md-typeset-a-color: #86BBD8 !important;
}

/* -----------------------------------------------------------------------------
   Header / Navbar / Tabs — Force navy colors over Material defaults
   Using high-specificity selectors to override Material theme internals.
   ----------------------------------------------------------------------------- */

/* Header bar — dark navy */
.md-header,
[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="default"] .md-header,
[data-md-color-primary] .md-header,
[data-md-color-primary="black"] .md-header {
    background-color: #0B132B !important;
}

/* Tabs bar — slightly lighter navy */
.md-tabs,
[data-md-color-scheme="slate"] .md-tabs,
[data-md-color-scheme="default"] .md-tabs,
[data-md-color-primary] .md-tabs,
[data-md-color-primary="black"] .md-tabs {
    background-color: #1C2541 !important;
}

.md-header__button,
.md-header-nav__button {
    color: #ffffff !important;
}

/* Nav link active/hover states — orange accent */
.md-tabs__link--active,
.md-tabs__link:hover {
    color: #F6AA1C !important;
}

/* Search bar styling */
.md-search__input {
    background-color: rgba(134, 187, 216, 0.12) !important;
}

/* Primary button — force orange everywhere */
.md-typeset .md-button--primary,
[data-md-color-scheme] .md-typeset .md-button--primary {
    background-color: #F26419 !important;
    border-color: #F26419 !important;
    color: #ffffff !important;
}

.md-typeset .md-button--primary:hover,
[data-md-color-scheme] .md-typeset .md-button--primary:hover {
    background-color: #F6AA1C !important;
    border-color: #F6AA1C !important;
}

/* Secondary button styling */
.md-typeset .md-button:not(.md-button--primary) {
    border-color: #33658A !important;
    color: var(--md-default-fg-color) !important;
}

.md-typeset .md-button:not(.md-button--primary):hover {
    border-color: #F6AA1C !important;
    color: #F6AA1C !important;
}

/* Sidebar / TOC active link */
.md-nav__link--active,
[data-md-color-scheme] .md-nav__link--active {
    color: #F26419 !important;
}

/* Scrollbar & progress indicator — override indigo accent in header */
.md-header[data-md-state="shadow"] {
    box-shadow: 0 0 0.2rem rgba(0,0,0,.1), 0 0.2rem 0.4rem rgba(0,0,0,.2) !important;
}

/* -----------------------------------------------------------------------------
   Typography
   ----------------------------------------------------------------------------- */
h1, h2, h3, .md-typeset h1, .md-typeset h2, .md-typeset h3 {
    font-family: 'DotGothic16', monospace;
    letter-spacing: 0.05em;
}

/* -----------------------------------------------------------------------------
   Hero Section
   ----------------------------------------------------------------------------- */
.hero-section {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg,
            rgba(11, 19, 43, 0.8) 0%,
            rgba(28, 37, 65, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(134, 187, 216, 0.3);
    color: #ffffff;
}

.hero-image {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 2px solid rgba(246, 170, 28, 0.4);
}

.hero-content {
    margin-top: 1rem;
}

.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: #1C2541;
    color: #ffffff;
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Dark Mode Adjustments
   ----------------------------------------------------------------------------- */
[data-md-color-scheme="slate"] .hero-section {
    background: linear-gradient(135deg,
            rgba(11, 19, 43, 0.9) 0%,
            rgba(28, 37, 65, 0.95) 100%);
    border-color: rgba(134, 187, 216, 0.4);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
    background: rgba(28, 37, 65, 0.9);
}

/* Dark mode: link color for readability on dark backgrounds */
[data-md-color-scheme="slate"] .md-typeset a {
    color: #86BBD8;
}

[data-md-color-scheme="slate"] .md-typeset a:hover {
    color: #F6AA1C;
}

/* Hero section button visibility */
.hero-section .md-button {
    border-color: rgba(246, 170, 28, 0.6);
    color: #ffffff;
}

.hero-section .md-button--primary {
    background-color: #F26419;
    border-color: #F26419;
    color: #ffffff;
}

.hero-section .md-button--primary:hover {
    background-color: #F6AA1C;
    border-color: #F6AA1C;
}

.hero-section .md-button:hover {
    border-color: #F6AA1C;
    color: #F6AA1C;
}

/* -----------------------------------------------------------------------------
   Lab-style Accents
   ----------------------------------------------------------------------------- */
.md-typeset .admonition.abstract,
.md-typeset details.abstract {
    border-color: #86BBD8;
}

.md-typeset .abstract>.admonition-title,
.md-typeset .abstract>summary {
    background-color: rgba(134, 187, 216, 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(242, 100, 25, 0.1) 0%,
            rgba(246, 170, 28, 0.08) 100%);
    border: 2px solid rgba(242, 100, 25, 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(242, 100, 25, 0.2);
}

.pickup-card .pickup-badge {
    display: inline-block;
    background: linear-gradient(90deg, #F26419, #F6AA1C);
    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(242, 100, 25, 0.15) 0%,
            rgba(246, 170, 28, 0.12) 100%);
    border-color: rgba(242, 100, 25, 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, #F26419, #F6AA1C);
    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, #F26419, #F6AA1C);
}

/* モバイル対応 */
@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);
}

/* -----------------------------------------------------------------------------
   MT5 Style Chart Container (Weekly Reports)
   ----------------------------------------------------------------------------- */
.mt5-chart-container {
    position: relative;
    width: 100%;
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

.mt5-chart-container canvas {
    max-height: 400px;
}

[data-md-color-scheme="slate"] .mt5-chart-container {
    background-color: #121212;
    border-color: #333333;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

/* -----------------------------------------------------------------------------
   Promo Highlight Box (トップページ用 — Phase 1 ライン D)
   ----------------------------------------------------------------------------- */
.promo-highlight {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.promo-highlight-card {
    position: relative;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.promo-highlight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.promo-highlight-card--course {
    background: linear-gradient(135deg,
            rgba(134, 187, 216, 0.08) 0%,
            rgba(51, 101, 138, 0.05) 100%);
    border-color: rgba(134, 187, 216, 0.3);
}

.promo-highlight-card--discord {
    background: linear-gradient(135deg,
            rgba(246, 170, 28, 0.08) 0%,
            rgba(242, 100, 25, 0.05) 100%);
    border-color: rgba(246, 170, 28, 0.3);
}

.promo-highlight-card .promo-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: white;
    margin-bottom: 0.5rem;
}

.promo-highlight-card--course .promo-badge {
    background: linear-gradient(90deg, #33658A, #86BBD8);
}

.promo-highlight-card--discord .promo-badge {
    background: linear-gradient(90deg, #F26419, #F6AA1C);
}

.promo-highlight-card h3 {
    margin: 0.5rem 0 0.3rem;
    font-size: 1.1rem;
}

.promo-highlight-card p {
    margin: 0.3rem 0 1rem;
    color: var(--md-default-fg-color--light);
    font-size: 0.88rem;
    line-height: 1.5;
}

[data-md-color-scheme="slate"] .promo-highlight-card--course {
    background: linear-gradient(135deg,
            rgba(134, 187, 216, 0.15) 0%,
            rgba(51, 101, 138, 0.08) 100%);
    border-color: rgba(134, 187, 216, 0.4);
}

[data-md-color-scheme="slate"] .promo-highlight-card--discord {
    background: linear-gradient(135deg,
            rgba(246, 170, 28, 0.15) 0%,
            rgba(242, 100, 25, 0.08) 100%);
    border-color: rgba(246, 170, 28, 0.4);
}

@media screen and (max-width: 600px) {
    .promo-highlight {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* -----------------------------------------------------------------------------
   Promo Footer Banner (全記事フッター用 — Phase 1 ライン D)
   ----------------------------------------------------------------------------- */
.promo-footer-banner {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 10px;
    background: linear-gradient(135deg,
            rgba(11, 19, 43, 0.06) 0%,
            rgba(134, 187, 216, 0.04) 100%);
    border: 1px solid rgba(134, 187, 216, 0.15);
    text-align: center;
}

.promo-footer-banner__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--md-default-fg-color);
}

.promo-footer-banner__desc {
    font-size: 0.85rem;
    color: var(--md-default-fg-color--light);
    margin: 0 0 1rem;
    line-height: 1.5;
}

.promo-footer-banner__links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

[data-md-color-scheme="slate"] .promo-footer-banner {
    background: linear-gradient(135deg,
            rgba(11, 19, 43, 0.12) 0%,
            rgba(134, 187, 216, 0.08) 100%);
    border-color: rgba(134, 187, 216, 0.25);
}

/* -----------------------------------------------------------------------------
   Mermaid diagram color overrides for dark mode
   ----------------------------------------------------------------------------- */
[data-md-color-scheme="slate"] .mermaid .node rect {
    stroke: #F6AA1C !important;
}