/* =============================================================
   @danigoico — Link in bio · Bento layout
   Paleta DaniGoico · Mobile-first · Vanilla CSS
   ============================================================= */

:root {
  --burdeos: #502231;
  --burdeos-dark: #2a1119;
  --rojo: #f84e4e;
  --azul: #7081f0;
  --coral: #ff9194;
  --rosa: #eededf;
  --crema: #f6e8e9;
  --white: #ffffff;
  --bg: #eededf;

  --radius-tile: 22px;
  --radius-pill: 999px;

  --max-width: 480px;
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--burdeos);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.4;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 12px 110px;
  position: relative;
}

/* Top decoration */
.page::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg,
    var(--rojo) 0%, var(--rojo) 33.33%,
    var(--coral) 33.33%, var(--coral) 66.66%,
    var(--azul) 66.66%, var(--azul) 100%);
  z-index: 100;
}

/* =============================================================
   HERO compacto
   ============================================================= */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px 12px 24px;
  margin-bottom: 14px;
  animation: fadeUp 0.6s ease-out both;
}

.hero__photo-wrap {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid var(--burdeos);
  background: var(--burdeos);
  flex-shrink: 0;
}

.hero__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.hero__text { min-width: 0; }

.hero__name {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 7vw, 34px);
  line-height: 1;
  color: var(--burdeos);
  letter-spacing: -0.02em;
}

.hero__tagline {
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
  color: var(--burdeos);
  opacity: 0.7;
  letter-spacing: 0.02em;
}

/* =============================================================
   BENTO GRID
   ============================================================= */
.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Divider de sección */
.bento__divider {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 4px 2px;
  animation: fadeUp 0.5s ease-out both;
}

.bento__divider-line {
  flex: 1;
  height: 1px;
  background: var(--burdeos);
  opacity: 0.25;
}

.bento__divider-label {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: 14px;
  color: var(--burdeos);
  opacity: 0.75;
  letter-spacing: 0.01em;
}

/* TILE base */
.tile {
  border-radius: var(--radius-tile);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1), box-shadow 0.22s ease;
  animation: fadeUp 0.5s ease-out both;
  cursor: pointer;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-3px);
  outline: none;
}

.tile:active { transform: translateY(0); }

.tile--wide { grid-column: span 2; min-height: 160px; }

.tile__head { display: flex; flex-direction: column; gap: 6px; }

.tile__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}

.tile__title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.005em;
}

.tile--wide .tile__title { font-size: 28px; }

.tile__sub {
  font-size: 11.5px;
  margin-top: 6px;
  opacity: 0.78;
  font-weight: 500;
  line-height: 1.35;
}

.tile__arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid currentColor;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  align-self: flex-start;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.tile:hover .tile__arrow {
  transform: rotate(-45deg);
}

/* Variantes de color */
.tile--burdeos {
  background: var(--burdeos);
  color: var(--white);
}
.tile--burdeos::after {
  content: "";
  position: absolute;
  bottom: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: var(--coral);
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.45;
  pointer-events: none;
}
.tile--burdeos .tile__head,
.tile--burdeos .tile__arrow { position: relative; z-index: 1; }
.tile--burdeos .tile__label { color: var(--coral); opacity: 1; }

.tile--rojo {
  background: var(--rojo);
  color: var(--white);
}
.tile--rojo::after {
  content: "";
  position: absolute;
  bottom: -30px;
  right: 20%;
  width: 160px;
  height: 160px;
  background: var(--azul);
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
}
.tile--rojo .tile__head,
.tile--rojo .tile__arrow { position: relative; z-index: 1; }

.tile--azul {
  background: var(--azul);
  color: var(--white);
}

.tile--coral {
  background: var(--coral);
  color: var(--burdeos-dark);
}
.tile--coral .tile__label { color: var(--burdeos); opacity: 0.7; }

.tile--crema {
  background: var(--crema);
  color: var(--burdeos);
  border: 1.5px solid var(--burdeos);
}

.tile--rosa {
  background: var(--rosa);
  color: var(--burdeos);
  border: 1.5px solid var(--burdeos);
}

.tile--white {
  background: var(--white);
  color: var(--burdeos);
  border: 1.5px solid var(--burdeos);
}

/* Variante con imagen de fondo */
.tile--image {
  color: var(--white);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--burdeos);
}
.tile--image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(80,34,49,0.85) 0%, rgba(42,17,25,0.55) 60%, rgba(80,34,49,0.4) 100%);
  pointer-events: none;
}
.tile--image .tile__head,
.tile--image .tile__arrow { position: relative; z-index: 1; }
.tile--image .tile__label { opacity: 0.95; color: var(--coral); }

/* Stagger animation */
.tile, .bento__divider {
  animation-delay: calc(var(--i, 0) * 50ms);
}

/* =============================================================
   FOOTER
   ============================================================= */
.footer {
  margin-top: 36px;
  padding: 24px 12px;
  text-align: center;
  animation: fadeUp 0.7s ease-out 0.5s both;
}

.social {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.social__link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--burdeos);
  color: var(--burdeos);
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: all 0.2s;
}

.social__link:hover,
.social__link:focus-visible {
  background: var(--burdeos);
  color: var(--white);
  transform: translateY(-2px);
  outline: none;
}

.social__link svg { width: 20px; height: 20px; }

.footer__credit {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  opacity: 0.55;
}

/* =============================================================
   BAGHEERA — burbuja flotante (bottom-left)
   ============================================================= */
.bagheera-bubble {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--burdeos);
  border: 3px solid var(--burdeos);
  cursor: pointer;
  z-index: 900;
  overflow: visible;
  padding: 0;
  box-shadow: 0 6px 20px rgba(42, 17, 25, 0.35), 0 2px 0 var(--burdeos-dark);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.6s ease-out 0.4s both;
}

.bagheera-bubble:hover,
.bagheera-bubble:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(42, 17, 25, 0.4), 0 3px 0 var(--burdeos-dark);
  outline: none;
}

.bagheera-bubble:active { transform: scale(0.98); }

.bagheera-bubble__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.bagheera-bubble__dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4ade80;
  border: 2.5px solid var(--burdeos);
  z-index: 2;
}

.bagheera-bubble__pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--coral);
  animation: pulse 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* =============================================================
   CHAT PANEL — más compacto, flotando
   ============================================================= */
.chat {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.chat[aria-hidden="false"] { display: block; pointer-events: auto; }

.chat__overlay {
  position: absolute;
  inset: 0;
  background: rgba(42, 17, 25, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease-out;
}

.chat__panel {
  position: absolute;
  bottom: 92px;
  left: 18px;
  width: calc(100vw - 36px);
  max-width: 380px;
  height: 540px;
  max-height: calc(100dvh - 110px);
  background: var(--bg);
  border-radius: 20px;
  border: 2px solid var(--burdeos);
  box-shadow: 0 12px 40px rgba(42, 17, 25, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUpBubble 0.28s cubic-bezier(.34,1.4,.64,1);
  transform-origin: bottom left;
}

@media (max-width: 420px) {
  .chat__panel {
    bottom: 88px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

.chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--burdeos);
  color: var(--white);
}

.chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--white);
  flex: 0 0 auto;
}

.chat__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.chat__title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat__name { font-weight: 600; font-size: 14px; }
.chat__status {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat__status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
}

.chat__close {
  background: transparent;
  border: none;
  color: var(--white);
  padding: 4px;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.chat__close:hover { background: rgba(255,255,255,0.18); }

.chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  scroll-behavior: smooth;
}

.msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeUp 0.25s ease-out both;
}

.msg--bot {
  background: var(--white);
  border: 1.5px solid var(--burdeos);
  color: var(--burdeos);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg--user {
  background: var(--burdeos);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.msg--typing {
  display: flex; gap: 4px;
  padding: 12px 14px;
}

.msg--typing span {
  width: 6px; height: 6px;
  background: var(--burdeos);
  border-radius: 50%;
  animation: blink 1.2s infinite;
  opacity: 0.4;
}

.msg--typing span:nth-child(2) { animation-delay: 0.2s; }
.msg--typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border-top: 1.5px solid var(--burdeos);
}

.chat__input {
  flex: 1;
  border: 1.5px solid var(--burdeos);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--burdeos);
  background: var(--white);
  outline: none;
  transition: box-shadow 0.2s;
  min-width: 0;
}

.chat__input::placeholder { color: var(--burdeos); opacity: 0.5; }

.chat__input:focus {
  box-shadow: 0 0 0 3px rgba(112, 129, 240, 0.3);
}

.chat__send {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--burdeos);
  background: var(--burdeos);
  color: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s;
}

.chat__send:hover { transform: translateY(-1px); }
.chat__send:active { transform: translateY(1px); }
.chat__send:disabled { opacity: 0.5; cursor: not-allowed; }

/* =============================================================
   ANIMACIONES
   ============================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUpBubble {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

/* =============================================================
   ACCESIBILIDAD
   ============================================================= */
.tile:focus-visible,
.bagheera-bubble:focus-visible,
.social__link:focus-visible {
  outline: 3px solid var(--azul);
  outline-offset: 3px;
}

@media (min-width: 600px) {
  .page { padding-top: 32px; }
}
