/* Shafik Hub — единая тема публичных страниц (страница подключения + документы).
   Правится здесь, а не в шаблонах: connect.html и legal_base.html подключают
   этот файл, поэтому любая правка меняет весь сайт сразу. */

:root {
    color-scheme: dark;

    /* Поверхности */
    --bg: #070910;
    --bg-deep: #04050a;
    --surface: #0d111c;
    --surface-2: #121826;
    --surface-3: #182034;
    --line: rgba(255, 255, 255, 0.07);
    --line-2: rgba(255, 255, 255, 0.14);

    /* Текст */
    --text: #eef1f7;
    --text-2: #9aa4b6;
    --text-3: #6a7488;

    /* Акценты сервиса */
    --brand: #4f8cff;
    --brand-2: #22d3ee;
    --amber: #fbbf24;

    /* Акценты приложений — сняты с их иконок */
    --incy-1: #7ede5c;
    --incy-2: #43b64a;
    --incy-on: #062a0f;
    --happ-1: #f2f3f5;
    --happ-2: #b9bec7;
    --happ-on: #1b1d21;

    --r-lg: 18px;
    --r: 14px;
    --r-sm: 10px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --t: 0.22s var(--ease);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    font-size: 16px;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding:
        calc(clamp(1.25rem, 5vw, 2.5rem) + env(safe-area-inset-top))
        clamp(1rem, 4vw, 1.5rem)
        calc(2rem + env(safe-area-inset-bottom));
    overflow-x: hidden;
}

/* Мягкая глубина под тёмным фоном — не декор, а замена плоской заливке */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(70% 45% at 50% -10%, rgba(79, 140, 255, 0.18), transparent 72%),
        radial-gradient(50% 35% at 96% 12%, rgba(34, 211, 238, 0.09), transparent 70%),
        radial-gradient(60% 40% at 4% 45%, rgba(124, 58, 237, 0.08), transparent 72%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 90%);
    pointer-events: none;
}

.wrap {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}
.wrap--doc { max-width: 700px; gap: 1.25rem; }

/* ── Шапка ────────────────────────────────────── */
.hero { text-align: center; }
.mark {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.9rem;
    border-radius: 19px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, rgba(79, 140, 255, 0.22), rgba(34, 211, 238, 0.08));
    border: 1px solid var(--line-2);
    box-shadow: 0 12px 32px -12px rgba(79, 140, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.mark svg { width: 30px; height: 30px; color: #93c5fd; }
.mark--sm { width: 42px; height: 42px; border-radius: 14px; margin-bottom: 0.7rem; }
.mark--sm svg { width: 22px; height: 22px; }

.hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
}
.hero--doc h1 { font-size: clamp(1.4rem, 5vw, 1.8rem); }
.hero p {
    color: var(--text-2);
    font-size: 0.95rem;
    margin-top: 0.4rem;
}
.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
    background: rgba(79, 140, 255, 0.12);
    border: 1px solid rgba(79, 140, 255, 0.24);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 0.7rem;
}

/* ── Заголовок шага ───────────────────────────── */
.step { display: flex; flex-direction: column; gap: 0.85rem; }
.step-head { display: flex; align-items: center; gap: 0.6rem; }
.step-n {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #bfdbfe;
    background: rgba(79, 140, 255, 0.16);
    border: 1px solid rgba(79, 140, 255, 0.28);
}
.step-head h2 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }

/* ── Выбор устройства ─────────────────────────── */
.devices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.device {
    font: inherit;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    min-height: 58px;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--t), background var(--t), border-color var(--t), box-shadow var(--t), transform 0.12s var(--ease);
}
.device svg { flex-shrink: 0; width: 21px; height: 21px; }
.device span { font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.device .tick {
    margin-left: auto;
    width: 17px;
    height: 17px;
    opacity: 0;
    transform: scale(0.7);
    color: var(--brand);
    transition: opacity var(--t), transform var(--t);
}
.device:hover { color: var(--text); border-color: var(--line-2); background: var(--surface-2); }
.device:active { transform: scale(0.98); }
.device:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.device[aria-selected="true"] {
    color: var(--text);
    border-color: rgba(79, 140, 255, 0.5);
    background: linear-gradient(155deg, rgba(79, 140, 255, 0.16), rgba(34, 211, 238, 0.05));
    box-shadow: 0 10px 26px -14px rgba(79, 140, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.device[aria-selected="true"] .tick { opacity: 1; transform: scale(1); }

/* ── Карточки приложений ──────────────────────── */
.panel { display: flex; flex-direction: column; gap: 0.75rem; }
.panel[hidden] { display: none; }
.panel:focus { outline: none; }

.app {
    --a1: var(--brand);
    --a2: #2563eb;
    --on-a: #fff;
    --glow: rgba(79, 140, 255, 0.5);

    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -30px #000;
    animation: rise 0.32s var(--ease) both;
}
.panel > .app:nth-child(2) { animation-delay: 0.06s; }
.panel > .app:nth-child(3) { animation-delay: 0.12s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.app--incy { --a1: var(--incy-1); --a2: var(--incy-2); --on-a: var(--incy-on); --glow: rgba(90, 200, 80, 0.45); }
.app--happ { --a1: var(--happ-1); --a2: var(--happ-2); --on-a: var(--happ-on); --glow: rgba(200, 208, 220, 0.35); }

.app-head { display: flex; align-items: center; gap: 0.8rem; }
.app-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 23%;
    display: block;
    background: var(--surface-3);
    box-shadow: 0 0 0 1px var(--line-2) inset, 0 6px 16px -8px #000;
}
.app-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.app-name-row { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.app-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}
.app-sub { color: var(--text-2); font-size: 0.82rem; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--amber);
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.22);
    padding: 2px 7px;
    border-radius: 999px;
}
.tag svg { width: 10px; height: 10px; }

.stores { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.store {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 0.9rem;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--t), border-color var(--t), transform 0.12s var(--ease);
}
.store svg { width: 14px; height: 14px; color: var(--text-3); }
.store:hover { background: #1e2740; border-color: var(--line-2); }
.store:active { transform: scale(0.97); }
.store:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 54px;
    padding: 0.85rem 1rem;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--a1), var(--a2));
    color: var(--on-a);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 14px 30px -16px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: filter var(--t), box-shadow var(--t), transform 0.12s var(--ease);
}
.cta svg { width: 19px; height: 19px; }
.cta:hover { filter: brightness(1.06); box-shadow: 0 18px 36px -16px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.cta:active { transform: scale(0.985); }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ── Сноска ───────────────────────────────────── */
.note {
    display: flex;
    gap: 0.6rem;
    color: var(--text-2);
    font-size: 0.84rem;
    line-height: 1.55;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 0.85rem 0.95rem;
}
.note svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }

/* ── Навигация по документам ──────────────────── */
.doc-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.doc-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--t), border-color var(--t), background var(--t);
}
.doc-nav a svg { width: 14px; height: 14px; }
.doc-nav a:hover { color: var(--text); border-color: var(--line-2); background: var(--surface-2); }
.doc-nav a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.doc-nav a.active {
    color: #bfdbfe;
    border-color: rgba(79, 140, 255, 0.45);
    background: linear-gradient(155deg, rgba(79, 140, 255, 0.16), rgba(34, 211, 238, 0.05));
}

/* ── Карточка документа ───────────────────────── */
.card {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: clamp(1.1rem, 4vw, 1.6rem);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -30px #000;
}
.card h2 {
    position: relative;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
    padding-left: 0.85rem;
    margin-bottom: 1rem;
}
.card h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
}
.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.35rem 0 0.5rem;
    color: var(--text);
}
.card p, .card li {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.68;
    max-width: 68ch;
}
.card p { margin-bottom: 0.7rem; }
.card p:last-child { margin-bottom: 0; }
.card ul, .card ol { padding-left: 1.25rem; margin: 0.5rem 0 0.9rem; }
.card li { margin-bottom: 0.4rem; }
.card li::marker { color: var(--text-3); }
.card b, .card strong { color: var(--text); font-weight: 600; }
.card code {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0.1rem 0.35rem;
    font-size: 0.88em;
}
.card a { color: #7fb0ff; text-decoration: none; border-bottom: 1px solid rgba(127, 176, 255, 0.35); }
.card a:hover { color: #a8c8ff; border-bottom-color: currentColor; }
.card a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

.contact-list { list-style: none; padding-left: 0 !important; }
.contact-list > li { margin-bottom: 0.6rem; }
.contact-list > li:last-child { margin-bottom: 0; }

/* Список ссылок-документов вместо эмодзи-маркеров */
.link-list { list-style: none; padding-left: 0 !important; display: flex; flex-direction: column; gap: 0.7rem; }
.link-list > li { margin: 0; display: flex; gap: 0.7rem; }
.link-list > li > svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 3px;
    color: var(--brand);
}
.link-list .ll-title {
    display: block;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 2px;
    border-bottom: none;
}
a.ll-title { transition: color var(--t); }
a.ll-title:hover { color: #a8c8ff; }

.table-wrap {
    overflow-x: auto;
    margin: 0.25rem 0 1rem;
    border: 1px solid var(--line);
    border-radius: var(--r);
    -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    white-space: nowrap;
}
th {
    color: var(--text);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.03);
}
td { font-variant-numeric: tabular-nums; }
td:first-child { white-space: normal; color: var(--text); }
tr:last-child td { border-bottom: none; }

/* ── Подвал ───────────────────────────────────── */
.footer {
    text-align: center;
    color: var(--text-2);
    font-size: 0.8rem;
    line-height: 1.7;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.footer a { color: var(--text); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ── Адаптив ──────────────────────────────────── */
@media (max-width: 359px) {
    .device { padding: 0.7rem; gap: 0.55rem; }
    .device span { font-size: 0.86rem; }
    .device .tick { display: none; }
}

@media (min-width: 420px) {
    .devices { gap: 0.7rem; }
    .app { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
