/* =================================================================
 * Page Specific Styles for Golden Ratio Tool (style.css) [v21]
 * ================================================================= */

/* --- 新規追加: Utility Classes --- */
.th-ratio-name {
    width: 20%;
}
.th-ratio-val {
    width: 15%;
}
.text-bronze {
    color: #cd7f32;
}
.card-header-ratio {
    min-height: 3.5rem;
}
.btn-spiral-toggle {
    --bs-btn-padding-y: .1rem;
    --bs-btn-padding-x: .4rem;
    font-size: .75rem;
}
.input-width-xs {
    width: 70px;
}
#page-toast-container {
    z-index: 1100;
}
.badge-ratio-label {
    font-size: 0.65em;
    font-weight: normal;
    vertical-align: text-bottom;
}
.badge-typo-label {
    font-size: 0.65em;
    font-weight: normal;
}
.subtext-typo {
    font-size: 0.85em;
}

/* --- 1. ビジュアライザー (アスペクト比コンテナ) --- */
.visualizer {
    position: relative;
    width: 100%;
    height: 0;
    /* JS (padding-top) で高さを制御 */
    border: 1px solid var(--bs-border-color);
    /* 枠線を薄く */
    overflow: visible;
    /* 寸法線を外に出すため visible に変更 */
    margin-bottom: 1.5rem;
    /* 下部の寸法線用スペース */
    margin-right: 1.5rem;
    /* 右側の寸法線用スペース */
    transition: padding-top 0.2s ease;
}

.visualizer.split-viz {
    background-color: transparent;
}

.viz-box-a,
.viz-box-b {
    position: absolute;
    bottom: 0;
    transition: width 0.2s ease, left 0.2s ease, height 0.2s ease, top 0.2s ease, opacity 0.2s ease;
    /* ボックス内のテキスト（分割モード用）を中央配置 */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* A領域の色 */
.viz-box-a {
    background-color: var(--bs-info-bg-subtle);
    border: 1px solid var(--bs-info-border-subtle);
}

/* B領域の色 */
.viz-box-b {
    background-color: var(--bs-success-bg-subtle);
    border: 1px solid var(--bs-success-border-subtle);
}

/* --- 2. 寸法線 (Dimension Lines) --- */
.dim-line {
    position: absolute;
    background-color: var(--bs-primary);
    opacity: 0.6;
    pointer-events: none;
    z-index: 10;
}

/* 横方向の寸法線 */
.dim-line-h {
    height: 1px;
    bottom: -10px;
    left: 0;
    width: 100%;
}

/* 縦方向の寸法線 */
.dim-line-v {
    width: 1px;
    right: -10px;
    top: 0;
    height: 100%;
}

/* 寸法線の端点 (ヒゲ) */
.dim-line-h::before,
.dim-line-h::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 6px;
    top: -3px;
    background-color: var(--bs-primary);
}

.dim-line-h::before {
    left: 0;
}

.dim-line-h::after {
    right: 0;
}

.dim-line-v::before,
.dim-line-v::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 1px;
    left: -3px;
    background-color: var(--bs-primary);
}

.dim-line-v::before {
    top: 0;
}

.dim-line-v::after {
    bottom: 0;
}

/* 寸法ラベル */
.dim-label {
    position: absolute;
    font-size: 0.7rem;
    color: var(--bs-primary);
    background-color: var(--bs-body-bg);
    padding: 0 2px;
    white-space: nowrap;
}

.dim-label-h {
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
}

.dim-label-v {
    right: -35px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

/* --- 3. タイポグラフィモード --- */
.typo-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1.5rem 1rem;
    /* はみ出した場合はスクロール */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* 上詰め */
    gap: 0.5rem;
    background-color: var(--bs-body-bg);
}

.typo-line {
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.typo-line span {
    color: var(--bs-secondary-color);
    font-size: 0.5em;
    /* 親文字サイズの半分 */
    margin-left: 0.5rem;
    font-weight: normal;
    vertical-align: middle;
}

/* --- 4. 分割モード用ボックス内ラベル --- */
.box-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #444;
    /* コントラスト確保のため濃いグレー */
    background-color: rgba(255, 255, 255, 0.7);
    /* 背景色となじませるための半透明白 */
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    /* クリック等を透過 */
}

/* --- 5. 計算結果テキスト --- */
.result-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

.result-text strong {
    color: var(--bs-emphasis-color);
    word-break: break-all;
}

/* --- 6. コピーボタン --- */
.btn-copy {
    display: inline-block;
    cursor: pointer;
    color: var(--bs-secondary-color);
    margin-left: 4px;
    transition: color 0.2s;
}

.btn-copy:hover {
    color: var(--bs-primary);
}

/* --- 7. CSSスニペット --- */
.css-snippet {
    font-family: var(--bs-font-monospace);
    font-size: 0.8em;
    padding: 1.75rem 0.5rem 0.5rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius-sm);
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    position: relative;
    word-break: break-all;
    border-left: 3px solid var(--bs-primary);
    /* モダン感を出すアクセント */
}

.css-snippet .btn-copy {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    font-size: 1.1em;
}

/* --- 8. クイック入力ボタン --- */
.quick-input-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-input-buttons .btn {
    padding: 0.1rem 0.5rem;
    font-size: 0.8em;
}

/* --- 9. 単位換算カード --- */
.conversion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.conversion-row:last-child {
    border-bottom: none;
}

.conversion-row .conversion-label {
    font-size: 0.9em;
    color: var(--bs-secondary-color);
}

.conversion-row .conversion-value {
    font-weight: bold;
}

/* --- 10. 比率の逆引き --- */
.reverse-result-area {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background-color: var(--bs-tertiary-bg);
}

.reverse-result-area strong {
    font-size: 1.2em;
    color: var(--bs-primary);
}

/* --- 11. 追加スタイル: カード説明テキスト (Typoモード用) --- */
.card-desc-text {
    display: block;
    font-size: 0.75rem;
    line-height: 1.3;
    margin-top: 0.25rem;
    color: var(--bs-secondary-color);
}

/* --- 12. 黄金螺旋オーバーレイ --- */
.spiral-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.spiral-overlay svg {
    width: 100%;
    height: 100%;
}

.spiral-curve {
    stroke-dasharray: 4000;
    stroke-dashoffset: 0;
}

/* --- 13. 特殊カード (単位換算・カスタム比率) --- */

/* 単位換算カード */
.card-conversion {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-tertiary-bg);
}
.card-conversion .card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--bs-secondary-border-subtle);
}

/* カスタム比率カードの入力欄（スタイリッシュ・モダン化） */
.custom-ratio-inputs input {
    background-color: var(--bs-primary-bg-subtle);
    border: 1px solid transparent;
    color: var(--bs-primary);
    border-radius: var(--bs-border-radius-sm);
    transition: all 0.2s ease-in-out;
}
.custom-ratio-inputs input:focus {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* =================================================================
 * 14. 最重要入力欄（基準の長さ）のハイライト設定
 * ================================================================= */
#base-length-input {
    border: 2px solid var(--bs-primary); /* 枠線を太くしてテーマカラー(青)に */
    font-weight: bold; /* 数字を太く強調 */
    background-color: var(--bs-body-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* 影をつけて少し浮かせる */
    transition: all 0.2s ease-in-out;
}

/* フォーカス（入力中）のアニメーション */
#base-length-input:focus {
    transform: translateY(-2px); /* 入力しようとするとフワッと浮き上がる */
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.15), 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ダークモード時の調整 */
[data-bs-theme="dark"] #base-length-input {
    background-color: rgba(13, 110, 253, 0.05); /* 背景にうっすらと青を敷く */
    border-color: #86b7fe; /* ダークモード用の明るい青枠 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] #base-length-input:focus {
    background-color: rgba(13, 110, 253, 0.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}