+page.svelte 13.9 KB
<script>
  import { onMount } from 'svelte';

  let mounted = $state(false);
  let hWidget = $state(null);

  onMount(() => { mounted = true; });

  const WIDGETS_INGRESOS = [
    { id: 'rubros', label: 'tipos de ingreso', d: 'Impuestos, regalías, ventas, créditos', t: 'Recursos por rubros', n: '324', href: '/clasificadores/rubros' },
    { id: 'organismos', label: 'organismos financiadores', d: 'BID, Banco Mundial, cooperación', t: 'Organismos', n: '228', href: '/clasificadores/organismos' },
  ];

  const WIDGETS_GASTOS_QUE = [
    { id: 'objeto', label: 'objetos de gasto', d: 'Sueldos, consultorías, materiales', t: 'Objeto del gasto', n: '324', href: '/clasificadores/objeto-gasto' },
    { id: 'sector', label: 'sectores económicos', d: 'Industria, construcción, servicios', t: 'Sectores', n: '488', href: '/clasificadores/sectores' },
  ];
</script>

<svelte:head>
  <title>Clasificadores | Presupuesto Público</title>
</svelte:head>

<div class="page" class:mounted>
  <div class="clas-container">
    <!-- Header -->
    <div class="clas-header-section">
      <div class="clas-header-row">
        <div>
          <p class="section-tag">CLASIFICADORES</p>
          <h2 class="section-title">Elige cómo explorar el presupuesto</h2>
          <p class="clas-subtitle">Navega por cada una de las 2,626 piezas de los 8 clasificadores.</p>
        </div>
      </div>
    </div>

    <!-- ¿Quién? -->
    <div class="clas-group-card">
      <div class="clas-group-header">
        <div class="clas-group-icon" style="--c: var(--theme-titulo)">
          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
        </div>
        <div>
          <div class="clas-group-label">¿QUIÉN?</div>
          <div class="clas-group-sub">La entidad que gasta o recibe</div>
        </div>
      </div>
      <a href="/clasificadores/institucional" class="widget-card widget-h" class:widget-hover={hWidget === 'quien'} onmouseenter={() => hWidget = 'quien'} onmouseleave={() => hWidget = null}>
        <div class="widget-left">
          <div class="widget-headline">
            <span class="widget-num-big">756</span>
            <span class="widget-label">instituciones públicas</span>
          </div>
          <div class="widget-desc">Ministerios, gobernaciones, municipios, empresas públicas, universidades</div>
        </div>
        <div class="widget-right">
          <span class="widget-tech">INSTITUCIONAL</span>
          <span class="widget-arrow" class:arrow-show={hWidget === 'quien'}>→</span>
        </div>
      </a>
    </div>

    <!-- Grid: Ingresos + Gastos -->
    <div class="clas-main-grid">
      <!-- INGRESOS -->
      <div class="clas-col">
        <div class="clas-group-card">
          <div class="clas-group-header">
            <div class="clas-group-icon" style="--c:#C9A751">
              <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
            </div>
            <div>
              <div class="clas-group-label" style="color:#C9A751">INGRESOS</div>
            </div>
          </div>
          <div class="widgets-col">
            {#each WIDGETS_INGRESOS as w}
              <a href={w.href} class="widget-card widget-grow" class:widget-hover={hWidget === w.id} onmouseenter={() => hWidget = w.id} onmouseleave={() => hWidget = null}>
                <div class="widget-headline">
                  <span class="widget-num-big widget-num-gold">{w.n}</span>
                  <span class="widget-label">{w.label}</span>
                </div>
                <p class="widget-desc">{w.d}</p>
                <div class="widget-footer">
                  <span class="widget-tech">{w.t}</span>
                  <span class="widget-arrow" class:arrow-show={hWidget === w.id}>→</span>
                </div>
              </a>
            {/each}
          </div>
        </div>
      </div>

      <!-- GASTOS -->
      <div class="clas-col">
        <div class="clas-group-card">
          <div class="clas-group-header">
            <div class="clas-group-icon" style="--c:#4A8B6E">
              <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
            </div>
            <div>
              <div class="clas-group-label" style="color:#4A8B6E">GASTOS</div>
            </div>
          </div>

          <div class="gastos-content">
            <!-- ¿En qué? -->
            <div class="clas-subgroup">
              <div class="clas-subgroup-header">
                <div class="clas-subgroup-icon" style="--c:#4A8B6E">
                  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>
                </div>
                <div>
                  <div class="clas-subgroup-label">¿EN QUÉ?</div>
                </div>
              </div>
              <div class="widgets-row">
                {#each WIDGETS_GASTOS_QUE as w}
                  <a href={w.href} class="widget-card widget-sm" class:widget-hover={hWidget === w.id} onmouseenter={() => hWidget = w.id} onmouseleave={() => hWidget = null}>
                    <div class="widget-headline">
                      <span class="widget-num-big widget-num-green">{w.n}</span>
                      <span class="widget-label">{w.label}</span>
                    </div>
                    <p class="widget-desc widget-desc-sm">{w.d}</p>
                    <div class="widget-footer">
                      <span class="widget-tech">{w.t}</span>
                      <span class="widget-arrow" class:arrow-show={hWidget === w.id}>→</span>
                    </div>
                  </a>
                {/each}
              </div>
            </div>

            <!-- Para qué + Dónde -->
            <div class="widgets-row">
              <div class="clas-subgroup">
                <div class="clas-subgroup-header">
                  <div class="clas-subgroup-icon" style="--c:#4A8B6E">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/></svg>
                  </div>
                  <div>
                    <div class="clas-subgroup-label">¿PARA QUÉ?</div>
                  </div>
                </div>
                <a href="/clasificadores/funcional" class="widget-card widget-full" class:widget-hover={hWidget === 'finalidad'} onmouseenter={() => hWidget = 'finalidad'} onmouseleave={() => hWidget = null}>
                  <div class="widget-headline">
                    <span class="widget-num-big widget-num-green">132</span>
                    <span class="widget-label">finalidades y funciones</span>
                  </div>
                  <p class="widget-desc">Educación, salud, defensa</p>
                  <div class="widget-footer">
                    <span class="widget-tech">Finalidad</span>
                    <span class="widget-arrow" class:arrow-show={hWidget === 'finalidad'}>→</span>
                  </div>
                </a>
              </div>

              <div class="clas-subgroup">
                <div class="clas-subgroup-header">
                  <div class="clas-subgroup-icon" style="--c:#4A8B6E">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z"/><circle cx="12" cy="9" r="2.5"/></svg>
                  </div>
                  <div>
                    <div class="clas-subgroup-label">¿DÓNDE?</div>
                  </div>
                </div>
                <a href="/ubicacion" class="widget-card widget-full" class:widget-hover={hWidget === 'donde'} onmouseenter={() => hWidget = 'donde'} onmouseleave={() => hWidget = null}>
                  <div class="widget-headline">
                    <span class="widget-num-big widget-num-green">352</span>
                    <span class="widget-label">ubicaciones geográficas</span>
                  </div>
                  <p class="widget-desc">Departamentos, municipios</p>
                  <div class="widget-footer">
                    <span class="widget-tech">Geográfico</span>
                    <span class="widget-arrow" class:arrow-show={hWidget === 'donde'}>→</span>
                  </div>
                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<style>
  .page {
    min-height: 100vh;
    background: var(--theme-body);
    color: var(--theme-titulo);
    font-family: var(--font-sans), -apple-system, sans-serif;
    opacity: 0;
    transition: opacity 0.4s;
  }
  .page.mounted { opacity: 1; }
  :global(html:not(.dark)) .page { background: #f5f5f7; }

  .clas-container { max-width: 1100px; margin: 0 auto; padding: 80px 2rem 2rem; }

  .clas-header-section { margin-bottom: 1.5rem; }
  .clas-header-row { display: flex; justify-content: space-between; align-items: flex-end; }

  .section-tag { font-family: 'DM Mono', monospace; font-size: 0.6875rem; letter-spacing: 0.15em; color: var(--theme-texto); opacity: 0.5; margin: 0 0 0.25rem; }
  .section-title { font-family: 'DM Serif Display', serif; font-size: 2rem; font-weight: 400; margin: 0 0 0.25rem; line-height: 1.15; }
  .clas-subtitle { font-size: 0.875rem; color: var(--theme-texto); opacity: 0.6; margin: 0; }

  .clas-group-card { background: var(--theme-surface); border: 1px solid var(--theme-borde); border-radius: 20px; padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; transition: all 0.3s; }
  .clas-group-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .clas-group-icon { width: 36px; height: 36px; border-radius: 12px; background: color-mix(in srgb, var(--c) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c) 15%, transparent); display: flex; align-items: center; justify-content: center; color: var(--c); flex-shrink: 0; }
  .clas-group-label { font-family: 'DM Mono', monospace; font-size: 0.75rem; letter-spacing: 0.15em; font-weight: 600; color: var(--theme-titulo); transition: transform 0.3s; }
  .clas-group-sub { font-size: 0.8125rem; color: var(--theme-texto); opacity: 0.6; }

  .clas-main-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; align-items: stretch; }
  .clas-col .clas-group-card { flex: 1; height: 100%; }

  .gastos-content { display: flex; flex-direction: column; gap: 10px; flex: 1; }
  .gastos-content .clas-subgroup { flex: 1; margin-bottom: 0; }

  .clas-subgroup { background: rgba(128, 128, 128, 0.05); border: 1px solid var(--theme-borde); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; transition: all 0.3s; }
  .clas-subgroup .widgets-row { flex: 1; }
  .clas-subgroup-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .clas-subgroup-icon { width: 32px; height: 32px; border-radius: 10px; background: color-mix(in srgb, var(--c) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c) 15%, transparent); display: flex; align-items: center; justify-content: center; color: var(--c); flex-shrink: 0; }
  .clas-subgroup-label { font-family: 'DM Mono', monospace; font-size: 0.75rem; letter-spacing: 0.15em; font-weight: 600; color: var(--theme-titulo); }

  .widget-card { display: block; background: var(--theme-surface); border: 1px solid var(--theme-borde); border-radius: 14px; padding: 14px; cursor: pointer; text-decoration: none; color: var(--theme-titulo); transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
  .widget-card:hover { border-color: var(--theme-accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }

  .widget-h { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .widget-left { flex: 1; }
  .widget-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }

  .widgets-col { display: flex; flex-direction: column; gap: 8px; flex: 1; }
  .widgets-col .widget-card { flex: 1; }
  .widgets-row { display: flex; gap: 8px; }
  .widgets-row .widget-card { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }

  .widget-headline { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
  .widget-num-big { font-family: 'DM Mono', monospace; font-size: 1.5rem; font-weight: 600; color: var(--theme-titulo); line-height: 1; }
  .widget-num-gold { color: #C9A751; }
  .widget-num-green { color: #4A8B6E; }
  .widget-label { font-size: 0.8125rem; color: var(--theme-texto); }
  .widget-desc { font-size: 0.75rem; color: var(--theme-texto); opacity: 0.6; margin: 0; line-height: 1.4; }
  .widget-desc-sm { font-size: 0.6875rem; }
  .widget-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
  .widget-tech { font-family: 'DM Mono', monospace; font-size: 0.5625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--theme-texto); opacity: 0.4; }
  .widget-arrow { font-size: 1.25rem; color: var(--theme-accent); opacity: 0; transition: all 0.3s; }
  .arrow-show { opacity: 1; transform: translateX(3px); }

  @media (max-width: 768px) {
    .clas-container { padding: 70px 1rem 1rem; }
    .section-title { font-size: 1.5rem; }
    .clas-main-grid { grid-template-columns: 1fr; }
    .widgets-row { flex-direction: column; }
    .widget-h { flex-direction: column; align-items: flex-start; }
  }
</style>