/* Club launch module styles. */

.launch-grid .launch-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.launch-grid .launch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.launch-card-photo {
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #f0f2f5;
    border-top-left-radius: var(--bs-card-inner-border-radius, 0.375rem);
    border-top-right-radius: var(--bs-card-inner-border-radius, 0.375rem);
}

.launch-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 3rem;
}

.launch-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.launch-days-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.launch-progress-ring {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.launch-progress-ring svg {
    display: block;
}

.launch-hero {
    border-left: 4px solid var(--bs-primary);
}

.launch-hero-photo {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.launch-hero-photo.is-drop {
    border-color: var(--bs-primary);
    background-color: #eef4ff;
}

.launch-hero-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.launch-hero-photo-placeholder {
    color: #adb5bd;
    text-align: center;
    font-size: 2.25rem;
}

.launch-hero-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.launch-tabs .nav-link {
    color: var(--bs-secondary);
    cursor: pointer;
}

.launch-tabs .nav-link.active {
    color: var(--bs-primary);
    font-weight: 600;
}

.launch-table table {
    font-size: 0.875rem;
}

.launch-table .form-control-sm,
.launch-table .form-select-sm {
    min-height: 28px;
}

.launch-table .drag-handle {
    cursor: grab;
    user-select: none;
}

.launch-table .drag-handle:active {
    cursor: grabbing;
}

.sortable-body .sortable-ghost {
    opacity: 0.4;
    background: #fff9e6;
}

/* Drag-drop visual affordances on the roadmap tree. */

.launch-tree-table .launch-tree-drag-ghost {
    opacity: 0.35;
    background: #e7f1ff;
    outline: 2px dashed var(--bs-primary, #3b82f6);
}

.launch-tree-table .launch-tree-drag-chosen {
    background: #fff3cd;
}

.launch-tree-table .launch-tree-drag-active {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
    background: #ffffff;
}

.launch-tree-table tr[data-id].drop-invalid {
    background: #fde2e1 !important;
}

/* === Roadmap Gantt === */
.launch-gantt {
    --gantt-day-w: 16px;
    --gantt-row-h: 44px;
    --gantt-month-h: 26px;
    --gantt-week-h: 22px;
    --gantt-label-w: 340px;
    /* Never push the page wider than its content — the chart scrolls
       inside its own frame, not via the page's horizontal scrollbar. */
    max-width: 100%;
    overflow: hidden;
}

.launch-gantt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.launch-gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
}

.launch-gantt-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.launch-gantt-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.launch-gantt-frame {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
}

.launch-gantt-grid {
    display: grid;
    /* Rows grow when a label wraps onto two+ lines; bars/diamonds inside
       use `align-self: center` so they stay vertically aligned in taller
       rows and never get visually stretched. */
    grid-auto-rows: minmax(var(--gantt-row-h), auto);
    position: relative;
    min-width: 100%;
}

/* Weekly vertical dividers rendered as real grid children, one per
   week boundary. A CSS-only approach (repeating-linear-gradient or
   linear-gradient tiled with repeat-x) dropped past ~1000px of the
   grid's width in wide Gantts — Chromium stops painting the tile. */
.launch-gantt-week-divider {
    border-left: 1px solid #e9ecef;
    width: 0;
    pointer-events: none;
}

.launch-gantt-corner {
    grid-row: 1;
    grid-column: 1;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    height: var(--gantt-month-h);
    /* Sticky so the label column stays glued to the left edge while
       the user scrolls the Gantt horizontally; z-index beats bars and
       week dividers, which scroll behind it. */
    /* Emulated sticky via JS transform (see _pinGanttLabels) — Chrome
       clamps position:sticky on grid items to the cell bounding box,
       which releases the column after scrollLeft > label width. */
    z-index: 11;
    will-change: transform;
}

.launch-gantt-corner-bottom {
    grid-row: 2;
    grid-column: 1;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    height: var(--gantt-week-h);
    /* Emulated sticky via JS transform (see _pinGanttLabels) — Chrome
       clamps position:sticky on grid items to the cell bounding box,
       which releases the column after scrollLeft > label width. */
    z-index: 11;
    will-change: transform;
}

.launch-gantt-month {
    grid-row: 1;
    background: #f8f9fa;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    padding: 4px 8px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
    height: var(--gantt-month-h);
    box-sizing: border-box;
    line-height: 1.2;
}

.launch-gantt-week {
    grid-row: 2;
    background: #fcfcfd;
    font-size: 0.65rem;
    color: #6c757d;
    padding: 2px 4px;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
    height: var(--gantt-week-h);
    box-sizing: border-box;
    line-height: 1.2;
}

/* Alternating month columns for visual separation */
.launch-gantt-month:nth-child(even) {
    background: #f0f4f8;
}

.launch-gantt-rowlabel {
    grid-column: 1;
    background: #fff;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #f1f3f5;
    padding: 4px 8px;
    font-size: 0.75rem;
    box-sizing: border-box;
    overflow: hidden;
    line-height: 1.25;
    display: flex;
    align-items: center;
    /* Pinned column — JS keeps it at the left edge via translateX on
       scroll (see _pinGanttLabels). CSS-only position:sticky breaks in
       wide CSS grids because Chrome constrains the sticky element to
       the grid cell's 280px bounding box. z-index must beat everything
       inside the scrollable area (bar=2, diamond=3, deps=3, ghost=5). */
    z-index: 10;
    will-change: transform;
    /* Right border as inset shadow so bars overlapping x=280 never
       paint over the column separator. */
    box-shadow: inset -1px 0 0 #e9ecef;
}

/* Milestone/stage labels get a faint shade when pinned so they stay
   visually distinct from regular row bands as content scrolls past. */
.launch-gantt-rowlabel.launch-gantt-rowlabel-milestone,
.launch-gantt-rowlabel.launch-gantt-rowlabel-stage {
    background: #f8f9fa;
}

.launch-gantt-rowlabel-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.launch-gantt-rowlabel-icon {
    flex-shrink: 0;
    color: #6c757d;
    font-size: 0.8rem;
}

.launch-gantt-rowlabel-title {
    /* Wrap long stage / milestone names instead of truncating with `…`.
       The user can't recover hidden text on a Gantt row label, so favour
       legibility over a perfectly uniform row height. */
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
    color: #212529;
}

.launch-gantt-rowlabel-milestone {
    background: #f8f9fa;
    font-weight: 600;
}

.launch-gantt-rowlabel-stage {
    background: #fbfbfd;
    font-weight: 500;
}

.launch-gantt-lane {
    grid-row-start: auto;
    z-index: 0;
    cursor: default;
}

.launch-gantt-lane-stage {
    cursor: crosshair;
}

.launch-gantt-lane-task {
    cursor: crosshair;
}

.launch-gantt-lane-milestone {
    cursor: default;
}

.launch-gantt-ghost {
    background: rgba(59, 130, 246, 0.25);
    border: 1px dashed rgba(59, 130, 246, 0.9);
    border-radius: 4px;
    margin: 10px 1px;
    pointer-events: none;
    z-index: 3;
}

.launch-gantt-bar {
    position: relative;
    background: var(--bs-primary, #3b82f6);
    border-radius: 4px;
    margin: 8px 1px;
    cursor: pointer;
    overflow: hidden;
    color: #fff;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    padding: 0 6px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: filter 0.1s ease, transform 0.1s ease, box-shadow 0.1s ease,
                opacity 0.1s ease;
    z-index: 2;
    touch-action: none;
    user-select: none;
}

.launch-gantt-bar.resizing {
    opacity: 0.75;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    outline: 1px dashed rgba(255, 255, 255, 0.75);
    z-index: 5;
    transition: none;
}

.launch-gantt-bar-resize {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    background: rgba(0, 0, 0, 0.15);
    z-index: 3;
}

.launch-gantt-bar-resize:hover {
    background: rgba(0, 0, 0, 0.35);
}

.launch-gantt-diamond {
    width: 14px;
    height: 14px;
    margin: 15px 0 0 1px;
    transform: rotate(45deg);
    background: var(--bs-primary, #3b82f6);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 3;
}

.launch-gantt-diamond.done {
    opacity: 0.55;
    filter: grayscale(0.5);
}

.launch-gantt-bar:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    z-index: 4;
}

.launch-gantt-bar.done {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.launch-gantt-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.launch-gantt-bar-label {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    text-overflow: ellipsis;
}

.launch-gantt-today {
    background: rgba(239, 68, 68, 0.15);
    border-left: 2px dashed #ef4444;
    pointer-events: none;
    z-index: 1;
}

.launch-gantt-deps {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
}

.launch-gantt-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.launch-gantt-modal {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 720px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* === Tree view === */

.launch-tree-table input.form-control-sm,
.launch-tree-table textarea.form-control-sm {
    font-size: 0.8rem;
    padding: 2px 4px;
}

/* Title cell — single-line by default, but stretches to fit the full
   string when the user types/loads something long. resize:none kills
   the drag handle that comes free with <textarea> (we don't want users
   pulling the row taller by accident). */
.launch-tree-title {
    resize: none;
    overflow: hidden;
    line-height: 1.25;
    min-height: 28px;
    word-break: break-word;
}

/* Compact "+" picker shown next to existing chips. Looks like a chip
   itself so it visually belongs to the same row of badges. */
.launch-tree-chip-add {
    border: 1px dashed #adb5bd;
    background: transparent;
    color: #6c757d;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.75rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease,
                background-color 0.12s ease;
}

.launch-tree-chip-add:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #f0f7ff;
}

.launch-tree-chip {
    background: #eef2f7;
    color: #1f2933;
    border: 1px solid #d8dee6;
    border-radius: 4px;
    padding: 1px 4px 1px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
}

/* Chip name itself is a button → clicking opens the entity's edit
   card. Keeps the visual identical to the surrounding chip so the
   only signal is cursor:pointer + a subtle hover underline. */
.launch-tree-chip-name {
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}

.launch-tree-chip-name:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    color: #0d6efd;
}

.launch-tree-chip-remove {
    border: 0;
    background: transparent;
    color: #94a3b8;
    padding: 0 2px;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.12s ease;
}

.launch-tree-chip-remove:hover {
    color: #dc2626;
}

/* Aggregated milestone / stage total — read-only, refined typography
   so it reads as a "final" computed number, not an editable field. */
.launch-tree-aggregate {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
    font-size: 0.875rem;
    text-align: right;
    width: 100%;
}

.launch-tree-aggregate-zero {
    color: #94a3b8;
    font-weight: 400;
}

.launch-tree-fact-cell {
    text-align: center;
    width: 56px;
}

.launch-tree-fact-cell .form-check-input {
    margin: 0 auto;
}

.launch-tree-milestone {
    background-color: #f8f9fa;
}

.launch-tree-checklist {
    background-color: #fff9e6;
}

.launch-tree-table .btn-link {
    color: #6c757d;
    text-decoration: none;
}

/* === Toast notification (fixed, no page jump) === */

.launch-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1050;
    background: #212529;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.launch-toast-enter {
    opacity: 0;
    transform: translateY(8px);
}

.launch-toast-leave {
    opacity: 0;
    transform: translateY(8px);
}

/* ─────────────────────────── Телефон (≤767.98px) ──────────────────────────
   Постраничный адаптив живёт в самой странице (web/README.md). Карточка
   проекта на 390px стоила 440px высоты, из них 206px — пустой фото-блок
   (aspect-ratio 16/9 при ширине во весь экран): на первый экран не попадал
   ни один проект из десяти. */
@media (max-width: 767.98px) {
    /* Фото-блок превращается в строку бейджей и уезжает ПОД название: 16:9 во
       всю ширину экрана — это 206px, на которых видно либо пустой серый
       прямоугольник, либо полоску фотографии, не говорящую ни о чём. Статус,
       срок до открытия и арендные каникулы — говорят.
       `.card` у Bootstrap — флекс-колонка, поэтому порядок меняем `order`, без
       переноса узлов (в них живут Alpine-привязки). */
    .launch-card > .card-body {
        order: 1;
        padding-bottom: 0.4rem;
    }
    .launch-card > .launch-card-photo {
        order: 2;
        aspect-ratio: auto;
        min-height: 0;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        padding: 0 0.7rem 0.7rem;
        background-color: transparent;
        /* Картинку задаёт инлайновый `style` из шаблона — перебить её можно
           только так; в класс она не переносится, она разная у каждой карточки. */
        background-image: none !important;
    }
    .launch-card > .card-footer {
        order: 3;
    }
    .launch-card .launch-card-placeholder {
        display: none;
    }
    .launch-card-photo .launch-status-badge,
    .launch-card-photo .launch-days-badge,
    .launch-card-photo .holiday-chip {
        position: static;
        box-shadow: none;
    }

    /* Название — главная цель карточки: 19px по высоте пальцем не берётся. */
    .launch-card .card-title a {
        display: flex;
        align-items: center;
        min-height: 44px;
    }
}
