/* ============================================================
 * デジトリ360 LP カスタムスタイル
 * （CSP対応：HTMLからインライン<style>を分離）
 * ============================================================ */

/* スムーズスクロール（固定ヘッダー分のオフセット込み） */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* ============================================================
 * 改行制御 ベース層（全テキスト共通）
 *
 * 【方針】本文(p)はSafariで keep-all を使うと句読点のない長文が
 *   改行不能となりカードをはみ出す（左右切れ）ため、本文には
 *   keep-all を使わず「日本語の自然な折返し」を許可する。
 *   ・Chromium/Edge … auto-phrase で文節単位の自然な折返し（上乗せ）
 *   ・Safari/iOS/Firefox … 標準の文字単位折返し＋禁則（はみ出さない）
 *   見出しの文節整合は固定層(.sp-br)と .no-wrap / .keep-phrase で個別保証する。
 * ============================================================ */
body {
    font-family: 'Noto Sans JP', sans-serif;
    color: #1d1d1f;
    background-color: transparent;
    overflow-x: hidden;

    /* はみ出し防止：長い英単語・URL・改行不能語を必要時に分割（全ブラウザ） */
    overflow-wrap: anywhere;

    /* 句読点・閉じ括弧の行頭禁則（全ブラウザ） */
    line-break: strict;
}

/* 対応ブラウザ(Chromium系)のみ：文節単位の自然な折返しへ上乗せ。
   Safari等は標準(文字単位)折返しにフォールバックし、はみ出しを防ぐ */
@supports (word-break: auto-phrase) {
    body {
        word-break: auto-phrase;
    }
}

/* 短い見出し専用：文節を途中で割らない（Safariでも有効）。
   長い本文には付けない（はみ出すため）。見出しは短く sp-br で改行制御済 */
.keep-phrase {
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* 見出しの行長を均等化（Safari 17.5+ / Chrome / Edge 対応）
   2行以上の見出しを左右バランス良く改行する。
   未対応ブラウザは通常折返しにフォールバック（害なし）。
   ※本文(p)には text-wrap を使わない（日本語で不自然な行分配が起きるため、
   　本文は .no-wrap による文節保護で制御する） */
h1,
h2,
h3,
h4,
h5,
.keep-phrase {
    text-wrap: balance;
}

/* ============================================================
 * CSP対応：インラインstyleをクラス化
 * ============================================================ */

/* モバイルメニューのガラス風背景（旧 inline style 由来） */
.mobile-menu-panel {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

/* モバイルメニュー開閉トランジション（JSはclass切替のみ／style操作禁止） */
.mobile-menu-panel {
    transform-origin: top;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scaleY(0);
}

.mobile-menu-panel.is-open {
    opacity: 1;
    transform: scaleY(1);
}

/* contactセクションのビューポート連動の最小高さ
 * （旧 JS による element.style.minHeight 設定を CSS 化） */
#contact {
    min-height: calc(100svh - 100px);
}

@supports not (height: 100svh) {
    #contact {
        min-height: calc(100vh - 100px);
    }
}

/* 動画要素：display と max-height のリセット（旧 inline style 由来） */
.video-block-reset {
    display: block;
    max-height: none;
}

/* STEP4 セクションの背景（外部画像→ローカルへ変更） */
.step4-bg {
    background-image: url('../../images/step4_bg.jpg');
    background-size: cover;
    background-position: center;
}

/* ============================================================
 * 改行制御 ユーティリティ
 * インラインstyle禁止のため、すべてクラスで制御
 * ============================================================ */

/* 数値+単位・対比表現を分離させない（例：350万円 / 490時間 / -70万円） */
.no-wrap {
    white-space: nowrap;
}

/* 文節を1つの塊にして折返し境界として扱う（例：年間コストダウン） */
.phrase {
    display: inline-block;
}

/* 主要見出しの手動改行（意味区切り固定用）
 * デスクトップ(≥1024px)では1行に収まるため非表示。
 * スマホ〜タブレット(≤1023px)では <br> として描画し、
 * 長い見出しが overflow-wrap で文字途中に泣き別れするのを防ぐ。
 * （発火幅をナビのハンバーガー切替 lg と統一） */
.sp-br {
    display: none;
}

@media (max-width: 1023px) {
    .sp-br {
        display: inline;
    }
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.04);
}
.glass-dark {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
    border-radius: 2rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 40px -10px rgba(0, 91, 159, 0.15);
    background: rgba(255, 255, 255, 0.85);
}

/* Fade-in Up Animation */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Hero section initial load animation */
.hero-reveal {
    opacity: 0;
    animation: heroFadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-reveal.delay-200 { animation-delay: 200ms; }
@keyframes heroFadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

.tracking-tight-apple { letter-spacing: -0.02em; }

.btn-apple { transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.btn-apple:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 20px -5px rgba(0, 91, 159, 0.3);
}
.btn-apple:active { transform: scale(0.97); }

.animate-blob {
    animation: blob 7s infinite;
}
@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

#site-content { opacity: 1; }

/* 黄色マーカー（文字下半分のみハイライト） */
.highlight-marker {
    background: linear-gradient(transparent 50%, #fff4d1 50%);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Hero Video Section */
.hero-video-section {
    position: relative;
    width: 100%;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.hero-video-container {
    position: absolute;
    top: 96px;
    bottom: 120px;
    left: 0;
    right: 0;
    overflow: hidden;
    z-index: 0;
}
@media (min-width: 1024px) {
    .hero-video-container {
        left: 1.5rem;
        right: 1.5rem;
        border-radius: 2rem;
        box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    }
}
.hero-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}
.hero-video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    z-index: 1;
}
.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-title-main {
    font-size: clamp(1.6rem, 3.8vw, 5rem);
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #0f172a;
    text-shadow: 0 4px 20px rgba(255,255,255,0.9);
    word-break: keep-all;
    overflow-wrap: break-word;
}
.hero-title-accent {
    color: #005B9F;
    text-shadow: 0 4px 20px rgba(255,255,255,0.9);
}

.hero-cta-primary {
    background: #005B9F;
    color: white;
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,91,159,0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    width: 100%;
}
@media (min-width: 480px) {
    .hero-cta-primary {
        width: auto;
        padding: 16px 36px;
        font-size: 1rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}
.hero-cta-primary:hover {
    background: #0074cc;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 32px rgba(0,91,159,0.4);
}

.hero-logo-img {
    height: clamp(2.5rem, 5vw, 6.5rem);
    object-fit: contain;
    opacity: 1;
}
@media (min-width: 768px) {
    .hero-logo-img { height: clamp(3.5rem, 6vw, 7.5rem); }
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: rgba(15,23,42,0.6);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
@media (min-width: 768px) {
    .hero-scroll-indicator { bottom: 2.5rem; font-size: 0.7rem; }
}
.hero-scroll-line {
    width: 1.5px;
    height: 36px;
    background: linear-gradient(to bottom, rgba(15,23,42,0.5), transparent);
    animation: scrollLine 1.8s ease-in-out infinite;
}
@media (min-width: 768px) {
    .hero-scroll-line { height: 48px; }
}
@keyframes scrollLine {
    0%, 100% { transform: scaleY(1); opacity: 0.5; }
    50% { transform: scaleY(0.5); opacity: 1; }
}

/* デバイスモックアップ */
.device-mockup-wrap {
    position: relative;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding-bottom: 40px;
    padding-right: 20px;
}
.mockup-pc-wrap {
    position: relative;
    width: 100%;
    filter: drop-shadow(0 20px 48px rgba(0,0,0,0.2));
}
.mockup-pc-frame {
    width: 100%;
    height: auto;
    position: relative;
    z-index: 20;
    pointer-events: none;
    display: block;
}
.mockup-pc-screen {
    position: absolute;
    top: 6%;
    left: 11%;
    width: 78%;
    height: 74%;
    z-index: 10;
    background: #0f1219;
    overflow: hidden;
    border-radius: 2px;
}
.mockup-pc-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left top;
    display: block;
}
.mockup-tablet {
    position: absolute;
    bottom: 0px;
    right: -10px;
    width: 58%;
    filter: drop-shadow(0 16px 36px rgba(0,0,0,0.25));
    z-index: 10;
}
.mockup-tablet-body {
    background: linear-gradient(160deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 10px;
    padding: 5px;
    border: 2.5px solid #94a3b8;
}
.mockup-tablet-screen {
    background: #0f1219;
    border-radius: 5px;
    overflow: hidden;
}
.mockup-tablet-screen img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    background: #0f1219;
}
.hero-device-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 2rem;
}
@media (min-width: 1024px) {
    .hero-device-wrap {
        width: 46%;
        margin-top: 0;
        flex-shrink: 0;
    }
}
.hero-side-cards { display: none !important; }

/* Scroll to Top Button */
#back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 60;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s, background-color .2s ease;
    cursor: pointer;
    border: 0;
}
#back-to-top:hover { background: #005B9F; }
#back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease, visibility 0s, background-color .2s ease;
}
@media (min-width: 768px) {
    #back-to-top { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
}

/* Google Tag Manager noscript用iframe (CSP対応のためインラインstyle属性の代替) */
.gtm-noscript {
    display: none;
    visibility: hidden;
}
