/*
 * 天気予報ディレクトリ（/weather/forecast/ トップのメインビジュアル）CSS
 * 2026-07-29 新設。デザインはサーフポイントトップ(assets/css/surf-directory.css)のヒーローに準拠。
 * クラス名は weather- 系に変更し、.weather-directory ラッパーの内側にだけ効くようスコープ済み。
 * ヒーロー配下のみを対象とし、既存の天気図タブ・エリア一覧には一切影響しない。
 */

.weather-directory,
.weather-directory *,
.weather-directory *::before,
.weather-directory *::after {
    box-sizing: border-box;
}

.weather-directory {
    --wd-navy: #082f53;
    --wd-blue: #157bb4;
    --wd-ink: #102e4b;
    --wd-muted: #617488;
    --wd-border: #dbe6ee;
    --wd-radius: 14px;
    --wd-shadow: 0 10px 30px rgba(6, 43, 75, 0.09);
    color: var(--wd-ink);
    font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    /* #page(max-width:1100px)内から画面幅いっぱいに広げるブレイクアウト */
    position: relative;
    left: 50%;
    width: 100vw;
    /* 上はパンくずの余白を打ち消してヒーローを直結、下はコンテンツ枠と直結 */
    margin: -25px 0 0 -50vw;
}

.weather-directory h1,
.weather-directory p {
    margin: 0;
    padding: 0;
}

.weather-directory button,
.weather-directory input {
    color: inherit;
    font: inherit;
}

.weather-directory a {
    color: inherit;
    text-decoration: none;
}

.weather-directory a:focus-visible,
.weather-directory button:focus-visible,
.weather-directory input:focus-visible {
    outline: 3px solid #62c8ff;
    outline-offset: 3px;
}

.weather-container {
    width: calc(100% - 64px);
    max-width: 1220px;
    margin-inline: auto;
}

/* ===== ヒーロー ===== */
.weather-directory-hero {
    position: relative;
    overflow-x: clip;
    overflow-y: visible; /* 検索サジェストを下にはみ出して表示させる */
    background:
        radial-gradient(circle at 82% 10%, rgba(84, 181, 224, 0.26) 0, transparent 33%),
        linear-gradient(135deg, #edf7fc 0%, #f9fcfd 58%, #eaf5fa 100%);
}

.weather-directory-hero__decor {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.weather-directory-hero__decor::after {
    position: absolute;
    right: -7%;
    bottom: -145px;
    width: 56%;
    height: 280px;
    background: rgba(63, 169, 209, 0.11);
    border-radius: 50% 50% 0 0;
    content: "";
    transform: rotate(-7deg);
}

.weather-directory-hero__watermark {
    position: absolute;
    right: 3%;
    bottom: -31px;
    color: rgba(13, 91, 137, 0.045);
    font-family: Arial, sans-serif;
    font-size: clamp(70px, 12vw, 175px);
    font-weight: 900;
    letter-spacing: -0.07em;
    line-height: 1;
    white-space: nowrap;
}

.weather-directory-hero__content {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 400px;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.82fr);
    align-items: center;
    gap: 70px;
    padding-block: 60px;
}

.weather-directory-hero h1 {
    margin: 0;
    font-size: clamp(35px, 4.1vw, 47px);
    letter-spacing: 0.03em;
    line-height: 1.35;
}

.weather-directory-hero__copy > p:not(.weather-eyebrow) {
    margin: 16px 0 19px;
    color: #526b80;
    font-size: 13px;
    font-weight: 600;
}

.weather-eyebrow {
    margin: 0 0 6px;
    color: var(--wd-blue);
    font-family: Arial, sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    line-height: 1.35;
}

/* ===== 検索カード ===== */
.weather-area-search {
    position: relative;
    padding: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--wd-radius);
    box-shadow: var(--wd-shadow);
    backdrop-filter: blur(8px);
}

.weather-area-search > label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 800;
}

.weather-area-search__field {
    position: relative;
    display: flex;
}

.weather-area-search__field > span {
    position: absolute;
    top: 17px;
    left: 16px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--wd-blue);
    border-radius: 50%;
}

.weather-area-search__field > span::after {
    position: absolute;
    right: -6px;
    bottom: -3px;
    width: 7px;
    height: 2px;
    background: var(--wd-blue);
    content: "";
    transform: rotate(45deg);
}

.weather-area-search input {
    min-width: 0;
    min-height: 50px;
    flex: 1;
    padding: 12px 14px 12px 43px;
    background: #fff;
    border: 1px solid var(--wd-border);
    border-radius: 7px;
    font-size: 12px;
}

.weather-area-search__secondary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 9px;
}

.weather-area-search__secondary > .weather-jump-link + .weather-jump-link {
    margin-left: -4px;
}

.weather-area-search__status {
    margin: 0;
    color: var(--wd-muted);
    font-size: 9px;
}

.weather-jump-link {
    padding: 0;
    color: var(--wd-blue);
    background: none;
    border: 0;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.weather-jump-link > span {
    margin-right: 4px;
}

.weather-jump-link[disabled] {
    opacity: 0.5;
    cursor: default;
}

/* 「エリア一覧から探す」は現在地ボタンより控えめに */
.weather-jump-link--sub {
    color: var(--wd-muted);
    font-weight: 700;
}

/* ===== サジェスト ===== */
.weather-area-suggest {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--wd-border);
    border-radius: 10px;
    box-shadow: var(--wd-shadow);
}

.weather-area-suggest[hidden] {
    display: none;
}

.weather-area-suggest a {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #eef4f8;
    font-size: 13px;
}

.weather-area-suggest a:last-child {
    border-bottom: 0;
}

.weather-area-suggest a:hover,
.weather-area-suggest a.is-active {
    background: #eff6fb;
}

.weather-area-suggest a > small {
    display: block;
    color: var(--wd-muted);
    font-size: 11px;
    font-weight: 600;
}

.weather-area-suggest__empty {
    padding: 14px;
    color: var(--wd-muted);
    font-size: 12px;
}

/* ===== レスポンシブ ===== */
@media (max-width: 1100px) {
    .weather-container {
        width: calc(100% - 44px);
    }

    .weather-directory-hero__content {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
        gap: 38px;
    }
}

@media (max-width: 767px) {
    .weather-container {
        width: calc(100% - 32px);
    }

    .weather-directory-hero__content {
        min-height: 0;
        grid-template-columns: 1fr;
        gap: 27px;
        padding-block: 45px;
    }

    .weather-directory-hero h1 {
        font-size: clamp(30px, 9vw, 41px);
    }

    .weather-directory-hero__copy > p:not(.weather-eyebrow) br {
        display: none;
    }

    .weather-area-search {
        padding: 20px 16px;
    }
}

/* コンテンツ枠内に置く場合はブレイクアウト(100vw)を打ち消す。
 * サーフポイントトップの .surf-directory--inline と同じ考え方（2026-07-29） */
.weather-directory.weather-directory--inline {
    position: static;
    left: auto;
    width: auto;
    margin: 0;
}

.weather-directory--inline .weather-container {
    width: 100%;
    max-width: none;
}

/* =====================================================================
 * 閲覧履歴（/weather/forecast/・2026-07-29）
 * サーフポイントトップ(surf-directory.css)の .surf-history-* を .weather-history-* として移植。
 * ===================================================================== */
.weather-history-section {
    padding: 0px 0 21px;
    background: #fff;
}

/* 閲覧履歴が0件の間はセクション（見出し含む）ごと非表示。
 * hidden属性はサイト側CSSのdisplay指定に負けることがあるため明示的に打ち消す */
.weather-history-section[hidden] {
    display: none !important;
}

/* 見出しは潮見表(tide-directory.css の .tide-section-heading)と同じ
 * 「オーシャンライン」に統一(2026-08-01)。
 * 単色の border-bottom をやめ、濃紺→水色→薄グレーの3色ラインを疑似要素で描く */
.weather-section-heading {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 23px;
    padding: 0 0 0.55em 7px;
}

.weather-section-heading::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    content: "";
    background: linear-gradient(90deg, #0759a7 0 16%, #81d7f0 16% 28%, var(--slb-color-border, #dce7f0) 28% 100%);
}

.weather-section-heading h2 {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--wd-navy) !important;
    background: none !important; /* サイト共通の青背景h2スタイルを打ち消す */
    border: 0 !important;
    font-size: clamp(21px, 2vw, 23px);
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* 見出し右側の補足（閲覧履歴の件数・ランキングの更新時刻など） */
.weather-section-heading > span {
    color: var(--wd-muted);
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.weather-history-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.weather-history-list[hidden] {
    display: none;
}

.weather-history-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--wd-border);
    border-radius: 10px;
    box-shadow: 0 5px 17px rgba(6, 43, 75, 0.05);
}

.weather-history-card__link {
    display: block;
    min-height: 100px;
    padding: 17px 42px 17px 16px;
    transition: background 220ms ease;
}

.weather-history-card__link:hover {
    background: #eff6fb;
}

.weather-history-card__copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.weather-history-card__head {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.weather-history-card__badge {
    flex: 0 0 auto;
    padding: 2px 7px;
    color: #fff;
    background: var(--wd-blue);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
}

.weather-history-card__head > strong {
    overflow: hidden;
    color: var(--wd-navy);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weather-history-card__copy > small {
    margin-top: 4px;
    overflow: hidden;
    color: var(--wd-muted);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* カード下部の波の装飾（サーフ・潮見表の履歴カードと同デザイン・同色） */
.weather-history-card__deco {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 35px;
    pointer-events: none;
}

.weather-history-card__deco path {
    fill: #92c1df; /* 潮見表トップの波と同色（tide-directory.css と揃える） */
}

.weather-history-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    padding: 0;
    color: var(--wd-muted);
    background: #f3f7f9;
    border: 0;
    border-radius: 50%;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.weather-history-card__remove:hover {
    color: #fff;
    background: var(--wd-navy);
}

.weather-history-empty {
    display: flex;
    min-height: 112px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    color: var(--wd-muted);
    background: #f8fbfc;
    border: 1px dashed #cfdde6;
    border-radius: 10px;
    text-align: center;
}

.weather-history-empty[hidden] {
    display: none;
}

@media (max-width: 1100px) {
    .weather-history-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .weather-history-section {
        padding: 26px 0 8px;
    }

    .weather-history-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 潮見表と同じく、狭い幅では見出しと件数を縦積みにする
     * （h2のサイズは clamp(21px, 2vw, 23px) の下限で21pxになるため個別指定は不要） */
    .weather-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

/* ===== SNS共有バーの位置調整 =====
 * サーフポイントトップ(surf-directory.css)と同じ考え方。
 * 旧位置(left:-1183px)はヒーロー見出しに重なるため、本文カラム1220pxの左16px外側へ再計算。
 * 収まらない1101〜1360pxは他ページのSP同様、下部追従バーへ切り替える。 */
@media (min-width: 1361px) {
    body .share {
        left: -1302px; /* -1302 = カラム1220 + 82 */
    }
}

@media (min-width: 1101px) and (max-width: 1360px) {
    body .share {
        margin: 0 auto;
        bottom: 0;
        width: 100%;
        left: 0;
        right: 0;
        top: inherit;
    }

    body .share li {
        display: inline-block;
        width: 25%;
        vertical-align: top;
    }

    body .share li a {
        padding: 21px 0 4px;
        line-height: 1.5;
    }
}


/* ===== アメダスランキング（カード型4種同時表示） =====
 * 天気予報トップ(weather/forecast/index.php)と都道府県ページ(area.php)で共用。
 * 2026-08-01に index.php のインラインstyleからここへ移動 */
.amedas-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 767px) {
    .amedas-cards {
        grid-template-columns: 1fr;
    }
}

.amedas-card {
    padding: 0px 0 15px;
}

.amedas-card h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    padding: 10px 10px;
    background: #eff6fb;
    border-left: 4px solid #2c7eb9;
    /* style.css の .forecast h3 が付ける青い下線を打ち消す(2026-08-01) */
    border-bottom: 0;
    font-size: 14px;
}

/* 見出しのMaterial Symbolsアイコン */
.amedas-card h3 .amedas-card__ic {
    width: 18px;
    height: 18px;
    flex: none;
    fill: currentColor;
    color: #2c7eb9;
}

.amedas-card .forecast_ranking {
    width: 100%;
}

.amedas-card .forecast_ranking td a {
    color: #333;
}

/* ===== ダークモード対策(2026-08-01) =====
   旧#darkBodyの汎用ルールとの組み合わせで、白背景の閲覧履歴カード等が読めなくなるため明示指定。
   新シェル(html[data-theme="dark"])と旧(#darkBody)の両方に対応 */
#darkBody .weather-section-heading h2,
html[data-theme="dark"] .weather-section-heading h2 {
    color: #e8f1f8 !important;
}
#darkBody .weather-section-heading .weather-eyebrow,
html[data-theme="dark"] .weather-section-heading .weather-eyebrow {
    color: #7fb4e8;
}
#darkBody .weather-history-card,
html[data-theme="dark"] .weather-history-card {
    background: #333;
    border-color: #555;
    box-shadow: none;
}
#darkBody .weather-history-card__link:hover,
html[data-theme="dark"] .weather-history-card__link:hover {
    background: #3d474f;
}
#darkBody .weather-history-card__head > strong,
html[data-theme="dark"] .weather-history-card__head > strong {
    color: #e8f1f8;
}
#darkBody .weather-history-card__copy > small,
html[data-theme="dark"] .weather-history-card__copy > small {
    color: #a8b8b5;
}
#darkBody .weather-history-card__remove,
html[data-theme="dark"] .weather-history-card__remove {
    color: #ccc;
    background: #4a545c;
}

/* ダークモード追補(2026-08-01): 白背景セクションとアメダス見出し */
#darkBody .weather-history-section,
html[data-theme="dark"] .weather-history-section {
    background: #282828;
}
#darkBody .amedas-card h3,
html[data-theme="dark"] .amedas-card h3 {
    background: #3d474f;
    color: #fff;
}
#darkBody .amedas-card h3 .amedas-card__ic,
html[data-theme="dark"] .amedas-card h3 .amedas-card__ic {
    color: #7fb4e8;
}
