/* === CSS Custom Properties === */
:root {
    --accent: #0077b6;
    --accent-glow: rgba(0, 80, 220, 0.3);
    --accent-readable: #0077b6;
    --bg: #0a0a0f;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #e4e4e7;
    --text-secondary: #8a8a94;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* === Animations === */
@keyframes meshShift {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 50% 0%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 100%; }
}

@keyframes meshGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* === Base === */
body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: monospace;
    transition: color .3s ease-out;
    padding-top: 1px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

/* Mesh gradient background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, var(--accent-glow), transparent),
        radial-gradient(ellipse 60% 80% at 80% 20%, rgba(0, 102, 255, 0.12), transparent),
        radial-gradient(ellipse 70% 50% at 50% 80%, rgba(255, 51, 102, 0.08), transparent);
    animation: meshShift 60s ease-in-out infinite, meshGlow 30s ease-in-out infinite;
    background-size: 200% 200%;
    transition: opacity 2s ease-out;
}

/* Noise overlay */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    pointer-events: none;
}

main { flex: 1; padding-bottom: 3rem; }

main, footer {
    width: calc(94% - 32px);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* === Content === */
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 3rem 0 0.5rem;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--text-primary);
}

p, address {
    font-style: normal;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

/* English translations */
p > em, h2 > em {
    font-style: italic;
    color: var(--text-secondary);
}

.placeholder {
    background: rgba(255, 51, 102, 0.15);
    border: 1px dashed rgba(255, 51, 102, 0.4);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    color: #ff6b8a;
    font-weight: 700;
}

/* === Links === */
a { color: var(--text-primary); text-decoration: none; border-bottom: 1px dashed var(--text-secondary); }
a:hover { border-bottom-style: solid; color: var(--text-primary); }

/* === Brand === */
.brand-logo {
    display: block;
    height: 24px;
    width: auto;
    margin: 0 auto 0.5rem;
    user-select: none;
    pointer-events: none;
    filter: invert(1);
    transition: filter .3s ease-out;
}

/* === Misc === */
::selection { background: rgba(255, 255, 255, .15); }

/* === Footer === */
footer {
    padding: 2rem 0;
    margin-top: auto;
    font-size: 1em;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    text-align: center;
}

footer nav {
    margin-top: 0.5rem;
}

footer nav a {
    margin: 0 0.5rem;
}

/* === Theme Toggle === */
#themeToggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

#themeToggle:hover {
    transform: scale(1.08);
    border-color: var(--text-secondary);
}

/* === Light Mode === */
html.light {
    --bg: #f5f5f7;
    --surface: rgba(0, 0, 0, 0.03);
    --surface-hover: rgba(0, 0, 0, 0.06);
    --border: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.18);
    --text-primary: #1a1a2e;
    --text-secondary: #6b6b80;
    --shadow: rgba(0, 0, 0, 0.08);
}

html.light body::before {
    opacity: 0.5;
}

html.light ::selection { background: rgba(0, 0, 0, .1); }

html.light .brand-logo {
    filter: none;
}

html.light .placeholder {
    background: rgba(255, 51, 102, 0.1);
    color: #cc2244;
}

/* === Desktop === */
@media (min-width: 701px) {
    .brand-logo {
        margin-bottom: 1rem;
    }
}

/* === Mobile === */
@media (max-width: 700px) {
    .page-title {
        font-size: 1.3rem;
        margin-top: 2rem;
    }

    footer nav {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    footer nav .nav-divider {
        display: none;
    }

    #themeToggle {
        right: auto;
        left: 2rem;
    }
}
