/*
Theme Name: Brewlab
Theme URI: 
Author: Webteam
Author URI: 
Description: A modern WordPress block theme for Brewlab.
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: brewlab
Tags: custom-background, custom-colors, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, block-styles, full-site-editing
*/

/* --- Utility Classes --- */

/* Primary Gradient Text (Utility & Headings) */
.text-gradient-primary,
h1,
h2,
h3,
h4,
h5,
h6 {
    background: linear-gradient(90deg, #35476d 0%, #1e2643 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
    width: fit-content;
    letter-spacing: 0.08em;
    font-weight: 900;
}

/* Ensure centered and right-aligned headings still align correctly with fit-content */
.has-text-align-center,
:where(h1, h2, h3, h4, h5, h6).has-text-align-center {
    margin-inline: auto;
}

:where(h1, h2, h3, h4, h5, h6).has-text-align-right {
    margin-left: auto;
    margin-right: 0;
}

/* Base specific overrides */
body {
    font-family: var(--wp--preset--font-family--noto-sans-jp, sans-serif);
    color: var(--wp--preset--color--base, #000000);
    overflow-x: hidden;
}

/* Background blur utility */
.bg-blur {
    backdrop-filter: blur(20.5px);
    background-color: rgba(255, 229, 204, 0.6);
}

/* Background gradient utility: Glowing white background for text-images with fading blur */
.wp-block-image.has-brewlab-gradient-bg,
figure.has-brewlab-gradient-bg,
.has-brewlab-gradient-bg {
    position: relative !important;
    padding: 30px 100px !important;
    /* 横に広げ、縦の余白を抑える */
    border-radius: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box;
    background: transparent !important;
    /* 箱の境界線（フチ）を見えなくするために本体にはフィルターと影を適用しない */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    /* 疑似要素がはみ出さないようにしつつ広く見せる */
    overflow: visible !important;
}

/* 疑似要素で「中央は強く、外側に向かって消える」背景色とブラーを適用 */
.has-brewlab-gradient-bg::before {
    content: '';
    position: absolute;
    /* 横に大きく広げ、縦の広がりを抑える */
    top: -10px;
    bottom: -10px;
    left: -100px;
    right: -100px;
    z-index: -1;
    /* コンテンツの後ろに配置 */

    /* 背景色（白〜透明）: 楕円形(ellipse)にして横長に広げる */
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 40%, rgba(255, 255, 255, 0) 80%);

    /* ブラーエフェクト */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* mask-imageでブラー自体も外側に向かってフェードアウト（これも楕円形に合わせる） */
    mask-image: radial-gradient(ellipse at center, black 0%, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 0%, black 40%, transparent 80%);
}

/* スマホ表示時（SP）はグラデーションの広がりを抑える */
@media (max-width: 768px) {

    .wp-block-image.has-brewlab-gradient-bg,
    figure.has-brewlab-gradient-bg,
    .has-brewlab-gradient-bg {
        position: relative !important;
        padding: 20px 40px !important;
        /* SP用に余白を狭める */
        border-radius: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        box-sizing: border-box;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    .has-brewlab-gradient-bg::before {
        content: '';
        position: absolute;
        top: -5px;
        bottom: -5px;
        left: -40px;
        right: -40px;
        /* 疑似要素の広がりも抑える */
        z-index: -1;
    }
}

.wp-block-image.has-brewlab-gradient-bg img,
figure.has-brewlab-gradient-bg img,
.has-brewlab-gradient-bg img {
    object-fit: contain;
    width: auto;
    max-height: 100%;
}

/* Custom rounded shapes */
.rounded-img-frame {
    border-radius: 4px;
    overflow: hidden;
}

/* --- Spacing Overrides --- */

/* セクション(<section>)のデフォルト上下パディングを100pxに */
:where(section) {
    padding-top: 100px;
    padding-bottom: 100px;
    padding-left: 20px;
    padding-right: 20px;
}

/* セクション(alignfull)内の標準gapを60pxに */
:where(.wp-block-group.alignfull) {
    --wp--style--block-gap: 60px;
}

:where(.wp-block-group.alignfull:not(.is-content-justification-space-between, .is-content-justification-left, .is-content-justification-right, .is-content-justification-center)) {
    gap: var(--wp--style--block-gap);
}

/* さらにその中のグループのgapを30pxに */
:where(.wp-block-group.alignfull .wp-block-group) {
    --wp--style--block-gap: 30px;
}

:where(.wp-block-group.alignfull .wp-block-group:not(.is-content-justification-space-between, .is-content-justification-left, .is-content-justification-right, .is-content-justification-center)) {
    gap: var(--wp--style--block-gap);
}

/* --- Group Block Extension --- */

.brewlab-custom-group {
    /* デフォルトのフォールバック (指定がない場合はauto) */
    --brewlab-width: auto;
    --brewlab-width-sp: var(--brewlab-width);
    --brewlab-height: auto;
    --brewlab-height-sp: var(--brewlab-height);

    /* 変数を利用した幅指定 */
    width: var(--brewlab-width) !important;
    height: var(--brewlab-height) !important;
}

@media (max-width: 768px) {
    .brewlab-custom-group {
        width: var(--brewlab-width-sp) !important;
        height: var(--brewlab-height-sp) !important;
    }
}

.brewlab-custom-group.is-position-custom {
    position: var(--brewlab-position) !important;
    top: var(--brewlab-top, auto);
    right: var(--brewlab-right, auto);
    bottom: var(--brewlab-bottom, auto);
    left: var(--brewlab-left, auto);
    z-index: var(--brewlab-zindex, auto);
}

.brewlab-custom-group.has-transform {
    transform: translate(var(--brewlab-tx, 0), var(--brewlab-ty, 0));
}

main {
    overflow-x: hidden;
    width: 100%;
}

@media (max-width: 768px) {
    .brewlab-custom-grid.is-layout-grid {
        grid-template-columns: repeat(var(--brewlab-grid-cols-sp), minmax(0, 1fr)) !important;
    }

    .brewlab-visibility-pc-only {
        display: none !important;
    }

    .brewlab-custom-group.is-position-custom {
        position: var(--brewlab-position-sp, var(--brewlab-position)) !important;
        top: var(--brewlab-top-sp, var(--brewlab-top, auto));
        right: var(--brewlab-right-sp, var(--brewlab-right, auto));
        bottom: var(--brewlab-bottom-sp, var(--brewlab-bottom, auto));
        left: var(--brewlab-left-sp, var(--brewlab-left, auto));
    }
}

@media (min-width: 769px) {
    .brewlab-visibility-sp-only {
        display: none !important;
    }
}

/* --- 文字列に矢印をつけるクラス (Text/Heading 拡張) --- */
.has-brewlab-arrow {
    position: relative;
    padding-right: 20px;
    /* 矢印が入るスペース */
    display: inline-flex !important;
    align-items: center;
}

.has-brewlab-arrow::after {
    /* 矢印 (→) の指定 */
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
    margin-left: 8px;
    /* 文字列との間隔 */
}

/* --- アイキャッチ画像の拡張 --- */
.has-brewlab-max-height img,
img.has-brewlab-max-height {
    max-height: var(--brewlab-max-height) !important;
    width: 100%;
    object-fit: var(--brewlab-object-fit, cover) !important;
}

/* --- クエリループ「全て表示」ボタン用のスタイル --- */
.brewlab-hidden-post {
    display: none !important;
}

.brewlab-show-all-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    margin-bottom: 20px;
    width: 100%;
}

.brewlab-show-all-btn {
    background: transparent;
    /* 背景透明 */
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    /* 文字と矢印の隙間を縮小 */
    padding: 10px;
    text-decoration: none;
}

.brewlab-show-all-text {
    font-size: 1rem;
    /* 約16px (1.25remから縮小) */
    font-weight: 900;
    color: #000;
    letter-spacing: 0.1em;
}

.brewlab-show-all-icon {
    display: inline-block;
    width: 14px;
    /* サイズダウン */
    height: 14px;
    /* サイズダウン */
    /* V字を作成 */
    border-right: 3px solid #000;
    /* 少し細く */
    border-bottom: 3px solid #000;
    transform: rotate(45deg);
    margin-top: 0;
}

/* エディター内のみの表示調整 */
.brewlab-show-all-wrapper.editor-mode {
    border: 2px dashed #ccc;
    background: rgba(255, 255, 255, 0.8);
    margin: 10px 0;
}

/* --- Font Styles --- */
.has-source-serif-pro-font-family {
    font-family: 'Source Serif Pro', serif !important;
}

/* --- Mobile Navigation Menu Styling --- */
.wp-block-navigation__responsive-container.is-menu-open {
    padding: 20px !important;
    box-sizing: border-box;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
    padding: 20px !important;
    border-radius: 8px;
    /* 角丸を追加 */
    background-color: #fff;
    /* ダイアログの背景色を明示 */
    height: auto !important;
    min-height: auto !important;
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto;
}

.wp-block-navigation__responsive-container-close {
    margin-right: 0 !important;
    margin-top: 0 !important;
    right: 20px;
    top: 20px;
}

/* --- Company Info Modal --- */
.brewlab-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: none;
    /* JSでflexに変更 */
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.brewlab-modal-container {
    background: #fff;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    /* 画面に収まるように */
    padding: 40px 50px;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
    overflow-y: auto;
    /* SPなどで溢れた場合のスクロール担保 */
    font-family: 'Noto Sans JP', sans-serif;
    color: #333;
}

.brewlab-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
    transition: color 0.3s;
}

.brewlab-modal-close:hover {
    color: #000;
}

.brewlab-modal-content {
    display: flex;
    gap: 60px;
}

.brewlab-modal-left,
.brewlab-modal-right {
    flex: 1;
}

.brewlab-modal-left {
    text-align: left;
}

.brewlab-modal-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.brewlab-modal-company-name {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 25px;
    letter-spacing: 0.05em;
}

.brewlab-modal-company-details {
    font-size: 14px;
    line-height: 1.8;
}

.brewlab-modal-company-details p {
    margin: 0;
}

.brewlab-modal-spacer {
    display: inline-block;
    width: 1em;
    /* TELとFAXの間隔 */
}

.brewlab-modal-divider {
    border: none;
    border-top: 1px solid #ccc;
    margin: 30px 0;
}

.brewlab-modal-subtitle {
    font-size: 18px;
    font-weight: 900;
    text-align: left;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.brewlab-modal-description {
    font-size: 14px;
    line-height: 1.8;
    text-align: left;
    margin: 0;
}

/* 右側カラム */
.brewlab-modal-right {
    text-align: left;
    padding-top: 45px;
    /* 左側の「会社名」などに高さを合わせるため */
}

.brewlab-modal-partners-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.brewlab-modal-partners-list li {
    font-size: 14px;
    font-weight: 700;
}

/* スマホ対応（レスポンシブ） */
@media (max-width: 768px) {
    .brewlab-modal-container {
        padding: 40px 20px;
    }

    .brewlab-modal-content {
        flex-direction: column;
        gap: 40px;
    }

    .brewlab-modal-right {
        padding-top: 0;
    }

    .brewlab-modal-partners-list {
        grid-template-columns: 1fr;
        /* SPでは1カラムにする */
        gap: 15px 0;
    }
}

/* --- テキストの強制改行 (英字等の折り返し) --- */
.has-brewlab-word-break {
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
    max-width: 100% !important;
}

/* --- サイトロゴの拡張 (スマホ時サイズ指定) --- */
@media (max-width: 768px) {

    .wp-block-site-logo.has-brewlab-width-sp,
    .has-brewlab-width-sp img {
        width: var(--brewlab-site-logo-width-sp) !important;
        height: auto !important;
    }
}