/* ==========================================================================
   iris-bridge.css — 伊里斯桥（色彩转换）页面样式
   类别：页面（iris-bridge.php 专属）
   布局：左侧可拖拽调色盘 + 透明度条；右侧各颜色格式输入框组
   对齐：每行输入框组两端对齐（同宽）；复制按钮展开用绝对定位，不影响布局
   ========================================================================== */

.iris-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 48px 24px 72px;
}

/* 左右内容：调色盘 + 输入框组（横排） */
.iris-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 56px;
}

/* ---------- 左：调色盘 ---------- */
.iris-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.ir-picker-canvas {
    border-radius: 16px;
    cursor: crosshair;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.ir-alpha-track {
    position: relative;
    width: 280px;
    height: 20px;
}

.ir-alpha-canvas {
    width: 280px;
    height: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
}

.ir-alpha-thumb,
.ir-value-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 26px;
    border-radius: 7px;
    background: #fff;
    border: 2px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* 明度条（透明度条下方，与透明度条一致样式） */
.ir-value-track {
    position: relative;
    width: 280px;
    height: 20px;
}

.ir-value-canvas {
    width: 280px;
    height: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
}

/* ---------- 右：输入框组 ---------- */
.iris-fields {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

/* 每行：标签 + 输入框组 + 示意 + 复制 */
.ir-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ir-label {
    width: 52px;
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: right;
}

/* 输入框组：两端对齐（总宽 256px，gap 4px）
   4 段时每段 61px：61*4 + 4*3 = 256；HEX 由 # 前缀 + 输入框组成同宽
   （加宽后 OKLCH 四位小数可完整显示） */
.ir-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 256px;
    flex-shrink: 0;
}

.ir-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
    text-align: center;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ir-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

/* 隐藏浏览器步进器（number input spinner） */
.ir-input[type="number"]::-webkit-outer-spin-button,
.ir-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ir-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* HEX：外侧 # 符号 + 输入框 */
.ir-hash {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.ir-hex-inputs .ir-input {
    text-transform: uppercase;
}

/* 圆形颜色示意 */
.ir-swatch {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* 复制按钮（圆形本体；桌面悬停时原位刷新为两个胶囊，绝对定位不推挤主内容） */
.ir-copy {
    position: relative;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
}

/* 按钮本体：固定 30px 圆形图标（不因展开改变尺寸 → 不推挤行内其它元素）
   悬停时仅淡出图标（保留盒模型 → hover 区域不丢失、不死循环） */
.ir-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s,
                opacity 0.18s;
}

.ir-copy-btn iconify-icon { font-size: 1rem; }

/* 胶囊菜单：绝对定位到图标原位（left:0），双按钮从原位置向右排布；
   不占文档流、不推挤内容；鼠标无需移动即可点击 */
.ir-copy-menu {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    height: 30px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s, visibility 0.18s;
}

/* 两个胶囊选项：相邻贴合，视觉上与图标连成一体 */
.ir-copy-opt {
    display: flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    background: var(--surface-solid);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

/* 第一个胶囊：左侧圆角（独立成首个胶囊） */
.ir-copy-opt:first-of-type {
    border-left: 1px solid var(--border);
    border-radius: 15px 0 0 15px;
}

/* 第二个胶囊：右侧圆角 */
.ir-copy-opt:last-of-type {
    border-right: 1px solid var(--border);
    border-radius: 0 15px 15px 0;
}

.ir-copy-opt:hover { color: #a5f3fc; background: rgba(255, 255, 255, 0.06); }

.ir-copy-opt.active { background: rgba(34, 211, 238, 0.14); }

.ir-copy-opt.copied { color: var(--green); background: rgba(52, 211, 153, 0.16); }

/* 桌面：悬停 / 聚焦时双按钮在原位刷新显示，同时图标淡出（只淡出、不隐藏盒模型
   → hover 区域持续存在，鼠标不动时不恢复、不闪烁、不死循环） */
.ir-copy:hover .ir-copy-menu,
.ir-copy:focus-within .ir-copy-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ir-copy:hover .ir-copy-btn,
.ir-copy:focus-within .ir-copy-btn {
    opacity: 0;
    /* 禁用图标自身的鼠标事件（避免拦截下方双按钮），但保留 30px 盒模型：
       父容器 .ir-copy 的 hover 仍持续 → 鼠标不动不恢复、不闪烁、不死循环 */
    pointer-events: none;
}

.ir-copy-btn:hover,
.ir-copy-btn:focus-visible {
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--accent);
    background: rgba(34, 211, 238, 0.08);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.18);
}

/* 按钮本体「已复制」闪烁（移动端点图标时） */
.ir-copy-btn.copied {
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.12);
}

/* ---------- 色域提示：主内容下方的列表类横幅（动态显隐，无关闭按钮） ---------- */
.ir-banner-list {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ir-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-left: 3px solid var(--orange);
    border-radius: var(--radius-md);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: ir-banner-in 0.25s ease;
}

/* 作者 display:flex 覆盖 [hidden] 的 UA 默认，需显式补回 */
.ir-banner[hidden] { display: none; }

@keyframes ir-banner-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ir-banner > iconify-icon {
    flex-shrink: 0;
    color: var(--orange);
    font-size: 1.15rem;
    margin-top: 1px;
}

.ir-banner-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.5;
}

/* ---------- 移动端：纵向排列；复制胶囊直接显示，与输入框组两侧对齐 ---------- */
@media (max-width: 820px) {
    .iris-main { gap: 32px; padding: 36px 18px 56px; }
    .iris-body { flex-direction: column; gap: 36px; }
    .ir-inputs { width: 224px; }
    .ir-label { width: 44px; }
    .ir-banner-list { max-width: 100%; }

    /* 复制按钮：换行到输入框组下方独占一行，宽度与输入框组一致、左缘对齐输入框组
       （label + gap 后 → margin-left = 44 + 10；宽 224 = 输入框组宽） */
    .ir-row {
        flex-wrap: wrap;
        gap: 8px 10px;
    }
    .ir-copy {
        order: 5;
        flex: 0 0 224px;                 /* 固定宽，独占换行，不侵入其它元素 */
        width: 224px;                    /* 与输入框组同宽 */
        margin-left: calc(44px + 10px);  /* label + gap，对齐输入框组左缘 */
        position: static;                /* 重置桌面 relative，避免定位残留 */
        height: auto;
    }

    /* 移动端不需要复制图标：彻底隐藏按钮本体（menu 已是兄弟节点） */
    .ir-copy-btn { display: none; }

    /* 胶囊菜单：移动端转为静态流内、常显（无需悬停），两个胶囊均分占满 */
    .ir-copy-menu {
        position: static;                /* 强制静态，杜绝绝对定位侵入 */
        left: auto;
        top: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: flex;
        width: 100%;
        height: 32px;
    }

    /* 两个胶囊均分占满，居中文本 */
    .ir-copy-opt {
        flex: 1 1 0;
        min-width: 0;
        height: 32px;
        padding: 0 4px;
        justify-content: center;
        text-align: center;
        border-radius: 16px;             /* 整体胶囊 */
        background: rgba(34, 211, 238, 0.08);
    }
    .ir-copy-opt:first-of-type {
        border-left: 1px solid rgba(34, 211, 238, 0.3);
        border-radius: 16px 0 0 16px;
    }
    .ir-copy-opt:last-of-type {
        border-right: 1px solid rgba(34, 211, 238, 0.3);
        border-radius: 0 16px 16px 0;
    }
}
