/* ═══════════════════════════════════════════════════════════════════════════
   WHAT WE KNOW — Terminal/Data Exposure Aesthetic
   Typography: IBM Plex Mono
   Theme: Dark terminal with phosphor green + amber accents
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Core palette — CRT terminal inspired */
    --bg-deep: #0a0e0d;
    --bg-card: #0d1311;
    --bg-elevated: #131a17;
    
    /* Phosphor green — main accent */
    --phosphor: #00ff9d;
    --phosphor-dim: #00cc7d;
    --phosphor-glow: rgba(0, 255, 157, 0.15);
    --phosphor-bright: #7fffcc;
    
    /* Amber — warnings & highlights */
    --amber: #ffb800;
    --amber-dim: #cc9300;
    --amber-glow: rgba(255, 184, 0, 0.12);
    
    /* Text hierarchy */
    --text-primary: #e8f0ed;
    --text-secondary: #8a9e96;
    --text-muted: #4a5a54;
    
    /* Borders & lines */
    --border: #1e2a26;
    --border-glow: rgba(0, 255, 157, 0.3);
    
    /* Functional */
    --success: #00ff9d;
    --warning: #ffb800;
    --error: #ff4d6a;
}

/* Light mode — Quiet Light inspired palette.
   Toggle by adding the attribute `data-theme="light"` to the document element (html).
*/
html[data-theme="light"] {
    --bg-deep: #f7f8fb; /* soft, cool white */
    --bg-card: #ffffff; /* card background */
    --bg-elevated: #f3f5f8; /* slightly darker than card */
    
    --phosphor: #4f46e5; /* Quiet Light soft indigo */
    --phosphor-dim: #3730a3;
    --phosphor-glow: rgba(79, 70, 229, 0.08);
    --phosphor-bright: #7c66ff;
    
    --amber: #c47a00;
    --amber-dim: #9a5d00;
    --amber-glow: rgba(196, 122, 0, 0.08);
    
    --text-primary: #17202a; /* dark text */
    --text-secondary: #475569; /* soft slate */
    --text-muted: #94a3b8;
    
    --border: #e6e9ef;
    --border-glow: rgba(79, 70, 229, 0.12);
}

/* Base reset and setup */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

/* Skip link for keyboard navigation accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--phosphor);
    color: var(--bg-deep);
    padding: 8px 16px;
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 0.85em;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--phosphor);
    outline-offset: 2px;
}

/* Scanline overlay effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

body {
    font-family: 'IBM Plex Mono', monospace;
    margin: 0;
    padding: 24px;
    background: var(--bg-deep);
    min-height: 100vh;
    color: var(--text-primary);
    
    /* Subtle grid pattern background */
    background-image: 
        linear-gradient(rgba(0, 255, 157, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 157, 0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: center center;
}

/* Light theme scanline / texture adjustments */
html[data-theme="light"] body::before {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.06) 2px,
        rgba(255, 255, 255, 0.06) 4px
    );
}

html[data-theme="light"] body {
    background-image: 
        linear-gradient(rgba(79, 70, 229, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 70, 229, 0.02) 1px, transparent 1px);
}

/* Main card container */
.card {
    max-width: 680px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 32px 40px;
    position: relative;
    
    /* Corner accents */
    clip-path: polygon(
        0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), 
        calc(100% - 12px) 100%, 0 100%
    );
    
    /* Glow effect */
    box-shadow: 
        0 0 0 1px var(--border),
        0 0 40px var(--phosphor-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    
    /* Entry animation */
    animation: cardReveal 0.6s ease-out;
}

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

/* Corner decoration */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border-left: 2px solid var(--phosphor);
    border-top: 2px solid var(--phosphor);
    opacity: 0.6;
}

.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-right: 2px solid var(--phosphor);
    border-bottom: 2px solid var(--phosphor);
    opacity: 0.6;
}

/* Header */
h1 {
    color: var(--phosphor);
    margin: 0 0 24px 0;
    font-size: 1.5em;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5em;
    
    /* Subtle glow */
    text-shadow: 0 0 30px var(--phosphor-glow);
    
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow: 0 0 20px var(--phosphor-glow);
    }
    to {
        text-shadow: 0 0 40px rgba(0, 255, 157, 0.25);
    }
}

.logo-inline {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    display: inline;
    filter: drop-shadow(0 0 8px var(--phosphor-glow));
}

/* Logo button wrap so clicking/tapping the image toggles theme */
.logo-toggle {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    height: 1.2em;
}

.logo-toggle:focus {
    outline: 2px solid var(--phosphor);
    outline-offset: 3px;
    border-radius: 6px;
}

.logo-toggle[aria-pressed="true"] {
    box-shadow: 0 0 10px var(--phosphor-glow);
    border-radius: 6px;
}

.logo-toggle:hover {
    transform: scale(1.03);
}

/* Smooth transitions when switching themes */
body, .card, .detail, .note, .footer, .share-section {
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

/* Temporary transition helper added from JS when toggling to reduce flicker */
.theme-transition * {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 220ms ease !important;
}

/* Indicator for light mode (small sun/outline) */
.logo-toggle::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: transparent;
    vertical-align: middle;
    transition: background 200ms ease, box-shadow 200ms ease;
}
.logo-toggle[aria-pressed="true"]::after {
    background: var(--phosphor);
    box-shadow: 0 0 8px var(--phosphor-glow);
}

/* Light-mode logo subtle filter */
.logo-inline.logo--light {
    filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.08));
}

/* Status/greeting text */
.greeting {
    font-size: 0.95em;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 28px;
    white-space: pre-wrap;
    padding-left: 16px;
    border-left: 2px solid var(--text-muted);
    
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Data detail blocks */
.detail {
    background: var(--bg-elevated);
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--phosphor);
    position: relative;
    
    /* Staggered reveal animation */
    opacity: 0;
    animation: detailSlide 0.4s ease-out forwards;
}

/* Animation delays for staggered reveal */
.detail:nth-child(1) { animation-delay: 0.1s; }
.detail:nth-child(2) { animation-delay: 0.15s; }
.detail:nth-child(3) { animation-delay: 0.2s; }
.detail:nth-child(4) { animation-delay: 0.25s; }
.detail:nth-child(5) { animation-delay: 0.3s; }
.detail:nth-child(6) { animation-delay: 0.35s; }
.detail:nth-child(7) { animation-delay: 0.4s; }
.detail:nth-child(8) { animation-delay: 0.45s; }
.detail:nth-child(9) { animation-delay: 0.5s; }
.detail:nth-child(10) { animation-delay: 0.55s; }

@keyframes detailSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.detail:hover {
    background: rgba(0, 255, 157, 0.03);
    border-left-color: var(--phosphor-bright);
}

.detail-title {
    font-weight: 600;
    color: var(--phosphor-dim);
    margin-bottom: 6px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.detail-value {
    color: var(--text-primary);
    font-size: 0.95em;
    word-break: break-word;
}

/* Privacy note — amber warning style */
.note {
    margin-top: 28px;
    padding: 20px;
    background: rgba(255, 184, 0, 0.05);
    border: 1px solid rgba(255, 184, 0, 0.2);
    border-left: 3px solid var(--amber);
    color: var(--text-secondary);
    font-size: 0.85em;
    line-height: 1.6;
    
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.note strong {
    color: var(--amber);
    display: block;
    margin-bottom: 8px;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.note a {
    color: var(--phosphor);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.note a:hover {
    border-bottom-color: var(--phosphor);
}

/* Footer */
.footer {
    max-width: 680px;
    margin: 24px auto 0;
    text-align: left;
    font-size: 0.8em;
    color: var(--text-muted);
    padding-left: 4px;
    
    animation: fadeIn 1s ease-out 0.8s both;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--phosphor);
}

/* Improved focus states for keyboard navigation */
a:focus,
button:focus {
    outline: 2px solid var(--phosphor);
    outline-offset: 2px;
}

/* Text selection */
.detail, .detail-title, .detail-value {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

::selection {
    background: rgba(0, 255, 157, 0.25);
    color: inherit;
}

::-moz-selection {
    background: rgba(0, 255, 157, 0.25);
    color: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Share functionality styles
   ═══════════════════════════════════════════════════════════════════════════ */

.share-section {
    margin-top: 28px;
    text-align: center;
    animation: fadeIn 0.8s ease-out 0.7s both;
}

.share-btn, .copy-btn {
    background: transparent;
    color: var(--phosphor);
    border: 1px solid var(--phosphor);
    padding: 12px 28px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px;
    position: relative;
    overflow: hidden;
}

.share-btn::before, .copy-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 157, 0.1), transparent);
    transition: left 0.4s ease;
}

.share-btn:hover, .copy-btn:hover {
    background: rgba(0, 255, 157, 0.1);
    box-shadow: 0 0 20px var(--phosphor-glow);
}

.share-btn:hover::before, .copy-btn:hover::before {
    left: 100%;
}

.share-btn:active, .copy-btn:active {
    transform: scale(0.98);
}

.share-fallback {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.share-fallback.hidden {
    display: none;
}

.social-links {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 1.1em;
    transition: all 0.2s ease;
}

.social-links a:hover {
    border-color: var(--phosphor);
    background: rgba(0, 255, 157, 0.05);
    transform: translateY(-2px);
}

/* Success notification */
.copy-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    color: var(--phosphor);
    padding: 14px 24px;
    border: 1px solid var(--phosphor);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.85em;
    box-shadow: 0 0 30px var(--phosphor-glow);
    transform: translateX(300px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.copy-success.show {
    transform: translateX(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile responsive styles
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .card {
        margin: 0 auto;
        padding: 24px 20px;
        
        /* Simpler clip-path on mobile */
        clip-path: polygon(
            0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), 
            calc(100% - 8px) 100%, 0 100%
        );
    }
    
    .card::before,
    .card::after {
        width: 24px;
        height: 24px;
    }
    
    h1 {
        flex-wrap: wrap;
        font-size: 1.3em;
    }
    
    .detail {
        padding: 14px 16px;
    }
    
    .footer {
        margin: 16px auto 0;
    }
    
    .share-btn, .copy-btn {
        padding: 10px 20px;
        font-size: 0.8em;
    }
}
