@font-face {
    font-family: "Tag Digits";
    src: local("CourierNewPSMT"), url("/fonts/CutiveMono-Regular.ttf") format("truetype");
    unicode-range: U+0030-0039;
}

/* Guestbook postcards */

.pc-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 0 30px;
    background: rgba(8, 9, 8, .97);
    color: #c5c5c0;
    font-family: "Blue Screen", monospace;
}

.pc-picker.is-open { display: flex; }

.pc-picker::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 100vh;
    background: #080908;
    pointer-events: none;
}

.pc-x,
.pc-back {
    position: absolute;
    top: 25px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #d6d6d2;
    font-family: "Blue Screen", monospace;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pc-x { right: 30px; }
.pc-back { left: 30px; }
.pc-back[hidden] { display: none; }

.pc-box {
    width: 100%;
    max-width: 560px;
    margin-top: 90px;
    flex: 0 0 auto;
}

.pc-input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #5a5a56;
    border-radius: 0;
    background: transparent;
    color: #e6e6e2;
    font-family: "Tag Digits", "Blue Screen", monospace;
    font-size: 22px;
    letter-spacing: 1.5px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.pc-input::placeholder { color: #6f6f6b; opacity: 1; }

.pc-body {
    width: 100%;
    max-width: 560px;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 6px;
    padding: 0 14px 24px 0;
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3a3a37 transparent;
    -webkit-overflow-scrolling: touch;
}

.pc-heading,
.pc-note {
    margin: 12px 0 6px;
    color: #6f6f6b;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    letter-spacing: 1px;
}

.pc-list { margin: 0; padding: 0; list-style: none; }

.pc-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 11px 0;
    border: 0;
    background: none;
    color: #c5c5c0;
    font-family: "Tag Digits", "Blue Screen", monospace;
    font-size: 18px;
    letter-spacing: 1.5px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pc-item b { font-weight: normal; color: #fff; }

.pc-count {
    flex: 0 0 auto;
    color: #6f6f6b;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    letter-spacing: 1px;
}

.pc-grid { display: flex; gap: 7px; align-items: flex-start; }
.pc-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; }

.pc-photo {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(184, 184, 180, .08);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pc-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .92;
}

.pc-photo:hover img { opacity: 1; }

/* attach controls inside the guestbook form */

.guestbook .pc-attach {
    display: block;
    margin: 2px auto 6px;
    background: rgba(8, 9, 8, .55);
    color: #b4b4b0;
    font-size: 12px;
    padding: 6px 10px;
    letter-spacing: 1px;
}

.pc-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 2px auto 4px;
}

.pc-preview[hidden] { display: none; }

.guestbook .pc-preview .pc-card { margin: 0; }
.pc-preview .pc-card img { max-width: 72px; max-height: 48px; }

.guestbook .pc-preview button.pc-remove {
    margin: 0;
    padding: 4px 8px 6px;
    background: rgba(8, 9, 8, .55);
    color: #b4b4b0;
    font-size: 18px;
    line-height: 1;
}

/* postcard inside a message */

.guestbook .pc-card {
    overflow: hidden;
    position: relative;
    display: block;
    width: fit-content;
    margin: 10px 0 2px;
    padding: 0;
    box-shadow: none;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pc-card img {
    display: block;
    width: auto;
    height: auto;
    max-width: 104px;
    max-height: 70px;
    opacity: 1;
}

.guestbook .pc-card:hover img,
.guestbook .pc-card:focus-visible img { opacity: 1; }
.pc-card:focus-visible { outline: 1px solid #b8b8b4; }

/* viewer */

.postcard-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 9, 8, .96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.postcard-lightbox.open { opacity: 1; visibility: visible; pointer-events: auto; }

.postcard-lightbox-image-container {
    position: absolute;
    top: 80px;
    right: 30px;
    bottom: 130px;
    left: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
}

.postcard-view-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.postcard-lightbox button {
    position: absolute;
    border: none;
    background: none;
    color: #a8a8a3;
    font-family: "Courier New", Courier, monospace;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.postcard-lightbox button:hover { color: #bcbcb7; }

.postcard-lightbox-close { top: 25px; right: 30px; font-size: 34px !important; }



@media screen and (max-width: 600px) {
    .pc-picker { padding: 0 18px; }
    .pc-x { top: 18px; right: 20px; font-size: 30px; }
    .pc-back { top: 18px; left: 20px; font-size: 30px; }
    .pc-box { margin-top: 70px; }
    .pc-input { font-size: 20px; }
    .pc-card img { max-width: 88px; max-height: 59px; }
    .postcard-lightbox-image-container { top: 70px; right: 12px; bottom: 120px; left: 12px; }
    .postcard-lightbox-close { top: 18px; right: 20px; font-size: 30px !important; }
    .postcard-lightbox button.pc-turn { bottom: 52px; }
}

.guestbook button,
.pc-picker button,
.postcard-lightbox button,
.pc-card {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.guestbook .pc-attach,
.guestbook .pc-card,
.guestbook .pc-remove {
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}

.banner .pc-card img,
.banner .pc-preview img {
    opacity: 1 !important;
    filter: none !important;
}

.banner .messages .pc-card img {
    opacity: .5 !important;
    filter: blur(4px) brightness(.8) saturate(.7) !important;
    transform: scale(1.12);
    transition: opacity .25s ease;
}

.banner .messages .pc-card:hover img,
.banner .messages .pc-card:focus-visible img {
    opacity: .85 !important;
}

.messages .pc-card::after {
    content: "TAP TO\A OPEN";
    white-space: pre;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 3px 5px;
    background: rgba(8, 9, 8, .78);
    border: 1px solid rgba(184, 184, 180, .4);
    color: #d0d0cc;
    font-family: "Blue Screen", monospace;
    font-size: 9px;
    line-height: 1.25;
    letter-spacing: .5px;
    text-align: center;
    pointer-events: none;
    animation: pc-nudge 3.6s ease-in-out infinite;
}

@media (hover: hover) and (pointer: fine) {
    .messages .pc-card::after { content: "CLICK TO\A OPEN"; }
}

@keyframes pc-nudge {
    0%, 70%, 100% { opacity: 1; }
    85% { opacity: .45; }
}

@media (prefers-reduced-motion: reduce) {
    .messages .pc-card::after { animation: none; }
}

.pc-flip {
    flex: 0 0 auto;
    perspective: 1400px;
    transform-origin: center center;
    will-change: transform;
}

.pc-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.4, .1, .2, 1);
}

.pc-flip-inner.is-flipped { transform: rotateY(180deg); }

.pc-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.pc-reverse {
    display: flex;
    box-sizing: border-box;
    padding: 5cqw 5cqw 5cqw 6cqw;
    transform: rotateY(180deg);
    container-type: size;
    background: #1a1b1a url(images/postcard/paper.jpg) center / cover no-repeat;
    border: 1px solid #3a3a37;
    color: #c5c5c0;
    font-family: "Tag Digits", "Blue Screen", monospace;
}

.pc-msg {
    flex: 1 1 58%;
    min-width: 0;
    overflow-y: auto;
    padding-right: 3cqw;
    scrollbar-width: thin;
    scrollbar-color: #3a3a37 transparent;
    touch-action: pan-y;
}

.pc-msg-text {
    margin: 0;
    font-size: clamp(10px, 4.1cqw, 18px);
    line-height: 1.55;
    letter-spacing: .5px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pc-divider {
    flex: 0 0 1px;
    margin: 0 4cqw;
    background: rgba(197, 197, 192, .3);
}

.pc-side {
    flex: 0 0 34%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pc-top { position: relative; height: 36cqw; }

.pc-stamp {
    position: absolute;
    top: 0;
    right: 0;
    width: 12cqw;
    height: 15.4cqw;
    background: center / contain no-repeat;
}

.pc-mark {
    position: absolute;
    top: 14cqw;
    right: 4cqw;
    width: 30cqw;
    aspect-ratio: 1380 / 777;
    background: url(images/postcard/postmark.png) center / 100% 100% no-repeat;
}

.pc-mark-text {
    position: absolute;
    left: 72.1%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(197, 197, 192, .85);
    font-family: "Courier New", Courier, monospace;
    font-size: clamp(6px, 2.1cqw, 10px);
    line-height: 1.2;
    letter-spacing: .4px;
    text-align: center;
    white-space: nowrap;
}

.pc-addr { display: flex; flex-direction: column; gap: 5cqw; }

.pc-addr-name,
.pc-addr-line {
    margin: 0;
    padding-bottom: 1cqw;
    border-bottom: 1px solid rgba(197, 197, 192, .35);
    min-height: 3.4cqw;
    font-size: clamp(9px, 3.4cqw, 15px);
    letter-spacing: .5px;
    overflow-wrap: anywhere;
    color: #e6e6e2;
}

.pc-reverse.is-portrait { flex-direction: column; padding: 6cqw; }
.pc-reverse.is-portrait .pc-msg { flex: 1 1 auto; padding: 0; }
.pc-reverse.is-portrait .pc-msg-text { font-size: clamp(10px, 5cqw, 18px); }
.pc-reverse.is-portrait .pc-divider { flex: 0 0 1px; width: auto; height: 1px; margin: 4cqw 0; }
.pc-reverse.is-portrait .pc-side { flex: 0 0 auto; flex-direction: row; align-items: flex-end; gap: 5cqw; }
.pc-reverse.is-portrait .pc-top { flex: 0 0 46cqw; height: 42cqw; order: 2; }
.pc-reverse.is-portrait .pc-addr { flex: 1 1 auto; order: 1; }
.pc-reverse.is-portrait .pc-stamp { width: 14cqw; height: 18cqw; }
.pc-reverse.is-portrait .pc-mark { top: 17cqw; right: 5cqw; width: 40cqw; }
.pc-reverse.is-portrait .pc-mark-text { font-size: clamp(6px, 2.8cqw, 10px); }
.pc-reverse.is-portrait .pc-addr-name,
.pc-reverse.is-portrait .pc-addr-line { font-size: clamp(9px, 4.2cqw, 15px); }

.pc-flipped .postcard-lightbox-image-container { touch-action: pan-y; cursor: default; }

.postcard-lightbox button.pc-turn {
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);
    padding: 8px 14px;
    font-family: "Blue Screen", monospace;
    font-size: 13px;
    letter-spacing: 2px;
    color: #92928c;
    white-space: nowrap;
}

.postcard-lightbox button.pc-turn:focus { outline: none; }
.postcard-lightbox button.pc-turn:focus-visible { outline: 1px solid #5a5a56; }
