/* ===================================
   Hero Section - Door to Mexico Scroll Effect
   ================================== */

/* Scroll Container - Creates space for scroll-driven animation */
.hero-scroll-container {
    position: relative;
    height: 120vh;
    width: 100%;
}

.hero {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Account for fixed nav at top AND reserve bar at bottom */
    padding-top: var(--nav-height);
    padding-bottom: var(--reserve-bar-height);
    box-sizing: border-box;
    background: var(--color-sand-light);
    overflow: hidden;
}

/* Drawing Area Component - Wrapper for content */
.hero-drawing-area {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Reduce vertical drawing area by adding padding */
    padding-block: 1vh;
    box-sizing: border-box;
    /* Optional: Add border or background here to visualize the area */
    /* border: 1px dashed rgba(0,0,0,0.1); */
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--color-sand-light);
    z-index: 2;
    transition: opacity 0.3s ease;
}

/* Mexico Street Background - Reveals based on scroll progress */
.hero-mexico-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.3s ease, transform 0.5s ease;
}

.hero-mexico-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.4) contrast(1.05);
}

/* When scrolled, hero fades out and Mexico street reveals */
.hero.scrolled .hero-bg {
    opacity: 0;
}

.hero.scrolled .hero-mexico-bg {
    opacity: 1;
    transform: scale(1);
}

.hero.scrolled .hero-content {
    opacity: 0;
    transform: scale(1.05);
}

.hero-content {
    /* position: relative; */
    /* z-index: 3;  <-- Handled by parent wrapper now */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Use 'center' to vertically center content in free space, or 'flex-start' if scrolling is preferred */
    justify-content: center;
    text-align: center;
    padding: var(--space-md);
    max-width: 900px;
    width: 100%;
    /* Use gap for consistent spacing between image and text group */
    gap: 3rem;
    /* Increased gap to separate image from text group clearly */

    /* Variable padding-top proportional to header height */
    padding-top: calc(var(--nav-height) * 0.1);
    /* Variable padding-bottom proportional to reserve bar height */
    padding-bottom: max(var(--space-md), calc(var(--reserve-bar-height) * 0.5));
    overflow: hidden;
    box-sizing: border-box;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-portrait {
    width: auto;
    max-width: 80vw;
    /* Take remaining space after text, but can shrink */
    flex: 1 1 auto;
    min-height: 0;
    max-height: 45svh;
    /* Slightly reduced to give more space to text */
    /* Margin replaced by gap in parent */
    margin-bottom: 0;
    animation: fadeInUp 1s ease 0.3s both;
}

.hero-portrait img {
    width: auto;
    height: auto;
    max-width: 100%;
    /* Max height for desktop */
    max-height: 50svh;
    object-fit: contain;
    transition: transform 0.1s linear;
    transform-origin: center center;
}

/* New Text Group Wrapper */
.hero-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Tight spacing between tagline and title */
    flex-shrink: 0;
    /* Prevent text from shrinking too much */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.hero-tagline-jp {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    color: var(--color-gray);
    margin-bottom: 0;
    /* Handled by gap in hero-text-group */
    font-weight: 500;
    animation: fadeIn 1s ease 0.6s both;
}

.hero-title {
    font-family: var(--font-accent);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1.1;
    margin: 0;
    animation: fadeIn 1s ease 0.9s both;
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 25% !important;
    /* 強制的に適用 */
    right: 2% !important;
    /* 5% -> 2% に変更して少し右へ */
    left: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    z-index: 1000 !important;
    /* 最前面に */
    animation: fadeIn 1s ease 1.2s both;
    pointer-events: none;
}

.scroll-text {
    display: none;
    /* テキストは非表示 */
    font-family: var(--font-heading);
    font-size: 2rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-gray);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.scroll-line {
    /* ユーザー指定のSkew矢印デザイン（赤・グレーグラデーション） */
    position: relative;
    width: 20px;
    height: 20px;
    /* 小さくして疑似要素で線を引く */

    /* アニメーション設定 */
    /* poyoyon: アニメーション名 */
    /* 2s: 1回のアニメーションにかかる時間 */
    /* infinite: 無限に繰り返す */
    animation: poyoyon 3s infinite;
}

/* 矢印本体（Skewとグラデーション） */
.scroll-line::after {
    content: '';
    position: absolute;
    top: 0 !important;
    left: 0;
    width: 100px;
    /* 矢印の長さを60px -> 100pxに変更 */
    height: 15px;
    /* 矢印の幅 */

    /* 線を引く */
    border-bottom: 2px solid;
    border-right: 2px solid;

    /* 赤と灰色のグラデーション */
    border-image: linear-gradient(to bottom right, var(--color-gray-light) 0%, var(--color-accent) 100%) 1;

    /* 形を作る変形 */
    transform: rotate(90deg) skew(45deg);
    transform-origin: top left;
}

/* 前のスタイルをリセット */
.scroll-line::before {
    display: none;
}

/* アニメーション定義：上から落ちてきて弾む動き */
@keyframes poyoyon {
    0% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(40px);
    }
}

/* Mobile Hero Adjustments */
@media (max-width: 768px) {
    .hero-content {
        gap: 1.5rem;
        /* Smaller gap on mobile */
    }

    .hero-portrait {
        width: auto;
        /* Allow image to be larger on mobile */
        max-width: 85vw;
        /* Allow shrinking */
        flex: 0 1 auto;
        min-height: 0;
    }

    .hero-portrait img {
        /* Set max-height but allow shrinking */
        max-height: 40svh;
        min-height: 0;
        /* Important: allow shrinking to 0 if needed */
        object-fit: contain;
    }

    .hero-scroll-indicator {
        right: 0rem !important;
        bottom: 15rem !important;
        /* モバイルでは下に配置 */
    }

    .hero-title {
        font-size: 2.25rem;
        /* Ensure title is large enough on mobile */
    }

    .hero-tagline-jp {
        font-size: 1.1rem;
        /* Slightly adjust tagline if needed, currently 1.1rem base */
    }
}