/* Minimal Apple-like UI — download site */

:root {
    --bg: #fbfbfd;
    --surface: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --hairline: rgba(0, 0, 0, 0.08);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-pill: 980px;
    --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.06);
    --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.47059;
    font-size: 17px;
    letter-spacing: -0.022em;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.container {
    max-width: 1068px;
    margin: 0 auto;
    padding: 0 22px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(251, 251, 253, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hairline);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo {
    max-height: 36px;
    width: auto;
    display: block;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.016em;
    padding: 10px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s var(--ease-out);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-btn:active {
    transform: scale(0.97);
}

.nav-btn--accent {
    background: var(--accent);
    color: #fff;
}

.nav-btn--accent:hover {
    background: var(--accent-hover);
}

.nav-btn--accent:active {
    transform: scale(0.97);
}

.nav-btn--ghost {
    border: 1px solid var(--hairline);
    background: var(--surface);
}

/* Hero / intro */
.hero {
    padding: 56px 0 28px;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 19px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.015em;
    max-width: 36em;
    margin: 0 auto;
}

/* Search */
.search-block {
    margin-top: 36px;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.search-form input[type='text'] {
    flex: 1;
    min-width: 200px;
    padding: 14px 18px;
    font: inherit;
    font-size: 16px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-form input[type='text']:focus {
    outline: none;
    border-color: rgba(0, 113, 227, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.search-form .btn-pill {
    flex-shrink: 0;
}

/* Sections */
.section {
    padding: 28px 0 48px;
}

.section-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* Category chips — horizontal scroll on small screens */
.category-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--hairline);
    background: var(--surface);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s var(--ease-out);
}

.category-chip:hover {
    border-color: rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

.category-chip.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

/* Software list — horizontal strip cards */
.software-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.software-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.software-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
}

.row-logo-wrap {
    flex-shrink: 0;
}

.row-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--hairline);
}

.row-logo--placeholder {
    background: rgba(0, 0, 0, 0.06);
}

.row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.row-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-category {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.row-download {
    min-width: 80px;
    padding-left: 18px;
    padding-right: 18px;
}

.no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
    font-size: 17px;
    border: 1px dashed var(--hairline);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
}

.btn-pill {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: transform 0.15s var(--ease-out), background 0.2s ease, opacity 0.2s ease;
}

.software-row .btn-pill.row-download {
    flex: 0 0 auto;
}

.btn-pill:active {
    transform: scale(0.98);
}

.btn-pill--primary {
    background: var(--accent);
    color: #fff;
}

.btn-pill--primary:hover {
    background: var(--accent-hover);
}

.btn-pill--secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.btn-pill--secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Footer */
.site-footer {
    margin-top: auto;
    padding: 48px 0 40px;
    border-top: 1px solid var(--hairline);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.footer-logo {
    max-height: 32px;
    width: auto;
}

.footer-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

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

/* ——— Overlay / Sheet system ——— */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
}

.overlay.is-open {
    pointer-events: auto;
    opacity: 1;
}

.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.overlay-panel {
    position: relative;
    width: 100%;
    max-height: min(92vh, 860px);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(40px);
    -webkit-backdrop-filter: saturate(180%) blur(40px);
    border-radius: 22px 22px 0 0;
    border: 1px solid var(--hairline);
    border-bottom: none;
    box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.12);
    transform: translateY(110%);
    transition: transform 0.48s var(--ease-spring);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.overlay.is-open .overlay-panel {
    transform: translateY(0);
}

.overlay-panel--narrow {
    max-width: 420px;
}

.overlay-handle {
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.12);
    margin: 10px auto 6px;
    flex-shrink: 0;
}

.overlay-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 22px 16px;
    border-bottom: 1px solid var(--hairline);
}

.overlay-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.overlay-close {
    appearance: none;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: var(--text-secondary);
    transition: background 0.2s ease, transform 0.15s var(--ease-out);
    flex-shrink: 0;
}

.overlay-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.overlay-close:active {
    transform: scale(0.92);
}

.overlay-body {
    padding: 20px 22px 28px;
    overflow-y: auto;
    flex: 1;
}

.overlay-footer {
    padding: 14px 22px calc(18px + env(safe-area-inset-bottom, 0));
    border-top: 1px solid var(--hairline);
    display: flex;
    gap: 10px;
    justify-content: stretch;
    align-items: center;
    flex-wrap: wrap;
    background: rgba(251, 251, 253, 0.85);
}

.sheet-official-link {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius-pill);
    transition: background 0.2s ease, opacity 0.2s ease;
}

.sheet-official-link:hover {
    background: rgba(0, 113, 227, 0.08);
}

.sheet-category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sheet-category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 16px;
    transition: background 0.2s ease;
}

.sheet-category-list a:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sheet-detail-row {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.sheet-detail-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid var(--hairline);
}

.sheet-detail-text {
    flex: 1;
    min-width: 0;
}

.sheet-detail-text h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.sheet-detail-text .muted {
    font-size: 14px;
    color: var(--text-secondary);
}

.sheet-prose {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.sheet-url {
    font-size: 13px;
    word-break: break-all;
    color: var(--text-secondary);
    margin-top: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
}

@media (min-width: 640px) {
    .overlay {
        align-items: center;
        padding: 24px;
    }

    .overlay-panel {
        border-radius: var(--radius-lg);
        border: 1px solid var(--hairline);
        max-width: 520px;
        transform: translateY(24px) scale(0.94);
        opacity: 0;
        transition: transform 0.45s var(--ease-spring), opacity 0.35s var(--ease-out);
    }

    .overlay.is-open .overlay-panel {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .overlay-handle {
        display: none;
    }

    .overlay-panel--wide {
        max-width: 560px;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 34px;
    }

    .hero-sub {
        font-size: 17px;
    }

    .site-header .container {
        flex-wrap: wrap;
    }

    .header-nav {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

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

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

    html {
        scroll-behavior: auto;
    }
}
