/* ============================================
   CONTACT PAGE SPECIFIC STYLES
   Same layout, font sizes, and mobile settings as index page
   ============================================ */

html, body {
    /* Create a stable viewport box on mobile (prevents URL bar resize stepping) */
    height: 100vh; /* fallback */
    /* Prevent any scrolling/bounce that would make overlays appear to “move up” */
    overflow: hidden;
    overscroll-behavior: none;
}
@supports (height: 100svh) {
    html, body { height: 100svh; }
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    /* Avoid background-attachment: fixed on iOS (can cause compositor glitches with fixed overlays) */
    background-attachment: scroll;
}

/* Online Users Indicator */
.online-indicator {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(17px) saturate(180%);
    -webkit-backdrop-filter: blur(17px) saturate(180%);
    color: #ffffff;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px;
    line-height: 1;
    padding: 8px 14px;
    border-radius: 999px;
    font-optical-sizing: auto;
    font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    height: auto;
    box-sizing: border-box;
    /* Subtle dimensional outline - lighter top-left, darker bottom-right */
    border: 0.5px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12),
                0 1px 2px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* Move online indicator to upper left when in drawer, vertically centered with close button */
html.drawer-embed .online-indicator,
html.drawer-embed body .online-indicator,
.drawer-embed .online-indicator {
    /* Close button is 38px high, centered in topbar */
    /* Desktop: Chrome padding-top is max(20px, env(safe-area-inset-top, 0px) + 20px) */
    /* Topbar content (segmented controller buttons) are ~28px high (8px padding * 2 + 12px font) */
    /* Close button center = chrome padding-top + (topbar content height / 2) */
    /* Close button center ≈ chrome padding-top + 14px */
    top: calc(max(20px, env(safe-area-inset-top, 0px) + 20px) + 14px) !important;
    left: 12px !important;
    right: auto !important;
    transform: translateY(-50%) !important; /* Center vertically on the calculated position */
}

.online-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.online-text {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400; /* Google Sans Flex Regular */
    line-height: 1;
    letter-spacing: 0.1px;
    color: #ffffff; /* White text */
    white-space: nowrap;
    display: flex;
    align-items: center;
    line-height: 1;
}

#onlineCount {
    transition: opacity 0.15s ease;
    margin-right: 4px;
}

.online-icon path {
    fill: #ffffff; /* White icon to match text */
}

/* iOS-style Message Bubbles */
.messages-container {
    /* Fixed overlay should never move with any document reflow/scroll. */
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh; /* fallback */
    pointer-events: none;
    /* Keep background media behind the main text block */
    z-index: 1;
    /* Allow overflow to show drop shadows - shadows extend up to 40px beyond element */
    overflow: visible;
}

/* Ensure main content is always above the overlay media */
main {
    position: relative;
    z-index: 2;
}

/* Contact links row: desktop inline, mobile stacked */
.contact-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
}

@media (max-width: 768px) {
    .contact-links {
        display: inline-flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        align-items: baseline;
        margin-top: 0;
    }
}

@supports (height: 100svh) {
    .messages-container { height: 100svh; }
}

.message-bubble {
    position: absolute;
    max-width: 280px;
    min-width: 200px;
    border-radius: var(--radius-sm); /* 24px - same as video tiles */
    padding: 12px 16px; /* Added 2px more padding (was 10px 14px) */
    opacity: 0;
    /* Avoid animating filter on iOS Safari (can cause "ghost reappear / jump" artifacts) */
    transform: translate3d(0, 8px, 0) scale(0.86) rotate(var(--msg-rot, -1deg));
    transition:
        opacity 220ms cubic-bezier(0.2, 0.9, 0.2, 1),
        transform 420ms cubic-bezier(0.12, 1.05, 0.18, 1);
    pointer-events: auto;
    z-index: 2;
    overflow: hidden;
    /* Keep absolute positioning for proper placement around the content well */
    will-change: transform, opacity;
    /* Prevent layout shifts during removal */
    contain: layout style paint;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Light theme - New UI style: liquid glass with transparency and blur */
.message-bubble-light {
    background: rgba(255, 255, 255, 0.78);
    border: none;
    /* Soft, subtle drop shadows with wide blur (matches drawer UI) */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06),
                0 4px 40px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.8),
                inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(16px) saturate(185%);
    -webkit-backdrop-filter: blur(16px) saturate(185%);
    position: relative;
}

/* Dark theme - New UI style: dark liquid glass */
.message-bubble-dark {
    /* Slightly lighter dark gray glass (less shaded) */
    background: rgba(58, 58, 60, 0.74);
    border: none;
    /* Soft, subtle drop shadows with wide blur for dark mode */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3),
                0 4px 40px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.10),
                inset 0 -1px 0 rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(16px) saturate(185%);
    -webkit-backdrop-filter: blur(16px) saturate(185%);
    position: relative;
}

/* Subtle top highlight for glass effect */
.message-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    z-index: 1;
}

.message-bubble-dark::before {
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.12) 0%, 
        rgba(255, 255, 255, 0) 100%);
}

/* Extra "liquid glass" sheen: soft top-left bloom (matches drawer UI) */
.message-bubble::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(120% 95% at 18% 8%,
        rgba(255, 255, 255, 0.55) 0%,
        rgba(255, 255, 255, 0.18) 22%,
        rgba(255, 255, 255, 0) 52%);
    mix-blend-mode: screen;
    opacity: 0.55;
}

.message-bubble-dark::after {
    background: radial-gradient(120% 95% at 18% 8%,
        rgba(255, 255, 255, 0.14) 0%,
        rgba(255, 255, 255, 0.06) 24%,
        rgba(255, 255, 255, 0) 62%);
    opacity: 0.22;
}

.message-bubble.show {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
    animation: msgSplashIn 420ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

.message-bubble.hide {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.86) rotate(var(--msg-rot, 1deg));
    animation: msgSplashOut 260ms cubic-bezier(0.55, 0, 1, 0.55) forwards;
    pointer-events: none;
}

/* Last seen image - video treatment */
.last-seen-image {
    position: absolute;
    /* Default size: 180px (Office, DTLA) - Haleakalā uses larger size via inline styles */
    max-width: 180px;
    /* Remove max-height to allow proportional scaling based on image aspect ratio */
    max-height: none;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm); /* 24px - same as video tiles */
    /* Ensure smooth corner rounding - prevent white pixels */
    overflow: visible; /* Changed from hidden to visible to allow drop shadows to show */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
    /* Use clip-path for content clipping but allow shadows outside */
    clip-path: none; /* Remove clip-path to allow shadows */
    -webkit-clip-path: none;
    opacity: 0;
    /* Avoid animating filter on iOS Safari (can cause "ghost reappear / jump" artifacts) */
    transform: translate3d(0, 8px, 0) scale(0.86) rotate(var(--img-rot, -1deg));
    transition:
        opacity 220ms cubic-bezier(0.2, 0.9, 0.2, 1),
        transform 420ms cubic-bezier(0.12, 1.05, 0.18, 1);
    pointer-events: auto;
    /* Above the overlay itself, but still behind <main> (which is z-index: 2) */
    z-index: 1;
    will-change: transform, opacity;
    /* Prevent layout shifts during removal - but don't clip shadows */
    contain: layout style; /* Removed 'paint' to allow shadows to extend */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Drop shadow will be applied by light/dark mode classes - don't set to none here */
    position: absolute;
}

/* iOS WebKit (Safari + Chrome iOS) compositing stability:
   backdrop-filter + fixed overlays can cause “ghost reappear / jump” artifacts.
   Keep the liquid-glass look via background + outline + shadows, but disable backdrop-filter. */
@supports (-webkit-touch-callout: none) {
    .message-bubble,
    .last-seen-image,
    .last-seen-flag {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* Remove gradient border - using drop shadow only (matches new UI style) */

.last-seen-image img,
.last-seen-image video {
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-sm); /* 24px - same as video tiles */
    /* Ensure smooth corner rounding - prevent white pixels */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
    /* Clip the image/video itself but allow container shadow to show */
    overflow: hidden;
}

.last-seen-image-light {
    /* Match new UI style: more transparent, less blur */
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px) saturate(185%);
    -webkit-backdrop-filter: blur(16px) saturate(185%);
    /* Light mode drop shadow - same as message bubbles */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06),
                0 4px 40px rgba(0, 0, 0, 0.04) !important;
}

.last-seen-image-dark {
    /* Match new UI style: dark glass */
    background: rgba(30, 30, 30, 0.78);
    backdrop-filter: blur(16px) saturate(185%);
    -webkit-backdrop-filter: blur(16px) saturate(185%);
    /* Dark mode drop shadow - same as message bubbles */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3),
                0 4px 40px rgba(0, 0, 0, 0.2) !important;
}

.last-seen-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.3) 0%, 
        rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    z-index: 1;
}

.last-seen-image-dark::before {
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0) 100%);
}

.last-seen-image.show {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
    animation: msgSplashIn 420ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

/* Mobile: skip animation for videos to improve performance */
@media (max-width: 768px) {
    .last-seen-image.show video {
        animation: none !important;
        transition: none !important;
    }
}

.last-seen-image.hide {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.86) rotate(var(--img-rot, 1deg));
    animation: msgSplashOut 260ms cubic-bezier(0.55, 0, 1, 0.55) forwards;
    pointer-events: none;
}

/* Flag in upper left corner - smaller treatment (same as mobile) */
.last-seen-flag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(17px) saturate(180%);
    -webkit-backdrop-filter: blur(17px) saturate(180%);
    color: #ffffff;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 12px;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 999px;
    font-optical-sizing: auto;
    font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Subtle dimensional outline - lighter top-left, darker bottom-right */
    border: 0.5px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12),
                0 1px 2px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* Email tooltip - styled exactly like video flags with center nozzle */
.email-tooltip {
    position: fixed;
    z-index: 10001;
    /* Solid background (no transparency) for seamless nozzle integration */
    background: #f0f0f0; /* Light grey background - solid color */
    backdrop-filter: blur(17px) saturate(180%);
    -webkit-backdrop-filter: blur(17px) saturate(180%);
    color: #1F2937; /* Dark grey text */
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px; /* Same as video flags */
    line-height: 1;
    padding: 8px 14px;
    border-radius: 999px; /* Rounded corners */
    font-optical-sizing: auto;
    font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
    pointer-events: none;
    white-space: nowrap;
    /* Subtle drop shadow matching message bubbles */
    border: none;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06),
                0 4px 40px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    /* Animation states - pop-up effect */
    opacity: 0;
    transform: translate(-50%, calc(-100% - 10px)) scale(0.85);
    transition: opacity 220ms cubic-bezier(0.2, 0.9, 0.2, 1), 
                transform 300ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

/* Mobile: same font size as flags (14px) */
@media (max-width: 768px) {
    .email-tooltip {
        font-size: 14px; /* Same as video flags on mobile */
        padding: 8px 14px; /* Same as video flags on mobile */
    }
}

/* Center nozzle pointing down at Email - positioned as part of tooltip shape */
.email-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #f0f0f0; /* Exact same solid color as tooltip background */
    /* No backdrop-filter, no shadow - inherits from parent tooltip shadow */
    filter: none;
}

.email-tooltip.show {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 10px)) scale(1);
    /* Pop-up animation */
    animation: tooltipPopUp 300ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

@keyframes tooltipPopUp {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 10px)) scale(0.85);
    }
    60% {
        transform: translate(-50%, calc(-100% - 10px)) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, calc(-100% - 10px)) scale(1);
    }
}

/* Red pulsating dot */
.last-seen-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff0000;
    display: inline-block;
    animation: pulseDot 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulseDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
        box-shadow: 0 0 8px 4px rgba(255, 0, 0, 0.4);
    }
}

/* Global splashy motion (liquid-ish pop) — reduced "float up" on settle */
@keyframes msgSplashIn {
    0%   { transform: translate3d(0, 14px, 0) scaleX(0.72) scaleY(0.78) rotate(var(--msg-rot, -2deg)); }
    28%  { transform: translate3d(0, 0, 0)    scaleX(1.10) scaleY(0.92) rotate(0deg); }
    52%  { transform: translate3d(0, 0, 0)    scaleX(0.94) scaleY(1.06) rotate(0deg); }
    76%  { transform: translate3d(0, 0, 0)    scaleX(1.02) scaleY(0.98) rotate(0deg); }
    100% { transform: translate3d(0, 0, 0)    scaleX(1)    scaleY(1)    rotate(0deg); }
}

@keyframes msgSplashOut {
    0%   { transform: translate3d(0, 0, 0)  scaleX(1)    scaleY(1)    rotate(0deg); }
    /* soap-bubble swell before collapse */
    28%  { transform: translate3d(0, 0, 0)  scaleX(1.12) scaleY(0.94) rotate(0deg); }
    55%  { transform: translate3d(0, 1px, 0) scaleX(0.96) scaleY(1.06) rotate(0deg); }
    100% { transform: translate3d(0, 18px, 0) scaleX(0.74) scaleY(0.64) rotate(var(--msg-rot, 2deg)); }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.message-name {
    font-family: var(--font-primary);
    font-weight: 600;
}

.message-bubble-light .message-name,
.message-bubble-light .message-text {
    color: #1a1a1a;
}

.message-bubble-dark .message-name,
.message-bubble-dark .message-text {
    color: #f8f9fa;
}

.message-time {
    font-size: 11px;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.message-bubble-light .message-time {
    color: #8e8e93;
}

.message-bubble-dark .message-time {
    color: rgba(248, 249, 250, 0.7);
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    font-family: var(--font-primary);
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .online-indicator {
        top: 8px;
        right: 8px;
        padding: 8px 14px;
        font-size: 14px;
    }
    
    html.drawer-embed .online-indicator,
    html.drawer-embed body .online-indicator,
    .drawer-embed .online-indicator {
        top: calc(max(12px, env(safe-area-inset-top, 0px) + 12px) + 12px) !important;
        left: 8px !important;
        right: auto !important;
        transform: translateY(-50%) !important;
    }
    
    .last-seen-image {
        max-width: 180px;
        /* Remove max-height to allow proportional scaling based on image aspect ratio */
        max-height: none;
    }
    
    .last-seen-image img,
    .last-seen-image video {
        /* Ensure image/video scales proportionally without cropping */
        max-width: 180px;
        max-height: none;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Mobile: same size as desktop now (180px) */
    .last-seen-image-light,
    .last-seen-image-dark {
        /* Mobile uses same styling as desktop */
    }

    /* Flag now uses same size on desktop and mobile - no override needed */

    .last-seen-dot {
        width: 6px;
        height: 6px;
    }
    
    .online-text {
        font-size: 14px;
    }
    
    .online-icon {
        width: 16px;
        height: 16px;
    }
    
    .message-bubble {
        /* Mobile: smaller, less wide */
        max-width: min(260px, calc(100% - 80px));
        min-width: 0;
        padding: 10px 14px;
        /* Mobile messages appear at top or bottom */
        /* Positioning is handled by JS so bubbles can appear left OR right of the text block */
        border-radius: 16px !important;
    }
    
    /* Fix mobile message bubble corner rounding - ensure ALL pseudo-elements match */
    .message-bubble::after {
        border-radius: 16px !important;
    }
    
    .message-bubble::before {
        border-radius: 16px 16px 0 0 !important;
    }
    
    .message-header {
        font-size: 11px;
    }
    
    .message-text,
    .message-name {
        letter-spacing: 0.1px;
    }
    
    .message-text {
        font-size: 12px;
        line-height: 1.35;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    /* Social icon sizing now scales automatically with .typewriter-text font size via em units */
    
    .typewriter-text .social-icons {
        gap: 6px;
    }

    .typewriter-text .social-icon-link {
        border-radius: 8px;
    }
}

.typewriter-text {
    font-size: 48px;
    font-weight: 450;
    line-height: 1.48; /* 148% - slightly more compact */
    min-height: 300px;
    position: relative;
    transition: color var(--transition-slow);
    text-decoration: none;
    font-family: var(--font-primary);
    font-optical-sizing: auto;
    font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* External links (email) - underline, same color as text */
.typewriter-text a.external-link {
    text-decoration: underline !important;
    color: inherit !important;
    cursor: pointer;
    display: inline;
    transition: opacity var(--transition-fast);
}

.typewriter-text a.external-link:hover {
    text-decoration: none !important;
}

/* Center the email copy pill */
.typewriter-text .email-copy-row {
    display: flex;
    justify-content: center;
    margin: 10px 0 8px 0;
}

/* Email copy pill button */
.typewriter-text .email-inline-slot {
    display: inline-flex;
    align-items: baseline;
    margin-left: 8px;
    vertical-align: baseline;
}

.typewriter-text .email-copy-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: baseline;
    white-space: nowrap;
    border-radius: 999px;
    background: var(--email-btn-bg, #000000);
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.1px;
    height: 36px;
    padding: 6px 14px;
    line-height: 1;
    vertical-align: text-bottom;
    transform: translateZ(0);
    will-change: transform, width, background-color;
    transition: width 280ms cubic-bezier(0.2, 0.9, 0.2, 1), background-color 220ms ease, transform 220ms cubic-bezier(0.2, 1.1, 0.2, 1);
}

.typewriter-text .email-copy-btn--appear {
    animation: emailBtnAppear 360ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

@keyframes emailBtnAppear {
    0%   { opacity: 0; transform: scale(0.84); }
    45%  { opacity: 1; transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

.typewriter-text .email-copy-btn:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.18);
    outline-offset: 2px;
}

.typewriter-text .email-copy-btn--copied {
    text-transform: lowercase;
}

.typewriter-text .email-copy-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    color: #ffffff;
}

.typewriter-text .email-copy-btn--pop {
    animation: emailBtnPop 320ms cubic-bezier(0.12, 1.25, 0.18, 1);
}

@keyframes emailBtnPop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Social icons container */
.typewriter-text .social-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    margin-left: 8px;
}

/* Social icon links */
.typewriter-text .social-icon-link {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    background: currentColor;
    border-radius: 12px;
    /* 4px padding at 48px type size; scales with font size on mobile */
    padding: 0.0833em;
    /* Size ties to type size: desktop (48px * 0.75 = 36px), scales down on mobile with font size */
    width: 0.75em;
    height: 0.75em;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.typewriter-text .social-icon-link:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.typewriter-text .social-icon-link:active {
    transform: scale(0.95);
}

/* Social icon images */
.typewriter-text .social-icon {
    /* 5% smaller than the filled background container */
    width: calc(100% - 0.1666em);
    height: calc(100% - 0.1666em);
    transform: scale(0.95);
    display: block;
    object-fit: contain;
    /* Icons match theme color dynamically via CSS variable */
    filter: var(--icon-filter, brightness(0));
    opacity: 1;
}

/* Ensure social icons inherit text color from parent */
.typewriter-text .social-icon-link {
    color: inherit;
}

/* Internal navigation links (Home, About me, Case Studies) - colored like landing page, with underline to match index.html */
/* ============================================
   CLICKABLE LINKS - AI AGENT STYLE
   Same as index page
   ============================================ */
.typewriter-text .clickable-link,
.typewriter-text span.clickable-link,
.typewriter-text a.clickable-link {
    text-decoration: none !important;
    color: inherit !important;
    line-height: inherit !important; /* Inherit exact line-height from parent to prevent expansion */
    transition: padding-right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease,
                backdrop-filter 0.3s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer !important;
    position: relative;
    z-index: 1000 !important;
    pointer-events: auto !important;
    display: inline-block !important;
    padding: 1px 16px; /* Balanced horizontal padding */
    margin: 1px 2px; /* 2px vertical gap between backgrounds in different lines */
    border-radius: 999px; /* Fully rounded background */
    background: rgba(119, 122, 129, 0.33) !important; /* #777A81 with 33% opacity */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    isolation: isolate;
    vertical-align: baseline; /* Consistent baseline alignment */

    /* Circular element sizing/placement */
    --orbit-size: 28px;  /* desktop default */
    --orbit-inset: 10px;  /* padding between circle and right edge of pill */
    --orbit-gap: 0px;   /* space between text and circle */
}

/* Email link: dark background with white text - must override all other rules */
.typewriter-text .email-link,
.typewriter-text span.email-link {
    background: #1F2937 !important;
    color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.typewriter-text .email-link:hover,
.typewriter-text .email-link:active,
.typewriter-text .email-link.touching,
.typewriter-text span.email-link:hover,
.typewriter-text span.email-link:active,
.typewriter-text span.email-link.touching {
    background: #1F2937 !important;
    color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Circular animated element - appears on hover/touch */
.typewriter-text .clickable-link::before,
.typewriter-text span.clickable-link::before,
.typewriter-text a.clickable-link::before {
    content: '';
    position: absolute;
    right: var(--orbit-inset);
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: var(--orbit-size);
    height: var(--orbit-size);
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease,
                width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: -1;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Rotating gradient band inside circular element */
.typewriter-text .clickable-link::after,
.typewriter-text span.clickable-link::after,
.typewriter-text a.clickable-link::after {
    content: '';
    position: absolute;
    right: var(--orbit-inset);
    top: 50%;
    transform: translateY(-50%) scale(0) rotate(0deg);
    width: var(--orbit-size);
    height: var(--orbit-size);
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgb(0, 255, 255),  /* cyan */
        rgb(0, 100, 255),   /* blue */
        rgb(150, 0, 255),   /* violet */
        rgb(255, 0, 150),   /* pink */
        rgb(255, 200, 0),   /* warm yellow */
        rgb(0, 255, 150),   /* mint */
        rgb(0, 255, 255)   /* cyan loop */
    );
    mask: radial-gradient(circle, transparent 10px, black 10.5px, black 12.5px, transparent 13px);
    -webkit-mask: radial-gradient(circle, transparent 10px, black 10.5px, black 12.5px, transparent 13px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease,
                width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: -1;
    pointer-events: none;
    animation: rotateGradient 3s linear infinite;
    animation-play-state: paused;
    will-change: transform, opacity;
    filter: saturate(1.15) brightness(1.05);
}

@keyframes rotateGradient {
    from {
        transform: translateY(-50%) scale(1) rotate(0deg);
    }
    to {
        transform: translateY(-50%) scale(1) rotate(360deg);
    }
}

@keyframes subtleBounce {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(calc(-50% - 2px)) scale(1); }
}

/* Icon bounce animation - smooth and bouncy without scaling */
@keyframes subtleBounceIcon {
    0%, 100% { 
        transform: translateY(-50%) translateY(0); 
    }
    50% { 
        transform: translateY(-50%) translateY(-3px); 
    }
}

.typewriter-text .clickable-link:hover,
.typewriter-text .clickable-link:active,
.typewriter-text .clickable-link.touching,
.typewriter-text span.clickable-link:hover,
.typewriter-text span.clickable-link:active,
.typewriter-text span.clickable-link.touching,
.typewriter-text a.clickable-link:hover,
.typewriter-text a.clickable-link:active,
.typewriter-text a.clickable-link.touching {
    text-decoration: none !important;
    color: inherit !important;
}

/* Ensure email link color is always white, even on hover/active */
.typewriter-text .email-link:hover,
.typewriter-text .email-link:active,
.typewriter-text .email-link.touching,
.typewriter-text span.email-link:hover,
.typewriter-text span.email-link:active,
.typewriter-text span.email-link.touching {
    color: #ffffff !important;
    background: #1F2937 !important; /* Keep same dark background on hover */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* Don't translate - keep left side fixed to avoid background moving right */
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    padding-left: 16px !important;
    /* Reduce extension to avoid pushing into next line */
    padding-right: calc(16px + var(--orbit-size) + var(--orbit-gap) + var(--orbit-inset) - 4px) !important;
}

.typewriter-text .clickable-link:hover::before,
.typewriter-text .clickable-link:active::before,
.typewriter-text .clickable-link.touching::before,
.typewriter-text span.clickable-link:hover::before,
.typewriter-text span.clickable-link:active::before,
.typewriter-text span.clickable-link.touching::before,
.typewriter-text a.clickable-link:hover::before,
.typewriter-text a.clickable-link:active::before,
.typewriter-text a.clickable-link.touching::before {
    transform: translateY(-50%) scale(1);
    opacity: 1;
    width: var(--orbit-size);
    height: var(--orbit-size);
}

.typewriter-text .clickable-link:hover::after,
.typewriter-text .clickable-link:active::after,
.typewriter-text .clickable-link.touching::after,
.typewriter-text span.clickable-link:hover::after,
.typewriter-text span.clickable-link:active::after,
.typewriter-text span.clickable-link.touching::after,
.typewriter-text a.clickable-link:hover::after,
.typewriter-text a.clickable-link:active::after,
.typewriter-text a.clickable-link.touching::after {
    transform: translateY(-50%) scale(1) rotate(0deg);
    opacity: 1;
    width: var(--orbit-size);
    height: var(--orbit-size);
    animation-play-state: running;
}

/* Hide spinner for email link when in copied state (even on hover) */
.typewriter-text .email-link.is-copied::after,
.typewriter-text .email-link.is-copied:hover::after,
.typewriter-text .email-link.is-copied:active::after,
.typewriter-text .email-link.is-copied.touching::after {
    opacity: 0 !important;
    animation-play-state: paused !important;
    mask: none !important;
    -webkit-mask: none !important;
    background: none !important;
    background-image: none !important;
    transform: translateY(-50%) scale(0) !important;
}

/* When email is copied, reserve space for the icon even without hover (mobile) */
.typewriter-text .email-link.is-copied {
    padding-right: calc(16px + var(--orbit-size) + var(--orbit-gap) + var(--orbit-inset) - 4px) !important;
}

/* CONNECT PAGE: external links use arrow-up-right icon instead of the spinner ring */
/* Override spinner for external links - hide it when not hovered */
.typewriter-text .contact-links a.clickable-link::after {
    /* Hide spinner by default for external links */
    opacity: 0 !important;
    animation-play-state: paused;
    /* Remove the gradient ring mask */
    mask: none !important;
    -webkit-mask: none !important;
    background: none !important;
    /* Remove the conic gradient */
    background-image: none !important;
    /* Instant transition to prevent spinner flash */
    transition: opacity 0.15s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Inline SVG icon for external links - positioned where spinner was */
.typewriter-text .contact-links a.clickable-link .link-icon-arrow {
    position: absolute;
    right: var(--orbit-inset);
    top: 50%;
    transform: translateY(-50%);
    width: var(--orbit-size);
    height: var(--orbit-size);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.typewriter-text .contact-links a.clickable-link .link-icon-arrow svg {
    width: 100%;
    height: 100%;
    color: currentColor;
    stroke: currentColor;
    fill: none;
}

/* External links (LinkedIn) - expand on hover like other links */
.typewriter-text .contact-links a.clickable-link:hover,
.typewriter-text .contact-links a.clickable-link:active,
.typewriter-text .contact-links a.clickable-link.touching {
    /* Don't translate - keep left side fixed to avoid background moving right */
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    padding-left: 16px !important;
    /* Expand to accommodate arrow icon */
    padding-right: calc(16px + var(--orbit-size) + var(--orbit-gap) + var(--orbit-inset) - 4px) !important;
}

.typewriter-text .contact-links a.clickable-link:hover .link-icon-arrow,
.typewriter-text .contact-links a.clickable-link:active .link-icon-arrow,
.typewriter-text .contact-links a.clickable-link.touching .link-icon-arrow {
    opacity: 1;
    animation: subtleBounceIcon 0.8s ease-in-out infinite;
    will-change: transform;
}

/* Inline SVG icon for email copy state */
.typewriter-text .email-link .link-icon-copy {
    position: absolute;
    right: var(--orbit-inset);
    top: 50%;
    transform: translateY(-50%);
    width: var(--orbit-size);
    height: var(--orbit-size);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.typewriter-text .email-link .link-icon-copy svg {
    width: 100%;
    height: 100%;
    color: #ffffff;
    stroke: #ffffff;
    fill: none;
}

.typewriter-text .email-link.is-copied .link-icon-copy {
    opacity: 1 !important;
    animation: subtleBounceIcon 0.8s ease-in-out infinite;
    will-change: transform;
}

.typewriter-text .clickable-link:active,
.typewriter-text span.clickable-link:active,
.typewriter-text a.clickable-link:active {
    transform: scale(0.98);
}

/* Desktop hover states */
@media (min-width: 769px) {
    .typewriter-text .clickable-link,
    .typewriter-text span.clickable-link,
    .typewriter-text a.clickable-link {
        cursor: pointer !important;
        pointer-events: auto !important;
    }
}

/* Mobile touch states */
@media (max-width: 768px) {
    .typewriter-text .clickable-link,
    .typewriter-text span.clickable-link,
    .typewriter-text a.clickable-link {
        --orbit-size: 21px;
        --orbit-inset: 7px;
        --orbit-gap: 0px;
    }

    .typewriter-text .clickable-link::after,
    .typewriter-text span.clickable-link::after,
    .typewriter-text a.clickable-link::after {
        mask: radial-gradient(circle, transparent 7.5px, black 8px, black 9.5px, transparent 10px);
        -webkit-mask: radial-gradient(circle, transparent 7.5px, black 8px, black 9.5px, transparent 10px);
    }
}

@media (max-width: 480px) {
    .typewriter-text .clickable-link,
    .typewriter-text span.clickable-link,
    .typewriter-text a.clickable-link {
        --orbit-size: 16px;
        --orbit-inset: 6px;
        --orbit-gap: 0px;
    }

    .typewriter-text .clickable-link::after,
    .typewriter-text span.clickable-link::after,
    .typewriter-text a.clickable-link::after {
        mask: radial-gradient(circle, transparent 5.5px, black 6px, black 7px, transparent 7.5px);
        -webkit-mask: radial-gradient(circle, transparent 5.5px, black 6px, black 7px, transparent 7.5px);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        /* Use global content well gutter via .container (var(--padding)) */
        padding: 0;
    }

    .typewriter-text {
        font-size: 40px;
        line-height: 1.48; /* 148% - slightly more compact */
    }
}

@media (max-width: 480px) {
    .typewriter-text {
        font-size: 28px;
        line-height: 1.48; /* 148% - slightly more compact */
    }
}
