/* Performance + layout stability overrides */
:root {
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img[width][height] {
  height: auto;
}

.container,
.hero-inner,
.about-grid,
.contact-grid,
.footer-inner,
.nav-links,
.nav-right,
.nav-right-inline,
.cards-grid,
.ventures-grid,
.port-grid,
.lang-picker-wrap,
.container > *,
.hero-inner > *,
.about-grid > *,
.contact-grid > *,
.footer-inner > * {
  min-width: 0;
}

h1, h2, h3, p, li, a, button,
.section-title,
.page-title,
.hero-headline,
.hero-sub,
.section-desc,
.cta-title,
.tl-role,
.tl-org,
.tl-desc,
.edu-degree,
.venture-name,
.venture-desc,
.aff-role,
.aff-desc,
.aff-quote,
.contact-val,
.contact-lbl,
.skill-tag,
.port-title,
.port-desc,
.port-modal-title,
.port-modal-desc,
.page-sub,
.diaz-desc,
.diaz-quote {
  overflow-wrap: anywhere;
}

.hero-headline,
.section-title,
.page-title,
.cta-title {
  text-wrap: balance;
}

.nav-links a,
.nav-cta,
.footer-right a {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  nav {
    padding: 0 1rem;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h, 64px);
    left: 0;
    right: 0;
    background: rgba(11,15,26,.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.25rem 1rem;
    gap: .25rem;
    border-bottom: .5px solid var(--border, rgba(255,255,255,.06));
    z-index: 199;
    max-height: calc(100vh - var(--nav-h, 64px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.open li {
    width: 100%;
  }

  .nav-links.open a {
    display: block;
    padding: 14px 4px;
    font-size: 15px;
    line-height: 1.4;
    border-bottom: .5px solid var(--border, rgba(255,255,255,.06));
    white-space: normal;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .nav-links.open li:last-child a {
    border-bottom: none;
  }

  .nav-cta {
    align-self: flex-start;
  }

  .lang-select-btn {
    min-width: auto;
  }
}

@media (max-width: 640px) {
  .btn-primary,
  .btn-outline {
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  .hero-buttons > *,
  .cta-actions > * {
    width: 100%;
  }
}


/* Accessibility contrast reinforcement */
:root {
  --text2: #a3aec2;
  --text3: #8893aa;
}

.port-filter.active {
  background: #1667c7;
  border-color: #1667c7;
  color: #fff;
}

.page-breadcrumb,
.aff-tag,
.footer-right a {
  color: var(--text2);
}
