/* 宇宙観測気象台ウィジェット（トップ）
 *
 * 感情気象台（aimesen）・AIコスト気象台（bizcommu）と同じ設計。
 * PC と スマホ で見せ方を変える:
 *   - 761px以上 … 枠を消して幅1040pxの帯にする（本文カラムに馴染ませる）
 *   - 760px以下 … カード表示
 *
 * ⚠ .page-ynews .front-hero-info は style.css で
 *    grid-template-columns: 16px minmax(0,1fr) 16px の3カラムグリッド。
 *    直下の子は grid-column:2 を指定しないと 16px 幅に潰れる。
 */

/* 親の .front-hero-info は style.css で
   grid-template-columns: 16px 1fr 16px / background:#fff。
   display:block で上書きし、余白は padding で作る（AIMESEN と同じ方式）。
   ここを grid のままにすると子が16px幅に潰れる。 */
.page-ynews .front-spaceweather-hero {
    display: block;
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: 12px 16px 0;   /* AIMESEN と同値。下余白は持たない */
    background: #fff;
}

.page-ynews .front-spaceweather-hero__panel {
    position: relative;
    border: 1px solid rgba(20, 30, 60, .10);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(20, 35, 70, .05);
    padding: 11px 12px 10px;
    overflow: hidden;
    min-height: 0;
}

.front-spaceweather-hero__link { position: absolute; inset: 0; z-index: 3; }

/* 高さの基準は左（h2＋サブ）。右カラムはその高さの中に上下配置する。
   right を伸ばすと左のタイトルが押し上げられて行間が崩れる。 */
.front-spaceweather-hero__header {
    display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; margin-bottom: 9px;
}
.front-spaceweather-hero__intro { min-width: 0; }
.front-spaceweather-hero__intro h2 {
    display: flex; align-items: center; gap: 6px; margin: 0;
    font-size: 15px; font-weight: 800; color: #131c33; letter-spacing: .01em; white-space: nowrap;
}
.front-spaceweather-hero__intro h2 i { color: #6a3df0; font-size: 17px; }
.front-spaceweather-hero__eyebrow {
    margin: 1px 0 0; font-size: 10.5px; color: #7c879b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.front-spaceweather-hero__state {
    display: flex; align-items: center; gap: 5px; margin: 0; font-size: 10px; color: #7c879b;
}
.front-spaceweather-hero__spinner {
    width: 8px; height: 8px; border-radius: 50%; background: #6a3df0; flex: 0 0 auto;
    box-shadow: 0 0 8px rgba(106, 61, 240, .6); animation: front-sw-pulse 1.6s ease-in-out infinite;
}
@keyframes front-sw-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(.75); }
}
.front-spaceweather-hero[aria-busy="false"] .front-spaceweather-hero__state { display: none; }
/* ビズコミュの details-button と同寸に揃える */
.front-spaceweather-hero__cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 3px;
    padding: 6px 11px; border: 0; border-radius: 999px;
    background: linear-gradient(110deg, #6a3df0, #a855f7);
    color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap;
}
/* CTA と節気を右側に縦積み */
.front-spaceweather-hero__side {
    margin-left: auto; display: flex; flex-direction: column; align-items: flex-end;
    justify-content: space-between;   /* ボタンは h2 の行、節気はサブの行に揃う */
    gap: 4px; min-width: 0;
}

.front-spaceweather-hero__grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
}
.front-sw-card {
    border: 1px solid rgba(20, 30, 60, .09); border-radius: 9px; background: #f7f9fd;
    padding: 7px 8px; min-width: 0;
    /* 見出し・値・補足を縦に積んで中央寄せ */
    text-align: center;
}
.front-sw-card--sun  { background: linear-gradient(180deg, #fff7ec, #f8fafd); }
.front-sw-card--moon { background: linear-gradient(180deg, #eef4ff, #f8fafd); }
.front-sw-card__k {
    display: block; font-size: 9.5px; color: #7c879b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 図と文字を横並びにして、高さを増やさずに視覚情報を足す */
.front-sw-card__v {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    margin-top: 2px; font-weight: 800; line-height: 1.15;
    color: #131c33; white-space: nowrap;
    /* 「かなり枠」5文字でも1行に収まるよう、セル幅に追従させる */
    font-size: clamp(12px, 3.9vw, 18px);
    overflow: hidden;
}
/* 警戒度で色を変える。数値より先に色で伝える */
.front-sw-card__v[data-tone="calm"]   { color: #0d9f74; }
.front-sw-card__v[data-tone="mild"]   { color: #1f6feb; }
.front-sw-card__v[data-tone="warn"]   { color: #d98200; }
.front-sw-card__v[data-tone="danger"] { color: #e0245e; }
.front-sw-card__v[data-tone="moon"]   { color: #5a3fd6; }
/* セル自体にも警戒色をうっすら乗せて、目線が一瞬で向くようにする */
.front-sw-card:has(.front-sw-card__v[data-tone="warn"])   { background: linear-gradient(180deg,#fff6e6,#f8fafd); border-color: rgba(217,130,0,.28); }
.front-sw-card:has(.front-sw-card__v[data-tone="danger"]) { background: linear-gradient(180deg,#ffecf1,#f8fafd); border-color: rgba(224,36,94,.32); }
.front-sw-fig { width: 18px; height: 18px; flex: 0 0 auto; overflow: visible; }
.front-sw-word {
    flex: 0 0 auto; min-width: 0; overflow: visible; text-overflow: clip;
    white-space: nowrap; word-break: keep-all; overflow-wrap: normal;
}
/* 警戒時だけ太陽をゆっくり脈打たせる。常時動かすと視線を奪いすぎる */
.front-sw-fig.is-alert { animation: front-sw-alert 2.2s ease-in-out infinite; }
@keyframes front-sw-alert {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .72; transform: scale(1.09); }
}
@media (prefers-reduced-motion: reduce) { .front-sw-fig.is-alert { animation: none; } }

.front-sw-card__s {
    display: block; margin-top: 2px; font-size: 9.5px; color: #7c879b;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.front-spaceweather-hero__term {
    display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; margin: 0;
    font-size: 10px; color: #7c879b; min-width: 0; white-space: nowrap;
}
.front-spaceweather-hero__term strong { font-size: 12px; font-weight: 800; color: #131c33; }
.front-spaceweather-hero__term small { font-size: 9.5px; color: #7c879b; }

/* ── PC：帯として本文カラムに馴染ませる ───────────────── */
@media (min-width: 761px) {
    .page-ynews .front-spaceweather-hero {
        width: min(1040px, calc(100% - 24px));
        margin: 10px auto 0;
        padding: 0;
        background: transparent;
    }
    .page-ynews .front-spaceweather-hero__panel {
        padding: 12px 14px 11px;
        border-radius: 12px;
    }
    .front-spaceweather-hero__intro h2 { font-size: 16px; }
    .front-sw-card__v { font-size: 20px; }
    .front-sw-fig { width: 21px; height: 21px; }
    .front-spaceweather-hero__grid { gap: 8px; }
}

/* ── スマホ：カード表示 ─────────────────────────── */
@media (max-width: 760px) {
    /* AIMESEN と同値 */
    .page-ynews .front-spaceweather-hero { padding: 10px 14px 0; }
    .page-ynews .front-spaceweather-hero__panel { padding: 10px 10px 9px; border-radius: 8px; }
    .front-spaceweather-hero__intro h2 { font-size: 14px; }
    .front-spaceweather-hero__intro h2 i { font-size: 15px; }
    .front-spaceweather-hero__eyebrow { font-size: 10px; }
    .front-spaceweather-hero__cta { padding: 6px 11px; font-size: 9px; }
    .front-spaceweather-hero__term { font-size: 9px; }
    .front-spaceweather-hero__term strong { font-size: 11px; }
    .front-spaceweather-hero__term small { font-size: 8.5px; }
    .front-spaceweather-hero__grid { gap: 5px; }
    .front-sw-card { padding: 6px; }
    .front-sw-fig { width: 16px; height: 16px; }
    .front-sw-card__k { font-size: 8.5px; }
    .front-sw-card__v { font-size: clamp(11px, 3.7vw, 15px); }
    /* 最長5文字でもアイコンと同じ行に必ず収め、省略もしない */
    .front-sw-card__v[data-chars="5"] { gap: 2px; font-size: clamp(9px, 2.7vw, 12px); }
    .front-sw-card__s { font-size: 8.5px; }
    .front-spaceweather-hero__term strong { font-size: 12.5px; }
}
@media (max-width: 380px) {
    .front-spaceweather-hero__eyebrow { display: none; }
}

/* ── ナイトモード ───────────────────────────────
   このサイトの切替は <html class="theme-night">。
   body.is-dark ではないので注意（実測で確認済み）。 */
html.theme-night .page-ynews .front-spaceweather-hero,
html.theme-night .page-ynews .front-spaceweather-hero__panel {
    background: #1b1e23;   /* AIMESEN と同じナイト色に揃える */
}
html.theme-night .page-ynews .front-spaceweather-hero__panel {
    border-color: #343941;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
html.theme-night .page-ynews .front-spaceweather-hero__intro h2 { color: #eef2fb; }
html.theme-night .page-ynews .front-spaceweather-hero__intro h2 i { color: #a98cff; }
html.theme-night .page-ynews .front-spaceweather-hero__eyebrow,
html.theme-night .page-ynews .front-spaceweather-hero__state,
html.theme-night .page-ynews .front-sw-card__k,
html.theme-night .page-ynews .front-sw-card__s,
html.theme-night .page-ynews .front-spaceweather-hero__term { color: #9aa7bd; }

html.theme-night .page-ynews .front-sw-card {
    background: #23272e;
    border-color: #343941;
}
/* 半透明グラデだと #1b1e23 の上で沈んでセルが見えなくなる。ベタ塗りにする */
html.theme-night .page-ynews .front-sw-card--sun  { background: #2a2620; }
html.theme-night .page-ynews .front-sw-card--moon { background: #21262f; }
html.theme-night .page-ynews .front-sw-card__v { color: #eef2fb; }

/* 暗い背景では明度を上げないと沈む */
html.theme-night .page-ynews .front-sw-card__v[data-tone="calm"]   { color: #35d9a0; }
html.theme-night .page-ynews .front-sw-card__v[data-tone="mild"]   { color: #6fa8ff; }
html.theme-night .page-ynews .front-sw-card__v[data-tone="warn"]   { color: #ffb545; }
html.theme-night .page-ynews .front-sw-card__v[data-tone="danger"] { color: #ff6b8a; }
html.theme-night .page-ynews .front-sw-card__v[data-tone="moon"]   { color: #b3a2ff; }

html.theme-night .page-ynews .front-sw-card:has(.front-sw-card__v[data-tone="warn"]) {
    background: #33291a;
    border-color: rgba(255, 181, 69, .38);
}
html.theme-night .page-ynews .front-sw-card:has(.front-sw-card__v[data-tone="danger"]) {
    background: #35202a;
    border-color: rgba(255, 107, 138, .36);
}

html.theme-night .page-ynews .front-spaceweather-hero__term strong { color: #eef2fb; }


@media (prefers-reduced-motion: reduce) { .front-sw-fig.is-alert { animation: none; } }

.front-sw-card__s {
    display: block; margin-top: 2px; font-size: 9.5px; color: #7c879b;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.front-spaceweather-hero__term {
    display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; margin: 0;
    font-size: 10px; color: #7c879b; min-width: 0; white-space: nowrap;
}
.front-spaceweather-hero__term strong { font-size: 12px; font-weight: 800; color: #131c33; }
.front-spaceweather-hero__term small { font-size: 9.5px; color: #7c879b; }

/* ── PC：帯として本文カラムに馴染ませる ───────────────── */
@media (min-width: 761px) {
    .page-ynews .front-spaceweather-hero {
        width: min(1040px, calc(100% - 24px));
        margin: 10px auto 0;
        padding: 0;
        background: transparent;
    }
    .page-ynews .front-spaceweather-hero__panel {
        padding: 12px 14px 11px;
        border-radius: 12px;
    }
    .front-spaceweather-hero__intro h2 { font-size: 16px; }
    .front-sw-card__v { font-size: 20px; }
    .front-sw-fig { width: 21px; height: 21px; }
    .front-spaceweather-hero__grid { gap: 8px; }
}

/* ── スマホ：カード表示 ─────────────────────────── */
@media (max-width: 760px) {
    /* AIMESEN と同値 */
    .page-ynews .front-spaceweather-hero { padding: 10px 14px 0; }
    .page-ynews .front-spaceweather-hero__panel { padding: 10px 10px 9px; border-radius: 8px; }
    .front-spaceweather-hero__intro h2 { font-size: 14px; }
    .front-spaceweather-hero__intro h2 i { font-size: 15px; }
    .front-spaceweather-hero__eyebrow { font-size: 10px; }
    .front-spaceweather-hero__cta { padding: 6px 11px; font-size: 9px; }
    .front-spaceweather-hero__term { font-size: 9px; }
    .front-spaceweather-hero__term strong { font-size: 11px; }
    .front-spaceweather-hero__term small { font-size: 8.5px; }
    .front-spaceweather-hero__grid { gap: 5px; }
    .front-sw-card { padding: 6px; }
    .front-sw-fig { width: 16px; height: 16px; }
    .front-sw-card__k { font-size: 8.5px; }
    .front-sw-card__v { font-size: clamp(11px, 3.7vw, 15px); }
    .front-sw-card__s { font-size: 8.5px; }
    .front-spaceweather-hero__term strong { font-size: 12.5px; }
}
@media (max-width: 380px) {
    .front-spaceweather-hero__eyebrow { display: none; }
}

/* ── ダークモード（サイト側の切替に追従）───────────── */
body.is-dark .page-ynews .front-spaceweather-hero__panel,
body.dark .page-ynews .front-spaceweather-hero__panel {
    background: #141a28; border-color: rgba(255, 255, 255, .10);
}
body.is-dark .front-spaceweather-hero__intro h2,
body.dark .front-spaceweather-hero__intro h2 { color: #eef2fb; }
body.is-dark .front-sw-card,
body.dark .front-sw-card { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .08); }
body.is-dark .front-sw-card__v,
body.dark .front-sw-card__v { color: #eef2fb; }
body.is-dark .front-spaceweather-hero__term strong,
body.dark .front-spaceweather-hero__term strong { color: #eef2fb; }

@media (prefers-reduced-motion: reduce) {
    .front-spaceweather-hero__spinner { animation: none; }
}


/* ── ヘッダー再構成 ─────────────────────────────
   左右をフレックスで並べると、列の高さが違うぶん下端がずれる（実際にずれた）。
   2行グリッドにして行ごとに align-items:end で下端を揃える。
   1行目 : タイトル ／ 詳しく見る
   2行目 : サブコピー ／ 月のカウントダウン                       */
.front-spaceweather-hero__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 10px; row-gap: 2px;
    align-items: end;
    margin-bottom: 9px;
}
/* 元のラッパは箱としては不要。子を直接グリッドに載せる */
.front-spaceweather-hero__intro,
.front-spaceweather-hero__side { display: contents; }

.front-spaceweather-hero__header h2 { grid-column: 1; grid-row: 1; font-size: 18px; }
.front-spaceweather-hero__header h2 i { font-size: 19px; }
.front-spaceweather-hero__eyebrow { grid-column: 1; grid-row: 2; }
.front-spaceweather-hero__cta { grid-column: 2; grid-row: 1; justify-self: end; }
.front-spaceweather-hero__moonline { grid-column: 2; grid-row: 2; justify-self: end; }
.front-spaceweather-hero__state { grid-column: 1 / -1; grid-row: 3; }

/* ビズコミュの details-button の実効値（padding:4px 9px / 9px / line-height:1.2）に合わせる */
.front-spaceweather-hero__cta {
    padding: 4px 9px; font-size: 9px; line-height: 1.2; font-weight: 800;
    border-radius: 999px; gap: 3px;
}

.front-spaceweather-hero__moonline {
    margin: 0; line-height: 1.35; white-space: nowrap;
}
.front-spaceweather-hero__moonline strong {
    font-size: 11.5px; font-weight: 800; color: #131c33;
}

@media (max-width: 760px) {
    .front-spaceweather-hero__header h2 { font-size: 17px; }
    .front-spaceweather-hero__header h2 i { font-size: 18px; }
}
@media (max-width: 380px) {
    .front-spaceweather-hero__header h2 { font-size: 15px; }
    .front-spaceweather-hero__header h2 i { font-size: 16px; }
    .front-spaceweather-hero__cta { padding: 4px 8px; font-size: 8.5px; }
    .front-spaceweather-hero__moonline strong { font-size: 10px; }
    /* 380px 以下ではサブコピーを隠す。その場合は月の行を1行目の下に置く */
    .front-spaceweather-hero__moonline { grid-row: 2; }
}
@media (min-width: 761px) {
    .front-spaceweather-hero__header h2 { font-size: 21px; }
    .front-spaceweather-hero__header h2 i { font-size: 22px; }
    .front-spaceweather-hero__moonline strong { font-size: 12.5px; }
}

html.theme-night .page-ynews .front-spaceweather-hero__moonline strong { color: #eef2fb; }
body.is-dark .front-spaceweather-hero__moonline strong,
body.dark .front-spaceweather-hero__moonline strong { color: #eef2fb; }

/* ── 縦を詰める ─────────────────────────────
   h2 は本文の line-height(1.62) を継承していて 21px の字に 34px の行箱が付き、
   タイトルとサブコピーの間が空いていた。行箱を字に寄せて余白を回収する。 */
.front-spaceweather-hero__header { row-gap: 0; margin-bottom: 8px; }
.front-spaceweather-hero__header h2 { line-height: 1.2; }
.front-spaceweather-hero__eyebrow { margin-top: 0; line-height: 1.35; }
.front-spaceweather-hero__moonline { font-size: 11.5px; line-height: 1.35; }
.front-spaceweather-hero__panel { padding: 11px 14px 10px; }

/* 詳しく見るボタンを上げる。
   行は align-items:end なのでボタンはタイトルの箱の下端に付いていた。
   タイトルの字面中央に合わせ（center）、さらに 3px 持ち上げる。 */
.front-spaceweather-hero__cta { align-self: center; margin-bottom: 3px; }

/* ── 宇宙観測気象台・横長ダッシュボード ──────────────────
   既存APIと判定はそのままに、見本の「見出し＋4観測ブロック」へ再配置する。 */
.front-spaceweather-icons {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.page-ynews .front-spaceweather-hero__panel {
    padding: 0;
    overflow: hidden;
    border-color: #e4e7ef;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(31, 42, 68, .07);
}

.front-spaceweather-hero__header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto auto;
    grid-template-rows: auto;
    align-items: center;
    column-gap: 24px;
    min-height: 92px;
    margin: 0;
    padding: 12px 18px;
    background: #fff;
    border-bottom: 1px solid #e4e7ef;
}

.front-spaceweather-hero__intro {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.page-ynews .front-spaceweather-hero__brand-icon {
    display: block;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    object-fit: contain;
}

.front-spaceweather-hero__copy {
    min-width: 0;
}

.front-spaceweather-hero__header .front-spaceweather-hero__copy h2 {
    display: block;
    margin: 0;
    color: #12203a;
    font-size: clamp(22px, 2.1vw, 31px);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: .025em;
    white-space: nowrap;
}

.front-spaceweather-hero__eyebrow {
    margin: 5px 0 0;
    color: #7f8a9d;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

.front-spaceweather-hero__side {
    display: contents;
}

.front-spaceweather-hero__moonline {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    white-space: nowrap;
}

.front-spaceweather-hero__moonline-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #18233a;
}

.front-spaceweather-hero__moonline strong {
    color: #18233a;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

/* 「次の新月まで…」の文字とアイコンはPC限定でグレーにする（スマホは変更しない） */
@media (min-width: 761px) {
    .front-spaceweather-hero__moonline-icon,
    .front-spaceweather-hero__moonline strong {
        color: #7f8a9d;
    }
}

.front-spaceweather-hero__cta {
    grid-column: 3;
    grid-row: 1;
    display: inline-flex;
    align-self: center;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin: 0;
    padding: 8px 18px;
    border-radius: 999px;
    background: linear-gradient(110deg, #6a3df0, #8b46ee);
    box-shadow: 0 5px 12px rgba(106, 61, 240, .18);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.front-spaceweather-hero__state {
    position: absolute;
    right: 148px;
    bottom: 7px;
    margin: 0;
}

.front-spaceweather-hero__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    background: #fff;
}

.front-sw-card {
    --sw-accent: #18b58e;
    position: relative;
    display: grid;
    /* 数値列(3列目)を1frで伸ばすと、値との間の余白がカード幅いっぱいに
       広がってしまう。max-contentで内容ぶんだけの幅にし、justify-content:start で
       3列全体を左に寄せて詰める。余った幅はカード右側の空白として残るだけになる。 */
    grid-template-columns: 58px max-content max-content;
    justify-content: center;
    align-items: center;
    column-gap: 14px;
    row-gap: 10px;
    min-width: 0;
    min-height: 86px;
    padding: 10px 14px 10px 16px;
    overflow: hidden;
    border: 0;
    border-right: 1px solid #e7e9f0;
    border-radius: 0;
    background: #fff;
    text-align: left;
}

.front-sw-card:last-child {
    border-right: 0;
}

.front-sw-card::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    /* 4枚それぞれ色を変えていたが、統一感を優先して薄いグレーへ変更 */
    background: #d5d9e0;
}

.front-sw-card:nth-child(1) { --sw-accent: #f1a20a; }
.front-sw-card:nth-child(2) { --sw-accent: #13ad88; }
.front-sw-card:nth-child(3) { --sw-accent: #367fe0; }
.front-sw-card:nth-child(4) { --sw-accent: #7d4ce0; }

.front-sw-card--sun,
.front-sw-card--moon,
.front-sw-card:has(.front-sw-card__v[data-tone="warn"]),
.front-sw-card:has(.front-sw-card__v[data-tone="danger"]) {
    background: #fff;
}

.front-sw-card__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
}

.front-sw-card__visual > svg,
.front-sw-card__visual > img,
.front-sw-card__visual .front-sw-fig {
    width: 58px;
    height: 58px;
    overflow: visible;
    object-fit: contain;
}

.front-sw-card__content {
    position: relative;
    min-width: 0;
}

.front-sw-card__k {
    display: block;
    color: #5c6a80;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.front-sw-card__v {
    display: block;
    margin: 4px 0 0;
    overflow: visible;
    color: var(--sw-accent);
    font-size: clamp(20px, 2.2vw, 28px);
    font-weight: 800;
    line-height: 1.05;
    white-space: nowrap;
}

.front-sw-card__s {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: center;
    align-self: center;
    max-width: 90px;
    overflow: hidden;
    color: #59667a;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-overflow: ellipsis;
    white-space: pre-line;
}

.front-sw-card__v[data-tone="calm"]   { color: #0d9f74; }
.front-sw-card__v[data-tone="mild"]   { color: #2778d8; }
.front-sw-card__v[data-tone="warn"]   { color: #d98200; }
.front-sw-card__v[data-tone="danger"] { color: #e0245e; }
.front-sw-card__v[data-tone="moon"]   { color: #6b43d3; }

/* 太陽アイコン（01.svg）の警戒色は、背景に色を「乗せる」合成（multiply等）ではなく、
   太陽本体（.js-sw-sun-face 内の st2/st3/st4/st6）の塗り色そのものを段階ごとに
   直接指定し直す方式にした。合成計算をしないので、背景に色が漏れる・薄まる・
   マゼンタに寄るといった問題が原理的に起きない。calm（既定）は元の色のまま
   （st2=#f18f41 st3=#9a4d23 st4=#bf6e32 st6=#ee771d）で上書きしない。
   明暗の相対関係（st2が最も明るく、st3が最も暗い）は4段階とも保っている。 */
.front-sw-card--sun:has(.front-sw-card__v[data-tone="mild"]) .js-sw-sun-face .sw-sun-st2 { fill: #ffa54d; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="mild"]) .js-sw-sun-face .sw-sun-st6 { fill: #ff8a1f; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="mild"]) .js-sw-sun-face .sw-sun-st4 { fill: #cc7a35; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="mild"]) .js-sw-sun-face .sw-sun-st3 { fill: #a8501f; }

.front-sw-card--sun:has(.front-sw-card__v[data-tone="warn"]) .js-sw-sun-face .sw-sun-st2 { fill: #ff8a63; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="warn"]) .js-sw-sun-face .sw-sun-st6 { fill: #ff5a1a; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="warn"]) .js-sw-sun-face .sw-sun-st4 { fill: #c94e1e; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="warn"]) .js-sw-sun-face .sw-sun-st3 { fill: #8f2f12; }

.front-sw-card--sun:has(.front-sw-card__v[data-tone="danger"]) .js-sw-sun-face .sw-sun-st2 { fill: #ff7a6b; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="danger"]) .js-sw-sun-face .sw-sun-st6 { fill: #ee2b1f; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="danger"]) .js-sw-sun-face .sw-sun-st4 { fill: #a91f16; }
.front-sw-card--sun:has(.front-sw-card__v[data-tone="danger"]) .js-sw-sun-face .sw-sun-st3 { fill: #6e0f0a; }

.js-sw-sun-face .sw-sun-st2,
.js-sw-sun-face .sw-sun-st3,
.js-sw-sun-face .sw-sun-st4,
.js-sw-sun-face .sw-sun-st6 {
    transition: fill .3s ease;
}
.front-sw-card--sun:has(.front-sw-card__v[data-tone="warn"])   .front-sw-sun-icon,
.front-sw-card--sun:has(.front-sw-card__v[data-tone="danger"]) .front-sw-sun-icon {
    animation: front-sw-alert 2.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .front-sw-sun-icon { animation: none !important; }
}

@media (min-width: 761px) {
    .page-ynews .front-spaceweather-hero {
        width: min(1040px, calc(100% - 24px));
        margin-top: 10px;
        padding: 0;
        background: transparent;
    }

    /* ラベル＋値（例:「太陽フレア／静穏」）をPC限定で中央寄せにする。
       スマホは既に .front-sw-card__content に text-align:center 済み。 */
    .front-sw-card__content {
        text-align: center;
    }

    /* 太陽フレア・地磁気Kp・磁気嵐・月齢の4アイコンをPC限定でさらに縮小する */
    .front-sw-card {
        grid-template-columns: 46px max-content max-content;
    }
    .front-sw-card__visual {
        width: 46px;
        height: 46px;
    }
    .front-sw-card__visual > svg,
    .front-sw-card__visual > img,
    .front-sw-card__visual .front-sw-fig {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 760px) {
    .page-ynews .front-spaceweather-hero {
        width: 100%;
        max-width: 100%;
        /* 左右の余白を0にして、画面幅いっぱいにパネルを広げる */
        padding: 0;
    }

    .page-ynews .front-spaceweather-hero__panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        /* 角丸・影は消してフラットな四角にする。下端だけ区切り線を入れる */
        border: 0;
        border-bottom: 1px solid #e7e9f0;
        border-radius: 0;
        box-shadow: none;
    }

    /* 右側（詳しく見る＋次の新月まで）は grid の行/列で個別配置すると
       左のタイトルと基準がズレてバランスが崩れた。既存の__sideラッパーを
       flex縦積みとして使い、header自体は「左1列・右1列」のシンプルな
       2列にして、align-items:centerで両方とも行の中央に揃える。 */
    .front-spaceweather-hero__header {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
        column-gap: 8px;
        min-height: 0;
        padding: 9px 10px;
    }

    .front-spaceweather-hero__intro {
        gap: 7px;
    }

    .page-ynews .front-spaceweather-hero__brand-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }

    .front-spaceweather-hero__header .front-spaceweather-hero__copy h2 {
        font-size: clamp(13px, 3.8vw, 16px);
    }

    .front-spaceweather-hero__eyebrow {
        margin-top: 2px;
        font-size: 7.5px;
    }

    .front-spaceweather-hero__side {
        display: flex;
        /* HTML順はmoonline→ctaだが、表示は「詳しく見る」を上にしたいので反転 */
        flex-direction: column-reverse;
        align-items: flex-end;
        justify-content: center;
        gap: 5px;
        grid-column: 2;
        grid-row: 1;
    }

    .front-spaceweather-hero__moonline {
        padding-left: 0;
        gap: 3px;
    }

    .front-spaceweather-hero__moonline-icon {
        display: none;
    }

    .front-spaceweather-hero__moonline strong {
        font-size: 9.5px;
    }

    .front-spaceweather-hero__cta {
        min-height: 0;
        padding: 5px 10px 4px 12px;
        font-size: 9px;
    }

    .front-spaceweather-hero__state {
        right: 10px;
        bottom: 3px;
        font-size: 8px;
    }

    /* PCと同じ「アイコン｜ラベル・値｜数値」の横3列を維持したまま、
       4枚のカードも横並びのまま詰め込む。1カードの幅が非常に狭くなるため、
       文字はかなり小さくする（利用者の指示で許容済み）。 */
    .front-sw-card {
        display: grid;
        /* minmax(0,1fr)だとテキスト列がカード右端まで伸び、アイコンとの
           グループが左に寄って見えた。max-contentにして justify-content:center で
           グループごとカード内の中央へ。 */
        grid-template-columns: 28px max-content;
        grid-template-rows: auto auto;
        align-items: center;
        justify-content: center;
        column-gap: 5px;
        row-gap: 0;
        min-height: 64px;
        padding: 5px 4px 4px;
        text-align: left;
    }

    .front-spaceweather-hero__grid {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: repeat(4, minmax(0, 25%));
        overflow: hidden;
    }

    .front-sw-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .front-sw-card::before {
        display: none;
    }

    .front-sw-card__visual,
    .front-sw-card__visual > svg,
    .front-sw-card__visual > img,
    .front-sw-card__visual .front-sw-fig {
        width: 28px;
        height: 28px;
    }

    .front-sw-card__content {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        min-width: 0;
        text-align: center;
    }

    .front-sw-card__k {
        overflow: hidden;
        font-size: 9.5px;
        text-overflow: ellipsis;
    }

    .front-sw-card__v,
    .front-sw-card__v[data-chars="5"] {
        margin-top: 1px;
        font-size: clamp(12px, 4.4vw, 14.5px);
    }

    /* 数値列は横に並べる幅が無いので、アイコン・ラベル行の下に全幅で回す */
    .front-sw-card__s {
        display: block;
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        max-width: 100%;
        margin-top: 3px;
        font-size: 9px;
        line-height: 1.25;
        text-align: center;
        /* PCは改行(pre-line)のままだが、スマホは1行にまとめる。
           JSが「・」の代わりに\nを入れているため、normalで空白1個に畳む */
        white-space: normal;
    }
}

@media (max-width: 380px) {
    .front-spaceweather-hero__eyebrow {
        display: block;
    }

    .front-spaceweather-hero__header .front-spaceweather-hero__copy h2 {
        font-size: 15px;
    }

    .front-spaceweather-hero__cta {
        padding-inline: 8px;
    }
}

/* ナイトモードでもカード構造とアイコン色は維持する。 */
html.theme-night .page-ynews .front-spaceweather-hero__header,
html.theme-night .page-ynews .front-spaceweather-hero__grid,
html.theme-night .page-ynews .front-sw-card,
html.theme-night .page-ynews .front-sw-card--sun,
html.theme-night .page-ynews .front-sw-card--moon,
html.theme-night .page-ynews .front-sw-card:has(.front-sw-card__v[data-tone="warn"]),
html.theme-night .page-ynews .front-sw-card:has(.front-sw-card__v[data-tone="danger"]) {
    background: #1b1e23;
}

html.theme-night .page-ynews .front-spaceweather-hero__header,
html.theme-night .page-ynews .front-sw-card {
    border-color: #343941;
}

html.theme-night .page-ynews .front-spaceweather-hero__copy h2,
html.theme-night .page-ynews .front-sw-card__k,
html.theme-night .page-ynews .front-spaceweather-hero__moonline strong {
    color: #eef2fb;
}

html.theme-night .page-ynews .front-spaceweather-hero__eyebrow,
html.theme-night .page-ynews .front-sw-card__s {
    color: #a4afc0;
}
