/* ==========================================================================
   iAgosto Profile — visual system
   Drenched hero, asymmetric cards, pill CTAs. Pure CSS motion.
   ========================================================================== */

@property --ring-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --hero-deep: #16264C;
  --hero-navy: #1D3466;
  --hero-aubergine: #402B62;
  --hero-forest: #003F2C;
}

html {
  scroll-behavior: smooth;
}

/* ---------- Hero: saturated drench + aurora blobs ---------- */

.hero-profile {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 48px 28px;
  background: linear-gradient(
    125deg,
    var(--hero-deep) 0%,
    var(--hero-navy) 34%,
    var(--hero-aubergine) 72%,
    var(--hero-forest) 100%
  );
  color: #FFFFFF;
}

@media screen and (min-width: 600px) {
  .hero-profile {
    padding: 72px 56px;
  }
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  pointer-events: none;
}

.blob-1 {
  width: 340px;
  height: 340px;
  background: #566CA1;
  top: -130px;
  right: -90px;
}

.blob-2 {
  width: 280px;
  height: 280px;
  background: #307A5E;
  bottom: -150px;
  left: -70px;
}

.blob-3 {
  width: 220px;
  height: 220px;
  background: #78629D;
  bottom: -90px;
  right: 20%;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-profile h1 {
  margin: 0 0 14px;
  max-width: 16ch;
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: #FFFFFF;
}

.hero-profile p {
  margin: 0 0 28px;
  max-width: 58ch;
  font-size: 1.05rem;
  line-height: 1.55;
  text-wrap: pretty;
  color: rgba(255, 255, 255, 0.88);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-ctas a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 26px;
  border-radius: 23px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.18s var(--ease-out-quart), background-color 0.18s var(--ease-out-quart), box-shadow 0.18s var(--ease-out-quart);
}

.hero-ctas a .material-symbols-outlined {
  font-size: 1.15rem;
}

.btn-hero-primary {
  background: #FFFFFF;
  color: var(--hero-navy);
}

.btn-hero-ghost {
  background: transparent;
  color: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.btn-hero-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
}

.btn-hero-primary:focus-visible,
.btn-hero-ghost:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* ---------- Sections ---------- */

.home-section {
  margin-top: 2.25rem;
  scroll-margin-top: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 1.5rem;
  font-weight: 500;
  text-wrap: balance;
}

.section-title .material-symbols-outlined {
  font-size: 1.6rem;
  color: var(--primary);
}

/* ---------- Ahora: asymmetric card pair ---------- */

.now-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media screen and (min-width: 900px) {
  .now-grid {
    grid-template-columns: 1.6fr 1fr;
  }
}

.now-role,
.now-years {
  border-radius: 12px;
  padding: 22px 20px;
}

.now-role {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.now-years {
  background: var(--surface-container-high);
  color: var(--on-surface);
}

.now-role h3,
.now-years h3 {
  margin: 14px 0 4px;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.2;
}

.now-role p,
.now-years p {
  margin: 0;
  font-size: 0.95rem;
}

.now-years h3 {
  color: var(--primary);
}

.now-years p {
  color: var(--on-surface-variant);
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.icon-tile .material-symbols-outlined {
  font-size: 1.5rem;
}

.now-role .icon-tile {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  .now-role .icon-tile {
    background: rgba(0, 0, 0, 0.15);
    color: var(--on-primary-container);
  }
}

.now-years .icon-tile {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

/* ---------- Stack: chip groups ---------- */

.chip-group-label {
  margin: 14px 0 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--on-surface-variant);
}

.home-section .chip {
  cursor: default;
}

/* ---------- Proyectos: featured + grid cards ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media screen and (min-width: 900px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }

  .project-featured {
    grid-column: 1 / -1;
  }
}

.project-card {
  display: block;
  border-radius: 12px;
  padding: 20px;
  background: var(--surface-container-high);
  color: var(--on-surface);
  text-decoration: none;
  transition: transform 0.18s var(--ease-out-quart), box-shadow 0.18s var(--ease-out-quart);
}

.project-featured {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tertiary-container) 30%, var(--surface-container-high)) 0%,
    var(--surface-container-high) 65%
  );
}

a.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--elevation-2);
}

.project-card:focus-visible,
.apartado-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.project-icon {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.project-card h3 {
  margin: 14px 0 4px;
  font-size: 1.25rem;
  font-weight: 500;
}

.project-card p {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
}

.project-link .material-symbols-outlined {
  font-size: 1.1rem;
  transition: transform 0.18s var(--ease-out-quart);
}

a.project-card:hover .project-link .material-symbols-outlined {
  transform: translate(2px, -2px);
}

/* ---------- Secciones: pill CTAs ---------- */

.apartados-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media screen and (min-width: 700px) {
  .apartados-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.apartado-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  border-radius: 28px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.18s var(--ease-out-quart), box-shadow 0.18s var(--ease-out-quart);
}

.apartado-btn.apartado-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.apartado-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-1);
}

/* ---------- Profile card (sidebar) ---------- */

/* Gradient border: brand conic ramp on border-box, card surface on padding-box.
   The angle animates via --ring-angle (registered @property); without support
   the var() fallback keeps a static border. */
.card.profile-card {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface-container-low), var(--surface-container-low)) padding-box,
    conic-gradient(
      from var(--ring-angle, 0deg),
      #566CA1,
      #307A5E,
      #78629D,
      #566CA1
    ) border-box;
}

@media screen and (min-width: 1000px) {
  .profile-card {
    position: sticky;
    top: 16px;
  }
}

.profile-avatar {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}

.avatar-ring {
  display: inline-flex;
  padding: 5px;
  border-radius: 50%;
  background: conic-gradient(
    from var(--ring-angle, 0deg),
    #566CA1,
    #307A5E,
    #78629D,
    #566CA1
  );
}

.avatar-ring img {
  display: block;
  width: 140px;
  height: 140px;
  border: 3px solid var(--surface-container-low);
  border-radius: 50%;
  object-fit: cover;
  box-sizing: border-box;
}

.profile-card h2 {
  margin-bottom: 0.25rem;
}

.profile-card .profile-role {
  margin-top: 0;
}

/* Social rows: vertical, logo left, handle right */
.profile-socials {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 1rem 0;
  text-align: left;
}

.social-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  color: var(--on-surface);
  text-decoration: none;
  transition: background-color 0.15s var(--ease-out-quart);
}

.social-row:hover {
  background: color-mix(in srgb, var(--on-surface) 8%, transparent);
}

.social-row:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.social-logo {
  display: inline-flex;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--on-surface-variant);
  transition: color 0.15s var(--ease-out-quart);
}

.social-row:hover .social-logo {
  color: var(--secondary);
}

.social-handle {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Contacto ---------- */

.hero-compact {
  padding: 40px 28px;
}

@media screen and (min-width: 600px) {
  .hero-compact {
    padding: 48px 56px;
  }
}

.hero-compact h1 {
  max-width: none;
  font-size: clamp(2rem, 4.5vw, 3rem);
}

.contact-lead {
  margin: 0 0 16px;
  max-width: 65ch;
  font-size: 1.05rem;
  line-height: 1.5;
  text-wrap: pretty;
  color: var(--on-surface-variant);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 12px;
  padding: 22px 20px;
  background: var(--surface-container-high);
  color: var(--on-surface);
}

.contact-info {
  flex: 1 1 auto;
  min-width: 0;
}

.contact-featured {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tertiary-container) 30%, var(--surface-container-high)) 0%,
    var(--surface-container-high) 65%
  );
}

.contact-card .icon-tile {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.contact-featured .icon-tile {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.contact-card h3 {
  margin: 14px 0 4px;
  font-size: 1.25rem;
  font-weight: 500;
}

.contact-card p {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

.contact-handle {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 12px;
  font-size: 0.95rem;
}

.contact-card .actions a {
  text-decoration: none;
}

.qr-plate {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 12px;
  background: #FFFFFF;
}

.qr-plate img {
  display: block;
  width: 140px;
  height: 140px;
}

@media screen and (max-width: 480px) {
  .contact-card {
    flex-direction: column;
    align-items: stretch;
  }

  .qr-plate {
    align-self: center;
  }
}

/* ---------- Portafolio ---------- */

.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media screen and (min-width: 900px) {
  .portfolio-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.portfolio-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-container-high);
  color: var(--on-surface);
  text-decoration: none;
  transition: transform 0.18s var(--ease-out-quart), box-shadow 0.18s var(--ease-out-quart);
}

a.portfolio-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--elevation-2);
}

a.portfolio-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.portfolio-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tertiary-container) 45%, var(--surface-container-high)) 0%,
    color-mix(in srgb, var(--secondary-container) 35%, var(--surface-container-high)) 100%
  );
}

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

.portfolio-media-icon {
  font-size: 4rem;
  color: var(--primary);
  opacity: 0.9;
}

.portfolio-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.portfolio-badge-oss {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.portfolio-badge-cliente {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.portfolio-body {
  padding: 16px;
}

.portfolio-body h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 500;
}

.portfolio-body p {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

.portfolio-body .chips {
  margin: 0 0 12px;
}

/* ---------- CV: summary + CTA ---------- */

.cv-summary {
  --cv-accent: var(--tertiary);
}

.cv-lead {
  margin: 0 0 16px;
  max-width: 70ch;
  font-size: 1.05rem;
  line-height: 1.55;
  text-wrap: pretty;
  color: var(--on-surface-variant);
}

.cv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media screen and (min-width: 700px) {
  .cv-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.cv-card {
  border-radius: 12px;
  padding: 22px 20px;
  background: var(--surface-container-high);
  color: var(--on-surface);
}

.cv-card-role {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary-container) 35%, var(--surface-container-high)) 0%,
    var(--surface-container-high) 65%
  );
}

.cv-card-role .icon-tile {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.cv-card-years .icon-tile {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.cv-card h3 {
  margin: 14px 0 4px;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.2;
}

.cv-card p {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

.cv-card .chip {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

/* CTA banner */

.cta-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: 12px;
  padding: 24px;
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.cta-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1 1 0;
  min-width: 0;
}

.cta-banner-icon {
  flex: 0 0 auto;
  background: var(--primary);
  color: var(--on-primary);
}

.cta-banner h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.2;
}

.cta-banner p {
  margin: 0;
  max-width: 56ch;
  font-size: 0.95rem;
  color: var(--on-primary-container);
  opacity: 0.92;
}

.cta-banner-actions {
  flex: 0 0 auto;
}

.cta-banner-actions a {
  text-decoration: none;
}

@media screen and (max-width: 700px) {
  .cta-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-banner-actions a,
  .cta-banner-actions button {
    width: 100%;
  }
}

/* ---------- Motion: entrance + ambient (pure CSS) ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ring-spin {
  to {
    --ring-angle: 360deg;
  }
}

@keyframes blob-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-46px, 34px) scale(1.15); }
}

@keyframes blob-drift-2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(52px, -28px) scale(1.1); }
}

@keyframes blob-drift-3 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-30px, -40px) scale(1.2); }
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 0.55s var(--ease-out-quart) both;
  }

  .reveal-1 { animation-delay: 0.05s; }
  .reveal-2 { animation-delay: 0.14s; }
  .reveal-3 { animation-delay: 0.23s; }
  .reveal-4 { animation-delay: 0.32s; }
  .reveal-5 { animation-delay: 0.41s; }

  .reveal-group > *:nth-child(1) { animation-delay: 0.08s; }
  .reveal-group > *:nth-child(2) { animation-delay: 0.15s; }
  .reveal-group > *:nth-child(3) { animation-delay: 0.22s; }
  .reveal-group > *:nth-child(4) { animation-delay: 0.29s; }
  .reveal-group > *:nth-child(5) { animation-delay: 0.36s; }
  .reveal-group > *:nth-child(6) { animation-delay: 0.43s; }

  .avatar-ring {
    animation: ring-spin 8s linear infinite;
  }

  .card.profile-card {
    animation: ring-spin 14s linear infinite;
  }

  .blob-1 { animation: blob-drift-1 16s ease-in-out infinite alternate; }
  .blob-2 { animation: blob-drift-2 20s ease-in-out infinite alternate; }
  .blob-3 { animation: blob-drift-3 14s ease-in-out infinite alternate; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
