* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

html {
    background: #0b0b0d;
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 50% -20%, rgba(255,255,255,0.055), transparent 35%),
        #0b0b0d;
    color: #f5f5f7;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 34px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: rgba(11,11,13,0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c1c1f;
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 20px;
    color: #d7d7da;
}

.brand h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.brand span {
    display: block;
    margin-top: 1px;
    color: #77777e;
    font-size: 12px;
}

main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 58px 0 80px;
}

.intro {
    margin-bottom: 30px;
}

.intro h2 {
    margin: 0;
    font-size: 34px;
    font-weight: 650;
    letter-spacing: -1.2px;
}

.intro p {
    margin: 8px 0 0;
    color: #85858c;
    font-size: 15px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.tool-card {
    position: relative;
    min-height: 175px;
    padding: 22px;
    border-radius: 18px;
    background: #151517;
    border: 1px solid rgba(255,255,255,0.065);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
    overflow: hidden;
    touch-action: manipulation;
}

.tool-card:hover {
    transform: translateY(-3px);
    background: #1a1a1d;
    border-color: rgba(255,255,255,0.13);
}

.tool-card:active {
    transform: scale(0.985);
}

.tool-emoji {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #202023;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 24px;
    margin-bottom: 20px;
}

.tool-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.25px;
}

.tool-description {
    margin: 7px 0 0;
    color: #85858c;
    font-size: 13px;
    line-height: 1.45;
}

.overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;

    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tool-window {
    width: min(1400px, 100%);
    height: min(850px, 94dvh);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #101012;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;

    box-shadow: 0 30px 100px rgba(0,0,0,0.6);

    transform: scale(0.97);
    transition: transform 0.2s ease;

    position: relative;
}

.overlay.open .tool-window {
    transform: scale(1);
}

.window-header {
    height: 58px;
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 12px 0 18px;

    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: #151517;

    position: relative;
    z-index: 20;
}

.window-title {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 14px;
    font-weight: 600;
}

.window-title span:first-child {
    font-size: 19px;
}

.window-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.close-button {
    flex: 0 0 auto;

    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #252528;
    color: #aaaab0;

    font-size: 25px;
    line-height: 1;

    cursor: pointer;

    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.close-button:hover {
    background: #343438;
    color: #fff;
}

.close-button:active {
    background: #404044;
    transform: scale(0.92);
}

.iframe-container {
    flex: 1;
    min-height: 0;
    background: #fff;
    position: relative;
}

iframe {
    width: 100%;
    height: 100%;

    display: block;

    border: 0;
    background: #fff;
}

/* TABLET */

@media (max-width: 800px) {
    .header {
        height: 64px;
        padding: 0 18px;
    }

    main {
        width: calc(100% - 28px);
        padding: 38px 0 60px;
    }

    .intro h2 {
        font-size: 30px;
    }

    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tool-card {
        min-height: 165px;
    }
}

/* MOBILE */

@media (max-width: 600px) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
    }

    .header {
        height: 60px;
        padding: 0 14px;
    }

    .brand {
        gap: 9px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 18px;
    }

    .brand h1 {
        font-size: 16px;
    }

    .brand span {
        font-size: 11px;
    }

    main {
        width: calc(100% - 24px);
        padding: 30px 0 50px;
    }

    .intro {
        margin-bottom: 22px;
    }

    .intro h2 {
        font-size: 27px;
        letter-spacing: -0.9px;
    }

    .intro p {
        font-size: 14px;
        line-height: 1.45;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .tool-card {
        min-height: 0;
        padding: 18px;
        border-radius: 16px;
    }

    .tool-card:hover {
        transform: none;
        background: #151517;
    }

    .tool-emoji {
        width: 44px;
        height: 44px;
        margin-bottom: 15px;
        border-radius: 13px;
        font-size: 22px;
    }

    .tool-title {
        font-size: 16px;
    }

    .tool-description {
        font-size: 13px;
    }

    /*
        Fullscreen modal na telefonie.
        Nie zostawiamy marginesu, dzieki czemu iframe
        nie wychodzi poza viewport.
    */

    .overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;

        background: #101012;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .tool-window {
        width: 100%;
        max-width: none;

        height: 100%;
        height: 100dvh;
        max-height: none;

        border: 0;
        border-radius: 0;

        box-shadow: none;

        transform: translateY(10px);
    }

    .overlay.open .tool-window {
        transform: translateY(0);
    }

    .window-header {
        height: 56px;
        min-height: 56px;

        padding:
            0
            10px
            0
            14px;

        padding-top: env(safe-area-inset-top);
        height: calc(56px + env(safe-area-inset-top));
    }

    .window-title {
        max-width: calc(100% - 52px);
        font-size: 14px;
    }

    .window-title span:first-child {
        font-size: 18px;
    }

    .close-button {
        width: 42px;
        height: 42px;
        font-size: 26px;
    }

    .iframe-container {
        min-height: 0;
        height: calc(
            100dvh -
            56px -
            env(safe-area-inset-top)
        );
    }
}

/* BARDZO MALE TELEFONY */

@media (max-width: 380px) {
    main {
        width: calc(100% - 18px);
    }

    .intro h2 {
        font-size: 25px;
    }

    .tool-card {
        padding: 16px;
    }
}

/* LANDSCAPE NA TELEFONIE */

@media (max-width: 900px) and (orientation: landscape) {
    .tool-window {
        height: 100dvh;
        border-radius: 0;
    }

    .window-header {
        height: 50px;
        min-height: 50px;
    }

    .close-button {
        width: 38px;
        height: 38px;
    }
}

/* REDUKCJA ANIMACJI */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
