/* ============================================================
   layer2.id  --  Glassmorphic Identity Card
   Swiss precision meets frosted glass
   8px baseline grid -- centered (max 640px) -- mesh gradient
   ============================================================ */

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

:root {
    /* Palette */
    --bg-deep:        #0c0c1a;
    --mesh-purple:    #1a0a3a;
    --mesh-teal:      #0a1a2a;
    --mesh-cool:      #0c1a2e;

    --text-primary:   #e4e4f0;
    --text-muted:     #6b6b80;
    --accent-green:   #4ade80;
    --pure-white:     #ffffff;

    --glass-bg:       rgba(255, 255, 255, 0.08);
    --glass-border:   rgba(255, 255, 255, 0.15);
    --glass-rule:     rgba(255, 255, 255, 0.06);
    --glass-strong:   rgba(255, 255, 255, 0.12);

    /* Typography */
    --font-display:   'Space Grotesk', 'Inter', sans-serif;
    --font-body:      'DM Sans', 'Inter', sans-serif;
    --font-mono:      'DM Mono', 'Space Mono', monospace;

    /* Rhythm */
    --grid-unit:      8px;
    --max-content:    640px;
}

html, body { height: 100%; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-deep);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- BACKGROUND LAYERS ---------- */

.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-color: #0c0c1a;
    background-image:
        radial-gradient(ellipse at 20% 20%, #1a0a3a 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, #0a1a2a 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, #0c1a2e 0%, transparent 40%);
    animation: meshShift 24s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0%   { background-position: 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 4% -2%, -3% 4%, 2% -3%; }
}

.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 64px 64px, 64px 64px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 90%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 90%);
}

/* ---------- PAGE FRAME ---------- */

.page {
    width: 100%;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: calc(var(--grid-unit) * 8) calc(var(--grid-unit) * 3);
    display: flex;
    flex-direction: column;
    gap: calc(var(--grid-unit) * 12);
}

/* ---------- HERO ---------- */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--grid-unit) * 4);
    padding-top: calc(var(--grid-unit) * 4);
}

.brand-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: calc(var(--grid-unit) * 2);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-mark {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    letter-spacing: 0;
}

.brand-meta {
    flex: 1;
}

.brand-version {
    color: var(--accent-green);
    opacity: 0.9;
}

/* ---------- ID CARD ---------- */

.id-card {
    position: relative;
    width: min(460px, 90vw);
    aspect-ratio: 460 / 280;
    perspective: 1200px;
    cursor: default;
}

.id-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--glass-border);
    padding: calc(var(--grid-unit) * 3);
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.6s ease;
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: calc(var(--grid-unit) * 1.5);
}

.id-card-header {
    display: grid;
    grid-template-columns: 1fr 56px;
    align-items: start;
    gap: calc(var(--grid-unit) * 2);
}

.id-card-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.id-card-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.id-card-domain {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
}

.id-card-domain .dot {
    color: var(--accent-green);
}

.hex-avatar {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 8px rgba(74, 222, 128, 0.18));
}

.hex-avatar svg {
    width: 100%;
    height: 100%;
}

.id-card-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--grid-unit) * 1.5);
    padding: calc(var(--grid-unit) * 1) 0;
    border-top: 1px solid var(--glass-rule);
    border-bottom: 1px solid var(--glass-rule);
    align-content: center;
}

.id-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.id-field-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.id-field-value {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.id-field-value.mono {
    font-family: var(--font-mono);
}

.status-verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-green);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.id-card-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: calc(var(--grid-unit) * 2);
    padding-top: 2px;
}

.id-stripe-label {
    font-family: var(--font-body);
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.id-hash {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-primary);
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Holographic shimmer */
.id-card-shimmer {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    pointer-events: none;
    background: linear-gradient(
        120deg,
        rgba(255, 0, 0, 0.025) 0%,
        rgba(0, 255, 0, 0.025) 25%,
        rgba(0, 0, 255, 0.025) 50%,
        rgba(255, 0, 255, 0.025) 75%,
        rgba(255, 0, 0, 0.025) 100%
    );
    background-size: 200% 200%;
    mix-blend-mode: screen;
    animation: shimmer 8s ease infinite;
    z-index: 2;
}

@keyframes shimmer {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

.hero-caption {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 380px;
    line-height: 1.6;
    margin-top: calc(var(--grid-unit) * 1);
}

/* ---------- SECTION HEADERS ---------- */

.section-head {
    display: flex;
    align-items: baseline;
    gap: calc(var(--grid-unit) * 2);
    margin-bottom: calc(var(--grid-unit) * 3);
}

.section-index {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-green);
    letter-spacing: 0.15em;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.section-rule {
    flex: 1;
    height: 1px;
    background: var(--glass-rule);
}

/* ---------- CREDENTIALS ---------- */

.credentials-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: calc(var(--grid-unit) * 1) calc(var(--grid-unit) * 3);
}

.credential-row {
    display: flex;
    align-items: baseline;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--glass-rule);
    gap: calc(var(--grid-unit) * 2);
}

.credential-row:last-child {
    border-bottom: none;
}

.credential-label {
    width: 120px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.credential-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.credential-value.mono {
    font-family: var(--font-mono);
}

/* ---------- SPECS ---------- */

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(var(--grid-unit) * 2);
}

.spec-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: calc(var(--grid-unit) * 3);
    display: flex;
    flex-direction: column;
    gap: calc(var(--grid-unit) * 1.5);
    transition: transform 0.4s ease, border-color 0.4s ease, background 0.4s ease;
    position: relative;
    overflow: hidden;
}

.spec-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--grid-unit) * 4);
    height: 1px;
    background: var(--accent-green);
    opacity: 0.5;
}

.spec-panel:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.spec-key {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.spec-body {
    font-family: var(--font-body);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-muted);
}

/* ---------- VERIFICATION SEAL ---------- */

.seal-stage {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: calc(var(--grid-unit) * 4) calc(var(--grid-unit) * 3);
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: calc(var(--grid-unit) * 4);
}

.seal {
    width: 100px;
    height: 100px;
    position: relative;
    margin: 0 auto;
}

.seal-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: sealSpin 30s linear infinite;
}

@keyframes sealSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.seal-check {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.seal::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    box-shadow:
        0 0 24px rgba(74, 222, 128, 0.18),
        inset 0 0 12px rgba(74, 222, 128, 0.08);
}

.seal-meta {
    display: flex;
    flex-direction: column;
    gap: calc(var(--grid-unit) * 1.5);
    min-width: 0;
}

.seal-row {
    display: flex;
    align-items: baseline;
    gap: calc(var(--grid-unit) * 1.5);
    padding-bottom: calc(var(--grid-unit) * 1);
    border-bottom: 1px solid var(--glass-rule);
}

.seal-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.seal-label {
    width: 92px;
    flex-shrink: 0;
    font-family: var(--font-body);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.seal-value {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* ---------- COLOPHON ---------- */

.colophon {
    margin-top: calc(var(--grid-unit) * 4);
    padding-top: calc(var(--grid-unit) * 4);
    border-top: 1px solid var(--glass-rule);
}

.colophon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(var(--grid-unit) * 3);
}

.colophon-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.colophon-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.colophon-value {
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.colophon-value.mono {
    font-family: var(--font-mono);
    letter-spacing: 0;
}

/* ---------- REVEAL ---------- */

.section-head,
.credentials-panel,
.spec-panel,
.seal-stage,
.hero-caption,
.colophon {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.is-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.id-card-inner {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition:
        opacity 0.9s ease,
        transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.6s ease;
}

.id-card.is-visible .id-card-inner {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 540px) {
    .page {
        padding: calc(var(--grid-unit) * 5) calc(var(--grid-unit) * 2);
        gap: calc(var(--grid-unit) * 8);
    }

    .id-card-inner {
        padding: calc(var(--grid-unit) * 2);
    }

    .id-card-fields {
        grid-template-columns: 1fr;
        gap: calc(var(--grid-unit) * 1);
    }

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

    .seal-stage {
        grid-template-columns: 1fr;
        gap: calc(var(--grid-unit) * 3);
        padding: calc(var(--grid-unit) * 3) calc(var(--grid-unit) * 2);
    }

    .seal {
        margin: 0 auto;
    }

    .credential-row {
        flex-direction: column;
        gap: 4px;
    }

    .credential-label {
        width: auto;
    }

    .colophon-grid {
        grid-template-columns: 1fr;
        gap: calc(var(--grid-unit) * 2);
    }

    .brand-row {
        flex-wrap: wrap;
    }

    .brand-meta {
        font-size: 0.62rem;
    }
}

@media (max-width: 380px) {
    .id-card-domain {
        font-size: 1.4rem;
    }

    .id-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
