body[data-section=contacts] .tablet #main {
    overflow: visible
}

body[data-section=contacts] .contacts-page {
    height: 100%;
    padding: clamp(18px, 2.5vh, 28px) 4.2%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 20px;
    min-width: 0
}

.contacts-heading h1 {
    font-size: clamp(30px, 3vw, 44px);
    line-height: 1.2;
    letter-spacing: -.035em;
    margin: 0 0 12px;
    color: #f4f6f8
}

.contacts-heading p {
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
    color: #c0cad4
}

.contacts-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 36px;
    min-height: 0;
    min-width: 0
}

.contact-form {
    display: grid;
    grid-template-rows: auto auto minmax(85px, 1fr) 48px auto;
    gap: 12px;
    min-height: 0;
    min-width: 0
}

.contact-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-width: 0
}

.contact-form label {
    display: grid;
    gap: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #c0cad4;
    min-width: 0
}

.contact-form {
    --contact-field-background: rgba(15, 31, 44, .7)
}

html[data-theme=human] .contact-form {
    --contact-field-background: rgba(39, 32, 23, .65)
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--edge);
    border-radius: 9px;
    color: #edf4fa;
    background: var(--contact-field-background);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: inset 0 1px 0 #ffffff04
}

.contact-form input,
.contact-form select {
    height: 46px;
    min-height: 46px
}

.contact-form select {
    appearance: none;
    padding-right: 40px
}

.contact-form label:has(>select) {
    position: relative
}

.contact-form label:has(>select):after {
    content: '';
    position: absolute;
    right: 17px;
    bottom: 20px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #edf4fa;
    border-bottom: 1.5px solid #edf4fa;
    transform: rotate(45deg);
    pointer-events: none
}

.contact-form .contact-message-label {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0
}

.contact-form textarea {
    height: 100%;
    min-height: 0;
    resize: none
}

.contact-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    border: 1px solid var(--edge);
    border-radius: 9px;
    background: var(--halo);
    color: #edf4fa;
    padding: 10px 18px;
    font-size: 13px;
    cursor: pointer
}

.contact-submit:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--halo)
}

.contact-submit:disabled {
    opacity: 1;
    cursor: wait
}

.contact-submit-outline {
    position: absolute;
    inset: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    overflow: visible;
    fill: none;
    stroke-linecap: round;
    opacity: 0;
    pointer-events: none;
}
.contact-submit-outline rect { stroke-dasharray: 100 100; stroke-dashoffset: 100; }
.contact-submit-glow { stroke: var(--accent); stroke-width: 3; filter: blur(2px); opacity: .4; }
.contact-submit-line { stroke: var(--light); stroke-width: 1.8; }
.contact-submit:is(.is-sending, .is-sent) .contact-submit-outline { opacity: 1; }
.contact-submit.is-sent .contact-submit-outline rect { stroke-dashoffset: 0; }
.contact-submit-check { display: none; color: var(--light); }
.contact-submit.is-sent .contact-submit-arrow { display: none; }
.contact-submit.is-sent .contact-submit-check { display: inline; }

#contact-feedback {
    font-size: 12px;
    line-height: 1.5;
    min-height: 18px;
    margin: 0;
    color: var(--light)
}

#contact-feedback.contact-error {
    color: #ffbaa0
}

.contact-sidebar {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 22px;
    min-width: 0;
    min-height: 0
}

.contacts-art {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    container-type: size;
    isolation: isolate
}

.contacts-art:before {
    content: '';
    position: absolute;
    width: 75%;
    height: 65%;
    background: radial-gradient(ellipse, var(--halo), transparent 70%);
    pointer-events: none
}

.envelope-button {
    --envelope-metal-light: #234762;
    --envelope-metal-mid: #132d43;
    --envelope-metal-dark: #06121e;
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: none;
    color: var(--light);
    cursor: pointer;
    perspective: 1100px;
    -webkit-tap-highlight-color: transparent
}

html[data-theme=human] .envelope-button {
    --envelope-metal-light: #68502a;
    --envelope-metal-mid: #322616;
    --envelope-metal-dark: #171109
}

.envelope-rotation {
    display: block;
    width: min(78%, 320px, 100cqh);
    aspect-ratio: 16/11;
    transform-style: preserve-3d;
    touch-action: none;
    will-change: transform
}

.envelope-scene {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(6deg) rotateY(-12deg) rotateZ(-3deg);
    animation: envelope-drift 8s ease-in-out infinite
}

.envelope-button {
    touch-action: pan-y;
    user-select: none;
    cursor: grab
}

.envelope-button.is-dragging {
    cursor: grabbing;
    touch-action: none
}

.envelope-button.is-rotated .envelope-scene {
    animation: none;
    transform: none
}

.envelope-pocket,
.envelope-letter {
    backface-visibility: hidden
}

.envelope-back {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--accent);
    border-radius: 18px;
    background: linear-gradient(145deg, var(--envelope-metal-mid), var(--envelope-metal-dark));
    box-shadow: 0 0 22px var(--halo), inset 0 0 16px #0007
}

.envelope-back {
    transform: translateZ(-1px);
    transform-style: preserve-3d
}

.envelope-back-mark {
    position: absolute;
    inset: 12%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transform: rotateY(180deg) translateZ(1px);
    backface-visibility: hidden;
    text-align: center;
    color: var(--light)
}

.envelope-back-mark strong {
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 500;
    letter-spacing: .25em;
    line-height: 1.1
}

.envelope-back-mark strong span {
    color: var(--accent);
    letter-spacing: 0;
    text-shadow: 0 0 12px var(--accent)
}

.envelope-back-mark>span {
    font-size: clamp(8px, 1vw, 12px);
    letter-spacing: .04em
}

.envelope-back-mark small {
    font-size: 9px;
    letter-spacing: .1em;
    opacity: .65
}

.envelope-pocket {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(3px);
    pointer-events: none
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    overflow: visible;
    transform-origin: 50% 0;
    transform: translateZ(5px) rotateX(0);
    transition: transform .8s cubic-bezier(.22, .7, .2, 1);
    backface-visibility: visible;
    pointer-events: none;
    filter: drop-shadow(0 5px 3px #0007)
}

.envelope-letter[hidden] {
    display: none !important
}

.envelope-letter {
    position: absolute;
    inset: 8% 9% 7%;
    display: flex;
    flex-direction: column;
    gap: 8%;
    padding: 9% 10%;
    border: 1px solid var(--edge);
    border-radius: 8px;
    background: linear-gradient(140deg, #edf4fa, #afc6d7);
    color: #17324a;
    transform: translateZ(1px) translateY(0);
    opacity: 0;
    visibility: hidden;
    transition: transform .6s cubic-bezier(.22, .7, .2, 1), opacity .2s .3s, visibility 0s .6s;
    box-shadow: 0 0 12px #0005
}

html[data-theme=human] .envelope-letter {
    background: linear-gradient(140deg, #fff3d9, #dbc49e);
    color: #4b3616
}

.envelope-letter-title {
    display: block;
    font-size: clamp(16px, 2vw, 26px);
    font-weight: 600;
    letter-spacing: .22em;
    line-height: 1.2
}

.envelope-letter-title span {
    color: var(--accent);
    margin-left: 5px
}

.envelope-letter-line {
    display: block;
    width: 100%;
    height: 3px;
    background: currentColor;
    opacity: .2;
    border-radius: 2px
}

.envelope-letter-line.short {
    width: 65%
}

.envelope-letter-sign {
    font-size: 8px;
    letter-spacing: .2em;
    opacity: .65;
    margin-top: auto
}

.envelope-hint {
    display: none
}

.envelope-button:hover .envelope-scene,
.envelope-button:focus-visible .envelope-scene,
.envelope-button[aria-expanded=true] .envelope-scene,
.envelope-button.is-dragging .envelope-scene {
    animation-play-state: paused
}

.envelope-button:hover .envelope-hint {
    color: var(--light)
}

.envelope-button:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: -4px;
    border-radius: 16px
}

.envelope-button[aria-expanded=true] .envelope-flap {
    transform: translateZ(-2px) rotateX(180deg)
}

.envelope-button[aria-expanded=true] .envelope-letter {
    transform: translateZ(1px) translateY(-62%);
    opacity: 1;
    visibility: visible;
    transition: transform .65s .55s cubic-bezier(.22, .7, .2, 1), opacity .2s .55s, visibility 0s .55s
}

.envelope-button[aria-expanded=false] .envelope-flap {
    transition-delay: .5s
}

@keyframes envelope-drift {

    0%,
    100% {
        transform: translateY(4px) rotateX(6deg) rotateY(-12deg) rotateZ(-3deg)
    }

    50% {
        transform: translateY(-5px) rotateX(-3deg) rotateY(13deg) rotateZ(2deg)
    }
}

@media(prefers-reduced-motion:reduce) {
    .envelope-scene {
        animation: none;
        transform: none
    }

    .envelope-flap,
    .envelope-letter {
        transition: none !important
    }
}

.contact-help {
    border-left: 2px solid var(--accent);
    padding-left: 16px
}

.contact-help h2 {
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
    margin: 0 0 10px;
    color: #edf4fa
}

.contact-help p {
    font-size: 12px;
    line-height: 1.9;
    margin: 0;
    color: #bac8d5
}

.contact-socials {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--edge)
}

.contact-social {
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-height: 44px;
    background: #050c1380;
    border: 1px solid var(--edge);
    border-radius: 50%;
    color: var(--light);
    padding: 0;
    text-decoration: none
}

.contact-social::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 55%, var(--accent) 84%, var(--light) 97%, transparent);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
    opacity: 0;
    pointer-events: none;
}

.contact-social:is(:hover, :focus-visible)::after {
    animation: contact-social-orbit 1.1s linear;
}

@keyframes contact-social-orbit {
    0% { opacity: 0; transform: rotate(-90deg); }
    12%, 85% { opacity: 1; }
    100% { opacity: 0; transform: rotate(270deg); }
}

@media (prefers-reduced-motion: reduce) {
    .contact-social:is(:hover, :focus-visible)::after { animation: none; }
}

.contact-social svg {
    width: 22px;
    height: 22px
}

.contact-social:disabled {
    opacity: .55;
    cursor: default
}

.contact-social[href]:hover {
    border-color: var(--accent);
    color: var(--light)
}

.contact-social:focus-visible,
.contact-submit:focus-visible {
    outline: 2px solid var(--light);
    outline-offset: 3px
}

.contact-socials {
    flex-wrap: wrap;
    gap: 12px
}

.contact-legal {
    display: grid;
    gap: 5px;
    flex: 1 1 240px;
    margin-left: auto;
    text-align: right;
    font-size: 14px;
    line-height: 1.6;
    color: #bac8d5
}

.contact-legal>span:first-child {
    color: #edf4fa
}

.contact-legal>div {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    column-gap: 12px
}

.contact-legal button {
    border: 0;
    padding: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--edge);
    text-underline-offset: 3px
}

.contact-legal button:hover {
    color: var(--light)
}

.contact-legal button:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 3px
}

.contact-legal-dialog {
    position: fixed;
    inset: 0;
    width: min(660px, calc(100vw - 32px));
    max-height: 85dvh;
    margin: auto;
    padding: 36px;
    border: 1px solid var(--edge);
    border-radius: 18px;
    background: #07121b;
    color: #edf4fa;
    overflow: auto;
    box-shadow: 0 0 60px var(--halo);
    font-family: inherit;
    box-sizing: border-box
}

html[data-theme=human] .contact-legal-dialog {
    background: #17120b
}

.contact-legal-dialog::backdrop {
    background: #000b;
    backdrop-filter: blur(8px)
}

.contact-legal-dialog h2 {
    font-size: 26px;
    line-height: 1.3;
    margin: 8px 0 20px;
    letter-spacing: -.03em
}

.contact-legal-dialog h3 {
    font-size: 15px;
    margin: 24px 0 8px;
    color: var(--light)
}

.contact-legal-dialog p {
    font-size: 13px;
    line-height: 1.8;
    color: #bac8d5
}

.contact-legal-dialog .legal-eyebrow {
    font-size: 10px;
    letter-spacing: .1em;
    color: var(--light);
    padding-right: 32px
}

.contact-legal-dialog .legal-close {
    position: absolute;
    right: 16px;
    top: 14px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--edge);
    border-radius: 50%;
    background: transparent;
    color: var(--light);
    font-size: 22px;
    cursor: pointer
}

@media(max-width:767px) {
    .contact-legal {
        flex-basis: 100%;
        margin-top: 8px;
        text-align: center
    }

    .contact-legal>div {
        justify-content: center
    }

    .contact-legal-dialog {
        padding: 28px 22px
    }

    .contact-legal-dialog h2 {
        font-size: 23px
    }

    .envelope-back-mark {
        gap: 7px
    }

    .envelope-back-mark small {
        font-size: 7px
    }
}

@media(max-height:850px) and (min-width:1101px) {
    body[data-section=contacts] .contacts-page {
        gap: 14px
    }

    .contact-form {
        gap: 9px
    }

    .contact-form input,
    .contact-form select {
        height: 44px;
        min-height: 44px
    }

    .contact-sidebar {
        gap: 16px
    }

    .contact-help h2 {
        margin-bottom: 6px
    }

    .contact-socials {
        padding-top: 12px
    }
}

@media(max-width:1100px) {
    body[data-section=contacts] .tablet {
        height: auto;
        min-height: calc(var(--tablet-header-height) + var(--tablet-scene-height) + 18px)
    }

    body[data-section=contacts] .tablet #main {
        height: auto
    }

    body[data-section=contacts] .contacts-page {
        height: auto;
        grid-template-rows: auto auto;
        padding: 24px 4.2%
    }

    .contacts-layout {
        gap: 24px
    }

    .contact-form {
        grid-template-rows: auto auto 145px 48px auto
    }

    .contact-sidebar {
        grid-template-rows: 190px auto auto;
        align-content: center
    }

    .contacts-heading h1 {
        font-size: 36px
    }
}

@media(max-width:767px) {
    body[data-section=contacts] .contacts-page {
        padding: 24px 20px;
        gap: 24px
    }

    .contacts-heading h1 {
        font-size: 32px
    }

    .contacts-heading p {
        font-size: 13px
    }

    .contacts-layout {
        grid-template-columns: 1fr;
        gap: 28px
    }

    .contact-form input,
    .contact-form select,
    .contact-form textarea {
        font-size: 16px
    }

    .contact-sidebar {
        grid-template-rows: 190px auto auto;
        gap: 18px
    }

    .contact-help p {
        font-size: 13px
    }

    .contact-socials {
        justify-content: center;
        gap: 22px
    }
}

@media(max-width:420px) {
    body[data-section=contacts] .contacts-page {
        padding: 22px 16px
    }

    .contact-form-row {
        grid-template-columns: 1fr;
        gap: 12px
    }

    .contact-form {
        gap: 14px
    }

    .contact-sidebar {
        grid-template-rows: 155px auto auto
    }

    .contact-socials {
        gap: 18px
    }

    .contact-help {
        padding-left: 12px
    }
}

@media(max-width:767px) {
    .contact-sidebar {
        grid-template-rows: 240px auto auto
    }

    .envelope-button {
        padding-top: 25cqh;
        box-sizing: border-box
    }

    .envelope-rotation {
        width: min(78%, 320px, 80cqh)
    }
}

.contact-help-row {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0
}

.contact-help-row .contact-help {
    flex: 1;
    min-width: 0
}

.contact-signature {
    display: block;
    flex: 0 0 auto;
    width: 112px;
    height: 112px;
    object-fit: contain;
    transform: translate(-15px, 7px)
}

@media(max-width:1100px) and (min-width:768px) {
    .contact-signature {
        width: 82px;
        height: 82px;

    }

    .contact-help-row {
        gap: 10px
    }
}

@media(max-width:420px) {
    .contact-signature {
        width: 76px;
        height: 76px
    }

    .contact-help-row {
        gap: 10px
    }
}

/* Only the visible envelope receives clicks; the layout space stays passive. */
.envelope-button,
.envelope-rotation,
.envelope-scene {
    pointer-events: none;
}
.envelope-back,
.envelope-letter {
    pointer-events: auto;
}
.envelope-pocket,
.envelope-flap {
    pointer-events: visiblePainted;
}
.envelope-button:focus-visible {
    outline: none;
}
.envelope-button:focus-visible .envelope-rotation {
    outline: 1px solid var(--accent);
    outline-offset: 5px;
    border-radius: 18px;
}

.contact-envelope {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--light);
    -webkit-tap-highlight-color: transparent;
}
.contact-envelope-canvas {
    visibility: hidden;
    position: absolute;
    left: 0;
    top: calc(-1 * var(--envelope-headroom, 0px));
    display: block;
    width: 100%;
    height: calc(100% + var(--envelope-headroom, 0px));
    touch-action: none;
}
.contact-envelope-placeholder {
    --envelope-edge: #55baff;
    --envelope-top: #183e58;
    --envelope-bottom: #071520;
    --envelope-flap-top: #205571;
    --envelope-flap-bottom: #102c42;
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(min(256px, 52.941176cqw, 52.941176cqh) * 1.0555555556);
    height: auto;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
html[data-theme="human"] .contact-envelope-placeholder {
    --envelope-edge: #ffc044;
    --envelope-top: #5a482a;
    --envelope-bottom: #1e190f;
    --envelope-flap-top: #65512b;
    --envelope-flap-bottom: #352a19;
}
.contact-envelope.is-ready .contact-envelope-canvas { visibility: visible; }
.contact-envelope.is-ready .contact-envelope-placeholder { visibility: hidden; }
@media(min-width:1101px) {
    /* The same size and centre as envelope-three.js computes, so the first frame does not jump:
       width = min(62.4% of the picture, 256px, (height - 24px) * 3.6 / 5.3); centre leaves room for the
       raised letter (2.95 units) above and a turned corner (2.35 units) below. */
    .contact-envelope-placeholder {
        --envelope-size: min(62.4cqw, 256px, (100cqh - 24px) * .6792452830);
        width: calc(var(--envelope-size) * 1.0555555556);
        top: max(calc(var(--envelope-size) * .8194444444 + 18px), min(50cqh, calc(100cqh - var(--envelope-size) * .6527777778 - 6px)));
    }
}
.contact-envelope-canvas.is-dragging { cursor: grabbing !important; }
.contact-envelope:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 4px;
    border-radius: 14px;
}
.contact-envelope-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 12px;
    pointer-events: none;
}
.contact-envelope-loading[hidden] { display: none; }
@media(max-width:767px) {
    .contact-sidebar { grid-template-rows: 330px auto auto; }
}
@media(min-width:768px) and (max-width:1400px) {
    body[data-section=contacts] .tablet,
    body[data-section=contacts] .tablet #main,
    body[data-section=contacts] .contacts-page { height: auto; }
    body[data-section=contacts] .contacts-page { grid-template-rows: auto auto; }
    .contact-sidebar { grid-template-rows: 320px auto auto; }
    .contact-form { grid-template-rows: max-content max-content minmax(180px, 1fr) 48px max-content; }
}
/* From 1101px the picture column starts at the top of the page, beside the heading: the envelope gets the free
   space above the form without reaching outside its own box, so the CSS placeholder and the 3D envelope agree.
   The legal links are always one per line, so the picture has the same height in both languages. */
@media(min-width:1101px) {
    body[data-section=contacts] .page-content.contacts-page { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 36px; }
    body[data-section=contacts] .contacts-layout { display: contents; }
    body[data-section=contacts] .contacts-heading { grid-column: 1; grid-row: 1; }
    body[data-section=contacts] .contact-form { grid-column: 1; grid-row: 2; }
    body[data-section=contacts] .contact-sidebar { grid-column: 2; grid-row: 1 / 3; }
    .contact-legal>div { flex-direction: column; align-items: flex-end; row-gap: 5px; }
}
