/* ==========================================================================
   files.appr.su — стили
   Тёмная тема. Фуксия как ведущий акцент. Glassmorphism, плавающий фон,
   glow на интерактивных элементах, типографика Fraunces × Manrope.
   ========================================================================== */

/* ---------- ПЕРЕМЕННЫЕ ---------- */
:root {
    /* Палитра */
    --bg-base:        #0a0612;     /* почти чёрный с фиолетовым подтоном */
    --bg-deep:        #050309;     /* глубже, для виньетки */
    --ink:            #f5edf6;     /* основной текст */
    --ink-soft:       #c7bfd1;     /* приглушённый */
    --ink-mute:       #7a728a;     /* совсем тихий */
    --line:           rgba(217, 70, 239, 0.14);

    /* Акцент */
    --fuchsia:        #d946ef;
    --fuchsia-soft:   #f0abfc;
    --fuchsia-deep:   #a21caf;
    --fuchsia-glow:   rgba(217, 70, 239, 0.45);

    /* Дополнительные тона для иконок (типа файла) */
    --c-folder:  #d946ef;
    --c-disc:    #67e8f9;
    --c-win:     #93c5fd;
    --c-android: #86efac;
    --c-archive: #fbbf24;
    --c-doc:     #fda4af;
    --c-text:    #c7bfd1;
    --c-code:    #c4b5fd;
    --c-image:   #fcd34d;
    --c-audio:   #f9a8d4;
    --c-video:   #fca5a5;
    --c-package: #a3e635;
    --c-term:    #5eead4;

    /* Стекло */
    --glass-bg:    rgba(24, 13, 36, 0.55);
    --glass-edge:  rgba(217, 70, 239, 0.18);
    --glass-inner: rgba(255, 255, 255, 0.04);

    /* Типографика */
    --font-display: "Fraunces", "Times New Roman", serif;
    --font-body:    "Manrope", "Helvetica Neue", sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", Consolas, monospace;

    /* Кривые */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }
input { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
:focus-visible {
    outline: 2px solid var(--fuchsia);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- ОСНОВА ---------- */
body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--ink);
    background: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
    /* Виньетка к краям */
    background-image:
        radial-gradient(ellipse at top, rgba(217, 70, 239, 0.08), transparent 60%),
        radial-gradient(ellipse at bottom, rgba(103, 232, 249, 0.04), transparent 50%);
}

/* ---------- ФОНОВЫЕ ОРБЫ ---------- */
.orbs {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    animation: drift 22s ease-in-out infinite;
}
.orb--1 {
    width: 420px; height: 420px;
    top: -120px; left: -80px;
    background: radial-gradient(circle, var(--fuchsia), transparent 70%);
}
.orb--2 {
    width: 520px; height: 520px;
    top: 30%; right: -180px;
    background: radial-gradient(circle, #a21caf, transparent 70%);
    animation-delay: -7s;
    animation-duration: 28s;
}
.orb--3 {
    width: 340px; height: 340px;
    bottom: -80px; left: 20%;
    background: radial-gradient(circle, #67e8f9, transparent 70%);
    opacity: 0.25;
    animation-delay: -14s;
    animation-duration: 35s;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.06); }
    66% { transform: translate(-40px, 50px) scale(0.96); }
}

/* ---------- ЗЕРНО ---------- */
.grain {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.06;
    mix-blend-mode: overlay;
    /* SVG-шум, не требует загрузки */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/></svg>");
}

/* ---------- LAYOUT ---------- */
.layout {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 64px 32px 96px;
}

@media (max-width: 720px) {
    .layout { padding: 32px 18px 64px; }
}

/* ---------- СТЕКЛО ---------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid var(--glass-edge);
    border-radius: 18px;
    box-shadow:
        0 1px 0 var(--glass-inner) inset,
        0 24px 48px -24px rgba(0, 0, 0, 0.6);
}

/* ---------- ШАПКА (hero) ---------- */
.hero {
    margin-bottom: 24px;
    animation: rise 0.7s var(--ease-out) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Хлебные крошки */
.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    color: var(--ink-mute);
    margin-bottom: 18px;
    font-family: var(--font-mono);
}
.crumbs__link {
    padding: 4px 10px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.crumbs__link:hover {
    color: var(--fuchsia-soft);
    background: rgba(217, 70, 239, 0.08);
}
.crumbs__here {
    padding: 4px 10px;
    color: var(--ink);
    background: rgba(217, 70, 239, 0.12);
    border-radius: 8px;
    border: 1px solid var(--line);
}
.crumbs__sep {
    width: 12px; height: 12px;
    color: var(--ink-mute);
    opacity: 0.5;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(48px, 7vw, 84px);
    font-weight: 500;
    font-variation-settings: "opsz" 100, "SOFT" 30;
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0 0 18px;
    background: linear-gradient(135deg, var(--ink) 30%, var(--fuchsia-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(217, 70, 239, 0.10);
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}
.chip strong {
    color: var(--fuchsia-soft);
    font-weight: 600;
}
.chip--ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--ink-mute);
}

/* ---------- ТУЛБАР ---------- */
.toolbar {
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    animation: rise 0.7s 0.05s var(--ease-out) both;
}
@media (max-width: 640px) {
    .toolbar { flex-direction: column; align-items: stretch; }
}

.search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within {
    border-color: var(--fuchsia);
    box-shadow: 0 0 0 4px rgba(217, 70, 239, 0.12);
}
.search__icon { width: 18px; height: 18px; color: var(--ink-mute); flex-shrink: 0; }
.search input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 15px;
}
.search input::placeholder { color: var(--ink-mute); }
.search__kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.03);
}

.sorter { display: flex; gap: 4px; }
.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--ink-mute);
    transition: color 0.2s, background 0.2s;
}
.sort-btn svg { width: 13px; height: 13px; opacity: 0.7; }
.sort-btn:hover { color: var(--ink-soft); background: rgba(255, 255, 255, 0.03); }
.sort-btn.is-active {
    color: var(--fuchsia-soft);
    background: rgba(217, 70, 239, 0.12);
}
.sort-btn[data-dir="desc"] svg { transform: scaleY(-1); }

/* ---------- СПИСОК ФАЙЛОВ ---------- */
.listing {
    overflow: hidden;
    animation: rise 0.7s 0.1s var(--ease-out) both;
}

.rows { display: flex; flex-direction: column; }

.row {
    display: grid;
    grid-template-columns: 1fr 110px 160px auto;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    position: relative;
    transition: background 0.2s;
    /* Stagger-анимация: каждый ряд появляется с задержкой */
    animation: row-in 0.5s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 25ms + 200ms);
}
.row:first-child { border-top: 0; }
.row:hover { background: rgba(217, 70, 239, 0.06); }

@keyframes row-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.row[hidden] { display: none; }

/* "Главная" часть ряда — это кликабельная иконка + имя */
.row__main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;          /* чтобы text-overflow работал */
    color: var(--ink);
    transition: color 0.2s;
}
.row__main:hover { color: var(--fuchsia-soft); }

.row__icon {
    display: inline-flex;
    width: 38px; height: 38px;
    border-radius: 10px;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    transition: transform 0.3s var(--ease-out), border-color 0.2s;
}
.row__icon svg { width: 20px; height: 20px; }
.row:hover .row__icon {
    transform: rotate(-4deg) scale(1.05);
    border-color: var(--fuchsia);
}

/* Раскрашиваем иконки по типу через currentColor */
.icon-folder   { color: var(--c-folder); }
.icon-disc     { color: var(--c-disc); }
.icon-windows  { color: var(--c-win); }
.icon-android  { color: var(--c-android); }
.icon-archive  { color: var(--c-archive); }
.icon-doc      { color: var(--c-doc); }
.icon-text     { color: var(--c-text); }
.icon-code     { color: var(--c-code); }
.icon-image    { color: var(--c-image); }
.icon-audio    { color: var(--c-audio); }
.icon-video    { color: var(--c-video); }
.icon-package  { color: var(--c-package); }
.icon-terminal { color: var(--c-term); }
.icon-file     { color: var(--ink-mute); }

.row__name {
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.row__slash {
    color: var(--fuchsia);
    opacity: 0.6;
    margin-left: 2px;
}

.row__size, .row__date {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-mute);
    white-space: nowrap;
}
.row__size { text-align: right; }

.row__actions { display: flex; gap: 4px; }

/* Иконочные кнопки */
.iconbtn {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    color: var(--ink-mute);
    transition: all 0.2s var(--ease-out);
    position: relative;
}
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:hover {
    color: var(--fuchsia-soft);
    background: rgba(217, 70, 239, 0.12);
    transform: translateY(-1px);
}
.iconbtn--dl:hover {
    color: #fff;
    background: var(--fuchsia);
    box-shadow: 0 4px 12px var(--fuchsia-glow);
}
.iconbtn.is-copied { color: #86efac; }

@media (max-width: 720px) {
    .row { grid-template-columns: 1fr auto; gap: 8px; padding: 12px 14px; }
    .row__size, .row__date { display: none; }
}

/* Пустое состояние */
.empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ink-mute);
}
.empty svg { width: 48px; height: 48px; opacity: 0.4; margin-bottom: 12px; }
.empty p { margin: 0; font-family: var(--font-display); font-size: 22px; font-style: italic; }
.empty--filtered { padding: 32px; font-family: var(--font-mono); font-size: 14px; }

/* ---------- МОДАЛКА С ХЭШАМИ ---------- */
.hash-modal {
    border: 0;
    background: transparent;
    padding: 0;
    max-width: min(560px, 92vw);
    color: var(--ink);
}
.hash-modal::backdrop {
    background: rgba(5, 3, 9, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.hash-modal[open] {
    animation: pop 0.3s var(--ease-out);
}
@keyframes pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.hash-modal__inner { padding: 24px; }
.hash-modal__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}
.hash-modal__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--fuchsia-soft);
    font-weight: 600;
}
.hash-modal__file {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    margin: 6px 0 0;
    word-break: break-all;
}

.hash-row {
    margin-bottom: 14px;
}
.hash-row__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
    margin-bottom: 6px;
}
.hash-row__value {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
}
.hash-row__value code { flex: 1; }
.hash-row__copy {
    flex-shrink: 0;
    color: var(--ink-mute);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}
.hash-row__copy:hover { color: var(--fuchsia-soft); }
.hash-row__copy.is-copied { color: #86efac; }

/* Блок заметки — отличается от хэшей: текст а не моноширинный.
   Слева акцентная полоска, чуть другой фон. */
.hash-row--note {
    padding: 12px 14px;
    background: rgba(217, 70, 239, 0.07);
    border: 1px solid var(--line);
    border-left: 3px solid var(--fuchsia);
    border-radius: 10px;
}
.hash-row--note .hash-row__label {
    margin-bottom: 4px;
}
.hash-row__note {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-soft);
    word-break: break-word;
}
.note-link {
    color: var(--fuchsia-soft);
    text-decoration: underline;
    text-decoration-color: rgba(217, 70, 239, 0.4);
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.note-link:hover {
    color: #fff;
    text-decoration-color: var(--fuchsia);
}

.hash-pending {
    text-align: center;
    color: var(--ink-mute);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 32px 0;
    margin: 0;
}
.hash-pending::after {
    content: "▍";
    margin-left: 4px;
    animation: blink 1s steps(2) infinite;
    color: var(--fuchsia);
}
@keyframes blink { 50% { opacity: 0; } }

.hash-large {
    text-align: center;
    padding: 24px 0;
}
.hash-large p {
    color: var(--ink-soft);
    font-size: 14px;
    margin: 0 0 16px;
}
.hash-large button {
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--fuchsia);
    color: #0a0612;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}
.hash-large button:hover {
    box-shadow: 0 4px 18px var(--fuchsia-glow);
    transform: translateY(-1px);
}

/* ---------- ТОСТ ---------- */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(120%);
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--fuchsia);
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 24px var(--fuchsia-glow);
    z-index: 100;
    transition: transform 0.4s var(--ease-out), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}
.toast.is-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ---------- FOOTER ---------- */
.page-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 32px;
    color: var(--ink-mute);
    font-family: var(--font-mono);
    font-size: 12px;
}
.page-footer__dot { margin: 0 8px; opacity: 0.5; }

/* ---------- СТРАНИЦА ОШИБКИ ---------- */
.error-page {
    text-align: center;
    padding: 80px 20px;
    animation: rise 0.7s var(--ease-out) both;
}
.error-page__code {
    font-family: var(--font-display);
    font-size: clamp(96px, 18vw, 200px);
    font-weight: 400;
    font-style: italic;
    line-height: 0.9;
    background: linear-gradient(135deg, var(--fuchsia), var(--fuchsia-deep));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-page__title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    margin: 8px 0 12px;
}
.error-page__msg {
    color: var(--ink-soft);
    margin-bottom: 32px;
}
.error-page__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--fuchsia-soft);
    transition: all 0.2s;
}
.error-page__back:hover {
    background: rgba(217, 70, 239, 0.12);
    border-color: var(--fuchsia);
    box-shadow: 0 0 24px var(--fuchsia-glow);
}
.error-page__back svg { width: 14px; height: 14px; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    .orb { animation: none; }
    .row, .hero, .toolbar, .listing, .error-page { animation: none; }
}
