* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-size: 17px;
    line-height: 1.7;
    color: #1a1a1a;
    background: #fff;
    padding: 3rem 1.5rem;
    max-width: 680px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-text {
    flex: 1;
}

.profile-pic-wrapper {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin-left: 1.5rem;
    background: #f5f5f5 url('./assets/loading.svg') center center no-repeat;
    background-size: 24px 24px;
    overflow: hidden;
}

.profile-pic {
    object-fit: cover;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s;
}

.profile-pic.loaded {
    opacity: 1;
}

h1 {
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

p {
    margin-bottom: 1rem;
    color: #333;
}

.subtitle {
    color: #666;
    margin-bottom: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

td {
    padding: 0.4rem 0;
    vertical-align: top;
    border-bottom: 1px solid #eee;
}

td:first-child {
    color: #666;
    width: 160px;
    min-width: 160px;
}

.photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.photo {
    cursor: pointer;
}

.photo-img {
    aspect-ratio: 1;
    background: #f5f5f5 url('./assets/loading.svg') center center no-repeat;
    background-size: 32px 32px;
    overflow: hidden;
    position: relative;
}

.photo-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s, opacity 0.3s;
    opacity: 0;
}

.photo-img img.loaded {
    opacity: 1;
}

.photo:hover .photo-img img {
    transform: scale(1.03);
}

.photo-caption {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Stamp perforated border - applied to .photo-img container */
.stamp-border {
    --r: 4px;   /* radius of the semi-circle cuts */
    --s: 16px;  /* spacing between cuts (center to center) */
    --c: #0000; /* transparent for the cuts */

    -webkit-mask:
        radial-gradient(var(--r) at 50% 0, var(--c) 97%, #000) 50% calc(100% + var(--r)/2) / var(--s) 100% repeat-x,
        radial-gradient(var(--r) at 50% calc(100%), var(--c) 97%, #000) 50% calc(0% - var(--r)/2) / var(--s) 100% repeat-x,
        radial-gradient(var(--r) at 0 50%, var(--c) 97%, #000) calc(100% + var(--r)/2) 50% / 100% var(--s) repeat-y,
        radial-gradient(var(--r) at calc(100%) 50%, var(--c) 97%, #000) calc(0% - var(--r)/2) 50% / 100% var(--s) repeat-y;
    -webkit-mask-composite: source-in;

    mask:
        radial-gradient(var(--r) at 50% 0, var(--c) 97%, #000) 50% calc(100% + var(--r)/2) / var(--s) 100% repeat-x,
        radial-gradient(var(--r) at 50% calc(100%), var(--c) 97%, #000) 50% calc(0% - var(--r)/2) / var(--s) 100% repeat-x,
        radial-gradient(var(--r) at 0 50%, var(--c) 97%, #000) calc(100% + var(--r)/2) 50% / 100% var(--s) repeat-y,
        radial-gradient(var(--r) at calc(100%) 50%, var(--c) 97%, #000) calc(0% - var(--r)/2) 50% / 100% var(--s) repeat-y;
    mask-composite: intersect;
}


.stamp-border-curved {
    --s: 35px;  /* size of each scallop unit */
    --d: 5px;   /* depth of the curved cut */
    
    /* Horizontal edge pattern (scallops pointing up/down) */
    --h-top: url("./assets/cut_top.svg");
    --h-bot: url("./assets/cut_bottom.svg");
    
    /* Vertical edge pattern (scallops pointing left/right) */
    --v-left: url("./assets/cut_left.svg");
    --v-right: url("./assets/cut_right.svg");
    
    mask:
        linear-gradient(#000, #000) center / calc(100% + var(--d)) calc(100% + var(--d)) no-repeat,
        var(--h-top) top/var(--s) var(--d) repeat-x,
        var(--h-bot) bottom/var(--s) var(--d) repeat-x,
        var(--v-left) left/var(--d) var(--s) repeat-y,
        var(--v-right) right/var(--d) var(--s) repeat-y;
    mask-composite: exclude, add, add, add, add;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 2rem 0;
}

footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

a {
    color: #1a1a1a;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 2rem;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-caption {
    color: #fff;
    margin-top: 1rem;
    font-size: 0.95rem;
    text-align: center;
    max-width: 600px;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
}

.lightbox-close:hover {
    opacity: 1;
}

/* Print styles */
@page {
    margin: 1.5cm;

    /* Remove browser headers/footers */
    @top-left { content: none; }
    @top-center { content: none; }
    @top-right { content: none; }
    @bottom-left { content: none; }
    @bottom-center { content: none; }
    @bottom-right { content: none; }
}

@media print {
    html, body {
        height: 100%;
    }

    body {
        padding: 0;
        max-width: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.75rem;
        border-top: none;
        margin-top: 0;
    }

    .photos {
        gap: 0.75rem;
    }

    .photo {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .photo-img {
        background: transparent;
    }

    .photo-img img {
        object-fit: cover;
        background: transparent;
    }

    .photo-caption {
        font-size: 0.65rem;
        margin-top: 0.2rem;
    }

    .stamp-border {
        -webkit-mask: none;
        mask: none;
    }

    .print-section {
        break-inside: avoid;
        page-break-inside: avoid;
        page-break-before: auto;
    }

    /* Keep heading with its content */
    h2 {
        break-after: avoid;
        page-break-after: avoid;
    }

    .lightbox {
        display: none !important;
    }
}

@media (max-width: 500px) {
    body {
        font-size: 16px;
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .photos {
        grid-template-columns: repeat(2, 1fr);
    }
}
