/* ==========================================================================
 * reel15.css — TOP ヒーローの15秒リール（index-new.html のみ）
 * 描画は /js/intro-showreel/reel15/。ヒーローの中にキャンバスを重ね、再生中だけヒーローを広げる。
 * ========================================================================== */
.top-v2 .reel15 {
    position: absolute;
    inset: 0;
    z-index: 7;
    overflow: hidden;
    pointer-events: none;
}

.top-v2 .reel15[hidden] {
    display: none;
}

/* 終わりにボタンが消えるとき、フォーカスを映像の枠へ移す（player.js。枠には線を出さない） */
.top-v2 .reel15:focus {
    outline: none;
}

/* キャンバスは再生中のヒーローの高さで固定する（ヒーローが広がる・縮む間は下が切れるだけで、描き直しはしない） */
.top-v2 .reel15__canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: var(--reel15-h, 100%);
}

.top-v2 .reel15__controls {
    position: absolute;
    right: clamp(10px, 1.6vw, 22px);
    bottom: clamp(12px, 1.6vw, 22px);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

/* 左上の LIVE 表示（動画ではなく、いまブラウザが描いていることを伝える）。ヘッダーの下に置く */
.top-v2 .reel15__live {
    position: absolute;
    top: calc(var(--reel15-top, 0px) + clamp(8px, 1.2vw, 16px));
    left: clamp(10px, 1.6vw, 22px);
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 5px 10px 5px 8px;
    /* 映像の邪魔にならないよう、枠と背景はごく薄く（読みやすさは文字の影で） */
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    background: rgba(4, 6, 14, 0.18);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    font: 400 10px/1 'Share Tech Mono', ui-monospace, monospace;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    max-width: calc(100% - 2 * clamp(10px, 1.6vw, 22px));
    transition: opacity 0.5s ease;
}

.top-v2 .reel15__live b {
    font-weight: 700;
    color: #ffffff;
}

/* LIVE の印：ブランドカラー（青→紫→ピンク）の輪が回り、中心の光が脈打つ */
.top-v2 .reel15__dot {
    position: relative;
    flex: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #6496ff, #a78bfa, #ff20ca, #6496ff);
    -webkit-mask: radial-gradient(circle, transparent 2.6px, #000 3.2px);
    mask: radial-gradient(circle, transparent 2.6px, #000 3.2px);
    filter: drop-shadow(0 0 3px rgba(167, 139, 250, 0.9));
    animation: reel15LiveSpin 1.4s linear infinite;
}

/* 中心の光（輪はマスクで穴を開けているので、その穴に親の ::before を重ねる。位置は左の余白 8px ＋ 輪の半径 5.5px） */
.top-v2 .reel15__live::before {
    content: '';
    position: absolute;
    left: 11.5px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 6px 1px #c4b5fd, 0 0 10px 2px rgba(255, 32, 202, 0.55);
    animation: reel15LiveCore 1.4s ease-in-out infinite;
}

.top-v2 .reel15__fps {
    min-width: 5.5ch;
    color: #7ee8ff;
}

.top-v2 .reel15__fps:empty {
    display: none;
}

@keyframes reel15LiveSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes reel15LiveCore {
    50% {
        opacity: 0.45;
        transform: scale(0.7);
    }
}

/* スキップ先まで来たら（終わりの余韻と TOP への受け渡し）、ボタンと LIVE 表示を消す */
.top-v2 .reel15__controls {
    transition: opacity 0.5s ease;
}

.top-v2 .reel15.reel15-ending .reel15__controls,
.top-v2 .reel15.reel15-ending .reel15__live {
    opacity: 0;
    pointer-events: none;
}

.top-v2 .reel15__controls button {
    padding: 7px 13px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.top-v2 .reel15__controls button:hover {
    background: rgba(62, 94, 155, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
}

.top-v2 .reel15__controls button:focus-visible {
    outline: 2px solid #ff20ca;
    outline-offset: 3px;
}

.top-v2 .reel15__controls .reel15__sound {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #d1d5db;
    font-size: 15px;
}

.top-v2 .reel15__sound.is-muted {
    color: #9ca3af;
}

/* アイコンの上に斜線。Font Awesomeのスピーカー自体は共通で使う。 */
.top-v2 .reel15__sound.is-muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 23px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    box-shadow: 0 0 0 1px #15171d;
    transform: translate(-50%, -50%) rotate(-45deg);
    pointer-events: none;
}

.top-v2 .reel15__controls button:disabled {
    cursor: default;
    opacity: 0.6;
}

/* 再生位置：見た目は細い線、操作領域は44px確保する。 */
.top-v2 .reel15__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    z-index: 2;
    pointer-events: auto;
    touch-action: none;
    cursor: pointer;
    --reel-progress: 0%;
}

.top-v2 .reel15__progress::before {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
}

.top-v2 .reel15__progress span {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #6496ff, #a78bfa, #ff20ca);
    transform: scaleX(0);
    transform-origin: left center;
}

.top-v2 .reel15__handle {
    position: absolute;
    bottom: 0;
    left: clamp(1.5px, var(--reel-progress), calc(100% - 1.5px));
    width: 3px;
    height: 9px;
    background: #c4b5fd;
    transform: translateX(-50%);
    pointer-events: none;
}

.top-v2 .reel15__progress:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
    border-radius: 8px;
}

.top-v2 .reel15__canvas {
    pointer-events: auto;
    touch-action: pan-y;
    cursor: grab;
}

.top-v2 .reel15-scrubbing .reel15__canvas,
.top-v2 .reel15-scrubbing .reel15__progress {
    cursor: grabbing;
}

.top-v2 .reel15__controls {
    z-index: 3;
}

/* 背景の描画はJSで即停止。最後の静止フレームだけをフェードアウトする。 */
.top-v2 #background-animation canvas {
    transition: opacity 0.3s ease, visibility 0s;
}

.top-v2 #main-content.reel15-background-paused #background-animation {
    background: #000;
}

.top-v2 #main-content.reel15-background-paused #background-animation canvas {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

/* 再生中：ヒーローを広げ、HTML の文字を隠す。ロゴはキャンバスが同じ位置で引き継ぐので、すぐに隠す */
.top-v2 #main-content.reel15-expanded .hero {
    min-height: var(--reel15-h);
}

.top-v2 #main-content.reel15-playing .hero-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.top-v2 #main-content.reel15-playing .hero-brand-en {
    visibility: hidden;
}

.top-v2 #main-content.reel15-playing .hero-intro-replay {
    visibility: hidden;
}

/* 受け渡し：キャンバスの文字とちょうど重なる位置に HTML を出し、右の見出しはすべり込ませる */
.top-v2 #main-content.reel15-playing.reel15-landing .hero-content {
    opacity: 1;
    transition: none;
}

.top-v2 #main-content.reel15-landing .hero-brand-en {
    visibility: visible;
}

/* ロゴだけが戻ってきたら、社名 → タグライン → 右の見出し → 説明文の順に、左から描き出す
 * style.css の .hero-motion … animation: none !important に負けないよう、より詳しい指定＋!important */
.hero-motion .top-v2 #main-content.reel15-landing .hero-brand-jp,
.top-v2 #main-content.reel15-landing .hero-brand-jp {
    animation: reel15CopyDraw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.08s both !important;
}

.hero-motion .top-v2 #main-content.reel15-landing .hero-tagline,
.top-v2 #main-content.reel15-landing .hero-tagline {
    animation: reel15CopyDraw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.26s both !important;
}

.hero-motion .top-v2 #main-content.reel15-landing .hero-copy > *,
.top-v2 #main-content.reel15-landing .hero-copy > * {
    animation: reel15CopyDraw 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.44s both !important;
}

.hero-motion .top-v2 #main-content.reel15-landing .hero-copy > .hero-sub,
.top-v2 #main-content.reel15-landing .hero-copy > .hero-sub {
    animation: reel15CopyDraw 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.66s both !important;
}

@keyframes reel15CopyDraw {
    from {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
        transform: translateX(-10px);
        filter: blur(4px);
    }
    35% {
        opacity: 1;
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        transform: none;
        filter: none;
    }
}

@media (max-width: 700px) {

    .top-v2 .reel15__controls button {
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .top-v2 .reel15 {
        display: none;
    }
}

/* ==========================================================================
 * ヒーロー右下の再生ボタン（リールのある TOP。style.css の .hero-intro-replay を上書き）
 * 暗いヒーローの上でもすぐ分かるよう、白いカプセルに濃紺のアイコンと「PLAY」。ボタン自体はヒーロー全体（どこを押しても再生）
 * アイコンは SVG（data URI。CSP の img-src は data: を許可）なので、三角の位置がずれない
 * ========================================================================== */
.top-v2 .hero {
    /* 右下のボタンと、折り返した説明文が重ならない領域を確保する。 */
    padding-bottom: 4rem;
}

.top-v2 .hero-intro-replay::before {
    content: 'PLAY';
    right: clamp(0.75rem, 1.6vw, 1.35rem);
    bottom: clamp(0.75rem, 1.6vw, 1.35rem);
    width: auto;
    aspect-ratio: auto;
    padding: 9px 16px 9px 36px;
    border: 0;
    border-radius: 999px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%230b1020'/%3E%3Cpath d='M8 6.2v7.6l6-3.8z' fill='%23fff'/%3E%3C/svg%3E") 10px 50% / 18px 18px no-repeat,
        rgb(255 255 255 / 94%);
    color: #0b1020;
    font: 700 11px/1 'Share Tech Mono', ui-monospace, monospace;
    letter-spacing: 0.12em;
    white-space: nowrap;
    box-shadow:
        0 8px 24px rgb(4 6 14 / 35%),
        0 1px 3px rgb(4 6 14 / 30%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: translate 0.2s ease, box-shadow 0.25s ease, background-color 0.2s ease;
}

.top-v2 .hero-intro-replay::after {
    content: none;
}

.top-v2 .hero-intro-replay:hover::before,
.top-v2 .hero-intro-replay:focus-visible::before {
    translate: 0 -2px;
    scale: 1;
    background-color: #ffffff;
    box-shadow:
        0 10px 28px rgb(4 6 14 / 40%),
        0 0 0 4px rgb(167 139 250 / 35%),
        0 0 24px rgb(255 32 202 / 35%);
}

@media (max-width: 700px) {
    .top-v2 .hero {
        padding-bottom: 3.5rem;
    }

    .top-v2 .hero-intro-replay::before {
        padding: 7px 12px 7px 30px;
        font-size: 10px;
        background-position: 8px 50%, 0 0;
        background-size: 15px 15px, auto;
    }
}

/* 見せ方の別パターンを試すページ（index-new）だけ：いまのカットのパターンを LIVE 表示の横に出す */
/* index-new のパターン表示：狭い画面では末尾を … で切る */
.top-v2 .reel15__pattern {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c4b5fd;
    letter-spacing: 0.08em;
}

.top-v2 .reel15__pattern:empty {
    display: none;
}
