/*
   main_page.css
   Apple-style design system for FotonCP
*/

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-dark: #1d1d1f;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --footer-bg: #2c2c2e;
    --footer-text: #a1a1a6;
    --footer-link: #d2d2d7;

    --nav-bg: rgba(18, 18, 20, 0.78);
    --nav-text: rgba(255, 255, 255, 0.85);

    --accent: #0071e3;
    --accent-hover: #0077ed;

    --line: rgba(0, 0, 0, 0.08);
    --line-dark: rgba(255, 255, 255, 0.12);

    --nav-h: 48px;
    --container: 1024px;

    --radius-lg: 0px;
    --radius-md: 8px;
    --radius-sm: 12px;

    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.05);
    --shadow-strong: 0 16px 40px rgba(0, 0, 0, 0.1);

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --transition: 0.35s var(--ease);
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: var(--nav-h) 0 0;

    display: flex;
    flex-direction: column;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        "Segoe UI",
        Helvetica,
        Arial,
        sans-serif;
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.007em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Favicon used as site logo */
table.heading img {
    display: inline-block;
    width: 15px;
    height: 15px;
    vertical-align: middle;
    opacity: 0.88;
}

/* Kill <br> ladders used as fake spacing on old pages */
body > br,
.main_content > br {
    display: none;
}

::selection {
    background: rgba(0, 113, 227, 0.2);
}

/* Base typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 999px;
}

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

/* ------------------------------------------------ */
/* Fixed translucent nav (Apple global nav style)   */
/* ------------------------------------------------ */

table.heading {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;

    width: 100%;
    max-width: 100%;

    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);

    border-collapse: collapse;
    color: var(--nav-text);
    font-size: 12px;
}

table.heading td {
    position: relative;
    height: var(--nav-h);
    padding: 0;
    vertical-align: middle;
}

/* Vertically expanding nav panel on "Проекты" hover */
table.heading td::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0;

    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);

    transition: height 0.3s var(--ease);
}

table.heading:has(.nav_dropdown:hover) td::after,
table.heading:has(.nav_dropdown:focus-within) td::after {
    height: 64px;
}

table.heading td:first-child {
    width: 1%;
    white-space: nowrap;
}

table.heading td:nth-child(2) {
    width: 100%;
}

/* Inline wrapper divs in header cells */
table.heading td > div[style] {
    height: var(--nav-h) !important;
    background: transparent;
}

.links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;

    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto;
    padding: 0 8px;

    color: var(--nav-text);
    font-size: 12px;
}

.links > div {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    height: var(--nav-h);
}

.links a {
    display: block;
    padding: 7px 12px;
    border-radius: 999px;

    color: var(--nav-text);
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-decoration: none;

    transition:
        background-color var(--transition),
        color var(--transition);
}

.links a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
}

.links p {
    display: inline;
    margin: 0;
    color: inherit;
    font: inherit;
    line-height: 1;
}

/* Site name in nav is slightly heavier */
.links .nav_brand a {
    font-weight: 600;
    font-size: 18px;
}

/* Nav dropdown "Проекты" */
.nav_dropdown {
    position: relative;
}

.nav_flyout {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 1001;

    min-width: 220px;
    padding: 0;

    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -8px);
    transform-origin: top center;

    transition:
        opacity 0.25s var(--ease),
        transform 0.25s var(--ease),
        visibility 0.25s var(--ease);
}

.nav_flyout::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
}

.nav_dropdown:hover .nav_flyout,
.nav_dropdown:focus-within .nav_flyout {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 8px);
}

.links .nav_flyout a {
    display: block;
    height: auto;
    padding: 10px 16px;
    border-radius: 8px;

    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
}

.links .nav_flyout a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Nav search pill */
.nav_search {
    display: flex;
    align-items: center;
    margin: 0;
}

.nav_search input[type="search"] {
    width: 140px;
    height: 30px;
    margin: 0 6px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;

    font-family: inherit;
    font-size: 12px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;

    transition:
        width var(--transition),
        background-color var(--transition);
}

.nav_search input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.nav_search input[type="search"]::-webkit-search-decoration,
.nav_search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.nav_search input[type="search"]:focus {
    width: 200px;
    background: rgba(255, 255, 255, 0.26);
}

.nav_search input[type="search"]:disabled {
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.45);
}

.nav_search input[type="search"]:disabled::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ------------------------------------------------ */
/* Page titles                                      */
/* ------------------------------------------------ */

/* Standalone page titles (old "В РАЗРАБОТКЕ" pages) */
body > h1 {
    flex: 0 0 auto;
    width: min(900px, calc(100% - 32px));
    margin: clamp(72px, 12vw, 140px) auto clamp(24px, 4vw, 40px);
    text-align: center;

    font-size: clamp(32px, 6vw, 56px);
    letter-spacing: -0.03em;
    line-height: 1.06;
}

/* Standalone paragraph blocks (support page text is an h3) */
body > h3 {
    flex: 0 0 auto;
    width: min(780px, calc(100% - 48px));
    margin: clamp(48px, 9vw, 96px) auto;

    text-align: center;
    font-size: clamp(19px, 2.6vw, 24px);
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

/* ------------------------------------------------ */
/* Content cards                                    */
/* ------------------------------------------------ */

.main_content {
    flex: 1 1 auto;
    display: flow-root;
    width: 100%;
    padding: clamp(40px, 8vw, 88px) 0 64px;
}

.apps {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;

    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto 20px;
    gap: 16px;
}

.apps > div {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    flex: 1 1 320px;
    min-height: 180px;
    padding: 32px 30px;
    overflow: hidden;

    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);

    transition:
        transform var(--transition),
        box-shadow var(--transition);
}

.apps > div:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-strong);
}

/* Wide hero-like tiles (force1 / force2) */
.apps > div:only-child,
.apps > #force1,
.apps > #force2 {
    flex-basis: 100%;
}

.apps > div h2 {
    margin-bottom: 14px;
    font-size: clamp(22px, 3vw, 28px);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.apps > div h3 {
    margin-bottom: 8px;
    font-size: 19px;
    line-height: 1.25;
}

.apps > div p,
.apps > div .paskagetextdownload {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.apps > div > p + p {
    margin-top: 12px;
}

.apps img,
.apps .paskagetextdownload img {
    width: 100%;
    height: clamp(220px, 26vw, 340px);
    max-width: 100%;
    margin-top: 0;
    padding-top: 24px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.apps .paskagetextdownload:has(img),
.apps img:not(p img) {
    margin-top: auto;
}

/* ------------------------------------------------ */
/* Contact tiles                                    */
/* ------------------------------------------------ */

.feat {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    width: min(var(--container), calc(100% - 32px));
    margin: 36px auto 0;
    gap: 16px;
}

.feat h2 {
    display: none;
}

.feat > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 16px;
}

.feat > div > div,
.feat > div > a.feat_card {
    flex: 1 1 300px;
    max-width: 460px;
    padding: 32px;
    text-align: center;

    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);

    transition:
        transform var(--transition),
        box-shadow var(--transition);
}

.feat > div > div:hover,
.feat > div > a.feat_card:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-strong);
    text-decoration: none;
}

.feat > div > a.feat_card {
    display: block;
    color: var(--text);
}

.feat > div > a.feat_card h3 {
    color: var(--text);
}

.feat > div > a.feat_card p {
    color: var(--muted);
}

.feat > div > a.feat_card p::after {
    content: " \203A";
    color: var(--accent);
    font-weight: 600;
}

.feat h3 {
    margin-bottom: 10px;
    font-size: 19px;
}

.feat p,
.download_link {
    color: var(--muted);
    font-size: 16px;
}

.download_link a {
    color: var(--accent);
}

.download_link a::after {
    content: " \203A";
    font-weight: 600;
}

/* ------------------------------------------------ */
/* Footer (Apple light footer)                      */
/* ------------------------------------------------ */

.bott {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 32px 20px 40px;
    text-align: center;

    background: var(--footer-bg);
    border-top: 0;
    color: var(--footer-text);
    font-size: 12px;
    line-height: 1.6;
}

.footer_links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 32px;

    margin-bottom: 18px;
    font-size: 12px;
}

.footer_links a {
    color: var(--footer-link);
}

.bott p {
    margin: 0;
    color: var(--footer-text);
    font-size: 12px;
}

.bott p + p {
    margin-top: 6px;
}

.bott a {
    color: var(--footer-link);
    text-decoration: none;
}

.bott a:hover {
    text-decoration: underline;
}

/* Neutralize old inline white styles inside the footer */
.bott p[style],
.bott #by,
.bott #by *,
.bott a[style] {
    color: inherit !important;
}

.bott .download_link {
    color: var(--footer-text) !important;
}

.bott img {
    display: inline-block;
    margin-bottom: 10px;
    opacity: 0.55;
}

/* ------------------------------------------------ */
/* Responsive                                       */
/* ------------------------------------------------ */

@media (max-width: 834px) {
    .links {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .links::-webkit-scrollbar {
        display: none;
    }

    .nav_search input[type="search"] {
        width: 105px;
    }

    .nav_flyout {
        display: none;
    }

    table.heading:has(.nav_dropdown:hover) td::after {
        height: 0;
    }

    .nav_search input[type="search"]:focus {
        width: 140px;
    }

    .apps {
        width: calc(100% - 24px);
        gap: 12px;
    }

    .apps > div {
        flex-basis: 100%;
        min-height: 0;
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }

    .apps img,
    .apps .paskagetextdownload img {
        height: clamp(180px, 40vw, 300px);
        padding-top: 18px;
    }

    .feat > div > div {
        flex-basis: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
