/* ============================================
   postp.day — The Uncollected Letter
   ============================================ */

/* --- CSS Custom Properties (Palette from DESIGN.md) --- */
:root {
    --aged-parchment: #f5ead6;
    --ink-dark: #2c2416;
    --worn-leather: #3d352a;
    --postmaster-red: #8b2500;
    --airmail-blue: #1a4a6e;
    --faded-ink: #6b5d4f;
    --stamp-gold: #c4a35a;
    --kraft-edge: #b8a88a;
    --envelope-interior: #e8dbc4;
    --cancelled-red: #a03020;
    --telegram-yellow: #f2e6a0;
    --wood-dark: #7a5c3a;
    --wood-light: #8b6d4a;
    --surface-alt: #e0d1b5;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--aged-parchment);
    color: var(--worn-leather);
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* Paper grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='1' height='1' fill='%233d352a' opacity='0.5'/%3E%3Crect x='2' y='3' width='1' height='1' fill='%233d352a' opacity='0.3'/%3E%3Crect x='3' y='1' width='1' height='1' fill='%233d352a' opacity='0.4'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Typography --- */
.typewriter, h1, h2 {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink-dark);
}

h1 {
    font-size: clamp(1.8rem, 4vw, 3.2rem);
}

h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
}

.baskerville {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.72;
    color: var(--worn-leather);
}

.label-mono {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faded-ink);
}

.caveat {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--postmaster-red);
}

/* ============================================
   OPENING SCENE: Envelope on Desk
   ============================================ */
#opening-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease-out;
}

#opening-scene.hidden {
    opacity: 0;
    pointer-events: none;
}

#desk-surface {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(
            0deg,
            var(--wood-light) 0px,
            var(--wood-light) 12px,
            var(--wood-dark) 12px,
            var(--wood-dark) 14px,
            #967352 14px,
            #967352 26px,
            var(--wood-light) 26px,
            var(--wood-light) 30px,
            #a07a52 30px,
            #a07a52 42px,
            var(--wood-dark) 42px,
            var(--wood-dark) 44px
        );
}

#envelope {
    position: relative;
    width: min(80vw, 640px);
    aspect-ratio: 16 / 9.5;
    opacity: 0;
    transform: scale(0.96);
    animation: envelopeFadeIn 400ms ease-out 0ms forwards;
    perspective: 800px;
}

@keyframes envelopeFadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#envelope-body {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--aged-parchment);
    border-radius: 2px;
    z-index: 2;
    overflow: hidden;
}

/* Airmail border on envelope */
#envelope-airmail-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    border: 12px solid transparent;
    border-image: repeating-linear-gradient(
        45deg,
        var(--postmaster-red) 0px,
        var(--postmaster-red) 8px,
        var(--aged-parchment) 8px,
        var(--aged-parchment) 16px,
        var(--airmail-blue) 16px,
        var(--airmail-blue) 24px,
        var(--aged-parchment) 24px,
        var(--aged-parchment) 32px
    ) 12;
}

/* Envelope flap */
#envelope-flap {
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 4;
    transform-origin: top center;
    transform: rotateX(0deg);
    transition: transform 700ms ease-in-out;
}

#envelope-flap.open {
    transform: rotateX(180deg);
}

#flap-inner {
    width: 100%;
    height: 100%;
    background: var(--envelope-interior);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    border-bottom: 2px solid var(--kraft-edge);
}

/* Postmark on envelope */
#envelope-postmark {
    position: absolute;
    top: 8%;
    right: 8%;
    width: 100px;
    height: 100px;
    opacity: 0;
}

#envelope-postmark.visible {
    opacity: 1;
}

.postmark-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.postmark-svg .postmark-outer,
.postmark-svg .postmark-inner {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 400ms ease-out;
}

#envelope-postmark.visible .postmark-outer,
#envelope-postmark.visible .postmark-inner {
    stroke-dashoffset: 0;
}

.postmark-svg .cancel-line {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    transition: stroke-dashoffset 300ms ease-out 200ms;
}

#envelope-postmark.visible .cancel-line {
    stroke-dashoffset: 0;
}

/* Typed domain on envelope */
#envelope-address {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#typed-domain {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.04em;
    color: var(--ink-dark);
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--ink-dark);
    margin-left: 2px;
    animation: cursorBlink 600ms step-end infinite;
    vertical-align: text-bottom;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Date stamp on envelope */
#envelope-datestamp {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--postmaster-red);
    opacity: 0;
    transition: opacity 600ms ease-out, color 400ms ease;
}

#envelope-datestamp.visible {
    opacity: 0.7;
}

/* ============================================
   MAIN CONTENT (hidden initially, slides up)
   ============================================ */
#main-content {
    position: relative;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 700ms ease-out, transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
    padding-left: 80px;
    padding-right: 60px;
    padding-bottom: 80px;
    min-height: 100vh;
}

#main-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SORTING TRAY NAV (Left Sidebar)
   ============================================ */
#sorting-tray {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: repeating-linear-gradient(
        0deg,
        var(--wood-light) 0px,
        var(--wood-light) 8px,
        var(--wood-dark) 8px,
        var(--wood-dark) 10px
    );
    border-right: 2px solid var(--kraft-edge);
    border-radius: 0 4px 4px 0;
    padding: 12px 0;
}

#sorting-tray.visible {
    opacity: 1;
}

.tray-tab {
    position: relative;
    width: 56px;
    height: 40px;
    background: var(--envelope-interior);
    border: 1px solid var(--kraft-edge);
    border-left: none;
    border-radius: 0 3px 3px 0;
    display: flex;
    align-items: center;
    padding-left: 8px;
    cursor: pointer;
    transform: rotate(0deg) translateX(0);
    transition: width 300ms ease-out, transform 150ms ease-out;
    overflow: hidden;
    white-space: nowrap;
}

.tray-tab:hover {
    width: 140px;
    transform: translateX(4px);
    z-index: 2;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
}

.tab-short {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--faded-ink);
    text-transform: uppercase;
    display: block;
}

.tab-full {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--faded-ink);
    text-transform: uppercase;
    display: none;
    margin-left: 8px;
}

.tray-tab:hover .tab-short {
    display: none;
}

.tray-tab:hover .tab-full {
    display: block;
}

.tray-tab.active {
    background: var(--aged-parchment);
    border-color: var(--postmaster-red);
    border-right-color: var(--postmaster-red);
}

.tray-tab.active .tab-short,
.tray-tab.active .tab-full {
    color: var(--postmaster-red);
}

/* ============================================
   STAMP COLLECTION STRIP (Right Side)
   ============================================ */
#stamp-collection {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#stamp-collection.visible {
    opacity: 1;
}

.stamp-slot {
    width: 36px;
    height: 36px;
    opacity: 0.2;
    transition: opacity 0.4s ease, transform 0.3s ease;
}

.stamp-slot.stamped {
    opacity: 0.8;
    transform: scale(1.1);
}

.mini-postmark {
    width: 100%;
    height: 100%;
}

/* ============================================
   Z-PATTERN HEADER
   ============================================ */
#z-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 60px 20px 40px 20px;
    min-height: 200px;
}

#zone-a {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.return-address {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.return-address .label-mono {
    margin-bottom: 4px;
}

.return-address .address-line {
    font-family: 'Special Elite', monospace;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--ink-dark);
    padding-left: 0;
}

.return-address .address-line:nth-child(3) {
    padding-left: 1rem;
}

.return-address .address-line:nth-child(4) {
    padding-left: 2rem;
}

.return-address .address-line:nth-child(5) {
    padding-left: 3rem;
}

#zone-b {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.header-postmark {
    width: 140px;
    height: 140px;
    overflow: visible;
}

/* ============================================
   AIRMAIL BORDER STRIPE
   ============================================ */
.airmail-border {
    height: 12px;
    width: 100%;
    background: repeating-linear-gradient(
        45deg,
        var(--postmaster-red) 0px,
        var(--postmaster-red) 8px,
        var(--aged-parchment) 8px,
        var(--aged-parchment) 16px,
        var(--airmail-blue) 16px,
        var(--airmail-blue) 24px,
        var(--aged-parchment) 24px,
        var(--aged-parchment) 32px
    );
    margin: 20px 0;
}

/* ============================================
   POSTAL ITEM (shared styles)
   ============================================ */
.postal-item {
    position: relative;
    margin: 40px 0;
    padding: 40px;
    background: var(--aged-parchment);
    border: 1px solid var(--kraft-edge);
}

.section-postmark-divider {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.divider-postmark {
    width: 80px;
    height: 80px;
}

/* Fold lines */
.fold-line {
    position: absolute;
    left: 5%;
    width: 90%;
    height: 0;
    border-top: 1px dashed var(--kraft-edge);
    opacity: 0.5;
}

.fold-top {
    top: 33%;
}

.fold-bottom {
    top: 66%;
}

/* Dog-ear */
.dog-ear {
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, transparent 50%, var(--surface-alt) 50%);
    box-shadow: -2px 2px 3px rgba(0,0,0,0.08);
}

/* Stamp perforation edges */
.postal-item::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    width: 100%;
    height: 8px;
    background: radial-gradient(circle, transparent 3px, var(--aged-parchment) 3px) repeat-x;
    background-size: 12px 8px;
    background-position: 0 0;
}

.postal-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 8px;
    background: radial-gradient(circle, transparent 3px, var(--aged-parchment) 3px) repeat-x;
    background-size: 12px 8px;
    background-position: 0 0;
}

/* Stamp-peel hover on interactive elements */
.postal-item {
    transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.postal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================
   SECTION 1: THE POSTCARD
   ============================================ */
.postcard-layout {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    gap: 0;
    min-height: 340px;
}

.postcard-image {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--airmail-blue) 0%, #2a6090 40%, var(--stamp-gold) 70%, #d4b46a 100%);
}

/* Cityscape art */
.cityscape-art {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 0 12px;
}

.building {
    flex: 1;
    background: var(--airmail-blue);
    opacity: 0.6;
    border-radius: 2px 2px 0 0;
}

.b1 { height: 45%; background: #1a4a6e; opacity: 0.7; }
.b2 { height: 68%; background: #1d5580; opacity: 0.55; }
.b3 { height: 52%; background: #1a4a6e; opacity: 0.65; }
.b4 { height: 80%; background: #1d5580; opacity: 0.5; }
.b5 { height: 35%; background: #1a4a6e; opacity: 0.7; }
.b6 { height: 90%; background: #1d5580; opacity: 0.45; }
.b7 { height: 55%; background: #1a4a6e; opacity: 0.6; }
.b8 { height: 40%; background: #1d5580; opacity: 0.65; }

.sky-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(180deg, #1a4a6e 0%, transparent 100%);
    opacity: 0.3;
}

/* Postcard stamp (top-right of image) */
.postcard-stamp {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 48px;
    height: 56px;
    background: var(--aged-parchment);
    padding: 3px;
}

/* Stamp perforation edge effect */
.postcard-stamp::before {
    content: '';
    position: absolute;
    inset: -3px;
    background:
        radial-gradient(circle, transparent 2px, var(--aged-parchment) 2px) repeat;
    background-size: 8px 8px;
    z-index: -1;
}

.stamp-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--stamp-gold), #d4b46a);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--kraft-edge);
}

.stamp-value {
    font-family: 'Special Elite', monospace;
    font-size: 1.1rem;
    color: var(--ink-dark);
}

.stamp-currency {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    color: var(--faded-ink);
}

/* Postcard divider */
.postcard-divider-line {
    width: 2px;
    background: var(--kraft-edge);
    min-height: 100%;
}

/* Postcard text area */
.postcard-text {
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.postcard-lines p {
    margin-bottom: 16px;
    position: relative;
}

/* Ruled lines effect on postcard text */
.postcard-lines p::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 0;
    border-bottom: 1px solid var(--kraft-edge);
    opacity: 0.4;
}

/* Handwritten annotations */
.handwritten-annotation {
    position: absolute;
}

.annotation-1 {
    bottom: 60px;
    right: 16px;
    transform: rotate(-2deg);
}

.annotation-2 {
    top: 20px;
    right: 24px;
    transform: rotate(2.5deg);
}

.annotation-parcel {
    position: relative;
    margin-top: 16px;
    text-align: right;
    transform: rotate(-1.5deg);
}

.annotation-dead {
    position: relative;
    margin-top: 16px;
    text-align: right;
    transform: rotate(2deg);
}

/* ============================================
   STRING AND WAX SEAL DIVIDER
   ============================================ */
.string-wax-divider {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 32px 0;
}

.string-line {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
}

.string-svg {
    width: 100%;
    height: 20px;
}

.wax-seal {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #b03010, var(--postmaster-red) 60%, #6a1800);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 2;
}

.seal-letter {
    font-family: 'Special Elite', monospace;
    font-size: 0.85rem;
    color: var(--stamp-gold);
    font-weight: 400;
}

/* ============================================
   SECTION 2: THE TELEGRAM
   ============================================ */
.telegram-item {
    background: var(--telegram-yellow);
    border: 2px solid #d4c670;
}

.telegram-paper {
    padding: 24px;
}

.telegram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--faded-ink);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.telegram-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dark);
}

.telegram-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--faded-ink);
}

.telegram-body {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 2;
    color: var(--ink-dark);
}

.telegram-body p {
    margin-bottom: 16px;
}

.stop {
    display: inline;
    font-weight: 600;
    color: var(--postmaster-red);
    margin: 0 4px;
}

.telegram-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid var(--faded-ink);
    padding-top: 12px;
    margin-top: 20px;
}

.telegram-time,
.telegram-route {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faded-ink);
}

/* Telegram text reveal animation */
.telegram-body p {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.telegram-body p.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   SECTION 3: THE PARCEL
   ============================================ */
.parcel-item {
    background: #c4a070;
    border: none;
}

.parcel-wrapper {
    position: relative;
    padding: 40px;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 2px,
            rgba(139,109,74,0.08) 2px,
            rgba(139,109,74,0.08) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 2px,
            rgba(139,109,74,0.08) 2px,
            rgba(139,109,74,0.08) 4px
        );
    background-color: #c4a070;
    border-radius: 2px;
}

/* String cross */
.parcel-string {
    position: absolute;
    background: var(--kraft-edge);
    z-index: 3;
}

.parcel-string.string-h {
    top: 50%;
    left: 0;
    width: 100%;
    height: 3px;
    transform: translateY(-50%);
    transition: opacity 0.8s ease, clip-path 0.8s ease;
}

.parcel-string.string-v {
    left: 50%;
    top: 0;
    width: 3px;
    height: 100%;
    transform: translateX(-50%);
    transition: opacity 0.8s ease, clip-path 0.8s ease;
}

.parcel-string-knot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--kraft-edge), #a08a6a);
    z-index: 4;
    transition: opacity 0.6s ease;
}

.parcel-wrapper.unwrapped .parcel-string.string-h {
    clip-path: polygon(0 0, 0 100%, 45% 100%, 45% 0, 55% 0, 55% 100%, 100% 100%, 100% 0);
}

.parcel-wrapper.unwrapped .parcel-string.string-v {
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%, 0 55%, 100% 55%, 100% 100%, 0 100%);
}

.parcel-wrapper.unwrapped .parcel-string-knot {
    opacity: 0;
}

.parcel-content {
    position: relative;
    z-index: 2;
    background: var(--aged-parchment);
    padding: 32px;
    border: 1px solid var(--kraft-edge);
}

.parcel-content h2 {
    margin-bottom: 20px;
}

.parcel-content p {
    margin-bottom: 16px;
}

.parcel-label {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.parcel-label .label-mono {
    background: var(--aged-parchment);
    border: 2px solid var(--postmaster-red);
    color: var(--postmaster-red);
    padding: 4px 10px;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}

/* ============================================
   SECTION 4: THE DEAD LETTER
   ============================================ */
.deadletter-item {
    background: var(--aged-parchment);
    border: 1px solid var(--kraft-edge);
    position: relative;
}

.dead-letter-paper {
    padding: 40px;
    position: relative;
}

.return-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    font-family: 'Special Elite', monospace;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    color: var(--cancelled-red);
    opacity: 0.25;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    z-index: 3;
    border: 4px solid var(--cancelled-red);
    padding: 8px 24px;
}

.dead-letter-content {
    position: relative;
    z-index: 2;
}

.dead-letter-content h2 {
    margin-bottom: 20px;
}

.dead-letter-content p {
    margin-bottom: 16px;
}

/* Faded photocopy effect */
.faded {
    opacity: 0.7;
}

/* ============================================
   BARCODE STRIP NAVIGATION (Zone D)
   ============================================ */
#barcode-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 48px;
    padding: 0 20px;
    margin-top: 40px;
}

.barcode-line {
    height: 32px;
    background: var(--ink-dark);
    cursor: pointer;
    transition: background-color 0.2s ease, height 0.15s ease;
    opacity: 0.7;
}

.barcode-line:hover {
    background: var(--postmaster-red);
    height: 38px;
    opacity: 1;
}

.barcode-gap {
    width: 12px;
    height: 32px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    #main-content {
        padding-left: 20px;
        padding-right: 20px;
    }

    #sorting-tray {
        display: none;
    }

    #stamp-collection {
        display: none;
    }

    .postcard-layout {
        grid-template-columns: 1fr;
    }

    .postcard-divider-line {
        width: 100%;
        height: 2px;
        min-height: 2px;
    }

    .postcard-image {
        min-height: 200px;
    }

    #z-header {
        grid-template-columns: 1fr;
        padding: 40px 10px 20px;
    }

    #zone-b {
        justify-content: flex-start;
    }

    .postal-item {
        padding: 24px;
        margin: 24px 0;
    }

    .parcel-wrapper {
        padding: 24px;
    }

    .parcel-content {
        padding: 20px;
    }

    .dead-letter-paper {
        padding: 24px;
    }

    .telegram-paper {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    #envelope {
        width: 92vw;
    }

    .return-stamp {
        font-size: 1.2rem;
    }

    .parcel-label {
        flex-direction: column;
        gap: 8px;
    }
}
