:root {
    --paper: #f4f0e8;
    --white: #fffdf8;
    --ink: #161616;
    --muted: #6d6a64;
    --line: #c9c2b6;
    --orange: #f24c27;
    --lime: #c4ef2d;
    --cyan: #10acc2;
    --danger: #bd2f1f;
    --shadow: 8px 8px 0 #161616;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background-color: var(--paper);
    background-image: linear-gradient(rgba(22, 22, 22, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 22, 22, 0.035) 1px, transparent 1px);
    background-size: 32px 32px;
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

button,
input,
select {
    color: inherit;
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
}

.site-header {
    position: relative;
    z-index: 4;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4vw;
    border-bottom: 2px solid var(--ink);
    background: rgba(244, 240, 232, 0.94);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
    text-decoration: none;
}

.brand > span:last-child > span {
    color: var(--orange);
}

.brand-mark {
    position: relative;
    width: 26px;
    height: 26px;
    border: 3px solid var(--ink);
    background: var(--lime);
}

.brand-mark::after {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 9px;
    height: 9px;
    background: var(--orange);
    content: "";
}

.privacy-note {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.privacy-note span {
    width: 9px;
    height: 9px;
    border: 2px solid var(--ink);
    background: var(--lime);
}

main {
    min-height: calc(100vh - 144px);
}

.upload-workspace {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: calc(100vh - 144px);
    grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
}

.upload-workspace::before {
    position: absolute;
    z-index: -1;
    inset: 0 47% 0 0;
    background: linear-gradient(rgba(244, 240, 232, 0.18), rgba(244, 240, 232, 0.18)), url("/assets/lab-contact-sheet.webp") center / cover no-repeat;
    content: "";
    filter: saturate(0.92);
}

.intro {
    display: flex;
    min-height: 650px;
    flex-direction: column;
    justify-content: center;
    padding: 64px 6vw 54px 4vw;
    border-right: 2px solid var(--ink);
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 24px;
    padding: 8px 10px;
    border: 2px solid var(--ink);
    background: var(--lime);
    font-size: 12px;
    font-weight: 900;
}

h1,
h2,
p {
    margin-top: 0;
}

.intro h1,
.photo-panel h1,
.missing-view h1 {
    max-width: 720px;
    margin-bottom: 24px;
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: 78px;
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: 0;
    text-transform: uppercase;
}

.intro h1 span {
    color: var(--orange);
    text-shadow: 3px 3px 0 var(--ink);
}

.lede {
    max-width: 610px;
    margin-bottom: 38px;
    font-size: 18px;
    line-height: 1.55;
}

.trust-list {
    display: grid;
    max-width: 590px;
    margin: auto 0 0;
    padding: 0;
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    grid-template-columns: repeat(3, 1fr);
    list-style: none;
}

.trust-list li {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    padding: 16px 12px;
    border-right: 1px solid var(--ink);
}

.trust-list li:last-child {
    border-right: 0;
}

.trust-list strong {
    font-size: 18px;
}

.trust-list span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.uploader {
    align-self: center;
    width: min(760px, calc(100% - 8vw));
    margin: 48px auto;
    border: 2px solid var(--ink);
    background: var(--white);
    box-shadow: var(--shadow);
}

.drop-zone {
    display: flex;
    width: calc(100% - 40px);
    min-height: 280px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    margin: 20px;
    padding: 30px;
    border: 2px dashed var(--ink);
    border-radius: 0;
    background: #f8f5ee;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    background: #edf8c8;
    transform: translate(-2px, -2px);
}

.drop-zone strong {
    margin-top: 8px;
    font-size: 25px;
}

.drop-zone > span:not(.drop-icon) {
    color: var(--muted);
    font-size: 15px;
}

.drop-zone small {
    margin-top: 15px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.drop-icon {
    position: relative;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 2px solid var(--ink);
    background: var(--orange);
    box-shadow: 4px 4px 0 var(--ink);
}

.drop-icon::before,
.drop-icon::after,
.drop-icon i {
    position: absolute;
    display: block;
    background: var(--ink);
    content: "";
}

.drop-icon::before {
    width: 24px;
    height: 3px;
}

.drop-icon::after {
    width: 3px;
    height: 24px;
}

.drop-icon i {
    bottom: 10px;
    width: 30px;
    height: 3px;
}

.selection,
.results {
    padding: 20px;
    border-top: 2px solid var(--ink);
}

.selection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.selection-head > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.selection-head h2 {
    margin: 0;
    font-size: 18px;
}

.section-index {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border: 1px solid var(--ink);
    background: var(--cyan);
    color: white;
    font-size: 10px;
    font-weight: 900;
}

.text-button {
    padding: 6px 0;
    border: 0;
    border-bottom: 2px solid var(--ink);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.preview-item {
    position: relative;
    min-width: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 2px solid var(--ink);
    background: #ddd8cf;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item button {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--white);
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
}

.preview-item .progress-track {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 7px;
    background: rgba(22, 22, 22, 0.72);
}

.preview-item .progress-bar {
    display: block;
    width: 0;
    height: 100%;
    background: var(--lime);
    transition: width 120ms linear;
}

.preview-item.is-done::after,
.preview-item.is-error::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(196, 239, 45, 0.82);
    content: "ГОТОВО";
    font-size: 13px;
    font-weight: 900;
}

.preview-item.is-error::after {
    background: rgba(189, 47, 31, 0.88);
    color: white;
    content: "ОШИБКА";
}

.upload-controls {
    padding: 20px;
    border-top: 2px solid var(--ink);
}

.upload-controls > label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
    font-size: 14px;
    font-weight: 900;
}

.control-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.55fr) minmax(230px, 1fr);
    gap: 10px;
}

select,
input {
    width: 100%;
    min-width: 0;
    height: 50px;
    padding: 0 14px;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--white);
}

.button {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 12px 20px;
    border: 2px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    cursor: pointer;
    font-weight: 900;
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ink);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.button-primary {
    background: var(--orange);
}

.button-secondary {
    background: var(--white);
}

.upload-button {
    justify-content: space-between;
}

.upload-button i {
    font-size: 22px;
    font-style: normal;
}

.form-status {
    min-height: 17px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.form-status.is-error {
    color: var(--danger);
    font-weight: 800;
}

.results[hidden],
.selection[hidden] {
    display: none;
}

.result-list {
    display: grid;
    gap: 10px;
}

.result-item {
    display: grid;
    min-width: 0;
    grid-template-columns: 74px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--ink);
    background: #f8f5ee;
}

.result-item img {
    width: 74px;
    height: 58px;
    border: 1px solid var(--ink);
    object-fit: cover;
}

.result-copy {
    min-width: 0;
}

.result-copy a {
    display: block;
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-copy span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.icon-button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--lime);
    cursor: pointer;
    font-size: 19px;
    font-weight: 900;
}

.photo-view {
    display: grid;
    min-height: calc(100vh - 144px);
    grid-template-columns: minmax(0, 1.4fr) minmax(380px, 0.6fr);
}

.photo-stage {
    display: grid;
    min-height: 650px;
    padding: 4vw;
    place-items: center;
    border-right: 2px solid var(--ink);
    background: url("/assets/lab-contact-sheet.webp") center / cover no-repeat;
}

.photo-stage img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    border: 8px solid var(--white);
    box-shadow: 0 0 0 2px var(--ink), 12px 12px 0 rgba(22, 22, 22, 0.88);
    object-fit: contain;
}

.photo-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 4vw;
    background: var(--paper);
}

.photo-panel h1 {
    font-size: 56px;
}

.photo-facts {
    margin: 0 0 28px;
    border-top: 2px solid var(--ink);
}

.photo-facts div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid var(--ink);
}

.photo-facts dt {
    color: var(--muted);
    font-size: 12px;
}

.photo-facts dd {
    margin: 0;
    font-size: 12px;
    font-weight: 900;
    text-align: right;
}

.link-stack {
    display: grid;
    gap: 8px;
}

.link-stack label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 50px;
    gap: 8px;
    margin-bottom: 7px;
}

.copy-row input {
    height: 46px;
    font-size: 12px;
}

.copy-row .icon-button {
    width: 50px;
    height: 46px;
}

.photo-actions {
    display: grid;
    margin-top: 16px;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.missing-view {
    display: flex;
    min-height: calc(100vh - 144px);
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    padding: 9vw;
    background: url("/assets/lab-contact-sheet.webp") center / cover no-repeat;
}

.missing-view h1 {
    max-width: 760px;
}

.missing-view p:not(.error-code) {
    max-width: 520px;
    font-size: 18px;
}

.error-code {
    padding: 8px;
    border: 2px solid var(--ink);
    background: var(--orange);
    font-weight: 900;
}

.missing-view .button {
    margin-top: 16px;
}

footer {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 4vw;
    border-top: 2px solid var(--ink);
    background: var(--ink);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

@media (max-width: 1050px) {
    .upload-workspace {
        grid-template-columns: 1fr;
    }

    .upload-workspace::before {
        inset: 0;
        opacity: 0.48;
    }

    .intro {
        min-height: auto;
        padding: 60px 5vw 38px;
        border-right: 0;
        border-bottom: 2px solid var(--ink);
        background: rgba(244, 240, 232, 0.76);
    }

    .intro h1 {
        font-size: 66px;
    }

    .trust-list {
        margin-top: 20px;
    }

    .uploader {
        background: rgba(255, 253, 248, 0.97);
    }

    .photo-view {
        grid-template-columns: 1fr;
    }

    .photo-stage {
        min-height: 55vh;
        border-right: 0;
        border-bottom: 2px solid var(--ink);
    }

    .photo-panel {
        padding: 48px 7vw;
    }
}

@media (max-width: 620px) {
    .site-header {
        min-height: 66px;
        padding: 13px 18px;
    }

    .brand {
        font-size: 20px;
    }

    .brand-mark {
        width: 22px;
        height: 22px;
    }

    .privacy-note {
        max-width: 130px;
        justify-content: flex-end;
        font-size: 9px;
        text-align: right;
    }

    .intro {
        padding: 44px 20px 28px;
    }

    .intro h1,
    .missing-view h1 {
        font-size: 48px;
        line-height: 0.96;
    }

    .lede {
        margin-bottom: 24px;
        font-size: 16px;
    }

    .trust-list {
        width: 100%;
    }

    .trust-list li {
        padding: 12px 7px;
    }

    .trust-list strong {
        font-size: 15px;
    }

    .trust-list span {
        font-size: 9px;
    }

    .uploader {
        width: calc(100% - 28px);
        margin: 26px auto 34px;
        box-shadow: 5px 5px 0 var(--ink);
    }

    .drop-zone {
        width: calc(100% - 24px);
        min-height: 235px;
        margin: 12px;
        padding: 22px 12px;
        text-align: center;
    }

    .drop-zone strong {
        font-size: 21px;
    }

    .drop-zone small {
        max-width: 220px;
        line-height: 1.5;
    }

    .selection,
    .results,
    .upload-controls {
        padding: 14px;
    }

    .preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .control-row {
        grid-template-columns: 1fr;
    }

    .result-item {
        grid-template-columns: 58px minmax(0, 1fr) 38px;
    }

    .result-item img {
        width: 58px;
        height: 50px;
    }

    .result-item .icon-button {
        width: 38px;
        height: 38px;
    }

    .photo-stage {
        min-height: 48vh;
        padding: 30px 20px;
    }

    .photo-stage img {
        max-height: 44vh;
        border-width: 5px;
        box-shadow: 0 0 0 2px var(--ink), 7px 7px 0 rgba(22, 22, 22, 0.88);
    }

    .photo-panel {
        padding: 36px 20px;
    }

    .photo-panel h1 {
        font-size: 43px;
    }

    .photo-actions {
        grid-template-columns: 1fr;
    }

    .missing-view {
        padding: 70px 20px;
    }

    footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
