/* Centro de descargas GstarBIM — same tokens and type as the GstarBIM landing (bim.gstarbim.cl). */

@font-face { font-family: 'MiSans'; src: url('../fonts/MiSans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'MiSans'; src: url('../fonts/MiSans-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'MiSans'; src: url('../fonts/MiSans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
    --ink: #060b24;
    --ink-2: #14193b;
    --text: #1c2240;
    --muted: #5b6480;
    --muted-2: #8a92ad;
    --line: #e1e5ee;
    --line-2: #cdd4e2;
    --surface: #f3f5fa;
    --surface-2: #e9ecf5;
    --card: #fff;
    --brand: #4f46e5;
    --brand-2: #4338ca;
    --brand-soft: #eef0ff;
    --cyan: #06b6d4;
    --cyan-soft: #67e8f9;
    --gold: #f59e0b;
    --gold-2: #f97316;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(6, 11, 36, .05);
    --shadow: 0 1px 2px rgba(6, 11, 36, .04), 0 8px 24px rgba(6, 11, 36, .06);
    --shadow-lg: 0 24px 60px rgba(6, 11, 36, .28);
    --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
    --top: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 24px); }
body {
    margin: 0;
    font-family: 'MiSans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, .45); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 24px; }
.ico { width: 18px; height: 18px; flex: none; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 500; font-size: .92rem; line-height: 1; text-decoration: none; white-space: nowrap;
    cursor: pointer; background: none; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-sm { height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(67, 56, 202, .3); }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-icon { width: 36px; padding: 0; background: var(--card); border-color: var(--line-2); color: var(--muted); }
.btn-icon:hover { border-color: var(--brand); color: var(--brand); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--ink); font-weight: 700; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-wa { background: #e8f9ef; border-color: #bfeccf; color: #0f7a3d; }
.btn-wa:hover { background: #d8f5e4; }

/* ── Header ── */
.topbar {
    position: sticky; top: 0; z-index: 40; height: var(--top);
    background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand img { height: 30px; width: auto; }
.brand-sep { width: 1px; height: 22px; background: var(--line-2); }
.brand-label { font-weight: 500; font-size: .95rem; color: var(--muted); }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: .92rem; text-decoration: none; }
.topnav a:hover { background: var(--surface-2); }

/* ── Hero ── */
.hero {
    position: relative; overflow: hidden; color: #fff; padding: 56px 0 64px;
    background:
        radial-gradient(900px 420px at 88% -12%, rgba(79, 70, 229, .5), transparent 62%),
        radial-gradient(720px 380px at -5% 115%, rgba(6, 182, 212, .28), transparent 60%),
        var(--ink);
}
.hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 30% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 80% at 30% 40%, #000 20%, transparent 75%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.eyebrow { margin: 0 0 14px; color: var(--cyan-soft); font-weight: 500; font-size: .8rem; letter-spacing: .09em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 20ch; font-size: clamp(2rem, 2.6vw + 1.1rem, 3.25rem); line-height: 1.08; letter-spacing: -.025em; font-weight: 700; text-wrap: balance; }
.lead { margin: 18px 0 0; max-width: 56ch; color: #b9c1dd; font-size: 1.075rem; }

.search { position: relative; margin-top: 28px; max-width: 620px; }
.search .ico { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search input {
    width: 100%; height: 58px; padding: 0 52px 0 50px; border: 1px solid transparent; border-radius: 14px;
    background: #fff; color: var(--ink); font-size: 1.05rem; box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .45), 0 12px 32px rgba(0, 0, 0, .28); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    min-width: 24px; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 6px;
    font: 500 12px/1.4 var(--mono); color: var(--muted); text-align: center; background: var(--surface);
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
.hero-meta { margin: 16px 0 0; color: #9aa3c4; font-size: .9rem; }
.hero-meta b { color: #fff; font-weight: 500; }

.trial {
    padding: 24px; border-radius: 20px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
    border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.trial-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.trial h2 { margin: 14px 0 6px; font-size: 1.35rem; line-height: 1.25; letter-spacing: -.01em; }
.trial p { margin: 0; color: #b9c1dd; font-size: .95rem; }
.trial-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.trial-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); }
.trial-list div b { display: block; font-weight: 700; }
.trial-list div span { display: block; color: #9aa3c4; font-size: .82rem; }
.trial-guide { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0; border: 0; background: none; color: var(--cyan-soft); font-size: .9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.trial-guide .ico { width: 16px; height: 16px; }

/* ── Layout ── */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 40px; padding-top: 36px; padding-bottom: 80px; align-items: start; }

.catnav { position: sticky; top: calc(var(--top) + 20px); max-height: calc(100vh - var(--top) - 40px); overflow-y: auto; scrollbar-width: thin; }
.catnav-group { margin: 20px 0 6px 10px; color: var(--muted-2); font-size: .72rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.catnav-link {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
    color: var(--text); text-decoration: none; font-weight: 500; font-size: .93rem; transition: background-color .15s;
}
.catnav-link:hover { background: var(--surface-2); }
.catnav-link.is-active { background: var(--brand-soft); color: var(--brand-2); }
.catnav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sigla {
    display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px;
    background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
    font-size: .62rem; font-weight: 700; letter-spacing: .02em;
}
.catnav-link.is-active .sigla { background: var(--brand); border-color: var(--brand); color: #fff; }
.count { min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .75rem; text-align: center; font-variant-numeric: tabular-nums; }
.catnav-link.is-active .count { background: #fff; color: var(--brand-2); }
.catnav-link.is-zero { opacity: .45; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 24px; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.kind { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: .875rem; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.kind:hover { border-color: var(--ink-2); }
.kind.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.result-count { margin: 0; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }

/* ── Categories & files ── */
.cat { margin-bottom: 44px; scroll-margin-top: calc(var(--top) + 24px); }
.cat-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.sigla-lg { width: 48px; height: 48px; border-radius: 12px; border: 0; background: linear-gradient(135deg, var(--brand), var(--cyan)); color: #fff; font-size: .78rem; box-shadow: 0 6px 16px rgba(79, 70, 229, .25); }
.cat-head h2 { margin: 2px 0 0; color: var(--ink); font-size: 1.4rem; line-height: 1.25; letter-spacing: -.015em; }
.cat-head p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; max-width: 72ch; }
.cat-empty { margin: 0; padding: 22px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); text-align: center; background: rgba(255, 255, 255, .5); }

.group + .group { margin-top: 18px; }
.group-title { margin: 0 0 8px 2px; color: var(--muted); font-size: .75rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.group-title span { color: var(--muted-2); }

.files { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.file {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; grid-template-areas: 'ico main meta actions';
    gap: 16px; align-items: center; padding: 14px 16px; transition: background-color .15s;
}
.file + .file { border-top: 1px solid var(--line); }
.file:hover { background: #fafbff; }
.file-ico { grid-area: ico; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: .66rem; font-weight: 700; letter-spacing: .03em; }
.k-instalador { background: #eef0ff; color: #4338ca; }
.k-complemento { background: #e3f7fb; color: #0e7490; }
.k-guia { background: #fff1f0; color: #c4320a; }
.k-proyecto { background: #ecfdf3; color: #067647; }
.k-multimedia { background: #fff7e6; color: #b45309; }
.k-otro { background: var(--surface-2); color: var(--muted); }
.file-main { grid-area: main; min-width: 0; }
.file-title { margin: 0; color: var(--ink); font-size: .98rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.file-name { margin-top: 2px; color: var(--muted); font: 12px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tags:empty { display: none; }
.tag { padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.5; }
.tag-new { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.file-meta { grid-area: meta; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 92px; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-meta span:first-child { color: var(--ink-2); font-weight: 500; }
.file-actions { grid-area: actions; display: flex; gap: 8px; justify-content: flex-end; }

.empty { padding: 48px 24px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--card); text-align: center; color: var(--muted); }
.empty h2 { margin: 0 0 8px; color: var(--ink); font-size: 1.25rem; }
.empty p { margin: 6px 0; }
.linklike { padding: 0; border: 0; background: none; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ── Viewer ── */
.viewer { width: min(1100px, calc(100vw - 32px)); height: min(90vh, 900px); padding: 0; border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(6, 11, 36, .72); backdrop-filter: blur(4px); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.viewer-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: .95rem; }
.viewer-actions { display: flex; gap: 8px; flex: none; }
.viewer-body { flex: 1; min-height: 0; background: var(--surface-2); }
.viewer-body iframe, .viewer-body img, .viewer-body video { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; }

.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 12px; border-radius: 999px;
    background: var(--ink); color: #fff; font-size: .9rem; box-shadow: var(--shadow-lg);
}
.toast .ico { color: #4ade80; }

/* ── Footer ── */
.footer { background: var(--card); border-top: 1px solid var(--line); padding: 36px 0 28px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 20px 40px; align-items: start; }
.footer-brand img { height: 28px; width: auto; }
.footer-brand p { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { color: var(--ink-2); font-weight: 500; font-size: .92rem; text-decoration: none; }
.footer-links a:hover { color: var(--brand); }
.footer small { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: .82rem; }

/* ── 404 / archivo actualizado ── */
.notfound { display: grid; place-items: center; min-height: calc(100vh - var(--top) - 200px); padding-top: 56px; padding-bottom: 72px; }
.notfound-card { max-width: 620px; padding: 40px 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); text-align: center; }
.notfound-code { display: block; font-size: 3.5rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; background: linear-gradient(135deg, var(--brand), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notfound h1 { margin: 16px 0 10px; color: var(--ink); font-size: 1.6rem; letter-spacing: -.015em; }
.notfound p { margin: 0; color: var(--muted); }
.notfound-file { padding: 2px 6px; border-radius: 6px; background: var(--surface); color: var(--ink-2); font: 13px/1.6 var(--mono); word-break: break-all; }
.notfound-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }

/* ── Responsive ── */
@media (max-width: 1080px) {
    .hero-grid { grid-template-columns: 1fr; gap: 32px; }
    .trial { max-width: 620px; }
}

@media (max-width: 900px) {
    .topnav { display: none; }
    .btn-wa { margin-left: auto; }
    .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
    .catnav {
        position: sticky; top: var(--top); z-index: 30; max-height: none; overflow: visible;
        margin-inline: -24px; padding: 10px 24px; background: rgba(243, 245, 250, .92);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
    }
    .catnav-scroll { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: -24px; padding-inline: 24px; }
    .catnav-scroll::-webkit-scrollbar { display: none; }
    .catnav-group { display: none; }
    .catnav-link { flex: none; scroll-snap-align: start; padding: 5px 10px 5px 5px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; }
    .catnav-link .sigla { width: 26px; height: 26px; border-radius: 999px; font-size: .55rem; }
    .catnav-name { overflow: visible; }
    .toolbar { margin-top: 18px; }
    .kinds { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -24px; padding-inline: 24px; }
    .kinds::-webkit-scrollbar { display: none; }
    .kind { flex: none; }
    .cat { scroll-margin-top: calc(var(--top) + 76px); }
    html { scroll-padding-top: calc(var(--top) + 76px); }
}

@media (max-width: 640px) {
    .wrap { padding-inline: 16px; }
    .catnav, .catnav-scroll, .kinds { margin-inline: -16px; padding-inline: 16px; }
    .catnav-scroll { margin-inline: -16px; }
    .brand-sep, .brand-label { display: none; }
    .btn-wa span { display: none; }
    .btn-wa { width: 40px; padding: 0; }
    .hero { padding: 36px 0 40px; }
    .search input { height: 54px; font-size: 1rem; }
    .search kbd { display: none; }
    .trial { padding: 20px; }
    .trial-list li { padding: 12px; }
    .cat-head h2 { font-size: 1.25rem; }
    .sigla-lg { width: 42px; height: 42px; }
    .file { grid-template-columns: 40px minmax(0, 1fr); grid-template-areas: 'ico main' '. meta' '. actions'; gap: 8px 12px; padding: 14px; }
    .file-ico { width: 40px; height: 40px; }
    .file-meta { flex-direction: row; align-items: center; gap: 10px; justify-content: flex-start; min-width: 0; }
    .file-meta span + span::before { content: '·'; margin-right: 10px; color: var(--muted-2); }
    .file-actions { justify-content: flex-start; }
    .footer-inner { grid-template-columns: 1fr; }
    .viewer { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
    .viewer-actions .btn-ghost span { display: none; }
    .viewer-actions .btn-ghost { width: 36px; padding: 0; }
    .notfound-card { padding: 32px 20px; }
}

@media (hover: none) { .search kbd { display: none; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
