/* ==========================================================================
   RYUHEIDOU / app.css — 中央カラムだけをアプリ風にする（p.app のページが読む）
   左右レール・トークン・既存コンポーネントはそのまま。
   ========================================================================== */

:root {
    --header-h: 52px;
    --tab-h: 66px;
}

/* タブバーに隠れない下余白 */
.column { padding-bottom: var(--tab-h); min-height: 100vh; min-height: 100dvh; }

/* HOME は 1 画面ぴったりなので、ページ自体は動かさない。
   （スマホの 100vh はアドレスバー込みで dvh より高く、その差ぶんスライドしてしまう） */
html:has(.hero), html:has(.hero) body { overflow: hidden; overscroll-behavior: none; height: 100dvh; }

/* ----- アプリバー ------------------------------------------------------ */
.site-header { height: var(--header-h); border-bottom: var(--border); background: color-mix(in srgb, var(--paper-2) 92%, transparent); backdrop-filter: blur(6px); }
.site-header__logo img { height: 20px; width: auto; }
.app-title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--font-display); font-size: 1.25rem; letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: baseline; gap: .5rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s; }
.app-title small { font: 700 var(--fs-xs)/1 var(--font-body); color: var(--ink-faint); letter-spacing: .1em; }
.site-header.has-title .app-title { opacity: 1; }

/* ----- HOME：1画面に収める --------------------------------------------
   ヘッダーとタブバーを引いた高さ = スクロール無しでぴったり。
   hero__body は上へ、元の位置（下）に NEWS を置く。SNS 縦列はそのまま右下。 */
.hero { height: calc(100dvh - var(--header-h) - var(--tab-h)); min-height: 0; }
.hero__body { top: var(--sp-5); bottom: auto; }

.hero-news {
    position: absolute;
    left: var(--col-pad);
    right: 72px;                 /* SNS 列（40px + 余白）を避ける */
    bottom: var(--sp-6);
    /* SNS 縦列と同じ高さ：アイコン 40px × 5 + 隙間 var(--sp-2) × 4（下端も揃う） */
    box-sizing: border-box;
    height: calc(5 * 40px + 4 * var(--sp-2));
    display: flex; flex-direction: column;
    background: var(--paper-2);
    border: var(--border-thick);
    box-shadow: var(--shadow);
}
.hero-news__head {
    flex: none; display: flex; align-items: baseline; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-bottom: var(--border);
    background: var(--acid);
}
.hero-news__head b { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; letter-spacing: .05em; text-transform: uppercase; line-height: 1; }
.hero-news__head span { font: 700 var(--fs-xs)/1 var(--font-mono); color: var(--ink-soft); }
.hero-news .news { flex: 1 1 auto; min-height: 0; max-height: none; border: 0; padding: 0 var(--sp-3); background: transparent; }

/* ----- セクションを「画面」らしく：区切り罫を消し、見出しを軽く -------- */
.section { border-bottom: none; padding: var(--sp-5) var(--col-pad) var(--sp-4); }
.section__head { margin-bottom: var(--sp-4); align-items: center; }

/* 見出し：[英語タイトル] ──────── [日本語]
   左右の端に置いた 2 つの間を直線でつなぐ（視線を右へ導き、区切りにもなる） */
.section__ja {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-3);
    white-space: nowrap;
}

.section__ja::before {
    content: "";
    flex: 1 1 auto;
    min-width: var(--sp-4);
    height: var(--bw);
    background: var(--ink);
}
.section__num { display: none; }
.section__title { font-size: 1.75rem; }

/* ----- 押した感触 ------------------------------------------------------ */
.card, .banner, .btn, .contact__card { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card:active, .banner:active, .contact__card:active { transform: translate(3px, 3px); box-shadow: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ----- ボトムタブバー：項目を等幅で並べる ------- */
.tabbar {
    position: fixed; z-index: 150;
    left: 50%; transform: translateX(-50%);
    width: min(100%, var(--col));
    bottom: 0;
    /* border-box にして左右の罫線ぶんも幅に含める（本体カラムと同じ幅になる） */
    box-sizing: border-box;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(var(--tabs, 7), minmax(0, 1fr));
    background: var(--paper-2);
    border-top: var(--border-thick);
    border-inline: var(--border);
}
.tabbar__home,
.tabbar__cell { min-width: 0; padding: 6px 2px; }
.tabbar__home { padding-left: 4px; }
.tabbar__cell:last-child { padding-right: 4px; }

.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 100%; height: 100%; padding: 0 1px;
    color: var(--ink-soft); text-decoration: none;
    font: 700 10px/1 var(--font-mono); letter-spacing: .02em; text-transform: uppercase;
    border: 2px solid transparent; background: none; cursor: pointer;
    transition: background var(--dur), color var(--dur);
}
.tab svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
.tab:active svg { transform: scale(.82); }
.tab[aria-current="page"] { background: var(--acid); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.tab[aria-current="page"] svg { transform: translateY(-1px) scale(1.08); }

/* 幅の狭い画面では文字を少し小さくして、MATERIAL が収まるようにする */
@media (max-width: 400px) { .tab { font-size: 9px; letter-spacing: 0; } }
@media (max-width: 340px) { .tab { font-size: 8px; } .tab svg { width: 20px; height: 20px; } }

/* ドロワーはタブバーより前面に */
.drawer { z-index: 300; }

/* ----- 一覧ページ：落書きギャラリーは 3 列の正方形 ---------------- */
.gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.gallery__item { box-shadow: var(--shadow-sm); }

/* ブログの年の見出しなど、タイルの上に付く小見出し */
.tiles-label { margin: var(--sp-5) 0 var(--sp-3); font-family: var(--font-display); font-size: var(--fs-lg); letter-spacing: .06em; }
.tiles-label:first-child { margin-top: 0; }
.tiles-label a { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--blue); text-underline-offset: 3px; }

/* ==========================================================================
   Windows 風ウィンドウ（Art のギャラリー：画像ビューアー + スライドショー）
   ・タイトルバー（青グラデ）/ 最小化・最大化・閉じる / ツールバー /
     黒い表示領域（へこんだ枠）/ ステータスバー
   ・面は紙色、立体は「明るい辺 + 暗い辺」の 2 色の縁で出す（クラシック Windows の凸凹）
   ========================================================================== */

.modal--win {
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    background:
        repeating-conic-gradient(rgba(22, 18, 15, .93) 0% 25%, rgba(22, 18, 15, .86) 0% 50%) 0 0 / 4px 4px;
}

.win {
    --win-face: var(--paper-3);
    --win-hi: #fffdf5;
    --win-lo: #7a7164;
    display: flex;
    flex-direction: column;
    width: min(100%, 720px);
    max-height: calc(100dvh - var(--sp-5));
    background: var(--win-face);
    border: 2px solid var(--ink);
    box-shadow: inset 2px 2px 0 var(--win-hi), inset -2px -2px 0 var(--win-lo), var(--shadow-lg);
    padding: 3px;
    font-size: var(--fs-sm);
}

.win.is-dragging { opacity: .92; }

/* ---- タイトルバー ---- */
.win__title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 3px 3px 3px var(--sp-2);
    background: linear-gradient(90deg, var(--blue), #3d84c8);
    color: #fff;
    cursor: move;
    touch-action: none;
    user-select: none;
}

.win__icon { flex: none; width: 16px; height: 16px; }

.win__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: var(--fs-sm);
}

.win__ctl { flex: none; display: flex; gap: 2px; }

.win__btn {
    width: 22px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0;
    background: var(--win-face);
    border: 0;
    box-shadow: inset 1px 1px 0 var(--win-hi), inset -1px -1px 0 var(--ink), inset -2px -2px 0 var(--win-lo);
    color: var(--ink);
    cursor: pointer;
}

.win__btn:active {
    box-shadow: inset 1px 1px 0 var(--ink), inset 2px 2px 0 var(--win-lo);
}

.win__btn--close { margin-left: 3px; }
.win__btn--close:hover { background: var(--red); color: #fff; }

/* ボタンの記号は CSS で描く（フォント差で崩れないように） */
.win__g { position: relative; display: block; width: 10px; height: 10px; }
.win__g--max::after { content: ""; position: absolute; inset: 0; border: 1px solid currentColor; border-top-width: 2px; }
.modal--win[data-max="true"] .win__g--max::before { content: ""; position: absolute; right: -1px; top: -2px; width: 7px; height: 7px; border: 1px solid currentColor; border-top-width: 2px; background: var(--win-face); z-index: 1; }
.modal--win[data-max="true"] .win__g--max::after { inset: 3px 3px 0 0; }
.win__g--close::before, .win__g--close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; background: currentColor; }
.win__g--close::before { transform: translate(-50%, -50%) rotate(45deg); }
.win__g--close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ---- ツールバー ---- */
.win__toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 2px;
    border-bottom: 1px solid var(--win-lo);
    box-shadow: 0 1px 0 var(--win-hi);
}

.win__tool {
    padding: 3px var(--sp-3);
    background: var(--win-face);
    border: 0;
    box-shadow: inset 1px 1px 0 var(--win-hi), inset -1px -1px 0 var(--ink), inset -2px -2px 0 var(--win-lo);
    font: 700 var(--fs-xs)/1.4 var(--font-body);
    color: var(--ink);
    cursor: pointer;
}

.win__tool:active,
.win__tool[aria-pressed="true"] {
    box-shadow: inset 1px 1px 0 var(--ink), inset 2px 2px 0 var(--win-lo);
    background: var(--paper-2);
    padding: 4px calc(var(--sp-3) - 1px) 2px var(--sp-3);
}

.win__tool:focus-visible,
.win__btn:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }

.win__sep { width: 2px; align-self: stretch; margin: 2px 3px; background: var(--win-lo); box-shadow: 1px 0 0 var(--win-hi); }

/* ---- 表示領域（へこんだ黒い枠） ---- */
.win__screen {
    flex: 1 1 auto;
    min-height: 0;
    margin: 4px 0;
    display: grid;
    place-items: center;
    background: var(--ink);
    box-shadow: inset 2px 2px 0 var(--win-lo), inset -2px -2px 0 var(--win-hi);
    border: 2px solid var(--ink);
    overflow: hidden;
}

.win__screen img {
    max-width: 100%;
    max-height: calc(100dvh - 190px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.modal--win[data-loading="true"] .win__screen img { opacity: 0; }

/* ---- ステータスバー ---- */
.win__status {
    display: flex;
    gap: 3px;
    align-items: stretch;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.win__cell {
    display: flex;
    align-items: center;          /* 上下中央 */
    margin: 0;
    padding: 2px var(--sp-2);
    box-shadow: inset 1px 1px 0 var(--win-lo), inset -1px -1px 0 var(--win-hi);
    white-space: nowrap;
}

.win__status .modal__caption { flex: 1 1 auto; min-width: 0; overflow: hidden; }

/* ---- 最大化 ---- */
.modal--win[data-max="true"] { padding: 0; }
.modal--win[data-max="true"] .win { width: 100%; height: 100dvh; max-height: none; border-width: 0; }
.modal--win[data-max="true"] .win__title { cursor: default; }
.modal--win[data-max="true"] .win__screen img { max-height: calc(100dvh - 130px); }

@media (max-width: 480px) {
    .win__tool { padding-inline: var(--sp-2); }
}

/* 通常モーダル用の装飾（青い影・傾いた札）をウィンドウ内では打ち消す */
.modal--win { grid-template-rows: none; gap: 0; }
.modal--win .win__screen img { background: none; border: 0; box-shadow: none; }
.modal--win .win__status .modal__counter { background: none; color: var(--ink); transform: none; letter-spacing: 0; font-weight: 400; padding: 2px var(--sp-2); }
.modal--win .win__status .modal__caption { max-width: none; color: var(--ink); font-size: var(--fs-xs); }

/* ==========================================================================
   外部サイトへ移動する前の確認（Windows のメッセージボックス風）
   ========================================================================== */
.win--dialog { width: min(100%, 420px); }
.modal--dialog { z-index: 600; }

.win__dialog { padding: var(--sp-4) var(--sp-3) var(--sp-3); }

.win__target {
    margin: 0 0 var(--sp-1);
    font-weight: 900;
    font-size: var(--fs-base);
    line-height: var(--lh-snug);
}

.win__msg { margin: 0 0 var(--sp-3); color: var(--ink-soft); line-height: var(--lh-snug); }

.win__choices { display: grid; gap: var(--sp-2); }

.win__choice {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--win-face);
    color: var(--ink);
    text-decoration: none;
    box-shadow: inset 1px 1px 0 var(--win-hi), inset -1px -1px 0 var(--ink), inset -2px -2px 0 var(--win-lo);
}

.win__choice b { font-size: var(--fs-base); }
.win__choice small { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.win__choice:hover,
.win__choice:focus-visible { background: var(--acid); outline: 1px dotted var(--ink); outline-offset: -4px; }

.win__choice:active { box-shadow: inset 1px 1px 0 var(--ink), inset 2px 2px 0 var(--win-lo); }

.win__actions { display: flex; justify-content: flex-end; margin-top: var(--sp-4); }
.win__actions .win__tool { min-width: 6rem; padding-block: var(--sp-2); }

/* ==========================================================================
   ABOUT：SNS ボタン（アイコン + 名前、2 列）
   ========================================================================== */
.follow {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
}

.follow__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--paper-2);
    border: var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 900;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.follow__link .icon { flex: none; width: 24px; height: 24px; }

.follow__link:hover,
.follow__link:focus-visible { background: var(--acid); transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.follow__link:active { transform: translate(2px, 2px); box-shadow: none; }

/* SNS ボタンも、同じ行の高さをそろえる */
.follow li { display: flex; }
.follow__link { flex: 1 1 auto; }

/* 幅の狭い画面：ロゴとページ名がぶつからないよう、日本語の添え名は省く */
@media (max-width: 430px) {
    .app-title small { display: none; }
}
@media (max-width: 340px) { .site-header__logo img { height: 16px; } }

/* ==========================================================================
   詳細ページ（作品など）の先頭：戻る / 1 枚絵 / タイトル / 一言 / ボタン
   ========================================================================== */
.appdetail { padding: var(--sp-4) var(--col-pad) 0; }

.appdetail__back {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-2);
    margin-bottom: var(--sp-4);
    background: var(--paper-2);
    border: var(--border);
    box-shadow: var(--shadow-sm);
    font: 700 var(--fs-xs)/1.6 var(--font-mono);
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.appdetail__back span { font-size: 1.25rem; line-height: 1; }
.appdetail__back:hover,
.appdetail__back:focus-visible { background: var(--acid); }
.appdetail__back:active { transform: translate(2px, 2px); box-shadow: none; }

.appdetail__media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: var(--border-thick);
    box-shadow: var(--shadow);
    background: var(--paper-3);
}

.appdetail__media img { width: 100%; height: 100%; object-fit: cover; }

.appdetail__title {
    margin-top: var(--sp-4);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    line-height: var(--lh-tight);
    letter-spacing: .02em;
    text-transform: uppercase;
}

.appdetail__lead {
    margin-top: var(--sp-3);
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    color: var(--ink-soft);
}

.appdetail__head .linkset {
    margin-top: var(--sp-4);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* ボタンは中央に */
    gap: var(--sp-3);
}

/* 日本語の題（ブログ記事など）と、題の上の一行（カテゴリ・日付） */
.appdetail__meta {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
    font: 700 var(--fs-xs)/1 var(--font-mono);
    letter-spacing: .08em;
    color: var(--ink-soft);
}

.appdetail__meta + .appdetail__title { margin-top: var(--sp-2); }

.appdetail__title--ja {
    font-family: var(--font-body);
    font-weight: 900;
    font-size: clamp(1.25rem, 5.6vw, 1.6rem);
    line-height: var(--lh-snug);
    letter-spacing: 0;
    text-transform: none;
}
