/* Окно «фото плитки» вьюера мозаики (assets/js/cb-osd-tiles.js, 16.10.2026).
   Подключается article.php только к странице, где у вьюера есть карта ячеек (cb-osd--cells).
   Телефон — главный экран: фото сверху, лайк и комментарии под ним, всё в пределах высоты окна;
   кнопки не меньше 44 px. Токены — из css_internal/article.css (:root). */

/* рамка ячейки на мозаике: под курсором и на выбранной плитке */
.cb-osd__cell {
    pointer-events: none;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 255, 255, .35);
    border-radius: 2px;
}
.cb-osd__stage.has-cells.is-live .openseadragon-canvas { cursor: pointer; }

html.cb-tile-open, html.cb-tile-open body { overflow: hidden; }

.cb-tile {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(12, 13, 17, .78);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    touch-action: pan-y;
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--cb-ink, #1c1d22);
}
.cb-tile[hidden] { display: none; }

.cb-tile__card {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}

.cb-tile__photo {
    position: relative;
    flex: 0 1 auto;
    min-height: 200px;
    background: #15180f;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cb-tile__photo img {
    display: block;
    max-width: 100%;
    max-height: 56vh;
    max-height: 56dvh;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity .2s;
}
.cb-tile.is-loading .cb-tile__photo img { opacity: .25; }
.cb-tile__spin {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: cb-tile-spin .8s linear infinite;
    pointer-events: none;
}
.cb-tile.is-loading .cb-tile__spin { opacity: 1; }
@keyframes cb-tile-spin { to { transform: rotate(360deg); } }

.cb-tile__nav,
.cb-tile__close {
    position: absolute;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(251, 246, 236, .25);
    border-radius: 50%;
    background: rgba(22, 24, 31, .55);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cb-tile__nav:hover,
.cb-tile__close:hover { background: var(--cb-accent, #c02942); }
.cb-tile__nav svg,
.cb-tile__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cb-tile__nav { top: 50%; margin-top: -22px; }
.cb-tile__nav--prev { left: 10px; }
.cb-tile__nav--next { right: 10px; }
.cb-tile__close { top: 10px; right: 10px; }

.cb-tile__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--cb-line, #e4ded4);
}
.cb-tile__like {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 16px 0 12px;
    border: 1px solid var(--cb-line, #e4ded4);
    border-radius: 22px;
    background: #fff;
    color: var(--cb-ink, #1c1d22);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .2s, color .2s, background-color .2s;
}
.cb-tile__like svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}
.cb-tile__like.is-on {
    color: var(--cb-accent, #c02942);
    border-color: rgba(192, 41, 66, .45);
    background: #fdf1f3;
}
.cb-tile__like.is-on svg { fill: currentColor; }
.cb-tile__like[hidden] { display: none; }
.cb-tile__hint { font-size: 13px; color: var(--cb-muted, #6b7079); line-height: 1.3; }

.cb-tile__talk {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}
.cb-tile__talk[hidden] { display: none; }
.cb-tile__list {
    flex: 1 1 auto;
    min-height: 48px;
    max-height: 30vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 10px 14px 4px;
}
.cb-tile__empty,
.cb-tile__count { margin: 0 0 8px; font-size: 14px; color: var(--cb-muted, #6b7079); }
.cb-tile__c { margin: 0 0 10px; }
.cb-tile__ch { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.cb-tile__ch span { color: var(--cb-muted, #6b7079); font-size: 12px; }
.cb-tile__c p { margin: 2px 0 0; font-size: 15px; overflow-wrap: anywhere; }

.cb-tile__form {
    display: grid;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--cb-line, #e4ded4);
    background: var(--cb-tint, #f7f4ef);
}
.cb-tile__form input,
.cb-tile__form textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--cb-line, #e4ded4);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 16px;            /* меньше 16 — iPhone приближает страницу при вводе */
    color: inherit;
    resize: none;
}
.cb-tile__form input:focus,
.cb-tile__form textarea:focus { outline: 2px solid rgba(192, 41, 66, .35); border-color: var(--cb-accent, #c02942); }
.cb-tile__send { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.cb-tile__err { flex: 1; font-size: 13px; color: var(--cb-accent-ink, #94202f); }
.cb-tile__send button {
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 8px;
    background: var(--cb-accent, #c02942);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.cb-tile__send button:disabled { opacity: .6; cursor: default; }

@media (max-width: 600px) {
    .cb-tile { padding: 8px; align-items: flex-end; }
    .cb-tile__card { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
    .cb-tile__photo img { max-height: 44vh; max-height: 44dvh; }
    .cb-tile__list { max-height: 24vh; }
    .cb-tile__hint { display: none; }
}
