/* ============================================================
   Modals, forms, post details
   ============================================================ */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top, 0px))
        max(16px, env(safe-area-inset-right, 0px))
        max(16px, env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-left, 0px));
    background: rgba(15, 14, 13, 0.5);
}

.modal {
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal.wide {
    width: min(920px, 100%);
}

.modal.narrow {
    width: min(440px, 100%);
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.modal-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-inline-start: auto;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.modal-close:hover {
    background: var(--soft);
    color: var(--fg);
}

.modal-body {
    padding: 22px 24px 24px;
    overflow-y: auto;
}

.modal-body h2 {
    margin: 0 0 4px;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.modal-body .desc {
    margin: 0 0 20px;
    color: var(--muted);
}


/* Form fields */

.field {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}

select.field {
    width: auto;
    padding-inline-end: 28px;
}

.form select.field {
    width: 100%;
}

textarea.field {
    min-height: 84px;
    resize: vertical;
}

.field:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: transparent;
}

.form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
}

.form .f {
    grid-column: span 6;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form .f.half {
    grid-column: span 3;
}

.form .f.third {
    grid-column: span 2;
}

.form .f.two-thirds {
    grid-column: span 4;
}

.form label {
    font-size: 13px;
    font-weight: 600;
}

.form .hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.form .box {
    grid-column: span 6;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
}

.form .box .f {
    grid-column: span 1;
}

.form .box .f.full {
    grid-column: 1 / -1;
}

@media (max-width: 560px) {
    .form .f.half,
    .form .f.third,
    .form .f.two-thirds {
        grid-column: span 6;
    }

    .form .box {
        grid-template-columns: 1fr;
    }
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.error {
    margin: 0 auto 0 0;
    color: var(--accent);
    font-size: 13px;
}

.switch-mode {
    margin-top: 14px;
    font-size: 13.5px;
    text-align: center;
    color: var(--muted);
}


/* Photo upload */

.drop {
    padding: 22px;
    border: 1.5px dashed var(--line);
    border-radius: 12px;
    background: var(--soft);
    text-align: center;
    cursor: pointer;
}

.drop:hover {
    border-color: var(--muted);
}

.thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.thumb {
    position: relative;
    width: 78px;
    height: 58px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.thumb .remove {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.thumb .cover {
    position: absolute;
    bottom: 2px;
    inset-inline-start: 2px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--accent);
    color: #ffffff;
    font-size: 9.5px;
    font-weight: 700;
}


/* Post details */

.detail {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 26px;
}

@media (max-width: 760px) {
    .detail {
        grid-template-columns: 1fr;
    }
}

.gallery-main {
    max-width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: var(--soft);
}

.gallery-main img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
}

.gallery-row button {
    flex: none;
    width: 70px;
    height: 52px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.gallery-row button.on {
    border-color: var(--accent);
}

.gallery-row img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin: 16px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--line);
}

.specs div {
    padding: 10px 12px;
    background: var(--surface);
}

.specs .wide {
    grid-column: span 2;
}

.specs dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.specs dd {
    margin: 2px 0 0;
    font-weight: 600;
}

.person {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 14px;
}

.contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-row {
    display: flex;
    gap: 10px;
}

.contact-row .btn {
    flex: 1;
}

.phone-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--soft);
    font-family: var(--font-mono);
    font-size: 14px;
}

.body-text {
    margin: 6px 0 0;
    white-space: pre-wrap;
    color: var(--muted);
    font-size: 14.5px;
}
