@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700;800&display=swap');

:root {
    --bg: #fffdf3;
    --surface: #ffffff;
    --surface-soft: #fff7c2;
    --text: #111111;
    --text-muted: #3d3d3d;
    --line: #111111;
    --indigo: #111111;
    --indigo-strong: #000000;
    --emerald: #059669;
    --rose: #e11d48;
    --phylens-yellow: #ffe030;
    --ink-strong: #0a0a0a;
    --radius-lg: 14px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', 'Trebuchet MS', 'Avenir Next', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.header-nav-container {
    position: sticky;
    top: 0;
    z-index: 101;
    width: min(1180px, calc(100% - 1.2rem));
    margin: 0.4rem auto 0;
    background: var(--phylens-yellow);
    border: 3px solid var(--ink-strong);
    border-radius: 12px;
    box-shadow: 0 4px 0 var(--ink-strong);
}

.header-content {
    min-height: 78px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.82rem 1rem;
    padding-right: 3.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 1.06rem;
    font-weight: 700;
}

.home-link {
    color: var(--text);
    text-decoration: none;
    border: 2px solid var(--ink-strong);
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    padding: 0.4rem 0.7rem;
    font-weight: 700;
}

.search-container {
    display: flex;
    flex: 1;
    max-width: 520px;
}

#search-input {
    width: 100%;
    border: 2px solid var(--ink-strong);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    padding: 0.58rem 0.78rem;
    background: var(--surface);
    color: var(--text);
    font-size: 0.94rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--ink-strong);
    background: #ffffff;
}

#search-button {
    border: 2px solid var(--ink-strong);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #ffe64a;
    color: var(--ink-strong);
    padding: 0.58rem 1rem;
    min-width: 98px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink-strong);
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

#search-button:hover {
    background: #fff08a;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink-strong);
}

#search-button:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0 var(--ink-strong);
}

#search-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

.blog-link {
    color: var(--ink-strong);
    text-decoration: none;
    border: 2px solid var(--ink-strong);
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    border-radius: 8px;
    padding: 0.38rem 0.68rem;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    line-height: 1.1;
}

.blog-link:hover {
    transform: translate(-1px, -1px);
}

.main-nav {
    position: relative;
    width: 100%;
    z-index: 1001;
    background: #ffe64a;
    border-top: 0;
    border-bottom: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.2s ease, opacity 0.18s ease;
    box-shadow: none;
}

.main-nav.active {
    border-top: 3px solid var(--ink-strong);
    border-bottom: 3px solid var(--ink-strong);
    max-height: 180px;
    opacity: 1;
    visibility: visible;
}

#navigation {
    width: 100%;
}

#navigation ul,
#navigation li {
    margin: 0;
    padding: 0;
    list-style: none;
}

#navigation.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 0 0 auto;
    min-width: 170px;
    padding: 0.52rem 0.75rem 0.52rem 1rem;
    background: #ffe64a;
}

.nav-item {
    position: relative;
    width: 100%;
    margin-bottom: 0.25rem;
}

#simulations-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.1rem;
}

section {
    background: var(--surface);
    border: 3px solid var(--line);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--line);
    padding: 0.82rem;
    margin-bottom: 0.85rem;
}

section h2 {
    display: inline-block;
    margin: 0 0 0.7rem 0;
    padding: 0.18rem 0.5rem;
    border: 2px solid var(--line);
    background: var(--phylens-yellow);
    box-shadow: 2px 2px 0 var(--line);
    font-size: 0.74rem;
    color: var(--ink-strong);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.simulation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2.2rem;
}

.nav-topic-menu {
    padding: 0.65rem 0.9rem 0.9rem;
    background: #ffe64a;
}

.nav-topic-picker {
    width: min(100%, 420px);
}

.topic-dropdown-label {
    display: block;
    margin-bottom: 0.32rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-strong);
}

.topic-dropdown {
    width: 100%;
    border: 2px solid var(--ink-strong);
    border-radius: 8px;
    background: #ffffff;
    color: #111111;
    padding: 0.55rem 0.62rem;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 2px 2px 0 var(--ink-strong);
}

.topic-dropdown:focus {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

.simulation-card {
    border: 3px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 4px 4px 0 var(--line);
    overflow: hidden;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
    display: flex;
    flex-direction: column;
}

.simulation-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--line);
}

.card-image {
    background: #fff4a4;
    border-bottom: 3px solid var(--line);
}

.simulation-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 0.68rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-content h3 {
    margin: 0 0 0.35rem 0;
    font-size: 0.94rem;
    line-height: 1.35;
    color: #111111;
}

.author-info {
    display: block;
    margin-bottom: 0.46rem;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 500;
    font-style: italic;
}

.description {
    margin: 0;
    font-size: 0.86rem;
    color: #1f1f1f;
    flex: 1;
}

.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    margin-top: 0.58rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.16rem 0.38rem;
}

.stat-count {
    color: #111111;
    font-weight: 900;
}

.card-footer {
    margin-top: 0.56rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.platform {
    display: inline-block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    color: #ffffff;
    background: #0f766e;
    border: 2px solid var(--line);
    border-radius: 999px;
    padding: 0.18rem 0.42rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.button {
    display: inline-block;
    text-decoration: none;
    color: #111111;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: var(--phylens-yellow);
    box-shadow: 2px 2px 0 var(--line);
    padding: 0.36rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 800;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.button:hover {
    background: #fff08a;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--line);
}

.like-button {
    appearance: none;
    color: #111111;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--line);
    padding: 0.36rem 0.58rem;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.like-button:hover:not(:disabled) {
    background: #e0f2fe;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--line);
}

.like-button.liked,
.like-button:disabled {
    background: #dcfce7;
    cursor: default;
}

.no-results {
    background: var(--surface);
    border: 3px solid var(--line);
    border-radius: 8px;
    box-shadow: 3px 3px 0 var(--line);
    padding: 0.9rem;
    text-align: center;
    color: #333333;
}

.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--ink-strong);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    cursor: pointer;
    padding: 0 6px;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.16s ease, background 0.16s ease;
}

.hamburger-menu:hover {
    background: #fff7c2;
    transform: translate(-1px, calc(-50% - 1px));
}

.hamburger-line {
    width: 18px;
    height: 2px;
    margin: 2.5px 0;
    background: var(--ink-strong);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

footer {
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.admin-link {
    color: var(--ink-strong);
    font-weight: 800;
    text-decoration: none;
}

.admin-link:hover {
    text-decoration: underline;
}

#back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--phylens-yellow);
    color: var(--ink-strong);
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: 3px 3px 0 var(--line);
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    z-index: 1000;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: #fff08a;
}

@media (max-width: 900px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.55rem;
    }

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

@media (max-width: 768px) {
    .header-content {
        min-height: 74px;
        padding: 0.7rem;
        padding-right: 3.5rem;
        position: relative;
    }

    header h1 {
        font-size: 1rem;
    }

    .main-nav {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        background: #ffe64a;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .main-nav.active {
        max-height: 220px;
        overflow-y: auto;
        border-top: 3px solid var(--ink-strong);
        border-bottom: 3px solid var(--ink-strong);
    }

    #navigation.nav-menu {
        padding: 0.7rem;
        width: 100%;
    }

    .nav-item {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .topic-dropdown {
        font-size: 0.88rem;
    }

    #simulations-container {
        padding: 0.85rem;
    }

    section {
        padding: 0.85rem;
    }

    .simulation-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .simulation-card img {
        height: 170px;
    }
}
