/**
 * Block Editor Styles
 * ブロックエディタ用スタイル
 */

/* =========================================================
   Club list figure — アスペクト比統一
   ========================================================= */
.club-list-figure {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

/* single-club 上部のメイン画像は 16:9・高さを抑える */
.club-list-figure--post {
    aspect-ratio: 16 / 9;
    max-height: 380px;
}

.club-list-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* =========================================================
   single-club — PC 2カラムレイアウト
   画像（header）左 / 最新の活動報告（aside）右
   本文（article）は下段全幅
   ========================================================= */
@media screen and (min-width: 769px) {
    body.single-club .content-article {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* CSS Grid: タイトル+画像+本文（左）/ サイドバー固定260px（右）*/
    body.single-club .post-article {
        display: grid;
        grid-template-columns: 1fr 260px;
        grid-template-areas:
            "title side"
            "img   side"
            "body  side";
        gap: 0 0;
    }
    body.single-club .post-article > #sp-page-title {
        grid-area: title;
    }
    body.single-club .post-article > header {
        grid-area: img;
    }
    body.single-club .post-article > article.main-section {
        grid-area: body;
    }
    body.single-club .post-article > aside.side-post-list {
        grid-area: side;
        padding-left: 24px;
        padding-right: 20px;
        padding-top: 0;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 768px) {
    body.single-club .post-article {
        display: block;
    }
}

/* =========================================================
   single-club サイドバー見出し — 付箋風デザイン
   ========================================================= */
body.single-club .side-post-list-headline {
    --club-color: #245076; /* フォールバック色 */
    border-top: none;
    border-bottom: none;
    padding: 10px 16px 10px 20px;
    background-color: var(--club-color);
    color: #fff;
    font-weight: bold;
    font-size: .875em;
    position: relative;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.18);
    margin-right: 8px;
}
body.single-club .side-post-list-headline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 0;
}

/* ========================================
 * File Block Styles
 * ファイルブロック用のアイコン表示スタイル
 * ======================================== */

.wp-block-file {
    margin: 0.75em 0;
    padding: 0;
    background: none;
    border: none;
    display: block;
}

.wp-block-file__button,
.wp-block-file .wp-block-file__button {
    display: none !important;
}

.wp-block-file__content-wrapper {
    display: block;
}

.wp-block-file a.wp-block-file__content {
    color: #1A1A1A;
    text-decoration: none;
    display: inline-block;
    margin-bottom: .75em;
    padding-left: calc(37px + 1em);
    min-height: 46px;
    background-repeat: no-repeat;
    background-size: 37px auto;
    background-position: left center;
    transition: opacity 0.3s ease;
}

.wp-block-file a.wp-block-file__content:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.wp-block-file a.wp-block-file__content[href$=".pdf"] {
    background-image: url('lib/images/icon-pdf2.svg');
}

.wp-block-file a.wp-block-file__content[href$=".xlsx"],
.wp-block-file a.wp-block-file__content[href$=".xls"] {
    background-image: url('lib/images/icon-xlsx.svg');
}

@media (max-width: 768px) {
    .wp-block-file a.wp-block-file__content {
        padding-left: calc(32px + 0.75em);
        background-size: 32px auto;
    }
}

.editor-styles-wrapper .wp-block-file {
    margin: 0.75em 0;
}

/* ========================================
 * Achievements Page Styles
 * 合格実績ページ用のスタイル
 * ======================================== */

:root {
    --achievements-primary: #2563EB;
    --achievements-bg: #F8FAFC;
    --achievements-card-bg: #FFFFFF;
    --achievements-text-main: #1E293B;
    --achievements-text-sub: #64748B;
    --achievements-border: #E2E8F0;
}

.achievements-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* ヒーローセクション */
.achievements-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.achievements-hero h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--achievements-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.achievements-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--achievements-text-main);
}

.achievements-hero p {
    max-width: 600px;
    margin: 0 auto;
    color: var(--achievements-text-sub);
}

/* 可視化バー（Sticky） */
.visual-bar-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(8px);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.visual-bar-label {
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-align: center;
    font-size: 1.1rem;
}

.visual-bar {
    display: flex;
    height: 40px;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: #eee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bar-segment {
    height: 100%;
    transition: opacity 0.2s;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.bar-segment:hover {
    opacity: 0.85;
}

.bar-segment:hover .tooltip {
    opacity: 1;
    top: 45px;
}

.tooltip {
    position: absolute;
    top: 150%;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
    z-index: 101;
}

.legend-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--achievements-text-sub);
    text-decoration: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.legend-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--achievements-text-main);
}

.category-section {
    margin-bottom: 3rem;
    background: var(--achievements-card-bg);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--achievements-border);
    scroll-margin-top: 180px;
}

.category-header {
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* テーブルスタイル */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.achievements-table table,
.category-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 600px;
}

.achievements-table th,
.achievements-table td,
.category-section th,
.category-section td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--achievements-border);
}

.achievements-table th,
.category-section th {
    background: #F1F5F9;
    color: var(--achievements-text-sub);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.achievements-table th:not(:first-child),
.achievements-table td:not(:first-child),
.category-section th:not(:first-child),
.category-section td:not(:first-child) {
    text-align: center;
}

.achievements-table tr:last-child td,
.category-section tr:last-child td {
    border-bottom: none;
}

.achievements-table tr:hover,
.category-section tr:hover {
    background-color: #F8FAFC;
}

.uni-name {
    font-weight: 600;
    color: var(--achievements-text-main);
}

.total-col {
    font-weight: 700;
    color: var(--achievements-primary);
    background-color: #F8FAFC;
}

.total-col.colored {
    color: inherit;
    background-color: rgba(0, 0, 0, 0.02);
}

.highlight-num {
    color: var(--achievements-text-main);
    font-weight: 500;
}

.empty-cell {
    color: #CBD5E1;
}

@media (max-width: 768px) {
    .achievements-hero h1 {
        font-size: 2rem;
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .visual-bar-container {
        top: -1px;
        padding: 1rem 0;
    }

    .visual-bar-label {
        display: none;
    }

    .category-section {
        scroll-margin-top: 140px;
    }
}

/* ==========================================================================
   Text Emphasis Styles (強調・装飾) - Improved for Alignment
   ========================================================================== */

.marker-yellow, .marker-blue, .modern-underline, .premium-badge {
    display: table !important; /* Shrink to fit text */
    width: auto !important;
    margin-top: 0.5em !important;
    margin-bottom: 0.5em !important;
}

/* Default Left Alignment */
.marker-yellow, .marker-blue, .modern-underline, .premium-badge {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Center Alignment Support */
.has-text-align-center.marker-yellow,
.has-text-align-center.marker-blue,
.has-text-align-center.modern-underline,
.has-text-align-center.premium-badge {
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
}

/* Right Alignment Support */
.has-text-align-right.marker-yellow,
.has-text-align-right.marker-blue,
.has-text-align-right.modern-underline,
.has-text-align-right.premium-badge {
    margin-left: auto !important;
    margin-right: 0 !important;
    text-align: right !important;
}

/* Specific Styles */
.marker-yellow {
    background: linear-gradient(transparent 60%, #fff382 60%) !important;
    padding: 0 0.4em !important;
}
.marker-blue {
    background: linear-gradient(transparent 60%, #d1e9ff 60%) !important;
    padding: 0 0.4em !important;
}
.modern-underline {
    position: relative !important;
    text-decoration: none !important;
    padding: 0 0.2em !important;
}
.modern-underline::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0.15em !important;
    left: 0 !important;
    width: 100% !important;
    height: 0.4em !important;
    background: rgba(37, 99, 235, 0.2) !important;
    z-index: -1 !important;
    border-radius: 2px !important;
}
.premium-badge {
    padding: 0.4em 1.2em !important;
    background: #f8fafc !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 0.9em !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    border: 1px solid #e2e8f0 !important;
    line-height: 1.2 !important;
}


/* ==========================================================================
   Button Decoration Styles (ボタン装飾)【削除済み】
   .btn-premium / .btn-glassy / .btn-arrow-slide / .btn-soft-outline の
   エディタ用スタイル（約80行）を削除した。

   フロント側の同スタイルは style.css で先に削除されており（経緯はそちらの
   「Button Decoration Styles」節を参照）、ここだけが残っていたため
   「編集画面では装飾されて見えるのに公開すると何も起きない」状態だった。
   選択用のパネルも block-extensions.js から削除済み。
   ========================================================================== */

/* =========================================================
   Local Navigation — wrapper spacing
   ========================================================= */
.front-local-nav {
    margin: 0 auto;
    padding: 0 0 10px 0;
    max-width: 1200px;
    width: 100%;
}

@media screen and (max-width: 760px) {
    .front-local-nav {
        padding-left: 0;
    }
}

/* content-secondary の上下余白リセット */
.content-secondary {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* スマホでローカルナビをヘッダー直下に表示（コンテンツより前） */
@media screen and (max-width: 568px) {
    #content {
        display: flex;
        flex-direction: column;
    }
    #content .content-secondary {
        order: 1;
    }
    #content .content-article {
        order: 2;
    }
}

/* ショートコードブロック・各フロントセクションの余白リセット */
.wp-block-shortcode,
.front-local-nav,
.front-alert,
.front-information {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* front-alert 内の l-content 上下 padding を縮小 */
.front-alert .l-content {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* front-information の padding-bottom を上書き（style.css の 80px を縮小） */
.front-information {
    padding-bottom: 20px !important;
}

/* front-alert の各 li 上下パディング */
.front-alert .archive-list-item li {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

/* WordPressブロックギャップのリセット */
/* --wp--style--block-gap を 0 に上書きし、is-layout-flow の gap も消す。
   単位は必ず付ける（0px）。単位なしの 0 だと、コアが幅指定ボタンで使う
   width: calc(50% - var(--wp--style--block-gap, .5em) * .5) が
   「パーセント − 単位なし数値」になって計算式全体が無効化され、
   width 指定ごと捨てられてボタンがコンテンツ幅に潰れていた
   （フロントで width-25/50/75 の幅指定が効かない原因。width-100 以外が該当）。
   0px にすると calc(50% - 0px * .5) = 50% と有効になり、幅指定が効く。
   ※このファイルはフロントでも読み込まれている。 */
main.normalize {
    --wp--style--block-gap: 0px !important;
}
/* ここは以前 !important を付けていたが外した。
   margin-block-start は横書きでは margin-top に相当し、!important だと
   **エディタで設定した上下の余白（インラインstyle）まで潰していた。**
   実測でトップページの7箇所が該当し、いずれも指定した値が0pxになっていた
   （例: wp-block-columns の margin-top が spacing--60 指定なのに 0px）。

   !important は不要だった。コア側の該当規則は
     :root :where(.is-layout-flow) > * { margin-block-start: 24px }
   で、:where() のため詳細度が (0,1,0)。
   こちらは (0,2,1) なので !important 無しでも勝つ。
   結果、コアの既定24pxは従来どおり消しつつ、
   エディタの明示指定（インライン）だけが通るようになる。

   外したときの影響はFEATURESセクションのみ。カード5枚が15px高くなり
   ページ全高が 7967 → 8027px（+60px）。他セクションへの波及なし。 */
main.normalize > *,
main.normalize .is-layout-flow > *,
main.normalize .is-layout-flow > * + * {
    margin-block-start: 0;
    margin-block-end: 0;
}

/* =========================================================
   Local Navigation — "Underline Stack"
   ========================================================= */
.local-nav.ln-underline {
    --nav-navy:   #022451;
    --nav-accent: #E85959;
    --nav-line:   #e7e5df;

    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    font-family: "Noto Sans JP", system-ui, -apple-system,
                 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

.local-nav.ln-underline > li { list-style: none; }

/* グリッド項目が min-width:auto で縮まず、スマホで最終項目が数px右にはみ出して
   ページに横スクロールが出るのを防ぐ（項目をセル幅内に収める） */
.local-nav.ln-underline > li,
.local-nav.ln-underline a {
    min-width: 0;
    box-sizing: border-box;
}

.local-nav.ln-underline a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 28px 12px 32px;
    height: 140px;
    box-sizing: border-box;
    position: relative;
    text-decoration: none;
    color: var(--nav-navy);
    background: none;
    -webkit-tap-highlight-color: transparent;
}


.local-nav.ln-underline .ico-wrap {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.local-nav.ln-underline .ico {
    width: 32px;
    height: 32px;
    color: var(--nav-navy);
    stroke-width: 1.5;
    display: block;
    flex-shrink: 0;
}

.local-nav.ln-underline .label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .04em;
    line-height: 1.45;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.local-nav.ln-underline .label .br { display: block; }

.local-nav.ln-underline a::after {
    content: "";
    position: absolute;
    left: 50%;
    right: 50%;
    bottom: 14px;
    height: 2px;
    background: var(--nav-accent);
    transition: left .3s ease, right .3s ease;
}
.local-nav.ln-underline a:hover::after,
.local-nav.ln-underline a:focus-visible::after {
    left: 24px;
    right: 24px;
}
.local-nav.ln-underline a:focus-visible { outline: none; }

@media (max-width: 760px) {
    .local-nav.ln-underline {
        gap: 4px;
    }
    .local-nav.ln-underline a {
        padding: 10px 4px 14px;
        height: auto;
    }
    .local-nav.ln-underline .ico-wrap {
        height: auto;
        margin-bottom: 6px;
    }
    .local-nav.ln-underline .ico {
        width: 20px;
        height: 20px;
    }
    .local-nav.ln-underline .label {
        font-size: 9px;
        letter-spacing: 0;
    }
    .local-nav.ln-underline a::after {
        bottom: 6px;
    }
    .local-nav.ln-underline a:hover::after,
    .local-nav.ln-underline a:focus-visible::after {
        left: 8px;
        right: 8px;
    }
}

/* 部活一覧 固定ページ レイアウト */
.club-list-content .wp-block-group,
.club-list-content .is-layout-grid,
.club-list-content .is-layout-constrained > * {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* カバーブロック内ボタンをタイル全体のリンクに */
.club-list-content .wp-block-cover {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, brightness 0.2s ease;
}
.club-list-content .wp-block-cover:hover {
    transform: scale(1.04);
    filter: brightness(1.1);
}

/* inner-containerをカバー全体に広げる */
.club-list-content .wp-block-cover .wp-block-cover__inner-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* ボタンをオーバーレイに（最前面・透明） */
.club-list-content .wp-block-cover .wp-block-buttons {
    position: absolute;
    inset: 0;
    z-index: 2;
    margin: 0;
    padding: 0;
}
.club-list-content .wp-block-cover .wp-block-button {
    position: absolute;
    inset: 0;
    margin: 0;
}
.club-list-content .wp-block-cover .wp-block-button__link {
    position: absolute;
    inset: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    color: transparent;
    font-size: 0;
    border-radius: 0 !important;
}

.club-list-content .is-layout-grid {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 8px !important;
    width: 100%;
}

@media (max-width: 768px) {
    .club-list-content .is-layout-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }
}

/* ==========================================================================
   蛍光ペン（インライン）
   block-formats.js が選択範囲を <mark class="tg-marker-*"> で囲む。

   このファイルはエディタ（add_editor_style）とフロント（wp_enqueue_scripts）の
   両方で読み込まれるので、ここに書けば編集中も公開後も同じ見た目になる。
   functions.php の gakkan_enqueue_block_styles() を参照。

   ブロック全体に付く .marker-yellow / .marker-blue とはクラス名を分けてある。
   あちらは display:table を持つため、インラインに使うと語句が塊で改行される。
   ========================================================================== */
mark.tg-marker-yellow,
mark.tg-marker-blue {
    /* ブラウザ標準の mark は黄色ベタ塗り＋黒文字なので打ち消す。
       線は background-image のグラデーションで引く。 */
    background-color: transparent;
    background-repeat: no-repeat;
    color: inherit;

    /* WebKit（iOS Safari）は、素のインライン要素に clip-path を適用しない。
       そのため iPhone では傾きが出ず、ただの帯に見えていた。
       display:inline-block にして「1つの箱」にすると適用される。
       vertical-align は既定と同じ baseline を明示して、行内での
       上下位置がブラウザ間でぶれないようにしておく。 */
    display: inline-block;
    vertical-align: baseline;

    /* 左右を右上がりに傾けて平行四辺形にする（蛍光ペンで一息に引いた形）。
       切り落とす 0.5em ぶんを padding で確保しているので、文字自体は切れない。

       ※ clip-path は要素全体の外接矩形に対して効くため、マークした語句が
         行末で折り返すと形が崩れる。長い文をまとめてマークしないこと。
         折り返し前提なら、傾きを斜めグラデーションで表現する方法に
         変える必要がある（傾きは弱くなる）。 */
    padding: 0 0.55em;
    -webkit-clip-path: polygon(0.5em 0, 100% 0, calc(100% - 0.5em) 100%, 0 100%);
    clip-path: polygon(0.5em 0, 100% 0, calc(100% - 0.5em) 100%, 0 100%);
}

/* 上端をぼかして、実際の蛍光ペンのにじみに寄せる。
   透明→薄い→濃い と3段階で変化させ、下端も少し手前で抜く。 */
mark.tg-marker-yellow {
    background-image: linear-gradient(
        transparent 42%,
        rgba(255, 230, 80, 0.28) 50%,
        rgba(255, 230, 80, 0.8) 62%,
        rgba(255, 230, 80, 0.8) 92%,
        transparent 97%
    );
}

mark.tg-marker-blue {
    background-image: linear-gradient(
        transparent 42%,
        rgba(140, 200, 255, 0.28) 50%,
        rgba(140, 200, 255, 0.8) 62%,
        rgba(140, 200, 255, 0.8) 92%,
        transparent 97%
    );
}
