/* ShimView — client review pages.
   Shimkanin brand system: ink, paper, rust. Source Serif 4 display,
   Manrope body, JetBrains Mono for meta. Hand-rolled, mobile-first. */

:root {
    --ink: #14202E;
    --ink-soft: #1F2D3F;
    --paper: #EBE3D2;
    --paper-light: #F5EFE2;
    --rust: #B45628;
    --rust-deep: #8E4220;
    --smoke: #5C6B7F;
    --stone: #8B9099;
    --hairline: rgba(20, 32, 46, 0.12);
    --radius: 3px;
    --shadow: 0 12px 32px rgba(20, 32, 46, 0.16);
    --font-display: 'Source Serif 4', Georgia, serif;
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, p { margin: 0; }

button { font: inherit; color: inherit; }

a { color: var(--rust); }

::selection { background: rgba(180, 86, 40, 0.25); }

/* ---------- Brand device: the stamp (rust dot + hairline) ---------- */

.stamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.stamp::before {
    content: "";
    width: 4px;
    height: 4px;
    background: var(--rust);
    flex-shrink: 0;
}

.stamp::after {
    content: "";
    width: 18px;
    height: 1px;
    background: var(--rust);
    flex-shrink: 0;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    border: 0;
    border-radius: 2px;
    padding: 0.65rem 1.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--rust);
    color: var(--paper-light);
}

.btn-primary:hover { background: var(--rust-deep); }

.btn-primary:disabled {
    opacity: 0.55;
    cursor: default;
    background: var(--rust);
}

.btn-ghost { color: var(--smoke); }

.btn-ghost:hover { color: var(--ink); }

.btn-block { width: 100%; }

/* ---------- Language switcher ---------- */

.lang-switcher {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--stone);
}

.lang-switcher a {
    color: var(--smoke);
    text-decoration: none;
    padding: 0.15rem 0.2rem;
    border-bottom: 1px solid transparent;
}

.lang-switcher a:hover { color: var(--ink); }

.lang-switcher a.is-active {
    color: var(--rust);
    border-bottom-color: var(--rust);
}

/* ---------- Card pages (gate, name, closed, empty) ---------- */

.page-card {
    display: flex;
    min-height: 100vh;
}

.card-page {
    margin: auto;
    width: 100%;
    max-width: 27rem;
    padding: 1.25rem;
}

.card-page > .lang-switcher {
    justify-content: flex-end;
    margin-bottom: 0.85rem;
}

.card {
    position: relative;
    background: var(--paper-light);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
}

/* Letterhead spine — the quiet rust signature down the left edge. */
.card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1.5rem;
    bottom: 1.5rem;
    width: 1px;
    background: var(--rust);
    opacity: 0.4;
}

.card h1 {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 40;
    font-weight: 500;
    font-size: 1.55rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 0.6rem;
}

.card-kicker {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--rust);
    margin-bottom: 1.1rem;
}

.card-kicker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hairline);
    max-width: 120px;
}

.card-intro {
    color: var(--smoke);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.card label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-soft);
    margin-bottom: 0.45rem;
}

.card input[type="password"],
.card input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.8rem;
    font: inherit;
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: 2px;
    background: var(--paper);
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card input:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 1px var(--rust);
    background: var(--paper-light);
}

.field-error {
    color: var(--rust-deep);
    font-size: 0.85rem;
    margin: -0.5rem 0 1rem;
}

.gdpr-note {
    font-size: 0.8rem;
    color: var(--smoke);
    background: var(--paper);
    border-left: 1px solid var(--rust);
    border-radius: 0 2px 2px 0;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1.5rem;
}

.card-message { text-align: center; }

.card-message .card-kicker { justify-content: center; }

.card-message .card-kicker::after { display: none; }

/* ---------- Brand footer under the card ---------- */

.review-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.review-footer-mark {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--smoke);
}

.review-footer-by {
    font-size: 0.62rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--stone);
}

/* ---------- Screen page: top bar (ink, like the brand hero) ---------- */

.page-screen { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--ink);
    color: var(--paper);
    border-bottom: 1px solid rgba(180, 86, 40, 0.3);
}

.topbar-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.7rem 1rem 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    /* Never let the switchers squeeze the client name out of the bar —
       it truncates, but it is always there. */
    flex: 1 1 auto;
    min-width: 7rem;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: var(--paper);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Maker's dot after the client name. */
.brand::after {
    content: "";
    width: 4px;
    height: 4px;
    background: var(--rust);
    flex-shrink: 0;
}

.topbar-row .lang-switcher { margin-left: auto; }

.topbar .lang-switcher { color: var(--stone); }

.topbar .lang-switcher a { color: var(--stone); }

.topbar .lang-switcher a:hover { color: var(--paper); }

.topbar .lang-switcher a.is-active {
    color: var(--paper);
    border-bottom-color: var(--rust);
}

.admin-badge {
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--paper);
    border: 1px solid var(--rust);
    border-radius: 2px;
    padding: 0.15rem 0.5rem;
    cursor: default;
}

.version-switcher {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.version-label { color: var(--stone); }

.version-link {
    text-decoration: none;
    color: var(--stone);
    padding: 0.2rem 0.15rem;
    border-bottom: 1px solid transparent;
}

.version-link:hover { color: var(--paper); }

.version-link.is-active {
    color: var(--paper);
    border-bottom-color: var(--rust);
}

/* ---------- Zoom switcher (fit width vs. 100 %) ---------- */

.zoom-switcher {
    display: flex;
    flex: 0 0 auto;
    border: 1px solid rgba(235, 227, 210, 0.25);
    border-radius: 2px;
    overflow: hidden;
}

.zoom-btn {
    border: 0;
    background: transparent;
    padding: 0.25rem 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    color: var(--stone);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.zoom-btn:hover { color: var(--paper); }

.zoom-btn.is-active {
    background: var(--rust);
    color: var(--paper-light);
}

.screen-nav {
    display: flex;
    gap: 1.1rem;
    padding: 0 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.screen-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.1rem 0.55rem;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    color: var(--stone);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.screen-tab:hover { color: var(--paper); }

.screen-tab.is-active {
    color: var(--paper);
    border-bottom-color: var(--rust);
}

.screen-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.25rem;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: var(--rust);
    color: var(--paper-light);
}

.screen-tab-approved {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1;
    background: rgba(120, 160, 120, 0.22);
    color: #9BC49B;
}

/* ---------- Approval bar (client sign-off) ---------- */

.approval-bar {
    border-bottom: 1px solid var(--hairline);
    background: var(--paper-light);
    padding: 0.7rem 1rem;
}

.approval-bar.is-approved {
    background: rgba(120, 160, 120, 0.12);
    border-bottom-color: rgba(120, 160, 120, 0.3);
}

.approval-open,
.approval-done {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    max-width: 90rem;
    margin: 0 auto;
}

.approval-hint {
    flex: 1 1 16rem;
    font-size: 0.82rem;
    color: var(--smoke);
}

.btn-approve {
    flex: 0 0 auto;
    background: var(--ink);
    color: var(--paper-light);
    padding: 0.5rem 1rem;
    font-size: 0.72rem;
}

.btn-approve:hover { background: var(--ink-soft); }

.btn-approve:disabled { opacity: 0.55; cursor: default; }

.approval-state {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.approval-check {
    color: #4C7A4C;
    font-size: 1rem;
}

.approval-by {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--smoke);
}

.approval-bar .field-error { margin: 0.4rem 0 0; }

/* ---------- Older-version banner ---------- */

.older-banner {
    background: rgba(180, 86, 40, 0.1);
    color: var(--rust-deep);
    border-bottom: 1px solid rgba(180, 86, 40, 0.25);
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    text-align: center;
}

/* ---------- Screen layout ---------- */

.screen-layout { padding: 1rem; }

@media (min-width: 960px) {
    .screen-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 21rem;
        gap: 1rem;
        align-items: start;
        max-width: 90rem;
        margin: 0 auto;
    }
}

/* ---------- Stage & pins ---------- */

.stage {
    background: var(--paper-light);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 0.75rem;
    /* At 100 % zoom a wide mockup scrolls inside the stage rather than
       stretching the page. */
    overflow-x: auto;
}

.image-wrap {
    position: relative;
    line-height: 0;
    margin: 0 auto;
    max-width: 100%;
    width: fit-content;
}

.image-wrap.can-comment { cursor: crosshair; }

.image-wrap img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
    user-select: none;
    -webkit-user-select: none;
}

/* 100 % zoom: the image keeps its own pixels and the wrapper grows with it,
   so pins (positioned in percent) stay exactly where they were placed. */
.image-wrap.is-actual { max-width: none; }

.image-wrap.is-actual img {
    max-width: none;
    width: auto;
}

.pin-anchor {
    position: absolute;
    width: 0;
    height: 0;
    line-height: 1.5;
}

.pin {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;   /* comfortable tap target */
    min-height: 24px;
    padding: 0;
    border: 2px solid var(--paper-light);
    border-radius: 999px 999px 999px 3px;
    background: var(--rust);
    color: var(--paper-light);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(20, 32, 46, 0.35);
    transition: transform 0.12s ease;
}

.pin:hover, .pin.is-open { transform: translate(-50%, -50%) scale(1.18); }

.pin.is-resolved {
    background: var(--smoke);
    opacity: 0.8;
}

.pin.is-highlight {
    animation: pin-pulse 0.5s ease 2;
}

@keyframes pin-pulse {
    50% { transform: translate(-50%, -50%) scale(1.5); }
}

.pin-new {
    background: var(--ink);
    cursor: default;
}

/* Movable pins: draggable by their author (or an admin) on the latest version. */
.pin.is-movable {
    cursor: grab;
    touch-action: none; /* pointer events receive touch drags instead of scrolling */
}

.pin.is-dragging {
    transition: none;
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 4px 12px rgba(20, 32, 46, 0.45);
}

/* ---------- Bubbles (thread + form) ---------- */

.bubble {
    position: absolute;
    top: 14px;
    left: 0;
    transform: translateX(-50%);
    width: min(17rem, 78vw);
    background: var(--paper-light);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.8rem 0.9rem;
    z-index: 30;
    line-height: 1.5;
    text-align: left;
    cursor: auto;
}

.bubble.b-left { left: auto; right: -14px; transform: none; }
.bubble.b-right { left: -14px; transform: none; }
.bubble.b-up { top: auto; bottom: 14px; }

.bubble-author {
    font-weight: 600;
    font-size: 0.85rem;
}

.bubble-text {
    font-size: 0.9rem;
    margin: 0.25rem 0 0.4rem;
    color: var(--ink-soft);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bubble-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--smoke);
}

.badge-resolved {
    display: inline-block;
    background: rgba(92, 107, 127, 0.14);
    color: var(--smoke);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.15rem 0.45rem;
    border-radius: 2px;
}

.bubble-form textarea {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: 2px;
    padding: 0.5rem 0.6rem;
    resize: vertical;
    background: var(--paper);
}

.bubble-form textarea:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 1px var(--rust);
    background: var(--paper-light);
}

.bubble-form .field-error { margin: 0.35rem 0 0; }

.bubble-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.bubble-actions .btn { padding: 0.45rem 0.85rem; font-size: 0.72rem; }

.form-hint {
    margin: 0.3rem 0 0;
    font-size: 0.68rem;
    color: var(--smoke);
}

/* ---------- Replies ---------- */

.bubble-replies {
    margin-top: 0.6rem;
    border-top: 1px solid var(--hairline);
    padding-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reply {
    padding-left: 0.6rem;
    border-left: 2px solid var(--hairline);
}

.reply-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.reply-author {
    font-weight: 600;
    font-size: 0.78rem;
}

.reply-when {
    font-size: 0.68rem;
    color: var(--smoke);
}

.reply-text {
    font-size: 0.85rem;
    margin: 0.1rem 0 0;
    color: var(--ink-soft);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.reply-form {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.reply-form textarea {
    flex: 1;
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: 2px;
    padding: 0.4rem 0.5rem;
    resize: none;
    background: var(--paper);
}

.reply-form textarea:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 1px var(--rust);
    background: var(--paper-light);
}

.reply-form .btn { padding: 0.45rem 0.7rem; font-size: 0.68rem; }

/* ---------- Comment list ---------- */

.comment-list {
    background: var(--paper-light);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 1.1rem 1rem;
    margin-top: 1rem;
}

@media (min-width: 960px) {
    .comment-list {
        margin-top: 0;
        position: sticky;
        top: 6.5rem;
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

.comment-list h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--rust);
    margin-bottom: 0.9rem;
}

.comment-list h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

.comment-total {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0;
    color: var(--smoke);
}

.comment-list-empty {
    color: var(--smoke);
    font-size: 0.9rem;
}

.comment-list-empty .hint {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--rust);
}

.comment-list ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.comment-item {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 2px;
    padding: 0.55rem 0.5rem;
    cursor: pointer;
}

.comment-item:hover, .comment-item.is-open { background: var(--paper); }

.comment-item-pin {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px 999px 999px 3px;
    background: var(--rust);
    color: var(--paper-light);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    margin-top: 0.1rem;
}

.comment-item-pin.is-resolved {
    background: var(--smoke);
    opacity: 0.85;
}

.comment-item-body { min-width: 0; }

.comment-item-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-item-author {
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-item-when {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--stone);
}

.comment-item-replies {
    display: inline-block;
    margin-top: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--stone);
}

.comment-item-text {
    display: block;
    font-size: 0.85rem;
    color: var(--smoke);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Bubble tools (permalink, edit, delete) ---------- */

.bubble-tools {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.4rem 0 0;
}

.tool-link {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    color: var(--smoke);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--hairline);
    text-underline-offset: 2px;
}

.tool-link:hover {
    color: var(--rust);
    text-decoration-color: var(--rust);
}

.tool-danger:hover { color: var(--rust-deep); }

/* ---------- In-place edit form ---------- */

.edit-form { margin: 0.25rem 0 0.4rem; }

.edit-form textarea {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: 2px;
    padding: 0.5rem 0.6rem;
    resize: vertical;
    background: var(--paper);
}

.edit-form textarea:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 1px var(--rust);
    background: var(--paper-light);
}

/* ---------- Sidebar filters ---------- */

.comment-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--hairline);
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--smoke);
    cursor: pointer;
    user-select: none;
}

.filter-toggle input {
    accent-color: var(--rust);
    margin: 0;
}

.filter-toggle:hover { color: var(--ink); }

.filter-sort {
    margin-left: auto;
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--smoke);
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: 2px;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
}

.filter-sort:focus {
    outline: none;
    border-color: var(--rust);
}
