/**
 * GBWebcams — contact form postcard (Step 85, v2.55.0). Markup: gbwebcams_render_contact_form() (inc/contact.php).
 * Design: site pages mock round 2c (previews/fixtures/site-pages-r2.html?page=contact) — air-mail striped card,
 * message on lined paper in the Caveat hand, topics as perforated stamps (the chosen one postmarked),
 * name + email where the address goes, a pillar box beside "Post it". Paper colours match the Town Hero postcards.
 */

.gb-contact {
    --gbc-paper: #f6f1e7;
    --gbc-rule: #d8ccb4;
    --gbc-line: #b9ab8e;
    --gbc-ink: #24324a;
    --gbc-ink-2: #5a6b85;
    --gbc-red: #c8102e;
    --gbc-navy: #1f3a5c;
    margin: 0 0 28px;
    scroll-margin-top: 90px;
}

.gb-contact-card,
.gb-contact-done {
    position: relative;
    background: var(--gbc-paper);
    color: var(--gbc-ink);
    border-radius: 10px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .5);
    padding: 30px 22px 26px;
}
.gb-contact-card::before,
.gb-contact-card::after,
.gb-contact-done::before,
.gb-contact-done::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(135deg, var(--gbc-red) 0 12px, var(--gbc-paper) 12px 24px, var(--gbc-navy) 24px 36px, var(--gbc-paper) 36px 48px);
}
.gb-contact-card::before, .gb-contact-done::before { top: 0; border-radius: 10px 10px 0 0; }
.gb-contact-card::after, .gb-contact-done::after { bottom: 0; border-radius: 0 0 10px 10px; }

.gb-contact-card {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}
.gb-contact-left { padding-right: 22px; border-right: 2px solid var(--gbc-rule); min-width: 0; }
.gb-contact-right { padding-left: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.gb-contact-hello {
    font-family: var(--gb-font-script);
    font-size: 1.9rem;
    line-height: 1.1;
    margin: 0 0 4px;
    color: var(--gbc-ink);
}

.gb-contact label,
.gb-contact legend {
    display: block;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    color: var(--gbc-ink-2);
    text-transform: uppercase;
    margin: 12px 0 4px;
    padding: 0;
}
.gb-contact .gb-stamp { margin: 0; }

.gb-contact textarea,
.gb-contact input[type="text"],
.gb-contact input[type="email"],
.gb-contact select {
    width: 100%;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1.5px solid var(--gbc-line);
    background: transparent;
    font: 500 1rem var(--gb-font-family);
    color: var(--gbc-ink);
    padding: 6px 2px;
    border-radius: 0;
    box-shadow: none;
}
.gb-contact select option { color: #1a1e2a; }
.gb-contact textarea {
    min-height: 168px;
    resize: vertical;
    font-family: var(--gb-font-script);
    font-size: 1.45rem;
    line-height: 32px;
    border-bottom: 0;
    background: repeating-linear-gradient(180deg, transparent 0 31px, var(--gbc-rule) 31px 32px);
}
.gb-contact textarea::placeholder { color: #8a8270; }
.gb-contact textarea:focus,
.gb-contact input:focus,
.gb-contact select:focus { outline: 2px solid rgba(31, 182, 209, .55); outline-offset: 2px; }
.gb-contact [aria-invalid="true"] { border-bottom-color: var(--gbc-red); }

/* without JS every topic's extra fields show; with it, only the chosen stamp's */
.gb-contact-extra[hidden] { display: none; }

/* ---- stamps: perforated edge from dots, white face, a postmark on the chosen one ---- */
.gb-contact-stamps-wrap { border: 0; margin: 0; padding: 0; min-width: 0; }
.gb-contact-stamps { display: flex; flex-wrap: wrap; gap: 10px; }
.gb-stamp { position: relative; cursor: pointer; }
.gb-stamp input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gb-stamp-face {
    position: relative;
    width: 78px;
    min-height: 90px;
    box-sizing: border-box;
    padding: 9px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    background: radial-gradient(circle, #fff 2.7px, transparent 3.1px) -1px -1px / 8px 8px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .28));
    font: 800 .58rem/1.15 var(--gb-font-family);
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--gbc-ink);
    transition: transform .2s;
}
.gb-stamp-face::before { content: ""; position: absolute; inset: 3px; background: #fff; }
.gb-stamp-face i,
.gb-stamp-face span { position: relative; }
.gb-stamp-face i {
    display: grid;
    place-items: center;
    width: 56px;
    height: 40px;
    border-radius: 2px;
    background: var(--st, #1f5a66);
    color: #fff;
    font-style: normal;
    font-size: 1.2rem;
}
.gb-stamp:hover .gb-stamp-face { transform: rotate(-3deg); }
.gb-stamp input:checked + .gb-stamp-face { transform: rotate(-6deg) scale(1.08); }
.gb-stamp input:checked + .gb-stamp-face::after {
    content: "";
    position: absolute;
    top: 6px;
    right: -14px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(154, 42, 42, .75);
    box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5.5px rgba(154, 42, 42, .55);
}
.gb-stamp input:focus-visible + .gb-stamp-face { outline: 2px solid var(--gb-accent-blue); outline-offset: 3px; }

/* ---- posting ---- */
.gb-contact-error { margin: 0; min-height: 1em; color: var(--gbc-red); font-weight: 700; font-size: .88rem; }
.gb-contact-error:empty { display: none; }
.gb-contact-post { display: flex; align-items: flex-end; gap: 12px; margin-top: auto; }
.gb-contact-pillarbox { width: 46px; height: 74px; flex-shrink: 0; }
.gb-contact-send {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--gb-accent-green);
    color: #fff;
    font: 800 .82rem var(--gb-font-family);
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--gb-transition);
}
.gb-contact-send:hover { background: var(--gb-accent-green-hover, var(--gb-accent-green)); transform: translateY(-1px); }
.gb-contact-send:disabled { opacity: .7; cursor: wait; transform: none; }
.gb-contact-note { margin: 8px 0 0; font-size: .78rem; line-height: 1.45; color: var(--gbc-ink-2); }
.gb-contact-note a { color: var(--gbc-navy); text-decoration: underline; }

/* honeypot: off-screen, never shown to people */
.gb-contact-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---- sent ---- */
.gb-contact-done { text-align: center; padding: 40px 22px 34px; }
.gb-contact-done p { margin: 6px 0 0; color: var(--gbc-ink-2); }
.gb-contact-done .gb-contact-hello { font-size: 2.3rem; color: var(--gbc-ink); }
.gb-contact-postmark {
    width: 120px;
    height: 120px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px double rgba(154, 42, 42, .75);
    color: #9a2a2a;
    display: grid;
    place-content: center;
    text-align: center;
    transform: rotate(-10deg);
    font: 900 .78rem/1.3 var(--gb-font-family);
    letter-spacing: .14em;
    animation: gb-contact-stamp .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
.gb-contact-postmark b { font-size: .9rem; letter-spacing: .04em; }
@keyframes gb-contact-stamp { from { transform: rotate(-30deg) scale(1.6); opacity: 0; } to { transform: rotate(-10deg) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .gb-stamp-face, .gb-contact-send { transition: none; }
    .gb-contact-postmark { animation: none; }
}

/* phones: one column, and the stamp comes straight after the greeting (it decides which fields show) */
@media (max-width: 900px) {
    .gb-contact-card { display: flex; flex-direction: column; padding: 28px 16px 24px; }
    .gb-contact-left, .gb-contact-right { display: contents; }
    .gb-contact-hello { order: 1; font-size: 1.6rem; }
    .gb-contact-stamps-wrap { order: 2; margin-bottom: 4px; }
    .gb-contact-left textarea { order: 3; }
    .gb-contact-extra { order: 4; }
    .gb-contact-address { order: 5; }
    .gb-contact-error { order: 6; margin-top: 10px; }
    .gb-contact-post { order: 7; margin-top: 16px; }
    .gb-contact-stamps { gap: 6px; }
    .gb-stamp-face { width: 58px; min-height: 76px; padding: 7px 5px 6px; font-size: .48rem; }
    .gb-stamp-face i { width: 44px; height: 32px; font-size: .95rem; }
    .gb-stamp input:checked + .gb-stamp-face::after { width: 38px; height: 38px; right: -10px; }
}
