/**
 * Layout Block Styles
 */

.fg-layout {
    position: relative;
    overflow: hidden;
    background-color: #000;
}

/* 背景エリア */
.fg-layout__background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 単一画像背景 */
.fg-layout__bg-image {
    width: 100%;
    height: 100%;
    object-position: var(--bg-position, center center);
}

/* 動画背景 */
.fg-layout__bg-video {
    width: 100%;
    height: 100%;
    object-position: var(--bg-position, center center);
}

/* 背景サイズ設定 */
.fg-layout--bg-cover .fg-layout__bg-image,
.fg-layout--bg-cover .fg-layout__bg-video,
.fg-layout--bg-cover .fg-layout__slide img,
.fg-layout--bg-cover .fg-layout__slide video {
    object-fit: cover;
}

.fg-layout--bg-contain .fg-layout__bg-image,
.fg-layout--bg-contain .fg-layout__bg-video,
.fg-layout--bg-contain .fg-layout__slide img,
.fg-layout--bg-contain .fg-layout__slide video {
    object-fit: contain;
}

.fg-layout--bg-fill .fg-layout__bg-image,
.fg-layout--bg-fill .fg-layout__bg-video,
.fg-layout--bg-fill .fg-layout__slide img,
.fg-layout--bg-fill .fg-layout__slide video {
    object-fit: fill;
}

.fg-layout--bg-none .fg-layout__bg-image,
.fg-layout--bg-none .fg-layout__bg-video,
.fg-layout--bg-none .fg-layout__slide img,
.fg-layout--bg-none .fg-layout__slide video {
    object-fit: none;
}

/* スライダー */
.fg-layout__slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.fg-layout__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.fg-layout__slide.is-active {
    opacity: 1;
    z-index: 2;
}

/* アニメーション: フェード */
.fg-layout--transition-fade .fg-layout__slide {
    transition: opacity var(--transition-speed, 800ms) ease-in-out;
}

/* アニメーション: スライド（押し出し） */
.fg-layout--transition-slide .fg-layout__slide {
    transition: transform var(--transition-speed, 800ms) ease-in-out;
    transform: translateX(100%);
}

.fg-layout--transition-slide .fg-layout__slide.is-active {
    transform: translateX(0);
    z-index: 2;
}

.fg-layout--transition-slide .fg-layout__slide.is-leaving {
    transform: translateX(-100%);
    opacity: 1;
    z-index: 1;
}

/* アニメーション: ズーム */
.fg-layout--transition-zoom .fg-layout__slide {
    transform: scale(1.2);
    transition: transform var(--transition-speed, 800ms) ease-in-out, opacity var(--transition-speed, 800ms) ease-in-out;
}

.fg-layout--transition-zoom .fg-layout__slide.is-active {
    transform: scale(1);
}

/* ========================================
 * 背景エフェクト（GSAPで制御）
 * ======================================== */

/* 初期状態の設定のみ（アニメーションはGSAPで制御） */
.fg-layout--effect-kenburns .fg-layout__slide img,
.fg-layout--effect-kenburns .fg-layout__slide video,
.fg-layout--effect-floating .fg-layout__slide img,
.fg-layout--effect-floating .fg-layout__slide video {
    will-change: transform, object-position;
}

.fg-layout__slide img,
.fg-layout__slide video {
    width: 100%;
    height: 100%;
    object-position: var(--bg-position, center center);
}

/* オーバーレイ */
.fg-layout__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* コンテンツエリア（InnerBlocks） */
.fg-layout__content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

/* コンテンツエリア内の実際のコンテンツはクリック可能にする */
.fg-layout__content > * {
    pointer-events: auto;
}

/* ========================================
 * ナビゲーション - 基本スタイル
 * ======================================== */

/* ナビゲーションコンテナ */
.fg-layout__nav {
    position: absolute;
    z-index: 100;
    display: flex;
    transition: all 0.3s ease;
}

/* ========================================
 * ドット（横）- ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--dots-h {
    flex-direction: row;
    gap: 6px;
}

.fg-layout__nav--dots-h .fg-layout__nav-item {
    width: 6px;
    height: 6px;
    border-radius: 1px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.fg-layout__nav--dots-h .fg-layout__nav-item:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.fg-layout__nav--dots-h .fg-layout__nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    width: 16px;
}

/* ========================================
 * ドット（縦）- ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--dots-v {
    flex-direction: column;
    gap: 6px;
}

.fg-layout__nav--dots-v .fg-layout__nav-item {
    width: 6px;
    height: 6px;
    border-radius: 1px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.fg-layout__nav--dots-v .fg-layout__nav-item:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.fg-layout__nav--dots-v .fg-layout__nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    height: 16px;
}

/* ========================================
 * 数字（横）- ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--numbers-h {
    flex-direction: row;
    gap: 4px;
}

.fg-layout__nav--numbers-h .fg-layout__nav-item {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.fg-layout__nav--numbers-h .fg-layout__nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.8);
}

.fg-layout__nav--numbers-h .fg-layout__nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    color: #000;
}

/* ========================================
 * 数字（縦）- ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--numbers-v {
    flex-direction: column;
    gap: 4px;
}

.fg-layout__nav--numbers-v .fg-layout__nav-item {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.fg-layout__nav--numbers-v .fg-layout__nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.8);
}

.fg-layout__nav--numbers-v .fg-layout__nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    color: #000;
}

/* ========================================
 * 矢印 - ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--arrows {
    width: 100%;
    pointer-events: none;
}

.fg-layout__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
    z-index: 100;
}

.fg-layout__arrow:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
}

.fg-layout__arrow svg {
    width: 16px;
    height: 16px;
}

.fg-layout__arrow--prev {
    left: 20px;
}

.fg-layout__arrow--next {
    right: 20px;
}

/* ========================================
 * プログレスバー - ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--progress {
    width: 120px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
    overflow: hidden;
}

.fg-layout__progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    transition: width 0.3s ease;
    border-radius: 1px;
}

/* ========================================
 * 分数 - ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--fraction {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
}

/* ========================================
 * サムネイル - ミニマム・シャープ
 * ======================================== */
.fg-layout__nav--thumbnails {
    flex-direction: row;
    gap: 4px;
}

.fg-layout__nav--thumbnails .fg-layout__nav-item {
    width: 40px;
    height: 24px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0.5;
}

.fg-layout__nav--thumbnails .fg-layout__nav-item:hover {
    border-color: rgba(255, 255, 255, 0.6);
    opacity: 0.7;
}

.fg-layout__nav--thumbnails .fg-layout__nav-item.is-active {
    border-color: rgba(255, 255, 255, 0.9);
    opacity: 1;
    border-width: 2px;
}

/* パララックス有効時 - スクロール範囲確保のため背景を拡大（JavaScriptでscale適用） */
.fg-layout[data-parallax="true"] .fg-layout__background {
    will-change: transform;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .fg-layout__nav--top,
    .fg-layout__nav--bottom {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .fg-layout__nav--left,
    .fg-layout__nav--right {
        left: 10px;
        right: auto;
    }

    .fg-layout__arrow {
        width: 28px;
        height: 28px;
    }

    .fg-layout__arrow--prev {
        left: 10px;
    }

    .fg-layout__arrow--next {
        right: 10px;
    }

    .fg-layout__nav--thumbnails .fg-layout__nav-item {
        width: 32px;
        height: 20px;
    }
}

/* エディター内表示調整 */
.block-editor-block-list__block[data-type="forgeee/layout"] {
    min-height: 400px;
}

/* アラインメント */
.fg-layout.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.fg-layout.alignwide {
    width: var(--fg-wide-width, 1600px);
    max-width: var(--fg-wide-width, 1600px);
    margin-left: calc(50% - var(--fg-wide-width, 1600px) / 2);
    margin-right: calc(50% - var(--fg-wide-width, 1600px) / 2);
}

/* ========================================
 * グラデーション背景・単色背景
 * ======================================== */

/* グラデーション背景 */
.fg-layout__bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 単色背景 */
.fg-layout__bg-solid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ========================================
 * 幅モード
 * ======================================== */

/* 全幅（デフォルト） */
.fg-layout--width-full .fg-layout__content {
    max-width: 100%;
}

/* コンテンツ幅 */
.fg-layout--width-content .fg-layout__content {
    max-width: var(--fg-layout-content-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* カスタム幅 */
.fg-layout--width-custom .fg-layout__content {
    max-width: var(--fg-layout-max-width, 100%);
    width: var(--fg-layout-content-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ========================================
 * Divider（区切り線）
 * ======================================== */

/* Dividerコンテナ */
.fg-layout__divider {
    position: absolute;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    z-index: 4;
}

/* 上部Divider */
.fg-layout__divider--top {
    top: 0;
}

/* 下部Divider */
.fg-layout__divider--bottom {
    bottom: 0;
}

/* Divider SVG */
.fg-layout__divider-svg {
    width: 100%;
    height: 100%;
}

.fg-layout__divider-svg svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* 上下反転 */
.fg-layout__divider-svg.fg-layout__divider--flip {
    transform: scaleY(-1);
}

/* レスポンシブ: Divider高さ調整 */
@media (max-width: 768px) {
    .fg-layout__divider {
        height: 60px !important;
    }
}

/* ========================================
 * 再生時間バー - ミニマム・シャープ
 * ======================================== */

/* 再生時間バーコンテナ */
.fg-layout__timer {
    position: absolute;
    z-index: 100;
    display: flex;
}

/* 細いライン */
.fg-layout__timer--line {
    width: 80px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
    overflow: hidden;
}

.fg-layout__timer-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 1px;
}

/* 円形 */
.fg-layout__timer--circle {
    width: 32px;
    height: 32px;
}

.fg-layout__timer-circle {
    width: 32px;
    height: 32px;
    display: block;
    transform: rotate(-90deg);
}

.fg-layout__timer-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 2;
    stroke-linecap: round;
}

.fg-layout__timer-circle-progress {
    fill: none;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 88;
    stroke-dashoffset: 88;
    transition: stroke-dashoffset 0.1s linear;
}

/* 数字カウント */
.fg-layout__timer--number {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
    min-width: 32px;
    text-align: center;
}

/* ========================================
 * スクロールダウンマーク - ミニマム・シャープ
 * ======================================== */

/* スクロールダウンマークコンテナ */
.fg-layout__scroll-indicator {
    position: absolute;
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* テキスト付きスクロールインジケーター */
.fg-layout__scroll-indicator--with-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* テキストなしの場合、アイコンだけで配置 */
.fg-layout__scroll-indicator:not(.fg-layout__scroll-indicator--with-text) .fg-layout__scroll-icon {
    display: contents; /* 透明なコンテナとして扱う */
}

.fg-layout__scroll-text {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 1.5px;
}

.fg-layout__scroll-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 矢印スタイル（下向きの三角形） */
.fg-layout__scroll-indicator--arrow .fg-layout__scroll-icon {
    width: 24px;
    height: 24px;
    animation: fg-scroll-bounce 2s infinite;
}

.fg-layout__scroll-indicator--arrow svg {
    width: 100%;
    height: 100%;
    fill: rgba(255, 255, 255, 0.8);
}

/* シェブロンスタイル（V字型） */
.fg-layout__scroll-indicator--chevron .fg-layout__scroll-icon {
    width: 24px;
    height: 24px;
    animation: fg-scroll-bounce 2s infinite;
}

.fg-layout__scroll-indicator--chevron svg {
    width: 100%;
    height: 100%;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* マウススタイル */
.fg-layout__scroll-indicator--mouse .fg-layout__scroll-icon {
    width: 20px;
    height: 32px;
}

.fg-layout__scroll-mouse {
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    position: relative;
}

.fg-layout__scroll-mouse::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 1px;
    animation: fg-scroll-wheel 2s infinite;
}

/* ラインスタイル */
.fg-layout__scroll-indicator--text .fg-layout__scroll-icon {
    width: 2px;
    height: 16px;
}

.fg-layout__scroll-line {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 1px;
    animation: fg-scroll-bounce 2s infinite;
}

/* ドット3つスタイル */
.fg-layout__scroll-indicator--dots .fg-layout__scroll-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fg-scroll-bounce 2s infinite;
}

.fg-layout__scroll-indicator--dots .fg-layout__scroll-icon span {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

/* アニメーション */
@keyframes fg-scroll-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(8px);
    }
}

@keyframes fg-scroll-wheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

/* ホバー効果 */
.fg-layout__scroll-indicator:hover {
    opacity: 0.7;
}
