@font-face {
    font-family: "JetBrains Sans";
    src: url("fonts/JetBrainsSans-Regular.woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/JetBrainsMono-Regular.woff2");
}

:root {
    --accent-green: #2ec27e; /* primary accent */
    --accent-green-strong: #26a269;
    --accent-green-soft: rgba(46, 194, 126, 0.18);
    --accent-green-glow1: rgba(46, 194, 126, 0.5);
    --accent-green-glow2: rgba(38, 162, 105, 0.5);

    font-family: "JetBrains Sans", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.87);
    background-color: #000000;
    text-align: center;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 320px;
    min-height: 100vh;
    align-items: center;
    overflow-x: hidden; /* prevent horizontal scrolling that can push fixed UI off-screen */
    overflow-y: hidden; /* page itself should not scroll; the content pane will */

    /* Background image removed; animated .bg covers full viewport edges */
}

h1 {
    font-size: 29px;
    line-height: 39px;
    font-weight: 300;
}

.title {
    margin-bottom: 40px;
}

#app {
    max-width: 1280px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-sizing: border-box;
    padding: 72px 16px 16px; /* push content below fixed top bar */
    flex: 1 1 auto; /* allow main to grow to fill viewport height */
    min-height: 0; /* enable child flex items to scroll */
}

.logo {
    margin-top: 45px;
    margin-left: 20%;
    align-self: flex-start;
}

img {
    max-width: 100%;
    height: auto;
}

.counter {
    font-family: "JetBrains Mono", Inter, system-ui, sans-serif;
    font-weight: 400;
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding: 60px;
    color: rgba(255, 255, 255, 1);
}

.counter-interaction {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px 0;
    width: 470px;
    justify-content: space-between;
}

.counter-interaction button {
    width: 48%;
    height: 47%;
    align-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 120px;
    font-size: 68px;
    text-align: center;
}

.counter-interaction button:nth-child(2n+1) {
    margin-right: 14px;
}

.counter-interaction button:disabled {
    color: rgba(255, 255, 255, 0.5);
    background-image: none;
    border-color: inherit;
}

.counter-info {
    width: 360px;
    height: 345px;
    margin-right: 27px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(25, 25, 28, 0.5);
    border-radius: 29px;
}

.counter-text {
    text-transform: uppercase;
    font-weight: 500;
    font-size: 24px;
    margin-top: 60px;
    margin-bottom: 28px;

}

.counter-value {
    font-weight: 200;
    font-size: 170px;
    margin: 0;
    padding: 0;
    line-height: 1;
}

button {
    font-family: "JetBrains Mono", Inter, system-ui, sans-serif;
    background-color: rgba(25, 25, 28, 0.5);
    cursor: pointer;
    color: rgba(255, 255, 255, 1);
}

button:hover {
    background-image: radial-gradient(
            farthest-corner at 77% 83%,
            var(--accent-green-glow1) 2%,
            var(--accent-green-glow2) 28%,
            rgba(25, 25, 28, 0) 70%
    );
    border: 1px solid var(--accent-green-soft);
    background-clip: padding-box;
}

.technologies {
    margin-bottom: 36px;
    align-self: center;
}

.technologies img {
    max-width: fit-content;
}


@media (max-width: 875px) {

    .logo {
        margin-top: 10px;
    }

    .title {
        margin-bottom: 30px;
    }

    .counter {
        flex-direction: column;
        padding: 0;
        margin-bottom: 0;
    }

    .counter-info {
        width: 100%;
        height: 300px;
        margin-right: 0;
        margin-bottom: 15px;
    }

    .counter-interaction {
        display: flex;
        flex-direction: row;
        height: auto;
        width: auto;
    }

    .counter-interaction button {
        width: 47%;
        height: 100px;
        margin-right: 0;
        margin-bottom: 15px;
    }
}

/* Zooming background layer */
.bg {
    position: fixed;
    inset: 0;
    background-image: url("zooming_background.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    transform-origin: center center;
    animation: bg-zoom 30s linear infinite;
    pointer-events: none;
    z-index: 0;
}

/* Keep the app content above the background layer */
header, main, footer {
    position: relative;
    z-index: 1;
}

/* Top bar and controls */
.topbar {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    z-index: 3;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-left,
.topbar-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.hamburger {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(25, 25, 28, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.hamburger:hover, .hamburger:focus-visible {
    background-image: radial-gradient(
            farthest-corner at 77% 83%,
            var(--accent-green-glow1) 2%,
            var(--accent-green-glow2) 28%,
            rgba(25, 25, 28, 0) 70%
    );
    border: 1px solid var(--accent-green-soft);
}
.hamburger-box { display: inline-block; width: 22px; height: 16px; position: relative; }
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,0.9);
    position: absolute;
    left: 0;
    transition: transform 0.2s ease;
}
.hamburger-inner { top: 7px; }
.hamburger-inner::before { top: -6px; }
.hamburger-inner::after { top: 6px; }

/* Simple open state (turn into an X) */
.hamburger[aria-expanded="true"] .hamburger-inner { transform: rotate(45deg); }
.hamburger[aria-expanded="true"] .hamburger-inner::before { transform: rotate(90deg) translateX(0); top: 0; }
.hamburger[aria-expanded="true"] .hamburger-inner::after { opacity: 0; }


.menu {
    position: absolute;
    top: 52px;
    left: 0;
    min-width: 240px;
    background: rgba(25, 25, 28, 0.9);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    padding: 6px;
    display: none;
}
.menu.open { display: block; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li { margin: 0; }
.menu button {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.95);
    font: inherit;
    border-radius: 8px;
    cursor: pointer;
}
.menu button:hover, .menu button:focus {
    outline: none;
    background: var(--accent-green-soft);
}

.lang-select {
    height: 36px;
    min-width: 72px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(25, 25, 28, 0.7);
    color: rgba(255,255,255,0.95);
    transition: border-color 0.2s ease, background 0.2s ease;
}
.lang-select:hover, .lang-select:focus-visible {
    background-image: radial-gradient(
            farthest-corner at 77% 83%,
            var(--accent-green-glow1) 2%,
            var(--accent-green-glow2) 28%,
            rgba(25, 25, 28, 0) 70%
    );
    border: 1px solid var(--accent-green-soft);
}
.lang-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-green-soft);
}

/* Class to pause animations when content is being read */
.paused-anim .bg { animation: none !important; }

@keyframes bg-zoom {
    from { transform: scale(1); }
    to { transform: scale(2); }
}

/* Scrollable text pane */
.text-pane {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1280px;
    /* Constrain height so rounded bottom corners remain visible and the pane scrolls internally */
    max-height: calc(100vh - 72px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto; /* internal scroll */
    padding: 24px;
    box-sizing: border-box;
    margin-top: 8px;
    margin-bottom: 16px;
    background-color: rgba(25, 25, 28, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(2px);
}

.text-content {
    /* Render compiled Markdown as normal flow text */
    white-space: normal;
    text-align: left;
    line-height: 1.7;
    font-size: 16px;
}

/* Basic Markdown element styling */
.text-content h1,
.text-content h2,
.text-content h3,
.text-content h4 {
    margin: 1.2em 0 0.5em;
    line-height: 1.25;
    font-weight: 600;
}
.text-content h1 { font-size: 1.8rem; }
.text-content h2 { font-size: 1.5rem; }
.text-content h3 { font-size: 1.25rem; }
.text-content h4 { font-size: 1.1rem; }

.text-content p { margin: 0.6em 0; }
.text-content ul, .text-content ol { margin: 0.6em 0 0.6em 1.2em; }
.text-content li { margin: 0.3em 0; }
.text-content a { color: var(--accent-green); text-decoration: none; }
.text-content a:hover { text-decoration: underline; }
.text-content strong { font-weight: 700; }
.text-content em { font-style: italic; }
.text-content code { font-family: "JetBrains Mono", monospace; font-size: 0.95em; background: rgba(255,255,255,0.08); padding: 0.1em 0.3em; border-radius: 4px; }
.text-content pre code { display: block; padding: 12px; border-radius: 8px; overflow: auto; }
.text-content blockquote { margin: 1em 0; padding: 0.2em 0 0.2em 1em; border-left: 3px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.9); }

@media (max-width: 875px) {
    .text-pane {
        padding: 16px;
        padding-bottom: 96px; /* a bit more space on small screens for the button */
        border-radius: 12px;
    }
}

/* Intro overlay (no box, centered above background) */
.intro {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2; /* above bg but below menu/audio */
    background: transparent;
    pointer-events: none; /* allow interacting with menu/audio */
}
.intro-content {
    max-width: 960px;
    padding: 0 24px;
    text-align: center;
    font-size: 18px;
    line-height: 1.7;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

/* Utilities */
.hidden { display: none !important; }

/* Audio toggle button shown inline in the top bar */
.audio-prompt {
    position: static; /* inline within .topbar-actions */
    z-index: auto;
    padding: 10px 14px;
    min-height: 44px; /* minimum tap target */
    min-width: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(25, 25, 28, 0.7);
    color: rgba(255, 255, 255, 0.95);
    font-family: "JetBrains Mono", Inter, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 480px) {
    .audio-prompt {
        font-size: 13px;
        padding: 10px 12px;
    }
}

.audio-prompt:hover {
    background-image: radial-gradient(
            farthest-corner at 77% 83%,
            var(--accent-green-glow1) 2%,
            var(--accent-green-glow2) 28%,
            rgba(25, 25, 28, 0) 70%
    );
    border: 1px solid var(--accent-green-soft);
}

/* Viewport and background coverage fixes */
:root {
    --accent-green: #2ec27e;
    --accent-green-strong: #26a269;
    --accent-green-soft: rgba(46, 194, 126, 0.18);
    --accent-green-glow1: rgba(46, 194, 126, 0.5);
    --accent-green-glow2: rgba(38, 162, 105, 0.5);
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100vh;     /* fallback */
    min-height: 100svh;    /* avoid mobile URL bar shrink */
}

/* Ensure the animated background truly fills the viewport and resizes smoothly */
.bg {
    width: 100vw;
    height: 100lvh; /* large viewport height to avoid iOS address bar jumps */
    height: 100svh; /* fallback for browsers without lvh */
    background-position: center center;
    background-size: cover;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}
