/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    tap-highlight-color: transparent;
}

*:focus {
    outline: none; /* Remove default focus outline */
}

*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

html {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    touch-action: pan-y; /* Allow vertical panning (scrolling) */
    cursor: default;
}

/* Force touch cursor on mobile devices */
@media (hover: none) and (pointer: coarse) {
    html, body, * {
        cursor: pointer !important;
    }
    
    input[type="text"],
    input[type="email"],
    textarea {
        cursor: text !important;
    }
}

body {
    touch-action: pan-y; /* Allow vertical panning (scrolling) */
    /* Don't prevent text selection globally - let users select text if they want */
}

/* Use touch-friendly cursor on touch devices */
@media (pointer: coarse) {
    * {
        cursor: pointer !important; /* Touch cursor on mobile/touch devices */
    }
    
    /* But keep text cursor for text inputs */
    input[type="text"],
    input[type="email"],
    textarea {
        cursor: text !important;
    }
    
    /* Ensure body and html also get touch cursor */
    html, body {
        cursor: pointer !important;
    }
}

:root {
    /* Corporate Colors - Dark Mode */
    --color-bg-primary: #0F0F0F; /* Ebony Black */
    --color-text-primary: #FFFFFF; /* Pure White */
    --color-text-secondary: #9B968F; /* Warm Grey Medium */
    --color-border: #1A1A1A; /* Charcoal */
    --color-accent: #C47A5F; /* Terracotta Accent */
    
    /* Glass Panel Colors - Glassmorphism */
    --color-glass-bg: rgba(15, 15, 15, 0.8); /* Low opacity for glass effect */
    --color-glass-border: rgba(255, 255, 255, 0.18);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* Typography */
    --font-serif: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
    --font-mono: 'Courier New', 'Monaco', 'Consolas', monospace;
}

body {
    font-family: var(--font-serif);
    background-color: #5C5852; /* Warm Grey Dark */
    background-image: 
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.06) 0px,
            transparent 0px,
            transparent 19px,
            rgba(0, 0, 0, 0.06) 19px,
            rgba(0, 0, 0, 0.06) 20px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.06) 0px,
            transparent 0px,
            transparent 19px,
            rgba(0, 0, 0, 0.06) 19px,
            rgba(0, 0, 0, 0.06) 20px
        );
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--spacing-lg);
    position: relative;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll only */
    /* Don't set overflow-y here - let it scroll naturally */
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: var(--spacing-lg);
    left: var(--spacing-lg);
    z-index: 1000;
    background: rgba(15, 15, 15, 0.5);
    backdrop-filter: blur(3.7px);
    -webkit-backdrop-filter: blur(3.7px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    width: 48px;
    height: 48px;
    display: none; /* Hidden until sound starts */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
}

.sound-toggle.visible {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.sound-toggle:hover {
    background: rgba(15, 15, 15, 0.6);
    transform: scale(1.05);
}

.sound-toggle:hover {
    transform: scale(1.05);
}

.sound-toggle.muted {
    opacity: 0.6;
}

.sound-toggle svg {
    width: 24px;
    height: 24px;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3xl);
    padding: var(--spacing-2xl) 0;
    box-sizing: border-box;
    touch-action: pan-y; /* Allow vertical scrolling */
}

/* Header */
.header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
}

.logo {
    width: 160px;
    height: 160px;
    transition: transform 0.3s ease;
}

.logo.shake {
    animation: subtleShake 0.5s ease-in-out;
}

.app-name {
    font-size: 64px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-text-primary);
    margin: 0;
}

.site-motto {
    font-size: 20px;
    font-weight: 400;
    color: var(--color-text-secondary);
    font-style: normal;
    margin: 0;
    letter-spacing: 0.01em;
    font-family: var(--font-serif); /* Use same serif font as rest of site */
}

/* Glass Effect Panel - Glassmorphism (from css.glass) */
.glass {
    background: rgba(15, 15, 15, 0.5);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(3.7px);
    -webkit-backdrop-filter: blur(3.7px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: var(--spacing-xl);
    position: relative;
}

/* Principles Panel */
.principles-panel {
    margin: var(--spacing-xl) 0;
}

.principles-list {
    list-style: decimal;
    list-style-position: inside;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    color: var(--color-text-secondary);
    font-size: 22px;
    line-height: 1.8;
    text-align: left;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.principles-list li {
    text-align: left;
    padding: 0;
}

.principles-list li strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.email-intro strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* Email Panel */
.email-panel {
    margin: var(--spacing-xl) 0;
}

.email-intro {
    font-size: 24px;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.email-input {
    font-family: var(--font-serif);
    font-size: 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 16px 20px;
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    letter-spacing: 0.5px;
    width: 100%;
    box-sizing: border-box;
}

.email-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(196, 122, 95, 0.2),
                0 0 20px rgba(196, 122, 95, 0.1);
}

/* Typewriter cursor effect */
.email-input::after {
    content: '|';
    color: var(--color-accent);
    animation: blink 1s infinite;
    margin-left: 2px;
    opacity: 0.8;
    font-weight: 300;
}

.email-input:not(:focus)::after {
    display: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Typing glow effect */
.email-input.typing {
    box-shadow: 0 0 0 2px rgba(196, 122, 95, 0.2),
                0 0 25px rgba(196, 122, 95, 0.15),
                inset 0 0 10px rgba(196, 122, 95, 0.05);
    background: rgba(196, 122, 95, 0.02);
}


.email-input::placeholder {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

.submit-button {
    font-family: var(--font-serif);
    font-size: 20px;
    background: var(--color-accent);
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    padding: 16px 32px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(196, 122, 95, 0.2);
}

.submit-button:hover {
    background: #D68A6F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 122, 95, 0.3);
}

.submit-button:active {
    transform: translateY(0);
}

.email-status {
    text-align: center;
    margin-top: var(--spacing-md);
    color: var(--color-text-secondary);
    font-size: 16px;
    height: 24px; /* Fixed height to prevent panel resizing */
    line-height: 24px;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
    transition: none;
}

.email-status.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.5s ease-out;
}

.email-status.hidden {
    opacity: 0;
    visibility: hidden;
    /* Keep fixed height to preserve panel size */
    height: 24px;
    line-height: 24px;
    margin-top: var(--spacing-md);
}

/* Responsive - Mobile First: Big, readable, touch-friendly */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-xl);
    }

    .container {
        padding: var(--spacing-2xl) 0;
        gap: var(--spacing-3xl);
    }

    .header {
        flex-direction: column;
        gap: var(--spacing-lg);
        align-items: center;
        justify-content: center;
        margin-bottom: var(--spacing-2xl);
    }

    .header-text {
        align-items: center;
        text-align: center;
    }

    .logo {
        width: 180px;
        height: 180px;
    }

    .app-name {
        font-size: 56px;
        text-align: center;
    }

    .site-motto {
        font-size: 22px;
        text-align: center;
    }

    .principles-list {
        font-size: 24px;
        line-height: 2;
        gap: var(--spacing-2xl);
        max-width: 100%;
    }
    
    .principles-list li {
        text-align: left;
    }

    .email-intro {
        font-size: 26px;
        margin-bottom: var(--spacing-2xl);
        line-height: 1.6;
    }

    .email-input {
        font-size: 24px;
        padding: 22px 24px;
        min-height: 68px; /* Touch-friendly */
    }

    .submit-button {
        font-size: 24px;
        padding: 22px 40px;
        min-height: 68px; /* Touch-friendly */
    }

    .email-status {
        font-size: 22px;
        height: 32px;
        line-height: 32px;
    }

    .glass {
        padding: var(--spacing-2xl);
    }

    .sound-toggle {
        width: 56px;
        height: 56px;
        top: var(--spacing-xl);
        left: var(--spacing-xl);
    }

    .sound-toggle.visible {
        display: flex;
        opacity: 1;
        pointer-events: auto;
    }

    .sound-toggle svg {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    body {
        padding: var(--spacing-lg);
    }

    .container {
        padding: var(--spacing-xl) 0;
        gap: var(--spacing-3xl);
    }

    .header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: center;
        justify-content: center;
        margin-bottom: var(--spacing-xl);
    }

    .header-text {
        align-items: center;
        text-align: center;
    }

    .logo {
        width: 160px;
        height: 160px;
    }

    .app-name {
        font-size: 50px;
        text-align: center;
    }

    .site-motto {
        font-size: 25px;
        text-align: center;
    }

    .principles-list {
        font-size: 22px;
        line-height: 1.9;
        gap: var(--spacing-xl);
        max-width: 100%;
    }
    
    .principles-list li {
        text-align: left;
    }

    .email-intro {
        font-size: 24px;
        margin-bottom: var(--spacing-xl);
        line-height: 1.6;
    }

    .email-input {
        font-size: 22px;
        padding: 20px 22px;
        min-height: 64px; /* Touch-friendly */
    }

    .submit-button {
        font-size: 22px;
        padding: 20px 36px;
        min-height: 64px; /* Touch-friendly */
    }

    .email-status {
        font-size: 20px;
        height: 30px;
        line-height: 30px;
    }

    .glass {
        padding: var(--spacing-xl);
    }

    .sound-toggle {
        width: 52px;
        height: 52px;
        top: var(--spacing-lg);
        left: var(--spacing-lg);
        display: none; /* Reset display */
    }

    .sound-toggle.visible {
        display: flex; /* Override for mobile */
        opacity: 1;
        pointer-events: auto;
    }

    .sound-toggle svg {
        width: 26px;
        height: 26px;
    }
}

/* Subtle shake animation - more noticeable */
@keyframes subtleShake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); filter: brightness(1); }
    10% { transform: translate(-2px, -2px) rotate(-1deg); filter: brightness(1.3); }
    20% { transform: translate(2px, 2px) rotate(1deg); filter: brightness(1.3); }
    30% { transform: translate(-2px, 2px) rotate(-0.8deg); filter: brightness(1.2); }
    40% { transform: translate(2px, -2px) rotate(0.8deg); filter: brightness(1.2); }
    50% { transform: translate(-1px, -1px) rotate(-0.5deg); filter: brightness(1.15); }
    60% { transform: translate(1px, 1px) rotate(0.5deg); filter: brightness(1.15); }
    70% { transform: translate(-1px, 1px) rotate(-0.3deg); filter: brightness(1.1); }
    80% { transform: translate(1px, -1px) rotate(0.3deg); filter: brightness(1.1); }
    90% { transform: translate(-1px, -1px) rotate(-0.1deg); filter: brightness(1.05); }
}

