/* share.imagic.ink — client proofing galleries.
   Builds on style.css variables. Deliberately quiet chrome: the photographs
   are the interface, everything else gets out of their way. */

.share-body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    margin: 0;
}

/* ---------------------------------------------------------------- gate --- */

.share-gate {
    max-width: 520px;
    margin: 0 auto;
    padding: 18vh 24px 0;
    text-align: center;
}
.share-gate-logo { height: 28px; margin-bottom: 40px; opacity: .85; }
.share-gate h1 { font-size: clamp(22px, 4vw, 30px); font-weight: 800; margin: 0 0 14px; }
.share-gate p { color: var(--text-secondary); line-height: 1.7; margin: 0 0 12px; }
.share-gate-hint { font-size: 14px; color: var(--text-muted); }
.share-gate code {
    background: var(--bg-card); padding: 2px 7px;
    border-radius: 5px; font-family: var(--font-mono); font-size: 13px;
}

/* -------------------------------------------------------------- topbar --- */

.share-topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 14px 22px;
    background: rgba(13, 13, 13, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.share-topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.share-brand img { height: 22px; display: block; opacity: .9; }
.share-title-block { min-width: 0; }
.share-title-block h1 {
    font-size: 16px; font-weight: 700; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-subtitle { font-size: 12px; color: var(--text-muted); }

.share-topbar-right { display: flex; align-items: center; gap: 18px; }

.share-progress { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.share-progress-count { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.share-progress-bar { height: 4px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.share-progress-fill {
    height: 100%; width: 0;
    background: var(--gradient-2);
    transition: width var(--transition);
}

/* Who else is in the gallery. Avatars are initials so nobody has to upload
   anything, and a filled ring means that person has already submitted. */
.share-who { display: flex; gap: -4px; }
.share-who-dot {
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
    background: var(--bg-card); color: var(--text-secondary);
    border: 2px solid var(--bg-primary);
    margin-left: -6px;
}
.share-who-dot.is-done { background: var(--accent); color: #1a1a1a; }
.share-who-dot.is-me { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ----------------------------------------------------------- filterbar --- */

.share-filterbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 22px; flex-wrap: wrap;
}
.share-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.share-chip {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 15px; border-radius: 20px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all var(--transition); font-family: inherit;
}
.share-chip:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.share-chip.is-active {
    background: var(--accent); border-color: var(--accent); color: #1a1a1a;
}
.share-hint { font-size: 12px; color: var(--text-muted); }
.share-hint kbd {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 4px; padding: 2px 6px;
    font-family: var(--font-mono); font-size: 11px;
}

/* ---------------------------------------------------------------- grid --- */

/* Uniform cells, flush edges. Every tile is the same size whatever the frame's
   orientation, so the grid reads as a clean contact sheet rather than a ragged
   run of different widths.

   The image is contained, never cropped: a portrait sits centred in its cell
   with space either side. Cropping portraits into landscape cells is what the
   3/2 + object-fit: cover version did, and it showed clients a framing that was
   never shot. Cells are 3/2 because 511 of the 711 frames in a real shoot were
   landscape, so the majority fill their cell exactly. */
.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    padding: 4px 22px 60px;
}

.share-tile {
    position: relative;
    aspect-ratio: 3 / 2;
    background: #101010;
    border-radius: var(--radius-sm);
    overflow: hidden; cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition), transform .15s ease;
    contain: layout paint;
}
.share-tile:hover { transform: translateY(-2px); }
/* contain, not cover: the tile box already matches the photo's aspect, so
   nothing is cropped even when the stored dimensions are slightly off. */
.share-tile img {
    width: 100%; height: 100%; object-fit: contain; display: block;
    opacity: 0; transition: opacity .4s ease;
}
.share-tile img.is-loaded { opacity: 1; }
.share-tile.is-picked { border-color: var(--accent); }
.share-tile.is-rejected { opacity: .38; }
.share-tile.is-rejected:hover { opacity: .7; }

.share-tile-actions {
    position: absolute; inset: auto 0 0 0;
    display: flex; gap: 6px; padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .78));
    opacity: 0; transition: opacity var(--transition);
}
.share-tile:hover .share-tile-actions,
.share-tile.is-picked .share-tile-actions,
.share-tile.is-rejected .share-tile-actions { opacity: 1; }

.share-mini {
    width: 32px; height: 32px; border-radius: 50%;
    border: none; cursor: pointer;
    display: grid; place-items: center;
    font-size: 15px; line-height: 1;
    background: rgba(255, 255, 255, .14); color: #fff;
    transition: all var(--transition);
}
.share-mini:hover { background: rgba(255, 255, 255, .28); transform: scale(1.08); }
.share-mini.is-on { background: var(--accent); color: #1a1a1a; }
.share-mini-reject.is-on { background: var(--error); color: #fff; }

.share-tile-meta {
    position: absolute; top: 8px; left: 8px; right: 8px;
    display: flex; justify-content: space-between; align-items: flex-start;
    pointer-events: none;
}
.share-tile-badge {
    background: rgba(0, 0, 0, .7); color: #fff;
    padding: 3px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 4px;
}
.share-tile-badge.is-hot { background: var(--accent); color: #1a1a1a; }
.share-tile-badge.is-edited { background: var(--success); color: #fff; }

.share-loading, .share-empty {
    text-align: center; padding: 40px 20px 80px;
    color: var(--text-muted); font-size: 14px;
}

/* ------------------------------------------------------------ lightbox --- */

.share-lightbox {
    position: fixed; inset: 0; z-index: 100;
    display: grid; grid-template-columns: 1fr 340px;
    background: rgba(8, 8, 8, .97);
}
.share-lightbox[hidden] { display: none; }

.share-lb-stage {
    margin: 0; display: grid; place-items: center;
    padding: 40px 20px; position: relative; min-width: 0;
}
.share-lb-stage img {
    max-width: 100%; max-height: calc(100vh - 80px);
    object-fit: contain; border-radius: 4px;
}
.share-lb-badge {
    position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
    background: var(--success); color: #fff;
    padding: 5px 14px; border-radius: 14px;
    font-size: 12px; font-weight: 700;
}

.share-lb-close, .share-lb-nav {
    position: absolute; z-index: 2;
    background: rgba(255, 255, 255, .1); color: #fff;
    border: none; cursor: pointer; border-radius: 50%;
    display: grid; place-items: center;
    transition: background var(--transition);
}
.share-lb-close:hover, .share-lb-nav:hover { background: rgba(255, 255, 255, .25); }
.share-lb-close { top: 18px; right: 358px; width: 38px; height: 38px; font-size: 24px; }
.share-lb-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 30px; }
.share-lb-prev { left: 18px; }
.share-lb-next { right: 358px; }

.share-lb-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 26px 22px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 18px;
}
.share-lb-head h2 {
    font-size: 15px; font-weight: 700; margin: 0 0 4px;
    font-family: var(--font-mono); word-break: break-all;
}
.share-lb-index { font-size: 12px; color: var(--text-muted); }

.share-lb-actions { display: flex; gap: 10px; }
.share-vote {
    flex: 1; padding: 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    font-size: 13px; font-weight: 700; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    transition: all var(--transition);
}
.share-vote:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.share-vote-icon { font-size: 16px; }
.share-vote-pick.is-on {
    background: var(--accent); border-color: var(--accent); color: #1a1a1a;
}
.share-vote-reject.is-on {
    background: var(--error); border-color: var(--error); color: #fff;
}

.share-compare {
    width: 100%; padding: 10px; border-radius: var(--radius-sm);
    background: transparent; border: 1px dashed var(--border);
    color: var(--text-secondary); cursor: pointer;
    font-size: 13px; font-weight: 600; font-family: inherit;
    transition: all var(--transition);
}
.share-compare:hover { border-color: var(--accent); color: var(--accent); }

.share-lb-tally {
    background: var(--bg-card); border-radius: var(--radius-sm);
    padding: 14px; font-size: 13px;
}
.share-lb-tally h4 {
    margin: 0 0 8px; font-size: 11px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--text-muted);
}
.share-tally-names { color: var(--text-secondary); line-height: 1.6; }

/* Shortcut legend. Present because the fastest way through a 700-frame shoot
   is the keyboard, and nobody discovers keys that are not shown. */
.share-shortcuts {
    background: var(--bg-card); border-radius: var(--radius-sm);
    padding: 14px; font-size: 13px;
}
.share-shortcuts h3 {
    margin: 0 0 10px; font-size: 11px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--text-muted);
}
.share-shortcuts ul { list-style: none; margin: 0 0 12px; padding: 0; }
.share-shortcuts li {
    display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
    color: var(--text-secondary);
}
.share-shortcuts li span { flex: 1; }
.share-shortcuts kbd {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 4px; padding: 3px 8px; min-width: 26px; text-align: center;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-primary);
}
.share-autoadvance {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); cursor: pointer; font-size: 12px;
}
.share-autoadvance input { accent-color: var(--accent); }
.share-shortcuts-note {
    margin: 10px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.55;
}

/* Comments */
.share-comments { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.share-comments h3 {
    margin: 0; font-size: 11px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--text-muted);
}
.share-comment-list { display: flex; flex-direction: column; gap: 10px; }
.share-comment {
    background: var(--bg-card); border-radius: var(--radius-sm);
    padding: 10px 12px; font-size: 13px; line-height: 1.55;
}
.share-comment-author {
    font-weight: 700; font-size: 12px; color: var(--accent);
    display: block; margin-bottom: 3px;
}
.share-comment-empty { color: var(--text-muted); font-size: 13px; font-style: italic; }
.share-comment-form { display: flex; flex-direction: column; gap: 8px; }
.share-comment-form textarea {
    width: 100%; background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px; font-family: inherit; font-size: 13px; resize: vertical;
}
.share-comment-form textarea:focus { outline: none; border-color: var(--accent); }

/* ----------------------------------------------------------- feedback --- */

.share-toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-left: 3px solid var(--accent);
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 14px; box-shadow: var(--shadow-md); z-index: 200;
}
.share-toast[hidden] { display: none; }

/* -------------------------------------------------------------- mobile --- */

@media (max-width: 900px) {
    .share-lightbox { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .share-lb-panel {
        border-left: none; border-top: 1px solid var(--border);
        max-height: 46vh; padding: 18px;
    }
    .share-lb-close { right: 14px; }
    .share-lb-next { right: 14px; }
    .share-lb-stage { padding: 20px 12px; }
    .share-lb-stage img { max-height: 50vh; }
}

@media (max-width: 720px) {
    .share-topbar { flex-wrap: wrap; gap: 12px; padding: 12px 14px; }
    .share-topbar-right { width: 100%; justify-content: space-between; }
    .share-hint { display: none; }
    .share-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 5px; padding: 4px 10px 60px;
    }
    /* Touch devices have no hover, so the vote buttons stay visible. */
    .share-tile-actions { opacity: 1; }
}
