/* Fuentes locales Plus Jakarta Sans */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/PlusJakartaSans-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/PlusJakartaSans-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/PlusJakartaSans-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/PlusJakartaSans-700.woff2') format('woff2');
}

:root {
  /* Paleta de colores */
  --negro-800: #1a1a1a;
  --negro-700: #262626;
  --negro-600: #333333;
  --blanco-50: #ffffff;
  --blanco-100: #f0f0f0;
  --aqua-500: #00e5ff;

  /* Tipografías */
  --font-family-base: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-code: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* ==========================================================================
     DESIGN TOKENS - PC / DESKTOP (Default)
     ========================================================================== */
  --type-h1-size: 48px;
  --type-h1-weight: 700;
  --type-h1-spacing: -0.5px;
  --type-h1-line-height: 117%;

  --type-h2-size: 36px;
  --type-h2-weight: 700;
  --type-h2-spacing: -0.25px;
  --type-h2-line-height: 122%;

  --type-h3-size: 28px;
  --type-h3-weight: 600;
  --type-h3-spacing: 0px;
  --type-h3-line-height: 129%;

  --type-h4-size: 22px;
  --type-h4-weight: 600;
  --type-h4-spacing: 0px;
  --type-h4-line-height: 127%;

  --type-p-large-size: 18px;
  --type-p-large-weight: 400;
  --type-p-large-spacing: 0.15px;
  --type-p-large-line-height: 156%;

  --type-p-size: 16px;
  --type-p-weight: 400;
  --type-p-spacing: 0.25px;
  --type-p-line-height: 150%;

  --type-p-small-size: 14px;
  --type-p-small-weight: 400;
  --type-p-small-spacing: 0.3px;
  --type-p-small-line-height: 143%;

  --type-caption-size: 12px;
  --type-caption-weight: 400;
  --type-caption-spacing: 0.4px;
  --type-caption-line-height: 133%;

  --type-button-size: 14px;
  --type-button-weight: 600;
  --type-button-spacing: 0.5px;
  --type-button-line-height: 140%;

  --type-code-inline-size: 14px;
  --type-code-inline-weight: 400;
  --type-code-inline-spacing: 0px;
  --type-code-inline-line-height: 143%;

  --type-code-block-size: 14px;
  --type-code-block-weight: 400;
  --type-code-block-spacing: 0px;
  --type-code-block-line-height: 160%;
}

/* Tablet Tokens (600px - 959px) */
@media (max-width: 959px) {
  :root {
    --type-h1-size: 40px;
    --type-h1-line-height: 120%;

    --type-h2-size: 32px;
    --type-h2-line-height: 125%;

    --type-h3-size: 24px;
    --type-h3-line-height: 133%;

    --type-h4-size: 20px;
    --type-h4-line-height: 130%;

    --type-p-large-size: 18px;
    --type-p-large-line-height: 156%;

    --type-p-size: 16px;
    --type-p-line-height: 150%;

    --type-p-small-size: 14px;
    --type-p-small-line-height: 143%;

    --type-caption-size: 12px;
    --type-caption-line-height: 133%;

    --type-button-size: 14px;
    --type-button-line-height: 140%;

    --type-code-inline-line-height: 143%;
    --type-code-block-line-height: 160%;
  }
}

/* Mobile Tokens (< 600px) */
@media (max-width: 599px) {
  :root {
    --type-h1-size: 32px;
    --type-h1-line-height: 125%;

    --type-h2-size: 28px;
    --type-h2-line-height: 129%;

    --type-h3-size: 22px;
    --type-h3-line-height: 127%;

    --type-h4-size: 18px;
    --type-h4-line-height: 133%;

    --type-p-large-size: 16px;
    --type-p-large-line-height: 150%;

    --type-p-size: 16px;
    --type-p-line-height: 150%;

    --type-p-small-size: 14px;
    --type-p-small-line-height: 143%;

    --type-caption-size: 12px;
    --type-caption-line-height: 133%;

    --type-button-size: 14px;
    --type-button-line-height: 140%;

    --type-code-inline-line-height: 138%;
    --type-code-block-line-height: 154%;
  }
}

/* Typography Utility Classes */
.type-h1 {
  font-family: var(--font-family-base);
  font-size: var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  letter-spacing: var(--type-h1-spacing);
  line-height: var(--type-h1-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-h2 {
  font-family: var(--font-family-base);
  font-size: var(--type-h2-size);
  font-weight: var(--type-h2-weight);
  letter-spacing: var(--type-h2-spacing);
  line-height: var(--type-h2-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-h3 {
  font-family: var(--font-family-base);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
  letter-spacing: var(--type-h3-spacing);
  line-height: var(--type-h3-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-h4 {
  font-family: var(--font-family-base);
  font-size: var(--type-h4-size);
  font-weight: var(--type-h4-weight);
  letter-spacing: var(--type-h4-spacing);
  line-height: var(--type-h4-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-p-large {
  font-family: var(--font-family-base);
  font-size: var(--type-p-large-size);
  font-weight: var(--type-p-large-weight);
  letter-spacing: var(--type-p-large-spacing);
  line-height: var(--type-p-large-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-p {
  font-family: var(--font-family-base);
  font-size: var(--type-p-size);
  font-weight: var(--type-p-weight);
  letter-spacing: var(--type-p-spacing);
  line-height: var(--type-p-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-p-small {
  font-family: var(--font-family-base);
  font-size: var(--type-p-small-size);
  font-weight: var(--type-p-small-weight);
  letter-spacing: var(--type-p-small-spacing);
  line-height: var(--type-p-small-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-caption {
  font-family: var(--font-family-base);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  letter-spacing: var(--type-caption-spacing);
  line-height: var(--type-caption-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-button {
  font-family: var(--font-family-base);
  font-size: var(--type-button-size);
  font-weight: var(--type-button-weight);
  letter-spacing: var(--type-button-spacing);
  line-height: var(--type-button-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-code-inline {
  font-family: var(--font-family-code);
  font-size: var(--type-code-inline-size);
  font-weight: var(--type-code-inline-weight);
  letter-spacing: var(--type-code-inline-spacing);
  line-height: var(--type-code-inline-line-height);
  text-transform: none;
  text-decoration: none;
}

.type-code-block {
  font-family: var(--font-family-code);
  font-size: var(--type-code-block-size);
  font-weight: var(--type-code-block-weight);
  letter-spacing: var(--type-code-block-spacing);
  line-height: var(--type-code-block-line-height);
  text-transform: none;
  text-decoration: none;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #37B6C5;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Contenedor de la página principal */
.page-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--blanco-50);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
  will-change: opacity, visibility;
}

.page-container.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Header superior */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 40px;
  margin-bottom: 16px;
  padding: 0;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--negro-800);
  border: none;
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.header-btn:hover {
  background: var(--negro-700);
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.header-btn:active {
  transform: scale(0.95);
}

.status-phrase {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--negro-800);
  letter-spacing: -0.2px;
  text-align: center;
  user-select: none;
}

.phrase-desktop {
  display: inline;
}

.phrase-mobile {
  display: none;
}

/* Contenedor central (Bento / Linktree) con bordes de 24px */
.bento-container {
  flex: 1;
  width: 100%;
  background: var(--negro-800);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background-color 0.5s ease;
}

/* Área de scroll interna */
.content-scroll {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.content-scroll::-webkit-scrollbar {
  width: 6px;
}

.content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.content-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.content-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Bento Grid: En PC horizontal / multi-columna, en móvil Linktree centrado */
.bento-grid {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  min-height: min-content;
}

/* Card base */
.bento-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}

/* Tarjeta oculta en Modo Mar */
.bento-card.card-hidden {
  opacity: 0 !important;
  transform: scale(0.92) !important;
  pointer-events: none !important;
}

/* ==========================================================================
   MODO MAR (Sea Mode)
   ========================================================================== */
.page-container.sea-mode {
  background: transparent;
}

.page-container.sea-mode .bento-container {
  background: transparent;
}

.page-container.sea-mode .bento-card {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(26, 26, 26, 0.14);
  box-shadow: 0 12px 36px rgba(12, 60, 70, 0.18);
  cursor: pointer;
}

.page-container.sea-mode .profile-name {
  color: var(--negro-800);
}

.page-container.sea-mode .profile-bio {
  color: rgba(26, 26, 26, 0.72);
}

.page-container.sea-mode .category-title {
  color: var(--negro-800);
}

.page-container.sea-mode .category-subtitle {
  color: rgba(26, 26, 26, 0.72);
}

.page-container.sea-mode .details-text {
  color: rgba(26, 26, 26, 0.68);
}

.page-container.sea-mode .link-item {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(26, 26, 26, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.page-container.sea-mode .link-item:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--negro-800);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.page-container.sea-mode .link-title {
  color: var(--negro-800);
}

.page-container.sea-mode .link-url {
  color: rgba(26, 26, 26, 0.55);
}

.page-container.sea-mode .link-icon {
  background: rgba(0, 0, 0, 0.06);
}

.page-container.sea-mode .link-item:not([title="Figma"]) .link-icon img {
  filter: invert(1) brightness(0.1);
}

.page-container.sea-mode .link-arrow {
  color: rgba(26, 26, 26, 0.4);
}

.page-container.sea-mode .link-item:hover .link-arrow {
  color: var(--negro-800);
}

/* Categoría 1 y tarjetas genéricas Bento */
.presentation-card,
.category-card {
  width: 440px;
  max-width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.category-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.category-title {
  font-family: var(--font-family-base);
  font-size: var(--type-h4-size);
  font-weight: var(--type-h4-weight);
  letter-spacing: var(--type-h4-spacing);
  line-height: var(--type-h4-line-height);
  color: var(--blanco-50);
}

.category-subtitle {
  font-family: var(--font-family-base);
  font-size: var(--type-p-small-size);
  font-weight: var(--type-p-small-weight);
  letter-spacing: var(--type-p-small-spacing);
  line-height: var(--type-p-small-line-height);
  color: rgba(255, 255, 255, 0.65);
}

/* Cabecera de perfil / presentación */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 4px;
}

.avatar-wrapper {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--negro-700);
  display: block;
}

.profile-name {
  font-family: var(--font-family-base);
  font-size: var(--type-h4-size);
  font-weight: var(--type-h4-weight);
  letter-spacing: var(--type-h4-spacing);
  line-height: var(--type-h4-line-height);
  color: var(--blanco-50);
}

.profile-bio {
  font-family: var(--font-family-base);
  font-size: var(--type-p-small-size);
  font-weight: var(--type-p-small-weight);
  letter-spacing: var(--type-p-small-spacing);
  line-height: var(--type-p-small-line-height);
  color: rgba(255, 255, 255, 0.65);
}

/* Lista vertical de enlaces (Modo lista 1-columna Linktree) */
.links-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.link-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.link-item:active {
  transform: scale(0.97);
}

.link-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-icon img {
  width: 18px;
  height: 18px;
  display: block;
}

.link-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.link-title {
  font-family: var(--font-family-base);
  font-size: var(--type-button-size);
  font-weight: var(--type-button-weight);
  letter-spacing: var(--type-button-spacing);
  line-height: var(--type-button-line-height);
  color: var(--blanco-50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-url {
  font-family: var(--font-family-base);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  letter-spacing: var(--type-caption-spacing);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.45);
  word-break: break-word;
}

.link-arrow {
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.link-item:hover .link-arrow {
  transform: translate(2px, -2px);
  color: var(--aqua-500);
}

/* Texto de Detalles */
.details-text {
  width: 100%;
  font-family: var(--font-family-base);
  font-size: var(--type-p-small-size);
  font-weight: var(--type-p-small-weight);
  letter-spacing: var(--type-p-small-spacing);
  line-height: var(--type-p-small-line-height);
  color: rgba(255, 255, 255, 0.58);
  box-sizing: border-box;
  text-align: left;
  padding: 2px 0;
}

/* ==========================================================================
   DESKTOP / PC (min-width: 960px) - Alto completo 100% y distribución horizontal
   ========================================================================== */
@media (min-width: 960px) {
  .content-scroll {
    height: 100%;
    padding: 24px;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
  }

  .bento-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
    width: 100%;
    height: 100%;
    min-height: 100%;
  }

  .presentation-card,
  .category-card {
    width: 440px;
    height: 100%;
    min-height: 100%;
    padding: 28px 24px 20px 24px;
    gap: 16px;
  }
}

/* ==========================================================================
   TABLETS Y MÓVILES (< 960px) - Altura auto con scroll fluido y padding simétrico
   ========================================================================== */
@media (max-width: 959px) {
  .content-scroll {
    padding: 16px;
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .content-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .bento-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: min-content;
    gap: 16px;
    padding: 0;
  }

  .presentation-card,
  .category-card {
    width: 100%;
    max-width: 480px;
    height: auto;
    min-height: min-content;
    padding: 20px;
    border-radius: 18px;
    gap: 16px;
    box-sizing: border-box;
  }
}

/* Responsive para pantallas móviles (< 600px) */
@media (max-width: 599px) {
  .page-container {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .app-header {
    height: 40px;
    margin-bottom: 16px;
  }

  .status-phrase {
    font-size: 14px;
  }

  .phrase-desktop {
    display: none;
  }

  .phrase-mobile {
    display: inline;
  }

  .links-grid {
    gap: 10px;
  }

  .link-item {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .presentation-card,
  .category-card {
    padding: 18px;
    gap: 14px;
  }
}

#glCanvas {
  display: block;
  width: 100vw;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* Contenedor y estilos de nenúfares de esquina */
.lily-pads-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.lily-pad {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: contain;
  max-width: 32vw;
  max-height: 32vh;
  filter: drop-shadow(0 5px 14px rgba(12, 60, 70, 0.22));
  will-change: transform;
}
