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

:root {
    --bg-color: #fafafa;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --grain-opacity: 0.03;
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-color: #f5f5f7;
    --text-secondary: #86868b;
    --grain-opacity: 0.04;
}

html {
    font-size: 16px;
}

/* Page fade-in on load */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.4s ease, color 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

body.loaded {
    opacity: 1;
}

/* Subtle grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Ambient color wash that reacts to dot color - Apple style (light mode only) */
.ambient-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: var(--glow-color, transparent);
    mix-blend-mode: multiply;
}

.ambient-glow.active {
    opacity: 0.06;
}

/* Disable in dark mode */
[data-theme="dark"] .ambient-glow {
    display: none;
}

.container {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

/* Logo Container */
.logo-container {
    position: relative;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

/* The dot that animates */
.animated-dot {
    position: fixed;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    background-color: var(--text-color);
    border-radius: 50%;
    opacity: 0;
    z-index: 10;
    will-change: transform, opacity;
}

.animated-dot.animation-complete {
    will-change: auto;
}


/* Logo wrapper for smooth recentering */
.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: baseline;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Logo text */
.logo {
    font-size: 4.5rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--text-color);
    display: flex;
    align-items: baseline;
    position: relative;
}

/* .com suffix */
.logo-suffix {
    font-size: 4.5rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--text-color);
    display: inline-flex;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transform: translateX(-8px);
    transition: max-width 1s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s,
                transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.logo-suffix.visible {
    max-width: 200px;
    opacity: 1;
    transform: translateX(0);
}

.logo-suffix span {
    display: inline-block;
    white-space: nowrap;
}

.logo .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(25px);
    will-change: transform, opacity;
}

.logo .letter.animation-complete {
    will-change: auto;
}

.logo .letter.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo .letter.squish {
    animation: letterSquish 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes letterSquish {
    0% { transform: scaleY(1) scaleX(1); }
    30% { transform: scaleY(0.85) scaleX(1.1); }
    60% { transform: scaleY(1.05) scaleX(0.98); }
    100% { transform: scaleY(1) scaleX(1); }
}

/* The final dot (period) */
.logo .dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: var(--text-color);
    border-radius: 50%;
    margin-left: 6px;
    margin-bottom: 10px;
    opacity: 0;
    transform: scale(0);
    will-change: transform, opacity;
    cursor: pointer;
    position: relative;
    outline: none;
}

.logo .dot.animation-complete {
    will-change: auto;
}

/* Larger touch target for the dot */
.logo .dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

/* Keyboard focus indicator */
.logo .dot:focus-visible {
    box-shadow: 0 0 0 3px var(--bg-color), 0 0 0 5px var(--text-color);
}

.logo .dot.visible {
    opacity: 1;
    animation: finalSettle 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.logo .dot.clickable {
    transform: scale(1);
}

@keyframes finalSettle {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.12); }
    75% { transform: scale(0.96); }
    100% { transform: scale(1); }
}

/* Tagline */
.tagline {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(15px);
    will-change: transform, opacity;
}

.tagline.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.tagline.animation-complete {
    will-change: auto;
}

/* Subtle hint */
.hint {
    position: fixed;
    bottom: 3rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0;
    letter-spacing: 0.05em;
    will-change: opacity;
    z-index: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.hint:hover {
    color: var(--text-color);
}

.hint.visible {
    opacity: 1;
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hint.animation-complete {
    will-change: auto;
}

/* Hint punctuation transition */
.hint .hint-punct {
    display: inline-block;
    transition: opacity 0.4s ease;
}

/* Dot color easter egg */
.logo .dot.color-active,
.animated-dot.color-active {
    transition: background-color 0.4s ease;
}

/* Chaos dots for .com reveal animation */
#chaosDots {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.chaos-dot {
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0;
    will-change: transform, opacity;
}

@media (max-width: 768px) {
    .chaos-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .chaos-dot {
        width: 9px;
        height: 9px;
    }
}

/* Hover effect */
.logo:hover .dot {
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* Menu Footer (Theme & Language) */
.menu-footer {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-overlay.active .menu-footer {
    opacity: 1;
    transition-delay: 0.2s;
}

/* Theme Toggle in Menu */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s ease, transform 0.3s ease;
}

.theme-toggle:hover svg {
    stroke: var(--text-color);
    transform: rotate(15deg);
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* Language Selector */
.lang-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-selector button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 4px 8px;
    transition: color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lang-selector button:hover {
    color: var(--text-color);
}

.lang-selector button.active {
    color: var(--text-color);
    font-weight: 500;
}

.lang-separator {
    color: var(--text-secondary);
    font-size: 0.875rem;
    opacity: 0.5;
}

/* Burger Menu */
.menu-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    border-radius: 1px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.menu-content nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.menu-content a {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.2s ease;
}

.menu-content a:hover {
    color: var(--text-secondary);
}

.menu-overlay.active .menu-content .menu-item {
    opacity: 1;
    transform: translateY(0);
}

.menu-overlay.active .menu-content .menu-item:nth-child(1) {
    transition-delay: 0.1s;
}

.menu-overlay.active .menu-content .menu-item:nth-child(2) {
    transition-delay: 0.15s;
}

/* Menu Items with fold-out */
.menu-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-item-header {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-color);
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    font-family: inherit;
    text-transform: lowercase;
    display: inline-flex;
    align-items: baseline;
    gap: 0.15em;
}

/* Menu item dots */
.menu-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--text-color);
    border-radius: 50%;
    margin-bottom: 0.2em;
    transition: background-color 0.4s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.menu-dot.color-active {
    transition: background-color 0.4s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.menu-item-header:hover .menu-dot {
    transform: translateY(-6px);
}

.menu-item.expanded .menu-dot {
    animation: menuDotFall 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes menuDotFall {
    0% { transform: translateY(-6px); }
    60% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.menu-item-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                margin 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    margin-top: 0;
}

.menu-item.expanded .menu-item-content {
    max-height: 200px;
    opacity: 1;
    margin-top: 1rem;
}

.menu-item-content a {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
    opacity: 1;
    transform: none;
    text-transform: lowercase;
}

.menu-item-content a:hover {
    color: var(--text-color);
}

.menu-item-content p {
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .logo {
        font-size: 3.5rem;
    }

    .logo-suffix {
        font-size: 3.5rem;
    }

    .logo-container {
        height: 90px;
    }

    .animated-dot,
    .logo .dot {
        width: 10px;
        height: 10px;
    }

    .logo .dot {
        margin-bottom: 8px;
        margin-left: 5px;
    }

    .tagline {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 3rem;
    }

    .logo-suffix {
        font-size: 3rem;
    }

    .animated-dot,
    .logo .dot {
        width: 9px;
        height: 9px;
    }

    .logo .dot {
        margin-bottom: 5px;
        margin-left: 3px;
    }
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
