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

html {
    min-height: 100%;
}

body {
    font-family: 'Avenir Next', Avenir, 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='0.2'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    background-color: #1a1a1a;
}

body.reflow-fix {
    /* Empty class just to trigger reflow */
}


.surface {
    position: relative;
    width: 100%;
    min-height: calc(100vh + 400px);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-perspective: 1000px;
    perspective: 1000px;
    -webkit-perspective-origin: 50% 50%;
    perspective-origin: 50% 50%;
    z-index: 1;
    padding: calc(30vh + 80px) 0 calc(30vh + 560px);
    box-sizing: border-box;
}

.drop-shadow {
    position: absolute;
    width: 420px;
    height: 240px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    -webkit-transform: translateY(0px);
    transform: translateY(0px);
    -webkit-transform-origin: center center;
    transform-origin: center center;
    opacity: 0;
    will-change: transform, opacity, filter;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    pointer-events: none;
}

/* Z-index layering for multiple cards */
.drop-shadow[data-card="1"] { z-index: 1; }
.drop-shadow[data-card="2"] { z-index: 3; }
.drop-shadow[data-card="3"] { z-index: 5; }

.business-card {
    position: absolute;
    width: 420px;
    height: 240px;
    background: white; /* Card stays white in both light and dark modes */
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transform: translateZ(500px) scale(2);
    transform: translateZ(500px) scale(2);
    -webkit-transform-origin: center center;
    transform-origin: center center;
    will-change: transform, filter;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    opacity: 0;
    overflow: hidden;
}

/* Z-index layering for multiple cards */
.business-card[data-card="1"] { z-index: 2; }
.business-card[data-card="2"] { z-index: 4; }
.business-card[data-card="3"] { z-index: 6; }

.business-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2; /* 0.04 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='cardGrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23cardGrain)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    border-radius: 15px;
}

/* Card 2 specific styling */
.business-card.card-2 {
    background: #E9E9CC;
}

.business-card.card-2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15; /* Slightly adjusted for the off-white background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='card2Grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23card2Grain)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    border-radius: 15px;
}

/* Card 2 content layout */
.card-content.card-2-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 11px !important;
    width: 100%;
    height: 100%;
}

.card-2-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    text-align: right;
    gap: 14px;
}

.card-2-graphic {
    width: 195px;
    height: 195px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 195px;
}

.card-2-graphic img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-2-section1,
.card-2-section2 {
    font-size: 11px;
    color: #01090C;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
    text-align: right;
    width: 100%;
}

.card-2-bold {
    font-weight: 600;
    color: #00AD7D;
}

.card-2-section2 {
    margin-top: -6px;
}

.card-2-links {
    margin-top: 4px;
    text-align: right;
    width: 100%;
}

.card-2-link {
    font-size: 13px;
    color: #01090C;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
    letter-spacing: 0.2px;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
}

.card-2-link:hover {
    color: #00AD7D;
}

/* Card 3 specific styling */
.business-card.card-3 {
    background: #F2EFE8;
}

.business-card.card-3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='card3Grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23card3Grain)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    border-radius: 15px;
}

/* Card 3 content layout */
.card-content.card-3-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16.5px !important;
    width: 100%;
    height: 100%;
}

.card-3-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
}

.card-3-graphic {
    width: 195px;
    height: 195px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 195px;
}

.card-3-graphic img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-3-section1,
.card-3-section2 {
    font-size: 11px;
    color: #3A3635;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
    text-align: left;
    width: 100%;
}

.card-3-bold {
    font-weight: 600;
    color: #D3552E;
}

.card-3-section2 {
    margin-top: -6px;
}

.card-3-links {
    margin-top: 4px;
    text-align: left;
    width: 100%;
}

.card-3-link {
    font-size: 13px;
    color: #3A3635;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
    letter-spacing: 0.2px;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
}

.card-3-link:hover {
    color: #D3552E;
}

/* Placeholder content styling */
.placeholder-content {
    font-size: 18px;
    color: #666;
    text-align: center;
    width: 100%;
}

.card-content {
    padding: 22.5px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 22.5px;
}

.design-element {
    width: 146px;
    height: 195px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.design-element img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
    padding-left: 0;
}

.name {
    font-size: 24px;
    font-weight: 500;
    color: #01090C; /* Dark color from suit graphic - doesn't change in dark mode */
    margin: 0;
    letter-spacing: 0.3px;
}

.tagline {
    font-size: 11px;
    color: #0F334C; /* Blue from suit graphic - doesn't change in dark mode */
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
    min-height: 14px;
    /* Try Futura, fall back to other geometric/technical fonts */
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
}

.tagline-part1 {
    font-weight: 600;
}

.tagline-part2 {
    font-weight: 400;
}

.links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.link-separator {
    color: #01090C;
    font-size: 13px;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
}

.links a {
    font-size: 13px;
    color: #01090C; /* Dark color from suit graphic - doesn't change in dark mode */
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
    letter-spacing: 0.2px;
    /* Match tagline font for consistency */
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
}

.links a:hover {
    color: #0F334C; /* Blue from suit graphic on hover */
}

.debug-overlay {
    position: fixed;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #1a2833 0%, #0f1923 100%);
    border: 2px solid #00ffcc;
    box-shadow: 
        0 0 20px rgba(0, 255, 204, 0.3),
        inset 0 0 20px rgba(0, 255, 204, 0.05);
    color: #00ffcc;
    font-family: 'Berkeley Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 11px;
    padding: 12px 14px;
    border-radius: 8px;
    z-index: 10000;
    line-height: 1.5;
    display: none;
    box-sizing: border-box;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 200px;
    width: 200px;
}

.debug-overlay::before {
    content: '◆ MISSION CONTROL ◆';
    display: block;
    font-size: 9px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 255, 204, 0.3);
    text-align: center;
    letter-spacing: 2px;
    color: rgba(0, 255, 204, 0.8);
}

.debug-overlay.visible {
    display: block;
    animation: debugPulse 2s ease-in-out infinite;
}

@keyframes debugPulse {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 255, 204, 0.3),
            inset 0 0 20px rgba(0, 255, 204, 0.05);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(0, 255, 204, 0.5),
            inset 0 0 25px rgba(0, 255, 204, 0.08);
    }
}

.debug-overlay div {
    margin: 3px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.debug-overlay span {
    color: #ffcc00;
    font-weight: 700;
    text-align: right;
    min-width: 45px;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.theme-toggle {
    display: none; /* Hidden in favor of keyboard hint */
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s ease;
    font-size: 20px;
    padding: 0;
    margin: 0;
    /* Fix Safari/Brave tint issue */
    -webkit-appearance: none;
    appearance: none;
    color: rgba(0, 0, 0, 0.8);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    isolation: isolate;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.theme-toggle:active,
.theme-toggle.touching {
    transform: scale(0.95);
}

body.dark-mode .theme-toggle {
    background: rgba(40, 40, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f5;
}

body.dark-mode .theme-toggle:hover {
    background: rgba(60, 60, 60, 1);
}

body.dark-mode .theme-toggle:active,
body.dark-mode .theme-toggle.touching {
    transform: scale(0.95);
}

.keyboard-hints {
    position: fixed;
    bottom: 24px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
    transform: translateY(10px);
    isolation: isolate;
}

.keyboard-hints.visible {
    opacity: 1;
    transform: translateY(0);
}

.hint-key {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Futura, 'Futura PT', 'Century Gothic', 'Trebuchet MS', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* Fix button styling */
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    /* Better touch target */
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Dark mode hint key with icon */
.hint-key-dark {
    width: auto;
    padding: 0 8px;
    gap: 3px;
}

.hint-icon {
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

body.dark-mode .hint-key {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.25);
}

.hint-key:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .hint-key:hover {
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hint-key:active {
    transform: translateY(0) scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .hint-key:active {
    background: rgba(0, 0, 0, 0.4);
}

/* Touch feedback state */
.hint-key.touching {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .hint-key.touching {
    background: rgba(0, 0, 0, 0.4);
}

/* Fix for mobile tap states not releasing */
@media (hover: none) and (pointer: coarse) {
    .hint-key:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.08);
        color: rgba(0, 0, 0, 0.3);
        box-shadow: none;
    }
    
    body.dark-mode .hint-key:hover {
        background: rgba(0, 0, 0, 0.2);
        color: rgba(255, 255, 255, 0.25);
        box-shadow: none;
    }
    
    /* Ensure active state works on touch */
    .hint-key:active {
        transform: scale(0.92);
        transition: transform 0.1s ease;
    }
    
    /* Fix for mobile Safari bottom positioning issues */
    .keyboard-hints,
    .theme-toggle {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    
    /* Test: Double margins on mobile to see if bottom edge is the issue */
    .theme-toggle {
        bottom: 40px;
        left: 40px;
    }
    
    .keyboard-hints {
        bottom: 48px; /* Aligned with 40px button bottom */
        right: 40px;
    }
}

/* Card 3 mobile styles */
@media (max-width: 768px) {
    .card-3-graphic {
        width: 163px;
        height: 163px;
        flex: 0 0 163px;
    }
    
    .card-3-section1,
    .card-3-section2 {
        font-size: 10px;
        letter-spacing: 0.7px;
    }
    
    .card-3-link {
        font-size: 12px;
    }
    
    .card-content.card-3-content {
        gap: 13.5px !important;
    }
    
    .card-3-info {
        gap: 12px;
    }
}

@media (max-width: 400px) {
    .card-3-graphic {
        width: 146px;
        height: 146px;
        flex: 0 0 146px;
    }
    
    .card-3-section1,
    .card-3-section2 {
        font-size: 9px;
        letter-spacing: 0.6px;
    }
    
    .card-3-link {
        font-size: 11px;
    }
    
    .card-content.card-3-content {
        gap: 12px !important;
    }
    
    .card-3-info {
        gap: 10px;
    }
}

/* Card 2 mobile styles */
@media (max-width: 768px) {
    .card-2-graphic {
        width: 163px;
        height: 163px;
        flex: 0 0 163px;
    }
    
    .card-2-section1,
    .card-2-section2 {
        font-size: 10px;
        letter-spacing: 0.7px;
    }
    
    .card-2-link {
        font-size: 12px;
    }
    
    .card-content.card-2-content {
        gap: 9px !important;
    }
    
    .card-2-info {
        gap: 12px;
    }
}

@media (max-width: 400px) {
    .card-2-graphic {
        width: 146px;
        height: 146px;
        flex: 0 0 146px;
    }
    
    .card-2-section1,
    .card-2-section2 {
        font-size: 9px;
        letter-spacing: 0.6px;
    }
    
    .card-2-link {
        font-size: 11px;
    }
    
    .card-content.card-2-content {
        gap: 8px !important;
    }
    
    .card-2-info {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .business-card {
        width: 350px;
        height: 200px;
        border-radius: 12.5px;
    }
    
    .drop-shadow {
        width: 350px;
        height: 200px;
        border-radius: 12.5px;
    }
    
    .card-content {
        padding: 18.75px;
        gap: 18.75px;
    }
    
    .design-element {
        width: 122px;
        height: 163px;
    }
    
    .name {
        font-size: 20px;
    }
    
    .links a {
        font-size: 12px;
    }
    
    .tagline {
        font-size: 10px;
        letter-spacing: 0.7px;
        margin: 1px 0 5px;
    }
    
    .info-section {
        gap: 12px;
    }
    
    .keyboard-hints {
        /* Doubled margins for testing */
        bottom: 46px;
        right: 35px;
        gap: 6px;
    }
    
    .hint-key {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .hint-key-dark {
        width: auto;
        padding: 0 6px;
    }
    
    .hint-icon {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .business-card {
        width: 315px;
        height: 180px;
        border-radius: 11.25px;
    }
    
    .drop-shadow {
        width: 315px;
        height: 180px;
        border-radius: 11.25px;
    }
    
    .card-content {
        padding: 16.875px;
        gap: 16.875px;
    }
    
    .design-element {
        width: 110px;
        height: 146px;
    }
    
    .name {
        font-size: 18px;
    }
    
    .links a {
        font-size: 11px;
    }
    
    .links {
        gap: 6px;
    }
    
    .tagline {
        font-size: 9px;
        letter-spacing: 0.6px;
        margin: 1px 0 4px;
    }
    
    .info-section {
        gap: 10px;
    }
    
    .keyboard-hints {
        /* Doubled margins for testing */
        bottom: 47px;
        right: 32px;
        gap: 5px;
    }
    
    .hint-key {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }
    
    .hint-key-dark {
        width: auto;
        padding: 0 5px;
    }
    
    .hint-icon {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .business-card {
        -webkit-transform: translateZ(0) translateY(0) scale(1) rotateZ(0deg) !important;
        transform: translateZ(0) translateY(0) scale(1) rotateZ(0deg) !important;
        -webkit-animation: none !important;
        animation: none !important;
        -webkit-transition: none !important;
        transition: none !important;
    }
    
    .business-card[data-card="2"] {
        -webkit-transform: translateZ(0) translateY(280px) scale(1) rotateZ(0deg) !important;
        transform: translateZ(0) translateY(280px) scale(1) rotateZ(0deg) !important;
    }
    
    .business-card[data-card="3"] {
        -webkit-transform: translateZ(0) translateY(560px) scale(1) rotateZ(0deg) !important;
        transform: translateZ(0) translateY(560px) scale(1) rotateZ(0deg) !important;
    }
    
    .drop-shadow {
        display: none !important;
    }
    
    .keyboard-hints {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }
}

@media (prefers-reduced-motion: reduce) and (max-width: 768px) {
    .business-card[data-card="2"] {
        -webkit-transform: translateZ(0) translateY(200px) scale(1) rotateZ(0deg) !important;
        transform: translateZ(0) translateY(200px) scale(1) rotateZ(0deg) !important;
    }
    
    .business-card[data-card="3"] {
        -webkit-transform: translateZ(0) translateY(400px) scale(1) rotateZ(0deg) !important;
        transform: translateZ(0) translateY(400px) scale(1) rotateZ(0deg) !important;
    }
}