/* =========================================================================
   ヒーロー写真スライド（トップ／営農型ページ共通）
   2026-09-18 新設。既存の styles.css・css/agrivoltaics.css は変更せず、
   このファイルを後ろから読み込んで上書きする。
   - 見出し(h1)は固定。写真ごとに「小札」（種類名＋入口リンク）だけ切り替える
   - 色を重ねる演出（紫・緑〜青のグラデーション）は使わず、文字が読める最小限の暗さのみ
   ========================================================================= */

/* --- 土台 --- */
.hero-slider {
    position: relative;
    overflow: hidden;
    background: #14261c; /* 画像読込前のフォールバック色 */
}

/* トップの .hero は styles.css で背景画像が指定されているため打ち消す
   （スライド背景は .hero-slide-bg が持つ）。
   高さは「画面の高さ以上」にして、中身が増えても隠れないようにする（横向きのスマホ対策） */
.hero.hero-slider {
    background-image: none;
    height: auto;
    min-height: 100vh;
    padding: 120px 20px 104px;
    box-sizing: border-box;
}

/* 営農型ページの上部。styles.css / agrivoltaics.css の緑〜青グラデーションを打ち消す */
.agrivoltaics-hero.hero-slider {
    background: #14261c;
    background-image: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
}

/* --- 背景レイヤー（ゆっくり入れ替え） --- */
/* 写真は「パソコン用（横長）」と「スマホ用（縦長）」の2種類を持ち、
   --bg-d / --bg-m（webp優先）と --bg-jpg / --bg-jpg-m（jpgのみ）で受け取る。
   image-set に対応しない古いブラウザでも jpg が表示されるよう2行書く。 */
.hero-slider .hero-slide-bg {
    position: absolute;
    inset: 0;
    background-image: var(--bg-jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    opacity: 0;
    transition: opacity 1.1s ease;
    z-index: 0;
}

@media (max-width: 768px) {
    .hero-slider .hero-slide-bg {
        background-image: var(--bg-jpg-m, var(--bg-jpg));
    }
}

/* webp をまとめて指定できるブラウザだけ、軽い webp を使う。
   （変数の中身を理解できないブラウザは「背景なし」になってしまうため、条件の中だけで使う） */
@supports (background-image: image-set(url("a.webp") type("image/webp"))) {
    .hero-slider .hero-slide-bg {
        background-image: var(--bg-d);
    }

    @media (max-width: 768px) {
        .hero-slider .hero-slide-bg {
            background-image: var(--bg-m, var(--bg-d));
        }
    }
}

.hero-slider .hero-slide-bg.is-active {
    opacity: 1;
    z-index: 1;
}

/* 文字を読めるようにする最小限の暗さ（色は付けない）。写真より上に置く */
.hero-slider::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .10) 0%, rgba(0, 0, 0, .24) 28%, rgba(0, 0, 0, .28) 58%, rgba(0, 0, 0, .20) 100%);
    z-index: 2;
    pointer-events: none;
}

.hero-slider .hero-content,
.hero-slider .container {
    position: relative;
    z-index: 3;
}

/* 明るい写真の上でも説明文が読めるように、影を少し強める */
.hero-slider .hero-content p,
.hero-slider .hero-subtitle {
    text-shadow: 0 1px 5px rgba(0, 0, 0, .85);
}

.hero-slider .hero-content h1 {
    text-shadow: 0 2px 7px rgba(0, 0, 0, .8);
}

/* --- 写真ごとの小札（種類名＋入口） --- */
.hero-slider .hero-tags {
    position: relative;
    height: 56px;
    margin-top: 26px;
}

.hero-slider .hero-tag {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding: 13px 26px;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 50px;
    background: rgba(0, 0, 0, .34);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: .02em;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .6s ease, visibility .6s ease, background .25s ease, border-color .25s ease;
    min-height: 44px; /* 指で押せる高さ */
    box-sizing: border-box;
}

.hero-slider .hero-tag.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hero-slider .hero-tag:hover,
.hero-slider .hero-tag:focus-visible {
    background: rgba(255, 255, 255, .92);
    border-color: #ffffff;
    color: #14261c;
}

.hero-slider .hero-tag-arrow {
    font-size: .95em;
    line-height: 1;
}

/* --- 送り（矢印と点） --- */
.hero-slider .hero-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 28px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.hero-slider .hero-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .9);
    background: rgba(0, 0, 0, .42);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    color: #ffffff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.hero-slider .hero-arrow:hover,
.hero-slider .hero-arrow:focus-visible {
    background: rgba(255, 255, 255, .32);
}

.hero-slider .hero-dots {
    display: flex;
    gap: 10px;
}

.hero-slider .hero-dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .85);
    background: rgba(255, 255, 255, .45);
    box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.hero-slider .hero-dot.is-active {
    background: #ffffff;
    transform: scale(1.35);
}

/* --- 営農型ページの上部（既存の見出し・ボタンはそのまま使う） --- */
.agrivoltaics-hero.hero-slider .cta-buttons {
    position: relative;
    z-index: 3;
}

.agrivoltaics-hero.hero-slider .hero-tags {
    margin-top: 18px;
}

/* --- 画面が狭いとき --- */
@media (max-width: 768px) {
    .hero-slider .hero-tags {
        height: 52px;
        margin-top: 20px;
    }

    .hero-slider .hero-tag {
        padding: 12px 20px;
        font-size: .9rem;
    }

    .hero-slider .hero-controls {
        bottom: 18px;
        gap: 12px;
    }

    .hero-slider .hero-arrow {
        width: 36px;
        height: 36px;
        font-size: 1.15rem;
    }
}

@media (max-width: 400px) {
    .hero-slider .hero-tag {
        padding: 11px 16px;
        font-size: .84rem;
        gap: 8px;
    }
}

/* --- 動きを減らす設定のとき --- */
@media (prefers-reduced-motion: reduce) {
    .hero-slider .hero-slide-bg,
    .hero-slider .hero-tag,
    .hero-slider .hero-arrow,
    .hero-slider .hero-dot {
        transition: none !important;
    }
}

/* --- ページ内の飛び先（上のメニューに隠れないようにする） --- */
.material-card[id^="type-"] {
    scroll-margin-top: 124px;
}

/* --- 営農型ページは写真が明るいので、少し強めに暗くする --- */
.agrivoltaics-hero.hero-slider::before {
    background: linear-gradient(180deg, rgba(0, 0, 0, .12) 0%, rgba(0, 0, 0, .26) 30%, rgba(0, 0, 0, .30) 62%, rgba(0, 0, 0, .22) 100%);
}

.agrivoltaics-hero.hero-slider .hero-subtitle {
    font-weight: 400;
}

/* --- 営農型ページ: 枠だけのボタンが明るい写真の上で消えないように裏地を足す --- */
.agrivoltaics-hero.hero-slider .cta-btn.secondary {
    background: rgba(0, 0, 0, .3);
    backdrop-filter: blur(2px);
}

.agrivoltaics-hero.hero-slider .cta-btn.secondary:hover {
    background: rgba(255, 255, 255, .92);
}

/* --- 小札はボタンと形を変える（3段重ねのボタンに見えないように） --- */
.agrivoltaics-hero.hero-slider .hero-tags {
    margin-top: 34px;
}

.hero-slider .hero-tag {
    border-radius: 8px;
}

/* --- スマホで言葉の途中で折り返さない --- */
.hero-slider .nowrap {
    white-space: nowrap;
}
