/* ========================================
   NEWS DETAIL
======================================== */

.ae-news-detail-page {
    margin: 0;
    color: #080b20;
    background: var(--ae-dot-background);
    background-attachment: fixed;
    animation: ae-dot-background-drift 20s ease-in-out infinite;
}


/* ページ全体 */

.ae-news-detail {
    --news-blue: #064bfa;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;

    width: calc(100% - 64px);
    max-width: 1360px;
    height: calc(100svh - var(--wp-admin--admin-bar--height, 0px));

    margin: 0 auto;
    padding: 20px 0 18px;
}


/* ========================================
   HEADER
======================================== */

.ae-news-detail__header {
    margin-bottom: 14px;
}


/* NEWSへ戻る */

.ae-news-detail__back {
    display: inline-flex;
    align-items: center;

    margin-bottom: 14px;

    color: var(--news-blue);

    font-family: "Courier New", monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;

    text-decoration: none;
}

.ae-news-detail__back:hover {
    text-decoration: underline;
}

/* 記事タイトル */

.ae-news-detail__title {
    margin: 0;

    color: #080b20;

    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(38px, 4vw, 60px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.ae-news-detail__title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 32px;

    width: 100%;
}

.ae-news-detail__date {
    display: block;
    justify-self: end;
    align-self: end;

    margin-right: 24px;
    margin-bottom: 8px;

    color: #515c75;

    font-family: "Courier New", monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: right;
    white-space: nowrap;
}


/* ========================================
   ARTICLE WINDOW
======================================== */

.ae-news-detail__window {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    overflow: hidden;

    border: 2px solid var(--news-blue);
    border-radius: 6px;

    padding: 4px;

    background: #fff;

    box-shadow:
        4px 4px 0 #62caff,
        8px 10px 0 rgba(6, 75, 250, 0.08),
        inset 0 0 0 1px #8cd7ff;
}


/* Windows風バー */

.ae-news-detail__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    min-height: 38px;

    padding: 7px 12px;

    background-color: #e3f4ff;

    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(6, 75, 250, 0.25) 0 1px,
            transparent 1px 3px
        );

    color: var(--news-blue);

    font-family: "Courier New", monospace;
    font-size: 12px;
    font-weight: 700;

    box-shadow:
        inset 0 0 0 1px #8eb4ff;
}

.ae-news-detail__bar span:last-child {
    flex-shrink: 0;
    font-size: 16px;
    white-space: nowrap;
}


/* 本文 */

.ae-news-detail__body {
    position: relative;
    height: calc(100% - 38px);
    min-height: 0;
    overflow: hidden;

    padding: clamp(22px, 3vh, 34px) 48px;

    background:
        linear-gradient(
            180deg,
            rgba(238, 248, 255, 0.55),
            rgba(255, 255, 255, 0.96) 100px
        );
}

.ae-news-detail__body p {
    max-width: none;

    margin: 0 0 22px;

    color: #20263b;

    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.9;
}

.ae-news-detail__body p:last-child {
    margin-bottom: 0;
}

/* NEWS詳細：記事ごとの挿絵 */

.ae-news-detail__visual {
    position: absolute;
    inset: 0;

    overflow: hidden;
    pointer-events: none;
}

.ae-news-detail__art {
    position: absolute;
    display: block;
    height: auto;
}


/* 新年：時計台 */

.ae-news-detail__art--clocktower {
    right: 4%;
    bottom: 12%;

    width: min(33%, 480px);

    opacity: 1;
}


/* 新年：雪 */
.ae-news-detail__art--snow,
.ae-news-detail__snow {
    position: absolute;
    top: 22%;
    right: 0;

    display: block;
    width: min(16%, 230px);
    height: auto;

    opacity: 0.8;
    pointer-events: none;
}

/* ========================================
   FOOTER / BACK
======================================== */

/* ボタンの外観は共通設定を使い、記事との間隔だけ指定 */
.ae-news-detail > .ae-page-return {
    --ae-return-gap: 24px;
    --ae-return-bottom-gap: 0px;
}

@media (max-width: 650px) {
    .ae-news-detail > .ae-page-return {
        --ae-return-gap: 10px;
    }
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 700px) {

    .ae-news-detail {
        width: calc(100% - 40px);

        padding-top: 48px;
        padding-bottom: 64px;
    }

    .ae-news-detail__back {
        margin-bottom: 36px;
    }

    .ae-news-detail__title {
        font-size: clamp(34px, 10vw, 52px);
    }

    .ae-news-detail__body {
        min-height: 0;
        position: relative;

        padding: 36px 22px;
    }

    .ae-news-detail__body p {
        font-size: 15px;
        line-height: 1.95;
    }

    .ae-news-detail__title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    }

    .ae-news-detail__date {
    margin-bottom: 0;
    }
}
/* ========================================
   NEWS詳細：追加記事の共通レイアウト
======================================== */

.ae-news-detail--standard {
    height: auto;
    min-height: calc(
        100svh - var(--wp-admin--admin-bar--height, 0px)
    );
}

.ae-news-detail--standard .ae-news-detail__title {
    font-size: clamp(32px, 3.2vw, 48px);
    line-height: 1.2;
}

/* 管理画面で登録するお知らせのタイトル */
.single-ae_news .ae-news-detail__title {
    letter-spacing: 0;
}

.ae-news-detail--standard .ae-news-detail__window {
    height: auto;
}

.ae-news-detail--standard .ae-news-detail__body {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, min(33%, 480px));
    gap: 40px;

    height: auto;
    min-height: 560px;
}

.ae-news-detail--standard .ae-news-detail__text {
    min-width: 0;
}

.ae-news-detail--standard .ae-news-detail__text strong {
    color: var(--news-blue);
}

.ae-news-detail--standard .ae-news-detail__text a {
    color: var(--news-blue);
    text-underline-offset: 4px;
}

.ae-news-detail--standard .ae-news-detail__visual {
    position: absolute;
    inset: 0;

    overflow: hidden;
    pointer-events: none;
}

.ae-news-detail--standard .ae-news-detail__art {
    position: static;
    flex-shrink: 0;
}

.ae-news-detail--standard .ae-news-detail__art--scene {
    position: absolute;
    right: 4%;
    bottom: 12%;

    width: min(33%, 480px);

    opacity: 1;
}

/* 管理画面で登録する画像：縦長でも大きくなりすぎない */
.single-ae_news .ae-news-detail__art--scene {
    max-height: min(40svh, 360px);
    object-fit: contain;
    object-position: right bottom;
}

/* PC：記事の高さとメイン画像の配置を統一 */
@media (min-width: 701px) {

    .ae-news-detail--standard {
        height: calc(
            100svh - var(--wp-admin--admin-bar--height, 0px)
        );
        min-height: 0;
    }

    .ae-news-detail--standard .ae-news-detail__window {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }

    .ae-news-detail--standard .ae-news-detail__bar {
        flex-shrink: 0;
    }

    .ae-news-detail--standard .ae-news-detail__body {
        flex: 1;
        height: auto;
        min-height: 0;

        grid-template-rows: minmax(0, 1fr);
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, min(37%, 550px));
    }

    .ae-news-detail--standard .ae-news-detail__text {
        min-height: 0;
        overflow-y: auto;
        padding-right: 8px;
    }

    /* 会社・人物：画像内の下側の透明余白を補正 */
    .ae-news-detail--standard .ae-news-detail__art--scene[src$="news-building.png"],
    .ae-news-detail--standard .ae-news-detail__art--scene[src$="news-people.png"] {
        transform: translateY(17%);
    }

    /* 2024年末：調整済みの大きさと配置 */
    .ae-news-detail--standard .ae-news-detail__art--scene[src$="news-works-illustration.png"] {
        bottom: 0%;
        width: min(44%, 680px);
    }
}

.ae-news-detail--standard .ae-news-detail__art--accent {
    width: 48%;
    margin-right: -32px;
    margin-bottom: -12px;
    opacity: 0.8;
}

@media (max-width: 700px) {

    .ae-news-detail--standard {
        padding-top: 28px;
        padding-bottom: 32px;
    }

    .ae-news-detail--standard .ae-news-detail__title-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .ae-news-detail--standard .ae-news-detail__date {
        margin-right: 0;
        margin-bottom: 0;
    }

    .ae-news-detail--standard .ae-news-detail__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        min-height: 0;
    }

    .ae-news-detail--standard .ae-news-detail__visual {
    position: relative;
    inset: auto;

    width: min(100%, 360px);
    justify-self: end;
    padding-bottom: 16px;
}

.ae-news-detail--standard .ae-news-detail__art--scene {
    position: static;
    width: 100%;
}
}
/* タブレット：本文を広げ、イラストは本文の下へ */
@media (min-width: 701px) and (max-width: 1100px) {
    .ae-news-detail.ae-news-detail--standard {
        width: calc(100% - 48px);
        height: auto;
        min-height: calc(100svh - var(--wp-admin--admin-bar--height, 0px));
        grid-template-rows: auto auto auto;
    }
    .ae-news-detail--standard .ae-news-detail__window {
        height: auto;
    }
    .ae-news-detail--standard .ae-news-detail__body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 18px;
        padding: 24px;
        overflow: visible;
    }
    .ae-news-detail--standard .ae-news-detail__text {
        padding-right: 0;
        overflow: visible;
    }
    .ae-news-detail--standard .ae-news-detail__text p {
        margin-bottom: 16px;
        font-size: 13px;
        line-height: 1.8;
        word-break: normal;
        overflow-wrap: normal;
        line-break: strict;
        text-wrap: pretty;
    }
    .ae-news-detail--standard .ae-news-detail__text p:last-child { margin-bottom: 0; }
    .ae-news-detail--standard .ae-news-detail__text br { display: none; }
    .ae-news-detail--standard .ae-news-detail__visual {
        position: relative;
        inset: auto;
        display: flex;
        justify-content: flex-end;
        width: 100%;
        overflow: hidden;
        padding: 0;
    }
    .ae-news-detail--standard .ae-news-detail__visual .ae-news-detail__art--scene {
        position: static;
        width: min(48%, 280px);
        height: auto;
        max-height: 220px;
        transform: none;
        object-fit: contain;
        object-position: right bottom;
    }
    .ae-news-detail--standard .ae-news-detail__visual .ae-news-detail__art--accent {
        position: absolute;
        top: 0;
        left: 0;
        width: 130px;
        margin: 0;
    }
    .ae-news-detail--standard .ae-news-detail__date { font-size: 16px; margin-right: 8px; }
}
/* スマホ：NEWS詳細を１画面にまとめる */
@media (max-width: 650px) {
  .ae-news-detail-page .ae-news-detail {
    box-sizing: border-box;
    width: calc(100% - 32px);
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
    padding: 16px 0 12px;
  }

  .ae-news-detail-page .ae-news-detail__header {
    margin-bottom: 10px;
  }

  .ae-news-detail-page .ae-news-detail__back {
    margin-bottom: 12px;
    font-size: 11px;
  }

  .ae-news-detail-page .ae-news-detail__title-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .ae-news-detail-page .ae-news-detail__title {
    font-size: 22px;
    line-height: 1.35;
    letter-spacing: 0;
    word-break: normal;
    line-break: strict;
    text-wrap: pretty;
  }

  .ae-news-detail-page .ae-news-detail__date {
    margin: 0;
    font-size: 11px;
  }

  .ae-news-detail-page .ae-news-detail__window {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
  }

  .ae-news-detail-page .ae-news-detail__bar {
    flex-shrink: 0;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .ae-news-detail-page .ae-news-detail--standard
  .ae-news-detail__body {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    min-height: 0;
    height: auto;
    gap: 8px;
    padding: 14px;
  }

  .ae-news-detail-page .ae-news-detail__text {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .ae-news-detail-page .ae-news-detail__body p {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.8;
    word-break: normal;
    overflow-wrap: break-word;
    line-break: strict;
    text-wrap: pretty;
  }

  .ae-news-detail-page .ae-news-detail__body p:last-child {
    margin-bottom: 0;
  }

  .ae-news-detail-page .ae-news-detail__visual {
    position: relative;
    inset: auto;
    display: flex;
    justify-content: flex-end;
    width: 100%;
    height: auto;
    padding: 0;
  }

  .ae-news-detail-page .ae-news-detail__visual
  .ae-news-detail__art--scene {
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    transform: none;
  }

}
/* スマホ：NEWS詳細はページ全体をスクロール */
@media (max-width: 650px) {
    .ae-news-detail-page .ae-news-detail__window {
        height: auto;
    }

    .ae-news-detail-page .ae-news-detail__body {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .ae-news-detail-page .ae-news-detail__text {
        overflow: visible;
        overscroll-behavior: auto;
    }
}
