/* ===== Base ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: #f7f8fa;
    color: #1a1a1a;
    line-height: 1.7;
}

html, body {
    height: 100%;
    /* overflow: hidden; */
}

a {
    text-decoration: none;
    transition: 0.2s ease;
}

/* ===== Layout ===== */

:root {
    --header-height: 70px;
    --graph-padding: 70px;
}


main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-top: var(--header-height);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(16px, 4vw, 32px);
    padding-right: clamp(16px, 4vw, 32px);
}

/* ===== Header ===== */

.site-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 30px;
    min-height: 70px;
}

/* Logo */

.logo img {
    height: 48px;
    width: auto;
    display: block;
}

/* Navigation */

nav {
    display: flex;
    gap: 22px;
    flex-wrap: nowrap;
    flex-shrink: 1;
}

nav a {
    color: #333;
    font-weight: 500;
}

nav a:hover {
    color: #0077cc;
}

/* Language Switch */

.lang-switch {
    display: flex;
    gap: 8px;
}

.lang-switch a {
    color: #bbb;
    font-size: 0.9rem;
}

.lang-switch a:hover {
    color: #f0c040;
}

/* Search */

.search-container {
    position: relative;
    width: 260px;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
}

.search-input:focus {
    outline: none;
    border-color: #0077cc;
    box-shadow: 0 0 0 2px rgba(0, 119, 204, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    list-style: none;
    margin: 5px 0 0 0;
    padding: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 100;
}

.search-results li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-results li:hover {
    background: #f5f5f5;
}

/* ===== Graph Wrapper ===== */

.graph-wrapper {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: #f7f8fa;
    touch-action: none;
    z-index: 1;
}

/* ===== Graph ===== */

#graph {
    display: block;
    height: auto;
    max-width: none;
    transform-origin: 0 0;   /* IMPORTANT */
}

/* ===== Zoom Controls ===== */

/* Container */
.zoom-controls-header {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 12px;

    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    border-radius: 18px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.08);

    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 1000;
}

.zoom-controls-header.visible {
    display: flex;
}

/* Buttons */
.zoom-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;

    background: linear-gradient(145deg, #0084ff, #0066cc);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    box-shadow:
        0 4px 10px rgba(0, 119, 204, 0.35),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);

    transition: 
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.2s ease;
}

/* Hover */
.zoom-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 16px rgba(0, 119, 204, 0.45),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

/* Active */
.zoom-btn:active {
    transform: translateY(0);
    box-shadow:
        0 2px 6px rgba(0, 119, 204, 0.35),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Focus (keyboard accessibility) */
.zoom-btn:focus-visible {
    outline: 3px solid rgba(0, 119, 204, 0.4);
    outline-offset: 2px;
}

/* SVG Icons */
.zoom-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 2.2;
}

/* Copy Success State */
.zoom-btn.copied {
    background: linear-gradient(145deg, #16a34a, #15803d); /* green gradient */
    box-shadow:
        0 4px 10px rgba(22, 163, 74, 0.35),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.zoom-btn.copied svg {
    stroke: white;
}

.zoom-btn.copied {
    transform: scale(1.08);
}

/* ===== Content ===== */

.content {
    padding-top: 40px;
    padding-bottom: 60px;
}

.content h1 {
    font-size: 2.2rem;
    margin-bottom: 30px;
    font-weight: 700;
}

.content h2 {
    font-size: 1.3rem;
    margin-top: 30px;
    font-weight: 600;
}

.content p {
    font-size: 1rem;
    color: #444;
}

/* ===== Footer ===== */

.site-footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 20px 0;
    font-size: 14px;
    text-align: center;
    border-top: 1px solid #eee;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger span {
    height: 3px;
    width: 24px;
    background: #333;
    border-radius: 2px;
    transition: 0.3s ease;
}

/* ===== Toast ===== */

.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    
    background: rgba(30, 30, 30, 0.92);
    color: white;
    font-size: 0.9rem;
    padding: 10px 18px;
    border-radius: 999px;

    opacity: 0;
    pointer-events: none;

    transition: 
        opacity 0.25s ease,
        transform 0.25s ease;

    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */

@media (max-width: 850px) {

    :root {
        --header-height: 70px;
    }

    .site-header {
        height: auto;
    }

    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 0;
    }

    .header-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        text-align: left;
    }

    .logo img {
        height: 48px;
        width: auto;
    }

    /* Show hamburger */
    .hamburger {
        display: flex;
    }

    /* Hide menu by default */
    .mobile-menu {
        display: none;
        flex-direction: column;
        gap: 12px;
        padding-top: 10px;
        border-top: 1px solid #eee;
    }

    .mobile-menu.active {
        display: flex;
    }

    nav {
        flex-direction: column;
        gap: 12px;
    }

    nav a {
        padding: 6px 0;
    }

    .lang-switch {
        justify-content: flex-start;
    }

    .search-container {
        width: 100%;
        max-width: none;
    }
}

