/* persopass.io - Digital Identity Document */

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

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

:root {
    --doc-dark: #0f1419;
    --card-dark: #1a2332;
    --parchment: #e8e0d0;
    --gold-seal: #c9a55c;
    --verified-teal: #00ccaa;
    --field-dark: #333d4d;
    --clean-white: #ffffff;
    --muted-silver: #666d7a;
}

html, body {
    background: var(--doc-dark);
    color: var(--parchment);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background:
        radial-gradient(ellipse at top, rgba(201, 165, 92, 0.04), transparent 50%),
        radial-gradient(ellipse at bottom, rgba(0, 204, 170, 0.03), transparent 50%),
        var(--doc-dark);
    min-height: 100vh;
}

.document-stage {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px;
    position: relative;
}

.document-stage::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(102, 109, 122, 0.05) 80px, rgba(102, 109, 122, 0.05) 81px),
        repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(102, 109, 122, 0.05) 80px, rgba(102, 109, 122, 0.05) 81px);
    pointer-events: none;
    z-index: 0;
}

/* Document Card with Holographic Border */
.document-card {
    position: relative;
    max-width: 560px;
    width: 100%;
    background: var(--card-dark);
    padding: 48px 44px 36px;
    border-radius: 8px;
    border: 2px solid transparent;
    border-image: conic-gradient(
        from var(--angle),
        var(--gold-seal),
        var(--verified-teal),
        var(--gold-seal),
        var(--parchment),
        var(--gold-seal)
    ) 1;
    animation: rotateAngle 14s linear infinite;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 10px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(201, 165, 92, 0.12);
    z-index: 1;
}

@keyframes rotateAngle {
    to { --angle: 360deg; }
}

/* Security Microprint Overlay */
.security-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(201, 165, 92, 0.05) 4px,
        rgba(201, 165, 92, 0.05) 5px
    );
    pointer-events: none;
    border-radius: 6px;
    mix-blend-mode: screen;
}

/* Document Header */
.document-header {
    text-align: center;
    margin-bottom: 36px;
    position: relative;
}

.header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.header-meta {
    font-family: 'Space Mono', 'Inter', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--gold-seal);
    text-transform: uppercase;
}

.document-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--clean-white);
    text-transform: lowercase;
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
}

.document-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-seal), transparent);
    opacity: 0.4;
}

.rule {
    width: 60%;
    margin: 0 auto 14px;
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-seal) 20%, var(--gold-seal) 80%, transparent);
    opacity: 0.6;
}

.document-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--parchment);
    padding-left: 0.4em;
}

/* Hero Row with Portrait + Fields */
.hero-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 28px;
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--field-dark);
}

.portrait-frame {
    position: relative;
    aspect-ratio: 3 / 4;
    background:
        linear-gradient(135deg, var(--field-dark) 0%, var(--card-dark) 100%);
    border: 1px solid var(--gold-seal);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
}

.portrait-grid {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 6px, rgba(232, 224, 208, 0.08) 6px, rgba(232, 224, 208, 0.08) 7px),
        repeating-linear-gradient(90deg, transparent, transparent 6px, rgba(232, 224, 208, 0.08) 6px, rgba(232, 224, 208, 0.08) 7px);
}

.portrait-frame::before {
    content: '';
    position: absolute;
    inset: 12% 18% 30% 18%;
    border-radius: 50% 50% 45% 45%;
    background: radial-gradient(ellipse at center, rgba(201, 165, 92, 0.18), transparent 70%);
    border: 1px solid rgba(201, 165, 92, 0.3);
}

.portrait-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    right: 25%;
    height: 35%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: linear-gradient(180deg, rgba(201, 165, 92, 0.18), rgba(201, 165, 92, 0.05));
    border-top: 1px solid rgba(201, 165, 92, 0.25);
}

.portrait-mark {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--gold-seal);
    letter-spacing: 0.1em;
    z-index: 2;
    background: rgba(15, 20, 25, 0.7);
    padding: 2px 5px;
    border-radius: 2px;
}

.hero-fields {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
}

/* Field Styles */
.field {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--field-dark);
    padding: 10px 0;
    margin-bottom: 6px;
    transition: border-color 0.4s ease;
}

.field:last-child {
    margin-bottom: 0;
}

.field:hover {
    border-bottom-color: var(--gold-seal);
}

.field-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-silver);
    margin-bottom: 4px;
}

.field-value {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--parchment);
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-value.mono {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--clean-white);
    letter-spacing: 0.05em;
    word-break: break-all;
}

.field-value.verified {
    color: var(--verified-teal);
    font-weight: 600;
    letter-spacing: 0.15em;
    font-size: 0.85rem;
}

.verified-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--verified-teal);
    box-shadow: 0 0 0 3px rgba(0, 204, 170, 0.2), 0 0 12px var(--verified-teal);
    animation: pulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(0, 204, 170, 0.2), 0 0 8px var(--verified-teal);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 204, 170, 0.05), 0 0 16px var(--verified-teal);
        transform: scale(1.1);
    }
}

/* Sections */
.section {
    margin-bottom: 32px;
    position: relative;
}

.section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-seal);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(201, 165, 92, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--gold-seal);
    transform: rotate(45deg);
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
}

.field.full {
    grid-column: 1 / -1;
}

/* Chip Section */
.chip-section {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 24px;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(51, 61, 77, 0.4), rgba(26, 35, 50, 0.4));
    border: 1px solid var(--field-dark);
    border-radius: 6px;
}

.chip {
    position: relative;
    width: 70px;
    height: 56px;
    background: linear-gradient(135deg, #d4b878 0%, var(--gold-seal) 50%, #a88a4a 100%);
    border-radius: 6px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 0 8px rgba(0, 0, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.chip-grid {
    position: absolute;
    inset: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
}

.chip-grid span {
    background: rgba(15, 20, 25, 0.5);
    border-radius: 1px;
    box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.15);
}

.chip-pin {
    position: absolute;
    width: 5px;
    height: 5px;
    background: rgba(15, 20, 25, 0.6);
    border-radius: 1px;
}

.chip-pin-tl { top: 2px; left: 2px; }
.chip-pin-tr { top: 2px; right: 2px; }
.chip-pin-bl { bottom: 2px; left: 2px; }
.chip-pin-br { bottom: 2px; right: 2px; }

.chip-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chip-meta .field {
    border-bottom: none;
    padding: 4px 0;
    margin-bottom: 0;
}

.chip-meta .field + .field {
    border-top: 1px dashed var(--field-dark);
    padding-top: 8px;
    margin-top: 4px;
}

/* MRZ - Machine Readable Zone */
.mrz-section .section-title {
    margin-bottom: 12px;
}

.mrz {
    background: var(--doc-dark);
    border: 1px solid var(--field-dark);
    padding: 14px 16px;
    border-radius: 4px;
    overflow: hidden;
}

.mrz-line {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--clean-white);
    letter-spacing: 0.12em;
    line-height: 1.6;
    word-break: break-all;
    text-shadow: 0 0 4px rgba(232, 224, 208, 0.15);
}

/* Footer with Security Strip */
.document-footer {
    margin-top: 32px;
    position: relative;
}

.security-strip {
    height: 28px;
    background:
        repeating-linear-gradient(
            -45deg,
            var(--gold-seal) 0px,
            var(--gold-seal) 1px,
            transparent 1px,
            transparent 5px
        ),
        repeating-linear-gradient(
            45deg,
            rgba(201, 165, 92, 0.4) 0px,
            rgba(201, 165, 92, 0.4) 1px,
            transparent 1px,
            transparent 5px
        );
    border-top: 1px solid var(--gold-seal);
    border-bottom: 1px solid var(--gold-seal);
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.security-strip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 204, 170, 0.15) 30%,
        rgba(232, 224, 208, 0.15) 50%,
        rgba(0, 204, 170, 0.15) 70%,
        transparent 100%
    );
    animation: shimmer 6s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.footer-meta {
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: var(--muted-silver);
    text-transform: uppercase;
}

/* Card Tilt Effect */
.document-card {
    transform-style: preserve-3d;
    transition: transform 0.4s ease-out;
}

/* Reveal Animations */
.document-card {
    animation: rotateAngle 14s linear infinite, cardEntrance 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.section, .hero-row, .document-header {
    animation: fadeInUp 0.8s ease-out both;
}

.document-header { animation-delay: 0.2s; }
.hero-row { animation-delay: 0.4s; }
.section:nth-of-type(2) { animation-delay: 0.5s; }
.section:nth-of-type(3) { animation-delay: 0.6s; }
.section:nth-of-type(4) { animation-delay: 0.7s; }
.section:nth-of-type(5) { animation-delay: 0.8s; }
.document-footer {
    animation: fadeInUp 0.8s ease-out 0.9s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .document-stage {
        padding: 30px 12px;
    }

    .document-card {
        padding: 32px 24px 24px;
    }

    .hero-row {
        grid-template-columns: 90px 1fr;
        gap: 18px;
    }

    .grid-two {
        grid-template-columns: 1fr;
    }

    .chip-section {
        grid-template-columns: 70px 1fr;
        gap: 16px;
        padding: 14px;
    }

    .header-row {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    .footer-row {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .mrz-line {
        font-size: 0.62rem;
        letter-spacing: 0.08em;
    }
}

@media (max-width: 380px) {
    .hero-row {
        grid-template-columns: 1fr;
    }

    .portrait-frame {
        max-width: 120px;
        margin: 0 auto;
    }
}
